summaryrefslogtreecommitdiff
path: root/lldb/include
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2023-05-10 17:48:48 -0700
committerJim Ingham <jingham@apple.com>2023-05-11 14:48:54 -0700
commite19387e6936c9ccc6200b32f3affea7b1020664c (patch)
tree17c33ecd481a53bdf768687de885a92d36c69746 /lldb/include
parentc45ee7c0fba8daa2b5b6b201faa99d02c01cce8b (diff)
downloadllvm-e19387e6936c9ccc6200b32f3affea7b1020664c.tar.gz
We can't let GetStackFrameCount get interrupted or it will give the
wrong answer. Plus, it's useful in some places to have a way to force the full stack to be created even in the face of interruption. Moreover, most of the time when you're just getting frames, you don't need to know the number of frames in the stack to start with. You just keep calling Thread::GetStackFrameAtIndex(index++) and when you get a null StackFrameSP back, you're done. That's also more amenable to interruption if you are doing some work frame by frame. So this patch makes GetStackFrameCount always return the full count, suspending interruption. I also went through all the places that use GetStackFrameCount to make sure that they really needed the full stack walk. In many cases, they did not. For instance frame select -r 10 was getting the number of frames just to check whether cur_frame_idx + 10 was within the stack. It's better in that case to see if that frame exists first, since that doesn't force a full stack walk, and only deal with walking off the end of the stack if it doesn't... I also added a test for some of these behaviors. Differential Revision: https://reviews.llvm.org/D150236
Diffstat (limited to 'lldb/include')
-rw-r--r--lldb/include/lldb/Target/StackFrameList.h6
-rw-r--r--lldb/include/lldb/lldb-private-enumerations.h5
2 files changed, 10 insertions, 1 deletions
diff --git a/lldb/include/lldb/Target/StackFrameList.h b/lldb/include/lldb/Target/StackFrameList.h
index e0bc210298fb..88e211ff692b 100644
--- a/lldb/include/lldb/Target/StackFrameList.h
+++ b/lldb/include/lldb/Target/StackFrameList.h
@@ -100,7 +100,11 @@ protected:
bool SetFrameAtIndex(uint32_t idx, lldb::StackFrameSP &frame_sp);
- void GetFramesUpTo(uint32_t end_idx);
+ /// Realizes frames up to (and including) end_idx (which can be greater than
+ /// the actual number of frames.)
+ /// Returns true if the function was interrupted, false otherwise.
+ bool GetFramesUpTo(uint32_t end_idx,
+ InterruptionControl allow_interrupt = AllowInterruption);
void GetOnlyConcreteFramesUpTo(uint32_t end_idx, Unwind &unwinder);
diff --git a/lldb/include/lldb/lldb-private-enumerations.h b/lldb/include/lldb/lldb-private-enumerations.h
index 4fae9e6e38ff..7f98220f9f16 100644
--- a/lldb/include/lldb/lldb-private-enumerations.h
+++ b/lldb/include/lldb/lldb-private-enumerations.h
@@ -274,4 +274,9 @@ enum SelectMostRelevant : bool {
DoNoSelectMostRelevantFrame = false,
};
+enum InterruptionControl : bool {
+ AllowInterruption = true,
+ DoNotAllowInterruption = false,
+};
+
#endif // LLDB_LLDB_PRIVATE_ENUMERATIONS_H