8370176: Mixed mode jhsdb jstack cannot unwind call stack with -Xcomp #27885
+190
−35
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
jhsdb jstack --mixed
would not work when attaches to the process runs with-Xcomp
.It has been reported by @pchilano in #27728. You can reproduce the problem with Test.java (attached JBS). You can see following stack.
Thread.sleepNanos0
is the bottom stack, but actually it has more call frames. You can see them with-XX:+PreserveFramePointer
.Java frame might be use the register for frame pointer (
RBP
in AMD64) as general purpose register, so SA cannot rely it in stack unwinding.hs_err log has mixed stack trace as "Native frames", it would be unwinded by
NativeStackPrinter
in HotSpot, and it works as mixed mode.NativeStackPrinter
usesframe::next_frame()
to find sender frame regardless whether Java frame or C frame, and it leverages sender FP/PC to create sender frame. On the other hand, SA separates CFrame and VFrame to unwind in mixed mode jstack, so sender FP/PC would not propagate to CFrame, thus the frame located at bottom of Java frame might not be shown.It is difficult to unify unwinder in
PStack
in SA, so it would be reasonable to propagate sender FP/PC to the sender of CFrame.Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27885/head:pull/27885
$ git checkout pull/27885
Update a local copy of the PR:
$ git checkout pull/27885
$ git pull https://git.openjdk.org/jdk.git pull/27885/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 27885
View PR using the GUI difftool:
$ git pr show -t 27885
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27885.diff
Using Webrev
Link to Webrev Comment