[Lldb-commits] [lldb] [LLDB] Add FreeBSD kernel coredump matching check. (PR #80785)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Tue Feb 6 03:39:27 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) {
----------------
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
More information about the lldb-commits
mailing list