Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Help me track down a tough bug? (probably funcfiletrace, subshells and possibly I/O redirection)



"Rocky Bernstein" wrote:
> Thanks. This addresses one of the problem seen. There are still the
> others -- output disappearing and weird line numbers shown further up
> in the trace. But we will take these one at a time.

Please could you send a simple example of a remaining incorrect line
number.  I would expect it would be reproducible without the debugger.

> How do you feel about noting the subshell level in one of the
> traceback stacks and allowing an optional parameter to set $LINENO in
> those cases where it is reset to 1.

I'm not entirely sure what you're referring to, please could you give an
example of what behaviour you'd like.

> (Is there a corresponding variable for the filename?

LINENO itself doesn't necessarily relate to a file, but for now you can
use ${(%):-%x} and ${(%):-%I} for the filename and line number in the
shell code which is probably what you need.  I'll add variables for
these later if they turn out to be useful (probably ZSH_SOURCE_FILE and
ZSH_SOURCE_LINE).

> I note that in
> x="
> $LINENO"
> 
> LINENO has the x's line number rather than the one it's on. No doubt
> this is an artifact of xtrace wanting to show for tracing purposes x's
> line. However probably more correct would be to keep that but have
> $LINENO be the line that it itself is on.

I think we'd have to track the line number in subst.c:stringsubst().
That may or may not be simple, I'll have to try it.


-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



Messages sorted by: Reverse Date, Date, Thread, Author