This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: walking the stack
- From: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>
- To: Anthony Green <green at redhat dot com>
- Cc: java at gcc dot gnu dot org
- Date: Mon, 15 Apr 2002 20:37:27 +1200
- Subject: Re: walking the stack
- References: <1018858471.8486.23.camel@dhcppc2>
Anthony Green wrote:
>I've been experimenting with an implementation of the Java's sandbox
>design.
>
>The idea is to map ProtectionDomains to PC ranges. I determine PC
>ranges by modifying libgcj.spec to link jrtbegin.o and jrtend.o before
>and after all other files.
>
Interesting. I was thinking of something similar for stack trace
printing, as an alternative to the dlsym/addr2line/demangling stuff we
do now. That would allow us to get a trace even from a stripped binary
by utilizing the reflection data.
>2) Is there some better way to get stack trace info? Like using the
>DWARF2 data if it exists.
>
I don't know how portable backtrace() is, but obviously using the DWARF2
unwind data would be better, since it is used on more targets than glibc is.
RTH has said that it wouldn't be difficult to add an interface to the
unwinder which walks the stack without actually unwinding. We want this
functionality for getting EH stack traces as well.
If we made that interface something like:
_Unwind_TraceStack(void **pc_array, int count)
then we could pass in a pc_array of length 2 and it would only unwind 2
frames, which would be more efficient for security checks.
regards
Bryce.