[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92492)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Fri May 17 09:15:05 PDT 2024
================
@@ -983,6 +1005,73 @@ llvm::Error ProcessElfCore::ParseThreadContextsFromNoteSegment(
}
}
+bool ProcessElfCore::IsElf(const lldb::addr_t address) {
+ uint8_t buf[4];
+ Status error;
+ size_t byte_read = ReadMemory(address, buf, 4, error);
+ if (byte_read != 4)
+ return false;
+ return elf::ELFHeader::MagicBytesMatch(buf);
+}
+
+std::optional<UUID> ProcessElfCore::FindNote(const lldb::addr_t address,
+ const uint32_t type) {
+ if (!IsElf(address))
+ return std::nullopt;
+ const uint32_t addr_size = GetAddressByteSize();
+ const lldb::offset_t ehdr_phoff_offset = ELFOFFSETOF(Ehdr, e_phoff);
+ const lldb::offset_t ehdr_phentsize_offset = ELFOFFSETOF(Ehdr, e_phentsize);
+ const lldb::offset_t ehdr_phnum_offset = ELFOFFSETOF(Ehdr, e_phnum);
----------------
clayborg wrote:
pass `addr_size` to the macro
https://github.com/llvm/llvm-project/pull/92492
More information about the lldb-commits
mailing list