We've introduced new test TestJhsdbJstackMixedCore.java in 
[JDK-8374482](https://bugs.openjdk.org/browse/JDK-8374482) to check mixed 
jstack could unwind signal trampoline on Linux AMD64. However it did not work 
with following error in some case. We saw it on Oracle Linux 8.10 
intermittently.


java.lang.NullPointerException: Cannot invoke 
"sun.jvm.hotspot.debugger.Address.addOffsetTo(long)" because "this.cfa" is null
at 
jdk.hotspot.agent/sun.jvm.hotspot.debugger.linux.amd64.LinuxAMD64CFrame.getNextRSP(LinuxAMD64CFrame.java:143)
at 
jdk.hotspot.agent/sun.jvm.hotspot.debugger.linux.amd64.LinuxAMD64CFrame.sender(LinuxAMD64CFrame.java:189)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.PStack.run(PStack.java:195)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.PStack.run(PStack.java:65)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.PStack.run(PStack.java:60)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.JStack.run(JStack.java:67)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:278)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.start(Tool.java:241)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.execute(Tool.java:134)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.JStack.runWithArgs(JStack.java:90)
at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.runJSTACK(SALauncher.java:306)
at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.main(SALauncher.java:507)


It was caused by incorrect calculation for virtual address alignment. It exists 
before JDK-8374482. We aligned `base address + virtual address` in ELF, but it 
should be aligned virtual address only.

This fix works fine with the coredump which we saw the error in above, and also 
it passed CI on Oracle Linux 8.10.

Thanks a lot @plummercj for your help!

-------------

Commit messages:
 - fix
 - Fix virtual address calculation

Changes: https://git.openjdk.org/jdk/pull/29662/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29662&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8377395
  Stats: 7 lines in 3 files changed: 0 ins; 2 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/29662.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29662/head:pull/29662

PR: https://git.openjdk.org/jdk/pull/29662

Reply via email to