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

functrace and funcsourcetrace (was Re: PATCH: trace information for sourced files)



I updated today from CVS sources and built. I tried a little test and
alas, I'm sorry to report that I can't use this.

I've attached the little test program called linebug.sh. It doesn't do
any "source"'ing.  rocky-patch.out contains the output given with the
patch I submitted. functrace.out contains output using $functrace and
funcsourcetrace.out contains output using $funcsourcetrace.out.

Right now I can't see how to patch together the output from functrace
and funcsourcetrace. But it really doesn't matter because it shouldn't
be that convoluted either. What we want is an array that contains the
source file name  and absolute line number of the place where we were
called from. If the caller has a caller, then another array entry for
the source file and line number of that location, and so on. This is
the way it works in virtually every other programming language I can
think of. Perl, Python, Ruby, Java, C, C++, bash, ksh, LISP, to name
some that come to mind.

Right now functrace (whose output is shown in functrace.out), seems to
come the closest were it not for this function information getting put
there inside functions instead, and which is sort of duplicated in
funcstack. I am not fussy about what name you want to give this,
whether you want to have several parallel arrays for functions, file
names, line numbers and so on, or fewer with each string encoding more
than one bit of information. However the the filenames and line
numbers have to be there, and match the information as shown in
rocky-patch.out for the run in linebug.sh.

Thanks.


On Tue, Aug 12, 2008 at 4:27 PM, Peter Stephenson
<p.w.stephenson@xxxxxxxxxxxx> wrote:
> On Tue, 12 Aug 2008 15:58:03 -0400
> "Rocky Bernstein" <rocky.bernstein@xxxxxxxxx> wrote:
>> > I'm not sure what to put in $funcsourcetrace since there is no separate
>> > point of definition from that of the caller in this case.
>>
>> How about "source" or ".". Down the line one may want to record the
>> number of parameters passed, and here I note that zsh allows passing
>> parameters in a source command.
>
> OK, I've committed it so that the funcsourcetrace element shows up as
> "source:0".
>
> I had a look at providing the text for debug traps but it wasn't as
> trivial as I'd hoped so that may have to wait.
>
> --
> Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
> Web page now at http://homepage.ntlworld.com/p.w.stephenson/
>
>

Attachment: linebug.sh
Description: Bourne shell script

Attachment: rocky-patch.out
Description: Binary data

Attachment: functrace.out
Description: Binary data

Attachment: funcsourcetrace.out
Description: Binary data



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