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

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu May 23 00:34:58 PDT 2024


================
@@ -983,6 +1001,66 @@ llvm::Error ProcessElfCore::ParseThreadContextsFromNoteSegment(
   }
 }
 
+bool ProcessElfCore::IsElf(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::FindNoteInCoreMemory(lldb::addr_t address,
+                                                         uint32_t type) {
----------------
labath wrote:

I don't think this `type` argument is useful, as this function already a UUID, and so it can't be used to parse any other kind of a note. I'd recommend inlining NT_GNU_BUILD_ID into the function (and renaming it to something like FindBuidIdInCoreMemory).

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


More information about the lldb-commits mailing list