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/Symbol/ObjectFile.cpp | |
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/Symbol/ObjectFile.cpp')
-rw-r--r-- | lldb/source/Symbol/ObjectFile.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp index 0394b9b60fe..483a315defb 100644 --- a/lldb/source/Symbol/ObjectFile.cpp +++ b/lldb/source/Symbol/ObjectFile.cpp @@ -22,6 +22,7 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/DataBuffer.h" #include "lldb/Utility/DataBufferHeap.h" +#include "lldb/Utility/DataBufferLLVM.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/RegularExpression.h" #include "lldb/lldb-private.h" @@ -76,8 +77,8 @@ ObjectFile::FindPlugin(const lldb::ModuleSP &module_sp, const FileSpec *file, // and object container plug-ins can use these bytes to see if they // can parse this file. if (file_size > 0) { - data_sp = file->ReadFileContents(file_offset, - std::min<size_t>(512, file_size)); + data_sp = + DataBufferLLVM::CreateSliceFromPath(file->GetPath(), 512, file_offset); data_offset = 0; } } @@ -120,7 +121,8 @@ ObjectFile::FindPlugin(const lldb::ModuleSP &module_sp, const FileSpec *file, } // We failed to find any cached object files in the container // plug-ins, so lets read the first 512 bytes and try again below... - data_sp = archive_file.ReadFileContents(file_offset, 512); + data_sp = DataBufferLLVM::CreateSliceFromPath(archive_file.GetPath(), + 512, file_offset); } } } @@ -206,7 +208,7 @@ size_t ObjectFile::GetModuleSpecifications(const FileSpec &file, lldb::offset_t file_offset, lldb::offset_t file_size, ModuleSpecList &specs) { - DataBufferSP data_sp(file.ReadFileContents(file_offset, 512)); + DataBufferSP data_sp = DataBufferLLVM::CreateSliceFromPath(file.GetPath(), 512, file_offset); if (data_sp) { if (file_size == 0) { const lldb::offset_t actual_file_size = file.GetByteSize(); |