[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:57 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;
----------------
labath wrote:

I think you can just delete this and put the magic bytes check at on line ~1024, after you read the full header. Reading 4 bytes is not going to be appreciably faster than reading 64 (sizeof(Elf64_Ehdr)), and this will make the code look more like the one on lines 60--70 (which essentially does the same thing).

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


More information about the lldb-commits mailing list