================
@@ -983,6 +995,44 @@ llvm::Error 
ProcessElfCore::ParseThreadContextsFromNoteSegment(
   }
 }
 
+bool ProcessElfCore::IsElf(const NT_FILE_Entry entry) {
+  const uint8_t elf_header[4] = {0x7f, 0x45, 0x4c,
+                                 0x46}; // ELF file begin with this 4 bytes
+  uint8_t buf[4];
+  Status error;
+  size_t byte_read = ReadMemory(entry.start, buf, 4, error);
+  if (byte_read == 4) {
+    return memcmp(elf_header, buf, 4) == 0;
+  } else {
+    return false;
+  }
----------------
clayborg wrote:

remove '{}' for single line if/then per llvm coding guidelines:
```
 if (byte_read == 4)
    return memcmp(elf_header, buf, 4) == 0;
  else
    return false;
```

https://github.com/llvm/llvm-project/pull/92078
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to