zsh-workers
 help / color / mirror / code / Atom feed
* funcstack and backtraces
@ 2006-09-01 19:10 Clint Adams
  2006-09-04 21:26 ` Bart Schaefer
  0 siblings, 1 reply; 12+ messages in thread
From: Clint Adams @ 2006-09-01 19:10 UTC (permalink / raw)
  To: zsh-workers; +Cc: ari

Any thoughts on bloating struct funcstack to contain
scriptname/argzero and lineno?

The use case is for a function to be able to print out
what called it.


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

* Re: funcstack and backtraces
  2006-09-01 19:10 funcstack and backtraces Clint Adams
@ 2006-09-04 21:26 ` Bart Schaefer
  2006-09-04 23:15   ` Clint Adams
  2006-09-17 19:14   ` PATCH: functrace [was Re: funcstack and backtraces] Clint Adams
  0 siblings, 2 replies; 12+ messages in thread
From: Bart Schaefer @ 2006-09-04 21:26 UTC (permalink / raw)
  To: zsh-workers

On Sep 1,  3:10pm, Clint Adams wrote:
}
} Any thoughts on bloating struct funcstack to contain
} scriptname/argzero and lineno?

On first blush it sounds good, but how would you propose to represent
this e.g. in the $funcstack special parameter?

Really it'd probably need a new parameter to avoid breaking current
uses of $funcstack.  $functrace?


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

* Re: funcstack and backtraces
  2006-09-04 21:26 ` Bart Schaefer
@ 2006-09-04 23:15   ` Clint Adams
  2006-09-17 19:14   ` PATCH: functrace [was Re: funcstack and backtraces] Clint Adams
  1 sibling, 0 replies; 12+ messages in thread
From: Clint Adams @ 2006-09-04 23:15 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

> On first blush it sounds good, but how would you propose to represent
> this e.g. in the $funcstack special parameter?

> Really it'd probably need a new parameter to avoid breaking current
> uses of $funcstack.  $functrace?

Yes, I imagine it would have to be a new array of lines of
delimited ASCII.


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

* PATCH: functrace [was Re: funcstack and backtraces]
  2006-09-04 21:26 ` Bart Schaefer
  2006-09-04 23:15   ` Clint Adams
@ 2006-09-17 19:14   ` Clint Adams
  2006-09-17 22:39     ` Bart Schaefer
  2006-09-17 22:52     ` Bart Schaefer
  1 sibling, 2 replies; 12+ messages in thread
From: Clint Adams @ 2006-09-17 19:14 UTC (permalink / raw)
  To: zsh-workers

> Really it'd probably need a new parameter to avoid breaking current
> uses of $funcstack.  $functrace?

This is buggy when either FUNCTIONARGZERO is unset, int is larger than
64-bits, or... I forget.  Furthermore, I am told that
function_name:function_lineno is useless and that it should be
filename:file_lineno in all cases.

As I don't really have a need for this myself, I have no opinion
on the matter.

M  Doc/Zsh/mod_parameter.yo
M  Src/exec.c
M  Src/zsh.h
M  Src/Modules/parameter.c
M  Src/Modules/parameter.mdd

* modified files

--- orig/Doc/Zsh/mod_parameter.yo
+++ mod/Doc/Zsh/mod_parameter.yo
@@ -159,4 +159,10 @@
 executed. The first element is the name of the function using the
 parameter.
 )
+vindex(functrace)
+item(tt(functrace))(
+This array contains the names and line numbers of the callers
+corresponding to the functions currently being executed.
+The format of each element is name:lineno.
+)
 enditem()


--- orig/Src/Modules/parameter.c
+++ mod/Src/Modules/parameter.c
@@ -551,6 +551,33 @@
     return ret;
 }
 
+/* Functions for the functrace special parameter. */
+
+/**/
+static char **
+functracegetfn(UNUSED(Param pm))
+{
+    Funcstack f;
+    int num;
+    char **ret, **p;
+
+    for (f = funcstack, num = 0; f; f = f->prev, num++);
+
+    ret = (char **) zhalloc((num + 1) * sizeof(char *));
+
+    for (f = funcstack, p = ret; f; f = f->prev, p++) {
+	char *colonpair;
+
+	colonpair = zhalloc(strlen(f->caller) + f->lineno > 9999 ? 24 : 6);
+	sprintf(colonpair, "%s:%d", f->caller, f->lineno);
+
+	*p = colonpair;
+    }
+    *p = NULL;
+
+    return ret;
+}
+
 /* Functions for the builtins special parameter. */
 
 /**/
