summaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Language/ObjC/CF.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2022-04-01 15:59:18 -0700
committerJonas Devlieghere <jonas@devlieghere.com>2022-04-05 13:46:37 -0700
commitfc54427e76c89e567390dd4a1d64a65568f4ec26 (patch)
treed785373d3b04cb1cee280af9da4d7f510dbeaef0 /lldb/source/Plugins/Language/ObjC/CF.cpp
parent4169650537622ef278b4d62ef5fb37aeb0ee9f4e (diff)
[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
Diffstat (limited to 'lldb/source/Plugins/Language/ObjC/CF.cpp')
-rw-r--r--lldb/source/Plugins/Language/ObjC/CF.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lldb/source/Plugins/Language/ObjC/CF.cpp b/lldb/source/Plugins/Language/ObjC/CF.cpp
index 6a4631e69387..fa2130e4b01e 100644
--- a/lldb/source/Plugins/Language/ObjC/CF.cpp
+++ b/lldb/source/Plugins/Language/ObjC/CF.cpp
@@ -158,7 +158,7 @@ bool lldb_private::formatters::CFBitVectorSummaryProvider(
// make sure we do not try to read huge amounts of data
if (num_bytes > 1024)
num_bytes = 1024;
- DataBufferSP buffer_sp(new DataBufferHeap(num_bytes, 0));
+ WritableDataBufferSP buffer_sp(new DataBufferHeap(num_bytes, 0));
num_bytes =
process_sp->ReadMemory(data_ptr, buffer_sp->GetBytes(), num_bytes, error);
if (error.Fail() || num_bytes == 0)