================
@@ -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) {
----------------
DavidSpickett wrote:

Ok, so we're relying on the first few fields of the header being the same for 
32 and 64 bit. Which is fine.

However I would like to see it as much as possible written as:
```
if 64 bit:
    64 bit stuff
else:
   32 bit stuff
```
Even if it means repeating a couple of things, because the program flow here is 
getting confusing.

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