@@ -1843,6 +1870,8 @@
 
 static const struct gsu_array funcstack_gsu =
 { funcstackgetfn, arrsetfn, stdunsetfn };
+static const struct gsu_array functrace_gsu =
+{ functracegetfn, arrsetfn, stdunsetfn };
 static const struct gsu_array reswords_gsu =
 { reswordsgetfn, arrsetfn, stdunsetfn };
 static const struct gsu_array disreswords_gsu =
@@ -1868,6 +1897,9 @@
     { "funcstack", PM_ARRAY|PM_SPECIAL|PM_READONLY,
       NULL, NULL, NULL,
       &funcstack_gsu, NULL },
+    { "functrace", PM_ARRAY|PM_SPECIAL|PM_READONLY,
+      NULL, NULL, NULL,
+      &functrace_gsu, NULL },
     { "builtins", PM_READONLY,
       getpmbuiltin, scanpmbuiltins, NULL,
       NULL, NULL },


--- orig/Src/Modules/parameter.mdd
+++ mod/Src/Modules/parameter.mdd
@@ -2,6 +2,6 @@
 link=either
 load=yes
 
-autoparams="parameters commands functions dis_functions funcstack builtins dis_builtins reswords dis_reswords options modules dirstack history historywords jobtexts jobdirs jobstates nameddirs userdirs aliases dis_aliases galiases dis_galiases"
+autoparams="parameters commands functions dis_functions funcstack functrace builtins dis_builtins reswords dis_reswords options modules dirstack history historywords jobtexts jobdirs jobstates nameddirs userdirs aliases dis_aliases galiases dis_galiases"
 
 objects="parameter.o"


--- orig/Src/exec.c
+++ mod/Src/exec.c
@@ -3798,6 +3798,8 @@
     }
 #endif
     fstack.name = dupstring(name);
+    fstack.caller = dupstring(oargv0 ? oargv0 : argzero);
+    fstack.lineno = lineno;
     fstack.prev = funcstack;
     funcstack = &fstack;
 


--- orig/Src/zsh.h
+++ mod/Src/zsh.h
@@ -1001,6 +1001,8 @@
 struct funcstack {
     Funcstack prev;		/* previous in stack */
     char *name;			/* name of function called */
+    char *caller;		/* name of caller */
+    int lineno;			/* line number in file */
 };
 
 /* node in list of function call wrappers */




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

* Re: PATCH: functrace [was Re: funcstack and backtraces]
  2006-09-17 19:14   ` PATCH: functrace [was Re: funcstack and backtraces] Clint Adams
@ 2006-09-17 22:39     ` Bart Schaefer
  2006-09-18  3:37       ` Clint Adams
  2006-09-17 22:52     ` Bart Schaefer
  1 sibling, 1 reply; 12+ messages in thread
From: Bart Schaefer @ 2006-09-17 22:39 UTC (permalink / raw)
  To: zsh-workers

On Sep 17,  3:14pm, Clint Adams wrote:
}
} This is buggy when either FUNCTIONARGZERO is unset, int is larger than
} 64-bits, or... I forget.

 ... lineno is greater than MAXINT?

} Furthermore, I am told that function_name:function_lineno is useless

Nonsense.

} and that it should be filename:file_lineno in all cases.

So for functions defined at the command line you're supposed to output
"stdin" and the number of input lines since the interpreter started?

I'd say whoever is telling you this stuff is not thinking clearly.  In
several cases it's not even possible to know the filename.

In any event:

schaefer<502> (foo() { print $functrace } ; foo )
zsh: segmentation fault (core dumped)  (; foo () { ... }; foo; )

#0  0x001e3de6 in strcpy () from /lib/tls/libc.so.6
#1  0x080aa616 in dupstring (
    s=0xb7d96590 "Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:"...)
    at ../../zsh-4.0/Src/string.c:40
#2  0x080ac028 in strcatsub (d=0xbff08010, pb=0xb7d96578 "", pe=0xb7d96578 "", 
    src=0xb7d96590 "Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:"..., l=9, 
    s=0xb7d96582 "", glbsub=0, copied=0) at ../../zsh-4.0/Src/subst.c:564
#3  0x080b1857 in paramsubst (l=0xb7d96548, n=0xb7d96560, str=0xbff081a8, 
    qt=0, ssub=0) at ../../zsh-4.0/Src/subst.c:3154
