[libcxx-commits] [libcxx] [lldb] [lldb][libc++] Hide all libc++ implementation details from stacktraces (PR #108870)
Adrian Vogelsgesang via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Sep 25 04:52:10 PDT 2024
================
@@ -90,9 +79,28 @@ class LibCXXFrameRecognizer : public StackFrameRecognizer {
if (!sc.function)
return {};
- for (RegularExpression &r : m_hidden_regex)
- if (r.Execute(sc.function->GetNameNoArguments()))
+ // Check if we have a regex match
+ for (RegularExpression &r : m_hidden_regex) {
+ if (!r.Execute(sc.function->GetNameNoArguments()))
+ continue;
+
+ // Only hide this frame if the immediate caller is also within libc++.
+ lldb::ThreadSP thread_sp = frame_sp->GetThread();
+ if (!thread_sp)
+ return {};
+ lldb::StackFrameSP parent_frame_sp =
+ thread_sp->GetStackFrameAtIndex(frame_sp->GetFrameIndex() + 1);
+ if (!parent_frame_sp)
+ return {};
+ const auto &parent_sc =
+ parent_frame_sp->GetSymbolContext(lldb::eSymbolContextFunction);
+ if (!parent_sc.function)
+ return {};
+ if (parent_sc.function->GetNameNoArguments().GetStringRef().starts_with(
+ "std::")) {
return m_hidden_frame;
+ }
----------------
vogelsgesang wrote:
Argh. There really should be a clang-tidy check or something similar for this...
https://github.com/llvm/llvm-project/pull/108870
More information about the libcxx-commits
mailing list