diff options
author | Zachary Turner <zturner@google.com> | 2017-03-06 23:42:14 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-03-06 23:42:14 +0000 |
commit | 7f6a7a37521e3610be7242ccec7ca9a15c1c307a (patch) | |
tree | e2b7f59e0254269500347dfbd067108d86ca70a0 /lldb/source/Plugins/Process | |
parent | 15492af547112d272572994bfef2d560ce651d7b (diff) | |
download | bcm5719-llvm-7f6a7a37521e3610be7242ccec7ca9a15c1c307a.tar.gz bcm5719-llvm-7f6a7a37521e3610be7242ccec7ca9a15c1c307a.zip |
Remove FileSpec::ReadFileContents.
This functionality is subsumed by DataBufferLLVM, which is
also more efficient since it will try to mmap. However, we
don't yet support mmaping writable private sections, and in
some cases we were using ReadFileContents and then modifying
the buffer. To address that I've added a flag to the
DataBufferLLVM methods that allow you to map privately, which
disables the mmaping path entirely. Eventually we should teach
DataBufferLLVM to use mmap with writable private, but that is
orthogonal to this effort.
Differential Revision: https://reviews.llvm.org/D30622
llvm-svn: 297095
Diffstat (limited to 'lldb/source/Plugins/Process')
3 files changed, 8 insertions, 4 deletions
diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp index adb199ef166..99c1b7d3733 100644 --- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -24,6 +24,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/UnixSignals.h" #include "lldb/Utility/DataBufferHeap.h" +#include "lldb/Utility/DataBufferLLVM.h" #include "lldb/Utility/Log.h" #include "llvm/Support/ELF.h" @@ -61,7 +62,8 @@ lldb::ProcessSP ProcessElfCore::CreateInstance(lldb::TargetSP target_sp, // to ignore possible presence of the header extension. const size_t header_size = sizeof(llvm::ELF::Elf64_Ehdr); - lldb::DataBufferSP data_sp(crash_file->ReadFileContents(0, header_size)); + auto data_sp = + DataBufferLLVM::CreateSliceFromPath(crash_file->GetPath(), header_size, 0); if (data_sp && data_sp->GetByteSize() == header_size && elf::ELFHeader::MagicBytesMatch(data_sp->GetBytes())) { elf::ELFHeader elf_header; diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp index 9941c632f3a..665fcd169b0 100644 --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -30,6 +30,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/DataBuffer.h" +#include "lldb/Utility/DataBufferLLVM.h" #include "lldb/Utility/Log.h" // Project includes @@ -66,7 +67,8 @@ lldb::ProcessSP ProcessMachCore::CreateInstance(lldb::TargetSP target_sp, lldb::ProcessSP process_sp; if (crash_file) { const size_t header_size = sizeof(llvm::MachO::mach_header); - lldb::DataBufferSP data_sp(crash_file->ReadFileContents(0, header_size)); + auto data_sp = + DataBufferLLVM::CreateSliceFromPath(crash_file->GetPath(), header_size, 0); if (data_sp && data_sp->GetByteSize() == header_size) { DataExtractor data(data_sp, lldb::eByteOrderLittle, 4); diff --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp index 352e33b1f36..f3f4664ad6e 100644 --- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp +++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp @@ -53,7 +53,7 @@ lldb::ProcessSP ProcessMinidump::CreateInstance(lldb::TargetSP target_sp, // Read enough data for the Minidump header constexpr size_t header_size = sizeof(MinidumpHeader); auto DataPtr = - DataBufferLLVM::CreateFromPath(crash_file->GetPath(), header_size, 0); + DataBufferLLVM::CreateSliceFromPath(crash_file->GetPath(), header_size, 0); if (!DataPtr) return nullptr; @@ -65,7 +65,7 @@ lldb::ProcessSP ProcessMinidump::CreateInstance(lldb::TargetSP target_sp, if (header == nullptr) return nullptr; - auto AllData = DataBufferLLVM::CreateFromPath(crash_file->GetPath(), -1, 0); + auto AllData = DataBufferLLVM::CreateSliceFromPath(crash_file->GetPath(), -1, 0); if (!AllData) return nullptr; |