#4  0x080ab18b in stringsubst (list=0xb7d96548, node=0xb7d96560, ssub=0, 
    asssub=0) at ../../zsh-4.0/Src/subst.c:156
#5  0x080aabdc in prefork (list=0xb7d96548, flags=0)
    at ../../zsh-4.0/Src/subst.c:91
#6  0x08063052 in execcmd (state=0xbff08650, input=0, output=0, how=18, 
    last1=2) at ../../zsh-4.0/Src/exec.c:1963
#7  0x080616ce in execpline2 (state=0xbff08650, pcode=67, how=18, input=0, 
    output=0, last1=0) at ../../zsh-4.0/Src/exec.c:1301
#8  0x08060bd2 in execpline (state=0xbff08650, slcode=4098, how=18, last1=0)
    at ../../zsh-4.0/Src/exec.c:1087
#9  0x08060576 in execlist (state=0xbff08650, dont_change_job=1, exiting=0)
    at ../../zsh-4.0/Src/exec.c:893
#10 0x08060285 in execode (p=0x8d82728, dont_change_job=1, exiting=0)
    at ../../zsh-4.0/Src/exec.c:793
#11 0x08067e3f in runshfunc (prog=0x8d82728, wrap=0x0, name=0xb7d96538 "foo")
    at ../../zsh-4.0/Src/exec.c:3915
#12 0x08067bea in doshfunc (name=0x8d78020 "foo", prog=0x8d82728, 
    doshargs=0xb7d96508, flags=0, noreturnval=0)
    at ../../zsh-4.0/Src/exec.c:3824
#13 0x08067511 in execshfunc (shf=0x8daf8e8, args=0xb7d96508)
    at ../../zsh-4.0/Src/exec.c:3612
#14 0x0806501d in execcmd (state=0xbff08e50, input=0, output=0, how=18, 
    last1=1) at ../../zsh-4.0/Src/exec.c:2583
#15 0x080616ce in execpline2 (state=0xbff08e50, pcode=195, how=18, input=0, 
    output=0, last1=1) at ../../zsh-4.0/Src/exec.c:1301
#16 0x08060bd2 in execpline (state=0xbff08e50, slcode=3074, how=18, last1=1)
    at ../../zsh-4.0/Src/exec.c:1087
#17 0x08060576 in execlist (state=0xbff08e50, dont_change_job=0, exiting=1)
    at ../../zsh-4.0/Src/exec.c:893
#18 0x080653e2 in execcmd (state=0xbff08e50, input=0, output=0, how=18, 
    last1=2) at ../../zsh-4.0/Src/exec.c:2666
#19 0x080616ce in execpline2 (state=0xbff08e50, pcode=195, how=18, input=0, 
    output=0, last1=0) at ../../zsh-4.0/Src/exec.c:1301
#20 0x08060bd2 in execpline (state=0xbff08e50, slcode=24578, how=18, last1=0)
    at ../../zsh-4.0/Src/exec.c:1087
#21 0x08060576 in execlist (state=0xbff08e50, dont_change_job=0, exiting=0)
    at ../../zsh-4.0/Src/exec.c:893
#22 0x08060285 in execode (p=0xb7d96420, dont_change_job=0, exiting=0)
    at ../../zsh-4.0/Src/exec.c:793
#23 0x08077866 in loop (toplevel=1, justonce=0) at ../../zsh-4.0/Src/init.c:167
#24 0x0807a46a in zsh_main (argc=1, argv=0xbff08f94)
    at ../../zsh-4.0/Src/init.c:1332
#25 0x0804c2ae in main (argc=1, argv=0xbff08f94) at ../../zsh-4.0/Src/main.c:93


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

* Re: PATCH: functrace [was Re: funcstack and backtraces]
  2006-09-17 19:14   ` PATCH: functrace [was Re: funcstack and backtraces] Clint Adams
  2006-09-17 22:39     ` Bart Schaefer
@ 2006-09-17 22:52     ` Bart Schaefer
  2006-09-17 23:38       ` Clint Adams
  1 sibling, 1 reply; 12+ messages in thread
From: Bart Schaefer @ 2006-09-17 22:52 UTC (permalink / raw)
  To: zsh-workers

On Sep 17,  3:14pm, Clint Adams wrote:
} Subject: PATCH: functrace [was Re: funcstack and backtraces]
}
} This is buggy when either FUNCTIONARGZERO is unset, int is larger than
} 64-bits, or... I forget.

Adding an extra level of function stack avoids the crash, but this
still doesn't look right to me:

