diff options
author | Adrian Prantl <aprantl@apple.com> | 2024-08-23 09:55:47 -0700 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2024-08-23 11:06:01 -0700 |
commit | 3c0fba4f2471cacb27d787c7d8f54f21d9dcafae (patch) | |
tree | 1358f71aaa271accdd5e311072c09fbc6c0808c5 /lldb/source/Commands/CommandObjectFrame.cpp | |
parent | b7c1be1a7f49539ea644ff3fd8b55f237e37b35e (diff) | |
download | llvm-3c0fba4f2471cacb27d787c7d8f54f21d9dcafae.zip llvm-3c0fba4f2471cacb27d787c7d8f54f21d9dcafae.tar.gz llvm-3c0fba4f2471cacb27d787c7d8f54f21d9dcafae.tar.bz2 |
Revert "Revert "[lldb] Extend frame recognizers to hide frames from backtraces (#104523)""
This reverts commit 547917aebd1e79a8929b53f0ddf3b5185ee4df74.
Diffstat (limited to 'lldb/source/Commands/CommandObjectFrame.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectFrame.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp index 29e460f..46c75e3 100644 --- a/lldb/source/Commands/CommandObjectFrame.cpp +++ b/lldb/source/Commands/CommandObjectFrame.cpp @@ -278,6 +278,30 @@ 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 (*m_options.relative_frame_offset < 0) { if (static_cast<int32_t>(frame_idx) >= -*m_options.relative_frame_offset) |