This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
walking the stack
- From: Andrew Haley <aph at cambridge dot redhat dot com>
- To: Anthony Green <green at redhat dot com>
- Cc: java at gcc dot gnu dot org
- Date: Mon, 15 Apr 2002 10:59:15 +0100 (BST)
- Subject: walking the stack
- References: <1018858471.8486.23.camel@dhcppc2>
Anthony Green writes:
> 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. These object files contain the bits
> necessary to determine the range of code needing registration with the
> runtime. For interpreted code I just need to register the closure stub.
>
> Running a check for a priviliged action involves walking the stack and
> examining the details of the appropriate ProtectionDomains along the
> way. My current experiments involve using glibc's backtrace()
> function. My questions...
>
> 1) Is this reliable on all glibc ports?
It doesn't work everywhere, but where it is implemented it works well.
It depends on the ABI.
> 2) Is there some better way to get stack trace info? Like using the
> DWARF2 data if it exists.
Yes.
> 3) Is there a better way to do all of this?
There sure is: David Mosberger's libunwind.
Andrew.