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
This commit is contained in:
Zachary Turner
2017-03-06 23:42:14 +00:00
parent 15492af547
commit 7f6a7a3752
20 changed files with 97 additions and 183 deletions

View File

@@ -39,6 +39,7 @@
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/DataBufferLLVM.h"
#include "lldb/Utility/Error.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegularExpression.h"
@@ -2536,7 +2537,7 @@ bool RenderScriptRuntime::LoadAllocation(Stream &strm, const uint32_t alloc_id,
}
// Read file into data buffer
DataBufferSP data_sp(file.ReadFileContents());
auto data_sp = DataBufferLLVM::CreateFromPath(file.GetPath());
// Cast start of buffer to FileHeader and use pointer to read metadata
void *file_buf = data_sp->GetBytes();
@@ -3074,7 +3075,7 @@ bool RSModuleDescriptor::ParseRSInfo() {
const addr_t size = info_sym->GetByteSize();
const FileSpec fs = m_module->GetFileSpec();
const DataBufferSP buffer = fs.ReadFileContents(addr, size);
auto buffer = DataBufferLLVM::CreateSliceFromPath(fs.GetPath(), size, addr);
if (!buffer)
return false;