zsh-workers
 help / color / mirror / code / Atom feed
* functrace and funcsourcetrace (was Re: PATCH: trace information for sourced files)
@ 2008-08-13  0:00 Rocky Bernstein
  2008-08-13 19:42 ` Peter Stephenson
  0 siblings, 1 reply; 10+ messages in thread
From: Rocky Bernstein @ 2008-08-13  0:00 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 2407 bytes --]

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@ntlworld.com> wrote:
> On Tue, 12 Aug 2008 15:58:03 -0400
> "Rocky Bernstein" <rocky.bernstein@gmail.com> 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@ntlworld.com>
> Web page now at http://homepage.ntlworld.com/p.w.stephenson/
>
>

[-- Attachment #2: linebug.sh --]
[-- Type: application/x-sh, Size: 231 bytes --]

[-- Attachment #3: rocky-patch.out --]
[-- Type: application/octet-stream, Size: 236 bytes --]

$ /usr/local/bin/zsh linebug.sh

linebug.sh:9
====
linebug.sh:13
====
linebug.sh:16
====
linebug.sh:10
linebug.sh:16
====
calling bar 10
linebug.sh:11
linebug.sh:16
====
linebug.sh:14
linebug.sh:11
linebug.sh:16
====
linebug.sh:17
====

[-- Attachment #4: functrace.out --]
[-- Type: application/octet-stream, Size: 277 bytes --]

$ /usr/local/bin/zsh ./linebug.sh

./linebug.sh:9
====
./linebug.sh:13
====
./linebug.sh:16
====
foo:1
./linebug.sh:16
====
calling bar 10
foo:2
./linebug.sh:16
====
bar:1
foo:2
./linebug.sh:16
====
./linebug.sh:17
====
 7:17PM rocky@dr-ferdinand /src/git/zshdb/bug [3 z] 0
$ 

[-- Attachment #5: funcsourcetrace.out --]
[-- Type: application/octet-stream, Size: 251 bytes --]

$ /usr/local/bin/zsh ./linebug.sh

./linebug.sh:1
====
./linebug.sh:1
====
./linebug.sh:1
====
./linebug.sh:1
./linebug.sh:9
====
calling bar 10
./linebug.sh:1
./linebug.sh:9
====
./linebug.sh:1
./linebug.sh:13
./linebug.sh:9
====
./linebug.sh:1
====

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-08-22 15:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-13  0:00 functrace and funcsourcetrace (was Re: PATCH: trace information for sourced files) Rocky Bernstein
2008-08-13 19:42 ` Peter Stephenson
2008-08-13 20:43   ` Peter Stephenson
2008-08-13 21:05     ` Peter Stephenson
2008-08-13 22:06       ` Rocky Bernstein
2008-08-18 11:13       ` Mikael Magnusson
2008-08-21 15:31         ` Peter Stephenson
2008-08-21 20:21           ` Mikael Magnusson
2008-08-22 15:33         ` Peter Stephenson
2008-08-22 15:48           ` Mikael Magnusson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).