RFR: 8295646: Ignore zero pairs in address descriptors read by dwarf parser
Xiaolin Zheng
xlinzheng at openjdk.org
Wed Oct 19 08:29:27 UTC 2022
RISC-V generates debuginfo like
> readelf --debug-dump=aranges build/linux-riscv64-server-fastdebug/images/test/hotspot/gtest/server/libjvm.so
...
Length: 1756
Version: 2
Offset into .debug_info: 0x4bc5e9
Pointer Size: 8
Segment Size: 0
Address Length
0000000000344ece 0000000000004a2c
0000000000000000 0000000000000000 <=
0000000000000000 0000000000000000 <=
0000000000000000 0000000000000000 <=
00000000003498fa 0000000000000016
0000000000349910 0000000000000016
....
000000000026d5b8 0000000000000b9a
000000000034a532 0000000000000628
000000000034ab5a 00000000000002ac
0000000000000000 0000000000000000 <=
0000000000000000 0000000000000000
0000000000000000 0000000000000000
000000000034ae06 0000000000000bee
000000000034b9f4 0000000000000660
000000000034c054 00000000000005aa
0000000000000000 0000000000000000
0000000000000000 0000000000000000 <=
000000000034c5fe 0000000000000af2
000000000034d0f0 0000000000000f16
000000000034e006 0000000000000b4a
0000000000000000 0000000000000000
0000000000000000 0000000000000000
000000000026e152 000000000000000e
0000000000000000 0000000000000000
Our dwarf parser (gdb's dwarf parser before this April is as well [1], which encountered the same issue on RISC-V) uses `address == 0 && size == 0` in `is_terminating_entry()` to detect terminations of an arange section, which will early terminate parsing RISC-V's debuginfo so that the result would not look correctly with tests fail. The `_header._unit_length` is read but not used and it is the real length which can determine the section's end, so we can use it to get the end position of a section instead of `address == 0 && size == 0` checks to fix this issue.
Also, the reason why `readelf` has no such issue is it also uses the same approach to determine the end position. [2]
Tests added along with the dwarf parser patch are all tested and passed on x86_64, aarch64 and riscv64.
Running a tier1 sanity test now.
Thanks,
Xiaolin
[1] https://github.com/bminor/binutils-gdb/commit/1a7c41d5ece7d0d1aa77d8019ee46f03181854fa
[2] https://github.com/bminor/binutils-gdb/blob/fd320c4c29c9a1915d24a68a167a5fd6d2c27e60/binutils/dwarf.c#L7499
-------------
Commit messages:
- Fix for dwarf parser
Changes: https://git.openjdk.org/jdk/pull/10758/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10758&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8295646
Stats: 11 lines in 2 files changed: 6 ins; 0 del; 5 mod
Patch: https://git.openjdk.org/jdk/pull/10758.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/10758/head:pull/10758
PR: https://git.openjdk.org/jdk/pull/10758
More information about the hotspot-dev
mailing list