aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectProcess.cpp
diff options
context:
space:
mode:
authorJason Molenda <jason@molenda.com>2021-07-22 01:02:54 -0700
committerJason Molenda <jason@molenda.com>2021-07-22 01:06:44 -0700
commitcdc6f8d728208d2f06c1c632a41d930e172b4fb5 (patch)
tree593676900dbdf9ad48ac0a06983bba1b61c1173b /lldb/source/Commands/CommandObjectProcess.cpp
parent924d62ca4a856f11caf90fd48ebc924733c5c3dc (diff)
downloadllvm-cdc6f8d728208d2f06c1c632a41d930e172b4fb5.zip
llvm-cdc6f8d728208d2f06c1c632a41d930e172b4fb5.tar.gz
llvm-cdc6f8d728208d2f06c1c632a41d930e172b4fb5.tar.bz2
Read and write a LC_NOTE "addrable bits" for addressing mask
This patch adds code to process save-core for Mach-O files which embeds an "addrable bits" LC_NOTE when the process is using a code address mask (e.g. AArch64 v8.3 with ptrauth aka arm64e). Add code to ObjectFileMachO to read that LC_NOTE from corefiles, and ProcessMachCore to set the process masks based on it when reading a corefile back in. Also have "process status --verbose" print the current address masks that lldb is using internally to strip ptrauth bits off of addresses. Differential Revision: https://reviews.llvm.org/D106348 rdar://68630113
Diffstat (limited to 'lldb/source/Commands/CommandObjectProcess.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectProcess.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp
index e4f67c0..00fb4d66 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -29,6 +29,8 @@
#include "lldb/Utility/Args.h"
#include "lldb/Utility/State.h"
+#include <bitset>
+
using namespace lldb;
using namespace lldb_private;
@@ -1341,6 +1343,18 @@ protected:
num_frames, num_frames_with_source, stop_format);
if (m_options.m_verbose) {
+ addr_t code_mask = process->GetCodeAddressMask();
+ addr_t data_mask = process->GetDataAddressMask();
+ if (code_mask != 0) {
+ int bits = std::bitset<64>(~code_mask).count();
+ result.AppendMessageWithFormat(
+ "Addressable code address mask: 0x%" PRIx64 "\n", code_mask);
+ result.AppendMessageWithFormat(
+ "Addressable data address mask: 0x%" PRIx64 "\n", data_mask);
+ result.AppendMessageWithFormat(
+ "Number of bits used in addressing (code): %d\n", bits);
+ }
+
PlatformSP platform_sp = process->GetTarget().GetPlatform();
if (!platform_sp) {
result.AppendError("Couldn'retrieve the target's platform");