aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectFrame.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Commands/CommandObjectFrame.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectFrame.cpp52
1 files changed, 30 insertions, 22 deletions
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index 88a02dc..9133359 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -265,6 +265,29 @@ public:
Options *GetOptions() override { return &m_options; }
+private:
+ void SkipHiddenFrames(Thread &thread, uint32_t frame_idx) {
+ uint32_t candidate_idx = frame_idx;
+ const unsigned max_depth = 12;
+ for (unsigned num_try = 0; num_try < max_depth; ++num_try) {
+ if (candidate_idx == 0 && *m_options.relative_frame_offset == -1) {
+ candidate_idx = UINT32_MAX;
+ break;
+ }
+ candidate_idx += *m_options.relative_frame_offset;
+ if (auto candidate_sp = thread.GetStackFrameAtIndex(candidate_idx)) {
+ if (candidate_sp->IsHidden())
+ continue;
+ // Now candidate_idx is the first non-hidden frame.
+ break;
+ }
+ candidate_idx = UINT32_MAX;
+ break;
+ };
+ if (candidate_idx != UINT32_MAX)
+ m_options.relative_frame_offset = candidate_idx - frame_idx;
+ }
+
protected:
void DoExecute(Args &command, CommandReturnObject &result) override {
// No need to check "thread" for validity as eCommandRequiresThread ensures
@@ -278,28 +301,13 @@ protected:
if (frame_idx == UINT32_MAX)
frame_idx = 0;
- // If moving up/down by one, skip over hidden frames.
- if (*m_options.relative_frame_offset == 1 ||
- *m_options.relative_frame_offset == -1) {
- uint32_t candidate_idx = frame_idx;
- const unsigned max_depth = 12;
- for (unsigned num_try = 0; num_try < max_depth; ++num_try) {
- if (candidate_idx == 0 && *m_options.relative_frame_offset == -1) {
- candidate_idx = UINT32_MAX;
- break;
- }
- candidate_idx += *m_options.relative_frame_offset;
- if (auto candidate_sp = thread->GetStackFrameAtIndex(candidate_idx)) {
- if (candidate_sp->IsHidden())
- continue;
- // Now candidate_idx is the first non-hidden frame.
- break;
- }
- candidate_idx = UINT32_MAX;
- break;
- };
- if (candidate_idx != UINT32_MAX)
- m_options.relative_frame_offset = candidate_idx - frame_idx;
+ // If moving up/down by one, skip over hidden frames, unless we started
+ // in a hidden frame.
+ if ((*m_options.relative_frame_offset == 1 ||
+ *m_options.relative_frame_offset == -1)) {
+ if (auto current_frame_sp = thread->GetStackFrameAtIndex(frame_idx);
+ !current_frame_sp->IsHidden())
+ SkipHiddenFrames(*thread, frame_idx);
}
if (*m_options.relative_frame_offset < 0) {