aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectProcess.cpp
diff options
context:
space:
mode:
authorDavid Spickett <david.spickett@linaro.org>2025-05-02 12:54:03 +0000
committerDavid Spickett <david.spickett@linaro.org>2025-05-02 13:00:12 +0000
commit7d01b85c2a0aa8bc91f731cfeb2a7b6885b8d04a (patch)
tree0cba1e1c61c25e552bd3227247a45356de061a8b /lldb/source/Commands/CommandObjectProcess.cpp
parentf6ac5276ee364b3b22ce746439e0ce3224dc9091 (diff)
downloadllvm-7d01b85c2a0aa8bc91f731cfeb2a7b6885b8d04a.zip
llvm-7d01b85c2a0aa8bc91f731cfeb2a7b6885b8d04a.tar.gz
llvm-7d01b85c2a0aa8bc91f731cfeb2a7b6885b8d04a.tar.bz2
Reland "[lldb] Do not bump memory modificator ID when "internal" debugger memory is updated (#129092)"
This reverts commit daa4061d61216456baa83ab404e096200e327fb4. Original PR https://github.com/llvm/llvm-project/pull/129092. I have restricted the test to X86 Windows because it turns out the only reason that `expr x.get()` would change m_memory_id is that on x86 we have to write the return address to the stack in ABIWindows_X86_64::PrepareTrivialCall: ``` // Save return address onto the stack if (!process_sp->WritePointerToMemory(sp, return_addr, error)) return false; ``` This is not required on AArch64 so m_memory_id was not changed: ``` (lldb) expr x.get() (int) $0 = 0 (lldb) process status -d Process 15316 stopped * thread #1, stop reason = Exception 0x80000003 encountered at address 0x7ff764a31034 frame #0: 0x00007ff764a31038 TestProcessModificationIdOnExpr.cpp.tmp`main at TestProcessModificationIdOnExpr.cpp:35 32 __builtin_debugtrap(); 33 __builtin_debugtrap(); 34 return 0; -> 35 } 36 37 // CHECK-LABEL: process status -d 38 // CHECK: m_stop_id: 2 ProcessModID: m_stop_id: 3 m_last_natural_stop_id: 0 m_resume_id: 0 m_memory_id: 0 ``` Really we should find a better way to force a memory write here, but I can't think of one right now.
Diffstat (limited to 'lldb/source/Commands/CommandObjectProcess.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectProcess.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp
index ed80c85..d0f5eaf 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -1388,6 +1388,9 @@ public:
case 'v':
m_verbose = true;
break;
+ case 'd':
+ m_dump = true;
+ break;
default:
llvm_unreachable("Unimplemented option");
}
@@ -1397,6 +1400,7 @@ public:
void OptionParsingStarting(ExecutionContext *execution_context) override {
m_verbose = false;
+ m_dump = false;
}
llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
@@ -1405,6 +1409,7 @@ public:
// Instance variables to hold the values for command options.
bool m_verbose = false;
+ bool m_dump = false;
};
protected:
@@ -1459,6 +1464,14 @@ protected:
crash_info_sp->GetDescription(strm);
}
}
+
+ if (m_options.m_dump) {
+ StateType state = process->GetState();
+ if (state == eStateStopped) {
+ ProcessModID process_mod_id = process->GetModID();
+ process_mod_id.Dump(result.GetOutputStream());
+ }
+ }
}
private: