RFR: 8377946: Use DWARF in mixed jstack on Linux AArch64 [v2]
Chris Plummer
cjplummer at openjdk.org
Sat Feb 28 01:08:27 UTC 2026
On Thu, 26 Feb 2026 00:00:34 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:
>> SA supports DWARF in jhsdb to unwind native call frames on Linux AMD64. It is better if DWARF is supported on other architectures. This RFE aims to implement it on AArch64.
>>
>> This make a big change, so I assembled in 5 commits:
>>
>> - Unify terminology to "sender"
>> - https://github.com/YaSuenag/jdk/commit/9cab52f778a678b283533fa2129bdec378111abb
>> - Several words ("next", "sender", no prefix) are used around frame related code in SA,
>> thus the commit unified to "sender" to follow manner in HotSpot.
>> - Separate DWARF implementation from Linux AMD64
>> - https://github.com/YaSuenag/jdk/commit/6c90a74e507bc6cf7068b4d74ffded6d516e4865
>> - DWARF related code can be separate as platform-independent.
>> - ~~DWARF parser improvement~~ **Done in [JDK-8377947](https://bugs.openjdk.org/browse/JDK-8377947)**
>> - ~~https://github.com/YaSuenag/jdk/commit/979eb7c0dc87c057fb1c0ca88c4ea217d04f09ca~~
>> - ~~Track all of registers' offset from CFA~~
>> - ~~Remember states when DWARF parser see `DW_CFA_restore_state` in each time~~
>> - Use DWARF on AArch64
>> - https://github.com/YaSuenag/jdk/commit/b4bd2f3f372cfe2a796a558a4eeada0d57318067
>> - Ignore PAC (PACA)
>> - https://github.com/YaSuenag/jdk/commit/8ad3ee82da34a3a6ff0407997904079cced5f9f3
>> - Ignore AArch64 specific DWARF instructions (`DW_CFA_AARCH64_negate_ra_state`, `DW_CFA_AARCH64_negate_ra_state_with_pc`, `DW_CFA_AARCH64_set_ra_state`)
>> - Mixed jstack might not work on PAC (Pointer Authentication Code) enabled platform (it is same with current SA) because SA does not decode PAC. We need to support it if possible (but I do not have PAC enabled Linux machines).
>> - And also this commit disables TestJhsdbJstackMixedCore.java on AArch64 because it does not work on Fedora 43 AArch64. PC (program counter) points out of function in some case because the another function begins immediately after the end of interest function. If the function ends with `bl`, PC points beginning of next function. (I confirmed that with assembly code generated by GCC 15)
>>
>>
>> I tested this change on following platforms:
>> - Fedora 43 AMD64
>> - Oracle Linux 8.10 AMD64
>> - Fedora 43 AArch64
>> - Rocky Linux 9.5 AArch64
>>
>> I tested serviceability/sa on each platforms. On Fedora 43 AArch64 on Raspberry Pi 4, TestJhsdbJstackMixedWithXComp.java timed out, but I believe it was caused by machine performance. I didn't see any warnings/errors on other platforms. In addition, my crash examples ...
>
> Yasumasa Suenaga has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains six commits:
>
> - Merge branch 'master' into dwarf-aarch64
> - Ignore PAC
>
> Disable TestJhsdbJstackMixedCore.java on AArch64 again.
> Some C/C++ compiler puts "bl" at the tail of function and another function is located
> sequently, then SA could not unwind correctly because the PC points next instruction.
> - Use DWARF on AArch64
> - DWARF parser improvement
> - Separate DWARF implementation from Linux AMD64
> - Rename "next" to "sender"
src/jdk.hotspot.agent/linux/native/libsaproc/DwarfParser.cpp line 50:
> 48: CHECK_EXCEPTION \
> 49: sa_##reg = env->GetStaticIntField(reg_cls, reg##_ID); \
> 50: CHECK_EXCEPTION
I don't think SET_REG is needed anymore.
src/jdk.hotspot.agent/linux/native/libsaproc/DwarfParser.cpp line 68:
> 66: CHECK_EXCEPTION
> 67:
> 68: #define DWARF_REG(reg, _) \
I'd like to come up with a better name than DWARF_REG, but at the moment I can't think of anything. Also, each place where you define DWARF_REG should include a comment indicating that it is used by the DWARF_REGLIST macro.
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/DwarfCFrame.java line 89:
> 87: return cfa;
> 88: }
> 89:
I don't think this is used.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29731#discussion_r2866430300
PR Review Comment: https://git.openjdk.org/jdk/pull/29731#discussion_r2866421528
PR Review Comment: https://git.openjdk.org/jdk/pull/29731#discussion_r2866484943
More information about the serviceability-dev
mailing list