[JVMTI] RFA: JVMTI Stack Tracing
David Daney
ddaney@avtrex.com
Fri Oct 20 15:27:00 GMT 2006
Andrew Haley wrote:
> David Daney writes:
> > Kyle Galloway wrote:
>
> > Is libc async-signal safe? What happens if the unwinder cannot produce
> > a stacktrace because the thread was stopped somewhere where there was no
> > unwind info?
>
> That seems to me like a problem. gdb uses a bunch of heuristics to
> get the stack trace, but it still sometimes fails.
>
> Andrew.
>
I think the only way to make it robust would be to have a little thread
local 'stack' of IP values. You would push the IP each time you were
entering native code and pop it each time you came back out. The
unwinder would then use these values to find the last time you were in
java code and could generate the stack trace from there. I have no idea
of what Sun does in their implementation, but I can't help but think
that they do something like that. Forcing all native code to use JNI
makes it easier to implement something like this because there are only
a couple of places you would have to track the IP.
With CNI it is much more difficult, I think you would need help from the
compiler to call some method before entering any native code (similar to
how profiling is done I think).
Not that the current implementation should not go in. Stacktraces that
are not 100% reliable are better than no stacktraces at all.
David Daney.
More information about the Java-patches
mailing list