diff options
author | Zachary Turner <zturner@google.com> | 2017-02-24 18:56:49 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-02-24 18:56:49 +0000 |
commit | 3f4a4b36818ace88fb0263ba7e999115a2c7d7af (patch) | |
tree | 19d9cc32fa7886197d7c83324ac0febc4063cc59 /lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp | |
parent | bb361fcba1ab832ccfde2bc55fef9bbbafd6b9c9 (diff) | |
download | bcm5719-llvm-3f4a4b36818ace88fb0263ba7e999115a2c7d7af.tar.gz bcm5719-llvm-3f4a4b36818ace88fb0263ba7e999115a2c7d7af.zip |
Delete DataBufferMemoryMap.
After a series of patches on the LLVM side to get the mmaping
code up to compatibility with LLDB's needs, it is now ready
to go, which means LLDB's custom mmapping code is redundant.
So this patch deletes it all and uses LLVM's code instead.
In the future, we could take this one step further and delete
even the lldb DataBuffer base class and rely entirely on
LLVM's facilities, but this is a job for another day.
Differential Revision: https://reviews.llvm.org/D30054
llvm-svn: 296159
Diffstat (limited to 'lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp index 0b86b1efd8e..b6cd0d1b9df 100644 --- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp +++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp @@ -12,7 +12,7 @@ #include "ThreadMinidump.h" // Other libraries and framework includes -#include "lldb/Core/DataBufferHeap.h" +#include "lldb/Core/DataBufferLLVM.h" #include "lldb/Core/Log.h" #include "lldb/Core/Module.h" #include "lldb/Core/ModuleSpec.h" @@ -25,6 +25,7 @@ #include "lldb/Target/UnixSignals.h" #include "lldb/Utility/LLDBAssert.h" +#include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Threading.h" // C includes @@ -50,20 +51,25 @@ lldb::ProcessSP ProcessMinidump::CreateInstance(lldb::TargetSP target_sp, lldb::ProcessSP process_sp; // Read enough data for the Minidump header - const size_t header_size = sizeof(MinidumpHeader); - lldb::DataBufferSP data_sp(crash_file->MemoryMapFileContents(0, header_size)); - if (!data_sp) + constexpr size_t header_size = sizeof(MinidumpHeader); + auto DataPtr = + DataBufferLLVM::CreateFromFileSpec(*crash_file, header_size, 0); + if (!DataPtr) return nullptr; + assert(DataPtr->GetByteSize() == header_size); + // first, only try to parse the header, beacuse we need to be fast - llvm::ArrayRef<uint8_t> header_data(data_sp->GetBytes(), header_size); - const MinidumpHeader *header = MinidumpHeader::Parse(header_data); + llvm::ArrayRef<uint8_t> HeaderBytes = DataPtr->GetData(); + const MinidumpHeader *header = MinidumpHeader::Parse(HeaderBytes); + if (header == nullptr) + return nullptr; - if (data_sp->GetByteSize() != header_size || header == nullptr) + auto AllData = DataBufferLLVM::CreateFromFileSpec(*crash_file, -1, 0); + if (!AllData) return nullptr; - lldb::DataBufferSP all_data_sp(crash_file->MemoryMapFileContents()); - auto minidump_parser = MinidumpParser::Create(all_data_sp); + auto minidump_parser = MinidumpParser::Create(AllData); // check if the parser object is valid if (!minidump_parser) return nullptr; |