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 --- lldb/source/Commands/CommandObjectMemory.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lldb/source/Commands/CommandObjectMemory.cpp') diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index 2f3e15a95ee..8b30189559b 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -41,6 +41,7 @@ #include "lldb/Target/StackFrame.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/DataBufferHeap.h" +#include "lldb/Utility/DataBufferLLVM.h" #include "lldb/Utility/StreamString.h" #include "lldb/lldb-private.h" @@ -1358,8 +1359,9 @@ protected: size_t length = SIZE_MAX; if (item_byte_size > 1) length = item_byte_size; - lldb::DataBufferSP data_sp(m_memory_options.m_infile.ReadFileContents( - m_memory_options.m_infile_offset, length)); + auto data_sp = DataBufferLLVM::CreateSliceFromPath( + m_memory_options.m_infile.GetPath(), length, + m_memory_options.m_infile_offset); if (data_sp) { length = data_sp->GetByteSize(); if (length > 0) { -- cgit v1.2.3