On Fri, 13 Nov 2026 05:29:13 GMT, Koichi Sakata <[email protected]> wrote:

>> This PR prevents the `clhsdb pstack` command from throwing a 
>> `DebuggerException` when obtaining the top frame. The exception occurs when 
>> the PC is within a native library that has no `.eh_frame` section.
>> 
>> I added a test, `ClhsdbPstackNoEhFrame.java`, that uses a native library 
>> without an `.eh_frame` section. The test fails with a `DebuggerException` 
>> without the fix in `LinuxAARCH64CFrame.java`.
>> 
>> `getFrameFromReg()` returns the current frame without DWARF information if 
>> DWARF parsing fails and the PC is within a known native library. Unwinding 
>> stops at this frame, but analysis continues for other threads. This behavior 
>> is consistent with the existing `sender()` method.
>> 
>> #### Testing
>> I've run the following tests on Linux AArch64.
>> 
>> $ make run-test 
>> TEST="jtreg:hotspot/jtreg/serviceability/sa/ClhsdbPstackNoEhFrame.java"
>>    TEST                                              TOTAL  PASS  FAIL ERROR 
>>  SKIP
>>    jtreg:test/hotspot/jtreg/serviceability/sa/ClhsdbPstackNoEhFrame.java
>>                                                          1     1     0     0 
>>     0
>> $ make run-test TEST="jtreg:hotspot/jtreg/serviceability/sa/"
>>    TEST                                              TOTAL  PASS  FAIL ERROR 
>>  SKIP
>>    jtreg:test/hotspot/jtreg/serviceability/sa           81    76     0     0 
>>     5
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Koichi Sakata has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Try to read .debug_frame if no .eh_frame

Almost looks good. I left comment to the test case.

> Regarding the test patterns, should I create the following 3 cases?
> 
> - no .eh_frame, but .debug_frame in the library
> - has .eh_frame, but it doesn't cover the target function. .debug_frame in 
> the library has the FDE of the function
> - no available information for the target function in .eh_frame and 
> .debug_frame in the library or external debuginfo

It would be good if you can do! But I think it is difficult to create separated 
debuginfo for native test libraries so far.
Just I've created PR #33764, and it can do that because it introduces 
`FORCE_COPY_DEBUG_SYMBOLS` in makefile. Maybe it is better to wait #33764, or 
merge changes of DebugSymbols.gmk from it.

test/hotspot/jtreg/serviceability/sa/ClhsdbPstackNoEhFrame.java line 43:

> 41:  * @requires vm.gc != "Z"
> 42:  * @requires (os.family == "linux")
> 43:  * @requires (os.arch == "aarch64")

I think we should test this on other platforms, however it might be better to 
exclude both RISC-V and qemu. `(os.arch != "riscv64" | !(vm.cpu.features ~= 
".*qemu.*"))` is set in ClhsdbPstack.java. See 
[JDK-8352730](https://bugs.openjdk.org/browse/JDK-8352730).

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

Changes requested by ysuenaga (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/33839#pullrequestreview-5886763116
PR Review Comment: https://git.openjdk.org/jdk/pull/33839#discussion_r4560113148

Reply via email to