[llvm] [LLVM][DWARF] Add support for .gnu_debuglink (PR #77715)
Daniel Thornburgh via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 22 14:58:47 PST 2024
mysterymath wrote:
> A direct alternative to `.gnu_debuglink` is the so called "build ID" method which uses the `.build-id` subdirectory of each one of the global debug directories, see https://sourceware.org/gdb/current/onlinedocs/gdb.html/Separate-Debug-Files.html for more details.
>
> In `llvm-symbolizer` for example we support both the build ID and debug link method, see
>
> https://github.com/llvm/llvm-project/blob/e611a4cf8060bf0a95b4acd9e136733425da085a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp#L520-L523
>
> I think we should factor the debug link implementation out of the symbolizer into a reusable library, similarly to what @mysterymath has done for the build ID implementation in [9812948](https://github.com/llvm/llvm-project/commit/9812948d22328e6f810c7654b93b063ce97ecfec), so it can be reused both inside the symbolizer and `DWARFContext`.
>
> In `DWARFContext` we should support both methods, especially since many ELF based systems are moving away from `.gnu_debuglink` and towards build ID (in Fuchsia for example we only support build ID).
> A direct alternative to `.gnu_debuglink` is the so called "build ID" method which uses the `.build-id` subdirectory of each one of the global debug directories, see https://sourceware.org/gdb/current/onlinedocs/gdb.html/Separate-Debug-Files.html for more details.
>
> In `llvm-symbolizer` for example we support both the build ID and debug link method, see
>
> https://github.com/llvm/llvm-project/blob/e611a4cf8060bf0a95b4acd9e136733425da085a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp#L520-L523
>
> I think we should factor the debug link implementation out of the symbolizer into a reusable library, similarly to what @mysterymath has done for the build ID implementation in [9812948](https://github.com/llvm/llvm-project/commit/9812948d22328e6f810c7654b93b063ce97ecfec), so it can be reused both inside the symbolizer and `DWARFContext`.
>
> In `DWARFContext` we should support both methods, especially since many ELF based systems are moving away from `.gnu_debuglink` and towards build ID (in Fuchsia for example we only support build ID).
I added a comment to the discussion earlier about the semantics of `.gnu_debuglink` vs `debuginfod` WRT non-DWARF stuffs. Implementation-wise, I'd agree that if their expected behavior lines up, all the fetch methods should be available behind a common library; it's not 100% clear to me yet whether their expected behaviors actually do line up. debuginfod and the local build ID lookup definitely do, but it really depends on whether the contents of a `.gnu_debuglink` section can have as arbitrary of contents as an object fetched by build ID can.
https://github.com/llvm/llvm-project/pull/77715
More information about the llvm-commits
mailing list