================
@@ -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
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to