schaefer<505> (bar() { foo } ; foo() { print $functrace } ; bar )
bar:0 Src/zsh:bar:0

No mention of "foo" at all?  Whose idea of useful is that?  And here:

schaefer<506> (baz() { bar }; 
 bar() { foo } ;                                   
 foo() { print $functrace } ;      
 baz )
bar:0 baz:0 Src/zsh:bar:0

What does that it mean that "bar" is at both ends of the stack?

You're right about it being buggy when functionargzero is not set.
Even the examples above that don't crash when it is set, crash when
it is not set (with effectively the same backtrace).


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

* Re: PATCH: functrace [was Re: funcstack and backtraces]
  2006-09-17 22:52     ` Bart Schaefer
@ 2006-09-17 23:38       ` Clint Adams
  2006-09-18  2:20         ` Bart Schaefer
  0 siblings, 1 reply; 12+ messages in thread
From: Clint Adams @ 2006-09-17 23:38 UTC (permalink / raw)
  To: zsh-workers

> Adding an extra level of function stack avoids the crash, but this
> still doesn't look right to me:

What crash?

> schaefer<505> (bar() { foo } ; foo() { print $functrace } ; bar )
> bar:0 Src/zsh:bar:0
> 
> No mention of "foo" at all?  Whose idea of useful is that?  And here:

I was assuming that the function printing the trace would be able to
identify itself, but if not, "foo" is in $funcstack.  Shouldn't be too
difficult to tack it on in functracegetfn if that's useful though.

> schaefer<506> (baz() { bar }; 
>  bar() { foo } ;                                   
>  foo() { print $functrace } ;      
>  baz )
> bar:0 baz:0 Src/zsh:bar:0

> What does that it mean that "bar" is at both ends of the stack?

I can't reproduce that.  I get
bar:0 baz:0 Src/zsh:6
(or Src/zsh:0 Src/zsh:0 Src/Zsh:12)

> You're right about it being buggy when functionargzero is not set.
> Even the examples above that don't crash when it is set, crash when
> it is not set (with effectively the same backtrace).

I can't reproduce that either.


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

* Re: PATCH: functrace [was Re: funcstack and backtraces]
  2006-09-17 23:38       ` Clint Adams
@ 2006-09-18  2:20         ` Bart Schaefer
  0 siblings, 0 replies; 12+ messages in thread
From: Bart Schaefer @ 2006-09-18  2:20 UTC (permalink / raw)
  To: zsh-workers

On Sep 17,  7:38pm, Clint Adams wrote:
} Subject: Re: PATCH: functrace [was Re: funcstack and backtraces]
}
} > Adding an extra level of function stack avoids the crash, but this
} > still doesn't look right to me:
} 
} What crash?

zsh-workers/22730

} > schaefer<506> (baz() { bar }; 
} >  bar() { foo } ;                                   
} >  foo() { print $functrace } ;      
} >  baz )
} > bar:0 baz:0 Src/zsh:bar:0
} 
} > What does that it mean that "bar" is at both ends of the stack?
} 
} I can't reproduce that.  I get
} bar:0 baz:0 Src/zsh:6
} (or Src/zsh:0 Src/zsh:0 Src/Zsh:12)

I suspect there's somewhere that you're calling dupstring() on a hunk
of memory that isn't really nul-terminated.

} > You're right about it being buggy when functionargzero is not set.
} > Even the examples above that don't crash when it is set, crash when
} > it is not set (with effectively the same backtrace).
} 
} I can't reproduce that either.

torch% unsetopt functionargzero
torch% (baz() { bar };         
bar() { foo } ;
foo() { print $functrace } ;
baz )
zsh: segmentation fault (core dumped)  (; baz () { ... }; bar () { ... }; foo
() { ... }; baz; )
torch% gdb Src/zsh core.771
(gdb) where
#0  0x001e3de6 in strcpy () from /lib/tls/libc.so.6
#1  0x080aa616 in dupstring (
    s=0xb7cdde40
    "Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:Src/zsh:"...)
        at ../../zsh-4.0/Src/string.c:40
[...]
(gdb) run -f
Starting program: /usr/local/src/zsh/Src/zsh -f
torch% baz() { bar };
torch% bar() { foo } ;
torch% foo() { print $functrace } ;
torch% baz
bar:0 baz:0 /usr/locbar:0
torch% unsetopt functionargzero
torch% baz

Program received signal SIGSEGV, Segmentation fault.
0x001e3de6 in strcpy () from /lib/tls/libc.so.6
(gdb) where
#0  0x001e3de6 in strcpy () from /lib/tls/libc.so.6
#1  0x080aa616 in dupstring (
    s=0xb7d76350
    "/usr/loc/usr/loc/usr/loc/usr/loc/usr/loc/usr/loc/usr/loc/usr/loc/usr/loc/usr/loc/usr/loc/usr/loc/usr/loc/usr/loc/usr/loc/usr/loc/usr/loc/usr/loc/usr/loc/usr/loc/usr/loc/usr/loc/usr/loc/usr/loc/usr/loc"...)
        at ../../zsh-4.0/Src/string.c:40
[...]


-- 


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

* Re: PATCH: functrace [was Re: funcstack and backtraces]
  2006-09-17 22:39     ` Bart Schaefer
