[Lldb-commits] [lldb] [lldb] Extend frame recognizers to hide frames from backtraces (PR #104523)

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 15 17:35:39 PDT 2024


================
@@ -40,8 +41,49 @@ static ConstString g_coro_frame = ConstString("__coro_frame");
 
 char CPPLanguageRuntime::ID = 0;
 
+/// A frame recognizer that is isntalled to hide libc++ implementation
+/// details from the backtrace.
+class LibCXXFrameRecognizer : public StackFrameRecognizer {
+  RegularExpression m_hidden_function_regex;
+  RecognizedStackFrameSP m_hidden_frame;
+
+  struct LibCXXHiddenFrame : public RecognizedStackFrame {
+    bool ShouldHide() override { return true; }
+  };
+
+public:
+  LibCXXFrameRecognizer()
+      : m_hidden_function_regex(
+            R"(^std::__1::(__function.*::operator\(\)|__invoke))"
----------------
jasonmolenda wrote:

This may be too ugly, but sometimes when I have a regex table, I like to include an example of a string each one is meant to match against.  This first one I can get, but the next two I'm not sure what names we're matching.  This mostly reflects me not paying attention to libc++ internal method names as I skip past them in backtraces, not necessarily important.

https://github.com/llvm/llvm-project/pull/104523


More information about the lldb-commits mailing list