[Lldb-commits] [lldb] [LLDB] Add FreeBSD kernel coredump matching check. (PR #80785)

via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 6 03:16:31 PST 2024


================
@@ -200,8 +201,19 @@ lldb_private::UUID DynamicLoaderFreeBSDKernel::CheckForKernelImageAtAddress(
   if (header.e_type != llvm::ELF::ET_EXEC)
     return UUID();
 
-  ModuleSP memory_module_sp =
-      process->ReadModuleFromMemory(FileSpec("temp_freebsd_kernel"), addr);
+  ArchSpec kernel_arch(llvm::ELF::convertEMachineToArchName(header.e_machine));
+
+  ModuleSP memory_module_sp = process->ReadModuleFromMemory(
+      FileSpec("temp_freebsd_kernel"), addr, header.e_shoff);
+  if (header.e_ident[llvm::ELF::EI_CLASS] == llvm::ELF::ELFCLASS64) {
----------------
aokblast wrote:

```c++
ModuleSP memory_module_sp = process->ReadModuleFromMemory(
      FileSpec("temp_freebsd_kernel"), addr, header.e_shoff);
```

This code segment is already handle the 32bit case as the original header structure is the 32bit ELF Ehdr. I just check if the ELF is 64bit version and replace it with the correct 64bit ELF Ehdr.

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


More information about the lldb-commits mailing list