[Lldb-commits] [PATCH] D74660: WIP: [lldb/FileSystem] Add & use CreateReadonlyDataBuffer where possible

Vedant Kumar via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 14 17:51:51 PST 2020


vsk created this revision.
vsk added reviewers: JDevlieghere, jingham.
vsk added a project: LLDB.
Herald added a subscriber: aprantl.
vsk added subscribers: rupprecht, labath.
vsk added a comment.

+ @labath @rupprecht, my tentative plan is to fix this by having ObjectFileELF make a copy into a heap-allocated buffer when applying relocations. Please lmk if that's problematic (although, that seems like a slightly lazier version of what we do today, so hopefully it's all right).


Add FileSystem::CreateReadonlyDataBuffer to allow lldb to open files
using mmap() (i.e. without any heap allocation).

There's no functionality change intended here. We've been getting
reports of lldb using 2GB+ of heap memory while debugging Xcode [1], and
I think this should help with that.

This is WIP because `ObjectFileELF::RelocateDebugSections` mutates a buffer
obtained from ObjectFile. `SymbolFile/DWARF/parallel-indexing-stress.s` is the
only failing test, everything else passes with the current patch (on Darwin).

rdar://53785446

[1] `heap` report from two different users:

Count Bytes       Avg Size    Symbol
11404 2143015136  187917.8   (anonymous namespace)::MemoryBufferMem<llvm::WritableMemoryBuffer>  C++ LLDB
11948 2537624624  212389.1   (anonymous namespace)::MemoryBufferMem<llvm::WritableMemoryBuffer>  C++ LLDB


https://reviews.llvm.org/D74660

Files:
  lldb/include/lldb/Host/FileSystem.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/FileSystem.cpp
  lldb/source/Host/linux/Host.cpp
  lldb/source/Host/netbsd/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/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: D74660.244798.patch
Type: text/x-patch
Size: 18643 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200215/e76698e3/attachment-0001.bin>


More information about the lldb-commits mailing list