On Wed, 19 Aug 2026 05:39:58 GMT, Yasumasa Suenaga <[email protected]> wrote:

> This is a part of [JDK-8382392](https://bugs.openjdk.org/browse/JDK-8382392).
> 
> Debuginfo related code such as `open_debug_file()` have been implemented in 
> symtab.c. Maybe it would be used for symbol resolution so far. However it is 
> needed for reading `.debug_frame` section from ELF file.
> 
> So this sub task moves debuginfo related code to salibelf.c because it 
> provides features for ELF.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

While moving the code, I restructured and renamed parts of the API to prepare 
for upcoming changes (such as Alpine Linux support) and to make the `salibelf` 
/ `symtab` interaction cleaner. Here is a summary of the main changes and why:

1. Extracted and exposed `open_debug_info()` in `salibelf`
   - Removed the `static` debuginfo-related functions from `symtab.c` and 
consolidated the debuginfo parsing into `open_debug_info()` in `salibelf.c`.
   - Added `extern "C"` declarations in `salibelf.h` because this API will be 
referenced from C++ code (`dwarf.cpp`) in subsequent changes (e.g., Alpine 
Linux support).

2. Refactored Build-ID handling
   - Moved the `NT_GNU_BUILD_ID` check logic out of `build_symtab_internal()` 
and included it into a dedicated `open_debuginfo_from_build_id()` function in 
`salibelf.c`.

3. Unified entry point for symtab creation
   - Streamlined the symtab creation interface by unifying the entry point into 
`build_symtab_from_debuginfo()`, reducing code duplication and simplifying the 
caller side.

These changes ensure that debuginfo parsing is properly encapsulated within 
`salibelf` while providing a clean, C++ compatible C API for symtab and DWARF.

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

PR Comment: https://git.openjdk.org/jdk/pull/32434#issuecomment-5377422878

Reply via email to