aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectFrame.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2023-04-21 13:49:01 -0700
committerJim Ingham <jingham@apple.com>2023-04-21 14:21:25 -0700
commit076341d1088b0b3e0140178760dc45ac5162cd65 (patch)
tree3b252a8a9e953b22eb4bd7f7d9ce13bb99006076 /lldb/source/Commands/CommandObjectFrame.cpp
parent2a3fbb6bd86bf79c0b3c5b118b4c7128938018ed (diff)
downloadllvm-076341d1088b0b3e0140178760dc45ac5162cd65.zip
llvm-076341d1088b0b3e0140178760dc45ac5162cd65.tar.gz
llvm-076341d1088b0b3e0140178760dc45ac5162cd65.tar.bz2
Make sure SelectMostRelevantFrame happens only when returning to the user.
This is a user facing action, it is meant to focus the user's attention on something other than the 0th frame when you stop somewhere where that's helpful. For instance, stopping in pthread_kill after an assert will select the assert frame. This is not something you want to have happen internally in lldb, both because internally you really don't want the selected frame changing out from under you, and because the recognizers can do arbitrary work, and that can cause deadlocks or other unexpected behavior. However, it's not something that the current code does explicitly after a stop has been delivered, it's expected to happen implicitly as part of stopping. I changing this to call SMRF explicitly after a user stop, but that got pretty ugly quickly. So I added a bool to control whether to run this and audited all the current uses to determine whether we're returning to the user or not. Differential Revision: https://reviews.llvm.org/D148863
Diffstat (limited to 'lldb/source/Commands/CommandObjectFrame.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectFrame.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index 4a0d752..71fed65 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -135,7 +135,7 @@ public:
protected:
bool DoExecute(Args &command, CommandReturnObject &result) override {
Thread *thread = m_exe_ctx.GetThreadPtr();
- StackFrameSP frame_sp = thread->GetSelectedFrame();
+ StackFrameSP frame_sp = thread->GetSelectedFrame(SelectMostRelevantFrame);
ValueObjectSP valobj_sp;
@@ -308,7 +308,7 @@ protected:
uint32_t frame_idx = UINT32_MAX;
if (m_options.relative_frame_offset) {
// The one and only argument is a signed relative frame index
- frame_idx = thread->GetSelectedFrameIndex();
+ frame_idx = thread->GetSelectedFrameIndex(SelectMostRelevantFrame);
if (frame_idx == UINT32_MAX)
frame_idx = 0;
@@ -362,7 +362,7 @@ protected:
return false;
}
} else if (command.GetArgumentCount() == 0) {
- frame_idx = thread->GetSelectedFrameIndex();
+ frame_idx = thread->GetSelectedFrameIndex(SelectMostRelevantFrame);
if (frame_idx == UINT32_MAX) {
frame_idx = 0;
}
@@ -372,7 +372,7 @@ protected:
bool success = thread->SetSelectedFrameByIndexNoisily(
frame_idx, result.GetOutputStream());
if (success) {
- m_exe_ctx.SetFrameSP(thread->GetSelectedFrame());
+ m_exe_ctx.SetFrameSP(thread->GetSelectedFrame(SelectMostRelevantFrame));
result.SetStatus(eReturnStatusSuccessFinishResult);
} else {
result.AppendErrorWithFormat("Frame index (%u) out of range.\n",