================
@@ -109,6 +109,73 @@ class LibCXXFrameRecognizer : public StackFrameRecognizer {
   }
 };
 
+/// A frame recognizer that hides MSVC STL implementation details from the
+/// backtrace. MSVC STL reserves identifiers beginning with an underscore
+/// followed by an uppercase letter (e.g. `_Func_class`) for implementation
+/// details, so frames whose function name starts with `std::_` followed by an
+/// uppercase letter are hidden when called from within `std::`.
+class MSVCSTLFrameRecognizer : public StackFrameRecognizer {
+  RegularExpression m_hidden_regex;
+  RecognizedStackFrameSP m_hidden_frame;
+
+  struct MSVCSTLHiddenFrame : public RecognizedStackFrame {
+    bool ShouldHide() override { return true; }
+  };
+
+  // The MSVC demangler emits demangled names that include the return type
+  // (e.g. `void std::_Func_impl_no_alloc<...>::_Do_call`). Detect whether a
+  // function name belongs to the `std::` namespace, accounting for that
+  // optional return-type prefix.
+  static bool IsInStdNamespace(llvm::StringRef name) {
+    return name.starts_with("std::") || name.contains(" std::");
+  }
+
+public:
+  MSVCSTLFrameRecognizer()
+      // Examples of MSVC STL internals that should be hidden:
+      //   void std::_Func_impl_no_alloc<`lambda...',void>::_Do_call
+      //   void std::_Func_class<void>::operator()
+      //   std::_Invoker_ret<std::_Unforced,1>::_Call<...>
+      // The regex is intentionally not anchored: the MSVC demangler may
+      // prepend a return type before the qualified name.
+      : m_hidden_regex(R"(std::_[A-Z])"),
----------------
Nerixyz wrote:

Ah, it looks like we don't support parsing of demangled Microsoft names. I 
opened #196509 for this.

https://github.com/llvm/llvm-project/pull/196336
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to