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

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



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
[...]


-- 



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