On Wed, 11 Nov 2026 08:15:59 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).

One question:
Can it work if you build JDK with `--enable-debug-symbols=internal` or deploy 
debuginfo file into same directory?
I guess libNoEhFrame.so has `.debug_frame` section, and SA can continue to 
unwind due to JDK-8390621.

I know this comment is not an important for this PR, but I'm curious because 
most of binaries which do not have `.eh_frame` (e.g. provided by Alpine Linux / 
built by older toolchain on RISC-V) have `.debug_frame` AFAIK.

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/aarch64/LinuxAARCH64CFrame.java
 line 52:

> 50:         dwarf = createDwarfParser(linuxDbg, pc);
> 51:       } catch (DebuggerException e) {
> 52:         if (linuxDbg.findLibPtrByAddress(pc) != null) {

You can use `hasNativeLibrary()` here.

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

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

Reply via email to