[Lldb-commits] [PATCH] D30622: Remove FileSpec::ReadFileContents

Zachary Turner via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun Mar 5 09:19:55 PST 2017


zturner created this revision.

The idea is that `DataBufferLLVM` already covers this use case, so there is no point duplicating the code.  The only tricky thing is that I found one case where we attempt to modify the bytes we read in (in `ObjectFilePECOFF`).  It seems kind of hackish, but it worked because `ReadFileContents` would only ever load a copy of the data into memory.  But LLVM uses `mmap` whenever possible and maps as readonly, so this was causing failures when we tried to modify the bytes.

To address this I've added a flag called `Private` which forces us to not use `mmap`.  In an ideal world, we would still try to use `mmap`, but map the bytes as private / writable.  This is a patch for another day.

Also for another day is to rename `DataBufferLLVM` to `DataBufferFile`.


https://reviews.llvm.org/D30622

Files:
  lldb/include/lldb/Host/FileSpec.h
  lldb/include/lldb/Utility/DataBufferLLVM.h
  lldb/source/API/SBSection.cpp
  lldb/source/Commands/CommandObjectMemory.cpp
  lldb/source/Core/SourceManager.cpp
  lldb/source/Host/common/FileSpec.cpp
  lldb/source/Host/common/Host.cpp
  lldb/source/Interpreter/OptionValueFileSpec.cpp
  lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
  lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
  lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
  lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
  lldb/source/Symbol/ObjectFile.cpp
  lldb/source/Utility/DataBufferLLVM.cpp
  lldb/unittests/Process/minidump/MinidumpParserTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30622.90617.patch
Type: text/x-patch
Size: 31680 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170305/f73dbba9/attachment-0001.bin>


More information about the lldb-commits mailing list