@ 2006-09-18  3:37       ` Clint Adams
  2006-09-18  5:57         ` Bart Schaefer
  0 siblings, 1 reply; 12+ messages in thread
From: Clint Adams @ 2006-09-18  3:37 UTC (permalink / raw)
  To: zsh-workers

> } and that it should be filename:file_lineno in all cases.
> 
> So for functions defined at the command line you're supposed to output
> "stdin" and the number of input lines since the interpreter started?

Well, I don't think the intended use has anything to do with interactive
input.  However, I'm happy to leave it the way it is but for the
breakage.

> In any event:
> 
> schaefer<502> (foo() { print $functrace } ; foo )
> zsh: segmentation fault (core dumped)  (; foo () { ... }; foo; )

% Src/zsh -f
zsh: failed to load module: zsh/zle
da% module_path=(Src/Modules Src/Zle)
da% zmodload parameter
da% (foo() { print $functrace } ; foo )
Src/zsh:3
da% 

> #24 0x0807a46a in zsh_main (argc=1, argv=0xbff08f94)
>     at ../../zsh-4.0/Src/init.c:1332

Operator precedence might be a good thing to pay attention to,
though I don't know if it's your problem.

Index: Src/Modules/parameter.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/parameter.c,v
retrieving revision 1.38
diff -u -r1.38 parameter.c
--- Src/Modules/parameter.c	17 Sep 2006 19:28:46 -0000	1.38
+++ Src/Modules/parameter.c	18 Sep 2006 03:35:58 -0000
@@ -568,7 +568,7 @@
     for (f = funcstack, p = ret; f; f = f->prev, p++) {
 	char *colonpair;
 
-	colonpair = zhalloc(strlen(f->caller) + f->lineno > 9999 ? 24 : 6);
+	colonpair = zhalloc(strlen(f->caller) + (f->lineno > 9999 ? 24 : 6));
 	sprintf(colonpair, "%s:%d", f->caller, f->lineno);
 
 	*p = colonpair;


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

* Re: PATCH: functrace [was Re: funcstack and backtraces]
  2006-09-18  3:37       ` Clint Adams
@ 2006-09-18  5:57         ` Bart Schaefer
  2006-09-18 11:07           ` Clint Adams
  0 siblings, 1 reply; 12+ messages in thread
From: Bart Schaefer @ 2006-09-18  5:57 UTC (permalink / raw)
  To: zsh-workers

On Sep 17, 11:37pm, Clint Adams wrote:
}
} Operator precedence might be a good thing to pay attention to,
} though I don't know if it's your problem.

That does in fact seem to have stopped the crash.

There just seems to be one more problem:  It looks as if functrace and
funcstack are indexed in the opposite order from one another?  Would it
not be better if they were in parallel?  Or am I misreading this?

schaefer<506> TRAPDEBUG() { print $funcstack ; print $functrace }
TRAPDEBUG
Src/zsh:8
TRAPDEBUG precmd
Src/zsh:1 Src/zsh:9
TRAPDEBUG title precmd
title:1 Src/zsh:1 Src/zsh:9
TRAPDEBUG title precmd
title:2 Src/zsh:1 Src/zsh:9
TRAPDEBUG precmd
Src/zsh:1 Src/zsh:9
TRAPDEBUG prompt_bart_precmd precmd
prompt_bart_precmd:1 Src/zsh:2 Src/zsh:9
TRAPDEBUG prompt_bart_precmd precmd
prompt_bart_precmd:2 Src/zsh:2 Src/zsh:9
TRAPDEBUG prompt_bart_precmd precmd
prompt_bart_precmd:6 Src/zsh:2 Src/zsh:9
TRAPDEBUG prompt_bart_precmd precmd
prompt_bart_precmd:7 Src/zsh:2 Src/zsh:9
TRAPDEBUG prompt_bart_precmd precmd
prompt_bart_precmd:8 Src/zsh:2 Src/zsh:9
TRAPDEBUG prompt_bart_precmd precmd
prompt_bart_precmd:11 Src/zsh:2 Src/zsh:9
TRAPDEBUG prompt_bart_precmd precmd
prompt_bart_precmd:12 Src/zsh:2 Src/zsh:9
TRAPDEBUG prompt_bart_precmd precmd
prompt_bart_precmd:1 Src/zsh:2 Src/zsh:9
TRAPDEBUG prompt_bart_precmd precmd
prompt_bart_precmd:15 Src/zsh:2 Src/zsh:9
TRAPDEBUG prompt_bart_precmd precmd
prompt_bart_precmd:12 Src/zsh:2 Src/zsh:9
TRAPDEBUG prompt_bart_precmd precmd
prompt_bart_precmd:19 Src/zsh:2 Src/zsh:9
TRAPDEBUG prompt_bart_precmd precmd
prompt_bart_precmd:20 Src/zsh:2 Src/zsh:9
TRAPDEBUG prompt_bart_precmd precmd
prompt_bart_precmd:23 Src/zsh:2 Src/zsh:9
TRAPDEBUG prompt_bart_precmd precmd
prompt_bart_precmd:26 Src/zsh:2 Src/zsh:9
TRAPDEBUG precmd
Src/zsh:2 Src/zsh:9
torch [TRAPDEBUG() { print $funcstack ; print $functrace }] /usr/src/local/zsh 
schaefer<507> 


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

* Re: PATCH: functrace [was Re: funcstack and backtraces]
  2006-09-18  5:57         ` Bart Schaefer
@ 2006-09-18 11:07           ` Clint Adams
  2006-09-18 15:16             ` Bart Schaefer
  0 siblings, 1 reply; 12+ messages in thread
From: Clint Adams @ 2006-09-18 11:07 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

> There just seems to be one more problem:  It looks as if functrace and
> funcstack are indexed in the opposite order from one another?  Would it
> not be better if they were in parallel?  Or am I misreading this?

They're supposed to be.

> TRAPDEBUG prompt_bart_precmd precmd
> prompt_bart_precmd:1 Src/zsh:2 Src/zsh:9

So Src/zsh:9 calls precmd, Src/zsh:2 (precmd?) calls prompt_bart_precmd,
and prompt_bart_precmd:1 unwittingly calls TRAPDEBUG.

Maybe grabbing the name of the previous function from the funcstack
would be more useful.


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

* Re: PATCH: functrace [was Re: funcstack and backtraces]
  2006-09-18 11:07           ` Clint Adams
@ 2006-09-18 15:16             ` Bart Schaefer
  0 siblings, 0 replies; 12+ messages in thread
From: Bart Schaefer @ 2006-09-18 15:16 UTC (permalink / raw)
  To: zsh-workers

On Sep 18,  7:07am, Clint Adams wrote:
} 
} > TRAPDEBUG prompt_bart_precmd precmd
} > prompt_bart_precmd:1 Src/zsh:2 Src/zsh:9
} 
} So Src/zsh:9 calls precmd, Src/zsh:2 (precmd?) calls prompt_bart_precmd,
} and prompt_bart_precmd:1 unwittingly calls TRAPDEBUG.

OK, so I was misreading it.  Just up too late, I guess.  Thanks.

} Maybe grabbing the name of the previous function from the funcstack
} would be more useful.

Particularly in combination with my "functions"-output newline-placement
suggestion from zsh-users/10591, so that you could actually match the
line number to a line in a function without having to re-read the source
file.


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

end of thread, other threads:[~2006-09-18 15:17 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-01 19:10 funcstack and backtraces Clint Adams
2006-09-04 21:26 ` Bart Schaefer
2006-09-04 23:15   ` Clint Adams
2006-09-17 19:14   ` PATCH: functrace [was Re: funcstack and backtraces] Clint Adams
2006-09-17 22:39     ` Bart Schaefer
2006-09-18  3:37       ` Clint Adams
2006-09-18  5:57         ` Bart Schaefer
2006-09-18 11:07           ` Clint Adams
2006-09-18 15:16             ` Bart Schaefer
2006-09-17 22:52     ` Bart Schaefer
2006-09-17 23:38       ` Clint Adams
2006-09-18  2:20         ` Bart Schaefer

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).