[Lldb-commits] [PATCH] D114967: [lldb] [Process/elf-core] Disable for FreeBSD vmcores

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 2 09:36:53 PST 2021


mgorny created this revision.
mgorny added reviewers: labath, krytarowski, emaste.
Herald added a subscriber: arichardson.
mgorny requested review of this revision.

Recognize FreeBSD vmcores (kernel core dumps) through OS ABI = 0xFF
+ ELF version = 0, and do not process them via the elf-core plugin.
While these files use ELF as a container format, they contain raw memory
dump rather than proper VM segments and therefore are not usable
to the elf-core plugin.


https://reviews.llvm.org/D114967

Files:
  lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp


Index: lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
===================================================================
--- lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -64,6 +64,10 @@
       DataExtractor data(data_sp, lldb::eByteOrderLittle, 4);
       lldb::offset_t data_offset = 0;
       if (elf_header.Parse(data, &data_offset)) {
+        // Check whether we're dealing with a FreeBSD vmcore that needs
+        // to be handled via FreeBSDKernel plugin instead.
+        if (elf_header.e_ident[7] == 0xFF && elf_header.e_version == 0)
+          return process_sp;
         if (elf_header.e_type == llvm::ELF::ET_CORE)
           process_sp = std::make_shared<ProcessElfCore>(target_sp, listener_sp,
                                                         *crash_file);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114967.391358.patch
Type: text/x-patch
Size: 865 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211202/faa2458b/attachment.bin>


More information about the lldb-commits mailing list