From 7f6a7a37521e3610be7242ccec7ca9a15c1c307a Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Mon, 6 Mar 2017 23:42:14 +0000 Subject: 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 --- .../RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp') diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp index d1f1a3bb12b..a4bd1c99855 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -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; -- cgit v1.2.3