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

Re: PATCH: functrace [was Re: funcstack and backtraces]



> } 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;



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