summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2019-03-28 00:07:07 +0000
committerDavide Italiano <davide@freebsd.org>2019-03-28 00:07:07 +0000
commitdfbcadf562f6f362537e72661ba0fef6ca0243b9 (patch)
tree2f11b27a5c1ad4c1f5c4ce92cb664c04adf42cbd /lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
parent432030e843bf124b4d285874362b6fd00446dd56 (diff)
downloadbcm5719-llvm-dfbcadf562f6f362537e72661ba0fef6ca0243b9.tar.gz
bcm5719-llvm-dfbcadf562f6f362537e72661ba0fef6ca0243b9.zip
[ObjectFileMachO] Disable memory caching for savecore.
Summary: It's not really useful, and largely increases the footprint. <rdar://problem/49293525> Reviewers: jasonmolenda Subscribers: llvm-commits, lldb-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59896 llvm-svn: 357134
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp')
-rw-r--r--lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp19
1 files changed, 6 insertions, 13 deletions
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 7d5386bb7f8..ae1eac634ec 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -6128,18 +6128,6 @@ bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp,
if (range_info.GetExecutable() == MemoryRegionInfo::eYes)
prot |= VM_PROT_EXECUTE;
- // printf ("[%3u] [0x%16.16" PRIx64 " -
- // 0x%16.16" PRIx64 ") %c%c%c\n",
- // range_info_idx,
- // addr,
- // size,
- // (prot & VM_PROT_READ ) ? 'r' :
- // '-',
- // (prot & VM_PROT_WRITE ) ? 'w' :
- // '-',
- // (prot & VM_PROT_EXECUTE) ? 'x' :
- // '-');
-
if (prot != 0) {
uint32_t cmd_type = LC_SEGMENT_64;
uint32_t segment_size = sizeof(segment_command_64);
@@ -6346,8 +6334,13 @@ bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp,
while (bytes_left > 0 && error.Success()) {
const size_t bytes_to_read =
bytes_left > sizeof(bytes) ? sizeof(bytes) : bytes_left;
- const size_t bytes_read = process_sp->ReadMemory(
+
+ // In a savecore setting, we don't really care about caching,
+ // as the data is dumped and very likely never read again,
+ // so we call ReadMemoryFromInferior to bypass it.
+ const size_t bytes_read = process_sp->ReadMemoryFromInferior(
addr, bytes, bytes_to_read, memory_read_error);
+
if (bytes_read == bytes_to_read) {
size_t bytes_written = bytes_read;
error = core_file.Write(bytes, bytes_written);
OpenPOWER on IntegriCloud