summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2019-10-25 22:18:51 +0000
committerPavel Labath <labath@google.com>2019-10-25 22:33:32 +0000
commit7c603a41e20f461cf38ec7359a9eaa118fc0db5d (patch)
tree8a52586354599f34a64b37d5f6ee1ae008fcc634 /lldb/source/Target
parent27fdf8a29d1e0740c342d428fa48eda7b088ac8e (diff)
downloadbcm5719-llvm-7c603a41e20f461cf38ec7359a9eaa118fc0db5d.tar.gz
bcm5719-llvm-7c603a41e20f461cf38ec7359a9eaa118fc0db5d.zip
lldb/minidump: Refactor memory region computation code
The goal of this refactor is to enable ProcessMinidump to take into account the loaded modules and their sections when computing the permissions of various ranges of memory, as discussed in D66638. This patch moves some of the responsibility for computing the ranges from MinidumpParser into ProcessMinidump. MinidumpParser still does the parsing, but ProcessMinidump becomes responsible for answering the actual queries about memory ranges. This will enable it (in a follow-up patch) to augment the information obtained from the parser with data obtained from actual object files. The changes in the actual code are fairly straight-forward and just involve moving code around. MinidumpParser::GetMemoryRegions is renamed to BuildMemoryRegions to emphasize that it does no caching. The only new thing is the additional bool flag returned from this function. This indicates whether the returned regions describe all memory mapped into the target process. Data obtained from /proc/maps and the MemoryInfoList stream is considered to be exhaustive. Data obtained from Memory(64)List is not. This will be used to determine whether we need to augment the data or not. This reshuffle means that it is no longer possible/easy to test some of this code via unit tests, as constructing a ProcessMinidump instance is hard. Instead, I update the unit tests to only test the parsing of the actual data, and test the answering of queries through a lit test using the "memory region" command. The patch also includes some tweaks to the MemoryRegion class to make the unit tests easier to write. Reviewers: amccarth, clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D69035
Diffstat (limited to 'lldb/source/Target')
-rw-r--r--lldb/source/Target/CMakeLists.txt1
-rw-r--r--lldb/source/Target/MemoryRegionInfo.cpp20
2 files changed, 21 insertions, 0 deletions
diff --git a/lldb/source/Target/CMakeLists.txt b/lldb/source/Target/CMakeLists.txt
index bb74ff19e73..a92951e6a73 100644
--- a/lldb/source/Target/CMakeLists.txt
+++ b/lldb/source/Target/CMakeLists.txt
@@ -17,6 +17,7 @@ add_lldb_library(lldbTarget
LanguageRuntime.cpp
Memory.cpp
MemoryHistory.cpp
+ MemoryRegionInfo.cpp
ModuleCache.cpp
OperatingSystem.cpp
PathMappingList.cpp
diff --git a/lldb/source/Target/MemoryRegionInfo.cpp b/lldb/source/Target/MemoryRegionInfo.cpp
new file mode 100644
index 00000000000..1feb84bffc5
--- /dev/null
+++ b/lldb/source/Target/MemoryRegionInfo.cpp
@@ -0,0 +1,20 @@
+//===-- MemoryRegionInfo.cpp ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Target/MemoryRegionInfo.h"
+
+llvm::raw_ostream &lldb_private::operator<<(llvm::raw_ostream &OS,
+ const MemoryRegionInfo &Info) {
+ return OS << llvm::formatv("MemoryRegionInfo([{0}, {1}), {2}, {3}, {4}, {5}, "
+ "`{6}`, {7}, {8})",
+ Info.GetRange().GetRangeBase(),
+ Info.GetRange().GetRangeEnd(), Info.GetReadable(),
+ Info.GetWritable(), Info.GetExecutable(),
+ Info.GetMapped(), Info.GetName(), Info.GetFlash(),
+ Info.GetBlocksize());
+}
OpenPOWER on IntegriCloud