[Lldb-commits] [lldb] fdc1638 - [lldb] [Process/elf-core] Disable for FreeBSD vmcores

Michał Górny via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 6 05:54:56 PST 2021


Author: Michał Górny
Date: 2021-12-06T14:40:02+01:00
New Revision: fdc1638b5cbd7f93937dce56f8ea29db52390502

URL: https://github.com/llvm/llvm-project/commit/fdc1638b5cbd7f93937dce56f8ea29db52390502
DIFF: https://github.com/llvm/llvm-project/commit/fdc1638b5cbd7f93937dce56f8ea29db52390502.diff

LOG: [lldb] [Process/elf-core] Disable for FreeBSD vmcores

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.

Differential Revision: https://reviews.llvm.org/D114967

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
index b852a01643753..65dbc8ea95b31 100644
--- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -64,6 +64,10 @@ lldb::ProcessSP ProcessElfCore::CreateInstance(lldb::TargetSP target_sp,
       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 raw FreeBSD "full memory dump"
+        // ELF 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);


        


More information about the lldb-commits mailing list