[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92078)

via lldb-commits lldb-commits at lists.llvm.org
Tue May 14 14:10:44 PDT 2024


GeorgeHuyubo wrote:

> Can we make this less brute force? I believe searching for the Build ID Note should be a completely deterministic process, without the need for heuristics. You start with the elf header, find the program headers, iterate to find the PT_NOTE segment (there could be more of them), and iterate over the notes until you find NT_GNU_BUILD_ID. All of these things should be in the memory (=> also in the core file) and within the first 4k of the mapping. There should be no need to search through a potentially huge file mapping just to see if it contains the build id.

Here is a real life binary:
0x7f2e7b6a5000+0x4000 b3bd5db2152ddae68640e781e1a6c039 at 0x7f2e7b6a7280 - - /tmp/hhvm_member_reflection_0d17d1c87f353d813d3e6b43e6db1d59e428c014_HFrPOT

so the .note.gnu.build-id is found at 0x7f2e7b6a7280 which is the file start address 0x7f2e7b6a5000 plus 0x2280(8832 bytes in decimal).
I don't know what is the precise search range limit which can guarantee us to find the NT_GNU_BUILD_ID. Open for suggestion.

https://github.com/llvm/llvm-project/pull/92078


More information about the lldb-commits mailing list