[all-commits] [llvm/llvm-project] fc5442: [lldb] Refactor DataBuffer so we can map files as ...

Jonas Devlieghere via All-commits all-commits at lists.llvm.org
Tue Apr 5 13:46:54 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fc54427e76c89e567390dd4a1d64a65568f4ec26
      https://github.com/llvm/llvm-project/commit/fc54427e76c89e567390dd4a1d64a65568f4ec26
  Author: Jonas Devlieghere <jonas at devlieghere.com>
  Date:   2022-04-05 (Tue, 05 Apr 2022)

  Changed paths:
    M lldb/include/lldb/Core/ValueObject.h
    M lldb/include/lldb/Host/FileSystem.h
    M lldb/include/lldb/Symbol/CompactUnwindInfo.h
    M lldb/include/lldb/Symbol/ObjectFile.h
    M lldb/include/lldb/Target/ProcessStructReader.h
    M lldb/include/lldb/Target/RegisterCheckpoint.h
    M lldb/include/lldb/Target/RegisterContext.h
    M lldb/include/lldb/Target/RegisterContextUnwind.h
    M lldb/include/lldb/Utility/DataBuffer.h
    M lldb/include/lldb/Utility/DataBufferHeap.h
    M lldb/include/lldb/Utility/DataBufferLLVM.h
    M lldb/include/lldb/lldb-forward.h
    M lldb/source/Commands/CommandObjectMemory.cpp
    M lldb/source/Core/SourceManager.cpp
    M lldb/source/Core/ValueObject.cpp
    M lldb/source/DataFormatters/StringPrinter.cpp
    M lldb/source/DataFormatters/TypeFormat.cpp
    M lldb/source/Expression/IRExecutionUnit.cpp
    M lldb/source/Host/common/FileSystem.cpp
    M lldb/source/Host/common/Host.cpp
    M lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp
    M lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
    M lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
    M lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp
    M lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
    M lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp
    M lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
    M lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
    M lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
    M lldb/source/Plugins/Language/ObjC/CF.cpp
    M lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
    M lldb/source/Plugins/Language/ObjC/NSSet.cpp
    M lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
    M lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
    M lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
    M lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
    M lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
    M lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
    M lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
    M lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
    M lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.h
    M lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
    M lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h
    M lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp
    M lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.h
    M lldb/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp
    M lldb/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.h
    M lldb/source/Plugins/Process/Utility/RegisterContextDummy.cpp
    M lldb/source/Plugins/Process/Utility/RegisterContextDummy.h
    M lldb/source/Plugins/Process/Utility/RegisterContextHistory.cpp
    M lldb/source/Plugins/Process/Utility/RegisterContextHistory.h
    M lldb/source/Plugins/Process/Utility/RegisterContextMemory.cpp
    M lldb/source/Plugins/Process/Utility/RegisterContextMemory.h
    M lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp
    M lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.h
    M lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp
    M lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.h
    M lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
    M lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h
    M lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp
    M lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h
    M lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.cpp
    M lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.h
    M lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.cpp
    M lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_s390x.h
    M lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp
    M lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h
    M lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    M lldb/source/Plugins/Process/minidump/RegisterContextMinidump_x86_32.cpp
    M lldb/source/Plugins/Process/minidump/RegisterContextMinidump_x86_64.cpp
    M lldb/source/Symbol/ObjectFile.cpp
    M lldb/source/Target/Platform.cpp
    M lldb/source/Target/RegisterContextUnwind.cpp
    M lldb/source/Utility/DataBufferHeap.cpp
    M lldb/source/Utility/DataBufferLLVM.cpp
    M lldb/unittests/Utility/CMakeLists.txt
    A lldb/unittests/Utility/DataBufferTest.cpp

  Log Message:
  -----------
  [lldb] Refactor DataBuffer so we can map files as read-only

Currently, all data buffers are assumed to be writable. This is a
problem on macOS where it's not allowed to load unsigned binaries in
memory as writable. To be more precise, MAP_RESILIENT_CODESIGN and
MAP_RESILIENT_MEDIA need to be set for mapped (unsigned) binaries on our
platform.

Binaries are mapped through FileSystem::CreateDataBuffer which returns a
DataBufferLLVM. The latter is backed by a llvm::WritableMemoryBuffer
because every DataBuffer in LLDB is considered to be writable. In order
to use a read-only llvm::MemoryBuffer I had to split our abstraction
around it.

This patch distinguishes between a DataBuffer (read-only) and
WritableDataBuffer (read-write) and updates LLDB to use the appropriate
one.

rdar://74890607

Differential revision: https://reviews.llvm.org/D122856


  Commit: f2ea125ea09d9e4512fa08a89eac5e0069d83738
      https://github.com/llvm/llvm-project/commit/f2ea125ea09d9e4512fa08a89eac5e0069d83738
  Author: Jonas Devlieghere <jonas at devlieghere.com>
  Date:   2022-04-05 (Tue, 05 Apr 2022)

  Changed paths:
    M lldb/include/lldb/Symbol/ObjectFile.h
    M lldb/include/lldb/lldb-private-interfaces.h
    M lldb/source/Core/Module.cpp
    M lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
    M lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h
    M lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
    M lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
    M lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
    M lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h
    M lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    M lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
    M lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp
    M lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.h
    M lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
    M lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.h
    M lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
    M lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
    M lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
    M lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
    M lldb/source/Symbol/ObjectFile.cpp

  Log Message:
  -----------
  [lldb] Change CreateMemoryInstance to take a WritableDataBuffer

Change the CreateMemoryInstance interface to take a WritableDataBuffer.

Differential revision: https://reviews.llvm.org/D123073


Compare: https://github.com/llvm/llvm-project/compare/416965053762...f2ea125ea09d


More information about the All-commits mailing list