From 484bc2bcc7990f4ecaf40f3d806ed870cdbdfd95 Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Mon, 23 Jan 2023 10:42:31 -0800 Subject: Run cmdline address expressions through ABI's FixAddress On systems like ARM, where the non-addressable bits of a pointer value may be used for metadata (ARMv8.3 pointer authentication, or Type Byte Ignore), those bits need to be cleared before the address points to a valid memory location. Add a call to the target's ABI to clear those from address expression arguments to the lldb commands (e.g. `disassemble -a`). Differential Revision: https://reviews.llvm.org/D141629 --- lldb/source/Interpreter/OptionArgParser.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lldb/source') diff --git a/lldb/source/Interpreter/OptionArgParser.cpp b/lldb/source/Interpreter/OptionArgParser.cpp index 93b01ab..63ca0f9 100644 --- a/lldb/source/Interpreter/OptionArgParser.cpp +++ b/lldb/source/Interpreter/OptionArgParser.cpp @@ -8,6 +8,7 @@ #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/DataFormatters/FormatManager.h" +#include "lldb/Target/ABI.h" #include "lldb/Target/Target.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" @@ -157,6 +158,10 @@ lldb::addr_t OptionArgParser::ToAddress(const ExecutionContext *exe_ctx, if (!s.getAsInteger(0, addr)) { if (error_ptr) error_ptr->Clear(); + Process *process = exe_ctx->GetProcessPtr(); + if (process) + if (ABISP abi_sp = process->GetABI()) + addr = abi_sp->FixCodeAddress(addr); return addr; } -- cgit v1.1