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
    - 
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 works fine with this change: 
https://github.com/YaSuenag/garakuta/tree/master/NativeSEGV

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

Commit messages:
 - Ignore PAC
 - Use DWARF on AArch64
 - DWARF parser improvement
 - Separate DWARF implementation from Linux AMD64
 - Rename "next" to "sender"

Changes: https://git.openjdk.org/jdk/pull/29731/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29731&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8377946
  Stats: 1035 lines in 22 files changed: 633 ins; 228 del; 174 mod
  Patch: https://git.openjdk.org/jdk/pull/29731.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29731/head:pull/29731

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

Reply via email to