This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: where do stack traces get filled in?
Tom Tromey writes:
> >>>>> "Adam" == Adam Megacz <gcj@lists.megacz.com> writes:
>
> Adam> Are backtraces a target-specific thing (which would have to be
> Adam> rewritten for win32), or would I be able to do some clever
> Adam> cut-and-paste out of glibc? Or is this impossible with SJLJ
> Adam> exceptions?
>
> Adam> Well, I guess there's licensing issues with glibc (LGPL vs
> Adam> GPL-with-exception); perhaps "review the glibc code, learn how
> Adam> it works, and then reimplement the same algorithm".
>
> I don't really know what exactly would have to be done.
> For all I know there is some Win32 API you could use here.
Walking the x86 stack is really pretty easy -- it's just a list of
stack frames. Other processors can be much harder.
What I would like, in the general case, is to expose the logic in
gcc's exception unwinder so that it can be used by backtrace.
> Occasionally we've discussed being able to find the backtraces
> using information that is already around, for instance
> exception-handling info.
Yup.
> We need a more powerful approach because we need to be able to find
> the classes whose methods are on the stack; this is used by some of
> the Java security features we don't implement.
I've wanted to do this for ages, but I never seem to find the time. I
might be able to do it over the holidays,
Andrew.