RFR(XS): 8208091: SA: jhsdb jstack --mixed throws UnmappedAddressException on i686

Severin Gehwolf sgehwolf at redhat.com
Mon Jul 23 16:27:30 UTC 2018


Hi,

Could I please get a review of this one-liner change related to jhsdb
--mixed when attaching to a running Java process? The issue arises when
threads are in native code and that native code has frame pointers not
properly preserved. In such a case the SA performs a simple frame
pointer valididy check: ebp >= esp

However, the code of retrieving the value for esp is incorrect in as
much as it's not in sync with native code in regards to the register
index:

native code => X86ThreadContext.SP
Java code   => X86ThreadContext.ESP

X86ThreadContext.ESP is never being set by the native code. Since
X86ThreadContext.getRegisterAsAddress(X86ThreadContext.ESP) then
returns null, ebp.lessThan(esp) wrongly returns false causing the
issue. This webrev fixes it by using SP as index on the Java side.
Thoughts?

webrev: http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-8208091/webrev.01/
bug: https://bugs.openjdk.java.net/browse/JDK-8208091

Thanks,
Severin


More information about the serviceability-dev mailing list