On Tue, 10 Nov 2026 05:02:02 GMT, Yasumasa Suenaga <[email protected]> wrote:

>> Currently SA would find Build ID from `SHT_NOTE` to load debuginfo file. 
>> However it does not work in some case for example, ELF binaries which does 
>> not have `.note.gnu.build-id`section. I see this case in vDSO (vdso64.so) in 
>> Linux Kernel 7.2.15-300.fc45.x86_64. This file can be handled in 
>> `debuginfod-find` - it can identify Build ID, and can download appropriate 
>> debuginfo file, but SA cannot identify it.
>> 
>> It might not be a common case, but we can create such ELF binaries with 
>> `strip -R .note.gnu.build-id`, and it works. So it is better to support such 
>> binaries in SA. In this case, the Build ID note is accessible through a 
>> `PT_NOTE` program header, even though there is no corresponding 
>> `.note.gnu.build-id` section. This change makes SA scan the notes in 
>> `PT_NOTE` segments instead of relying on `SHT_NOTE` section headers to 
>> obtain the Build ID.
>> 
>> SA already supports debuginfo, but test code is not available. So this PR 
>> adds it.
>> We need to separate debuginfo from native library and strip it, so I 
>> modified related makefiles to do it in force. It works regardless of 
>> `--with-native-debug-symbols` configure option.
>> However we cannot test Build ID because the debuginfo depends on Build ID 
>> should be located at debug directory on host e.g. `/usr/lib/debug`. So the 
>> test introduced by this PR tests to load debug symbols from separated 
>> debuginfo file.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Yasumasa Suenaga has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Fix

test/hotspot/jtreg/serviceability/sa/TestELFDebuginfo.java line 69:

> 67:         // it is not an exported function. In addition .note.gnu.build-id 
> ELF
> 68:         // section is removed, so SA should find out associated debuginfo 
> from
> 69:         // .gnu_debuglink section.

Suggestion:

        // callSleep() JNI function calls sleep_internal(). Both functions
        // are provided by libDebuginfoTest.so, which is stripped with 
--strip-all
        // in build process. See BUILD_TEST_libDebuginfoTest in 
make/test/JtregNativeHotspot.gmk.
        // It does not have the sleep_internal() symbol because
        // it is not an exported function. In addition the .note.gnu.build-id 
ELF
        // section is removed, forcing SA to find out the associated debuginfo 
from
        // the .gnu_debuglink section instead.


I think maybe you can also remove the comment about sleep_internal(). I don't 
see why not exporting it is important to how the test works, but maybe I'm not 
understanding something.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/33764#discussion_r4527110819

Reply via email to