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

via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 15 16:42:13 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff ae059a1f9f1e501b08a99cb636ec0869ec204c6f 6289b797e6699c356c03caf32a4b74a5e2ee3278 --extensions h,cpp -- lldb/test/API/lang/cpp/std-function-recognizer/main.cpp lldb/include/lldb/Target/StackFrameList.h lldb/include/lldb/Target/StackFrameRecognizer.h lldb/include/lldb/Target/Thread.h lldb/source/API/SBThread.cpp lldb/source/Commands/CommandCompletions.cpp lldb/source/Commands/CommandObjectFrame.cpp lldb/source/Commands/CommandObjectMemory.cpp lldb/source/Commands/CommandObjectThread.cpp lldb/source/Core/Debugger.cpp lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp lldb/source/Target/Process.cpp lldb/source/Target/StackFrameList.cpp lldb/source/Target/Thread.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index b93ffe27bb..aae7306291 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -342,7 +342,7 @@ protected:
           }
         }
       }
-      } else {
+    } else {
       if (command.GetArgumentCount() > 1) {
         result.AppendErrorWithFormat(
             "too many arguments; expected frame-index, saw '%s'.\n",
@@ -365,7 +365,7 @@ protected:
           frame_idx = 0;
         }
       }
-      }
+    }
 
     bool success = thread->SetSelectedFrameByIndexNoisily(
         frame_idx, result.GetOutputStream());
diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
index 209b971b2f..768e519f33 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
@@ -59,16 +59,13 @@ public:
             R"(( const)?$)"), // const.
         m_hidden_frame(new LibCXXHiddenFrame()) {}
 
-  std::string GetName() override {
-    return "libc++ frame recognizer";
-  }
+  std::string GetName() override { return "libc++ frame recognizer"; }
 
   lldb::RecognizedStackFrameSP
   RecognizeFrame(lldb::StackFrameSP frame_sp) override {
     if (!frame_sp)
       return {};
-    auto &sc =
-        frame_sp->GetSymbolContext(lldb::eSymbolContextFunction);
+    auto &sc = frame_sp->GetSymbolContext(lldb::eSymbolContextFunction);
     if (!sc.function)
       return {};
 
@@ -82,10 +79,10 @@ public:
 CPPLanguageRuntime::CPPLanguageRuntime(Process *process)
     : LanguageRuntime(process) {
   if (process)
-        process->GetTarget().GetFrameRecognizerManager().AddRecognizer(
-            StackFrameRecognizerSP(new LibCXXFrameRecognizer()), {},
-            std::make_shared<RegularExpression>("^std::__1::"),
-            /*first_instruction_only*/ false);
+    process->GetTarget().GetFrameRecognizerManager().AddRecognizer(
+        StackFrameRecognizerSP(new LibCXXFrameRecognizer()), {},
+        std::make_shared<RegularExpression>("^std::__1::"),
+        /*first_instruction_only*/ false);
 }
 
 bool CPPLanguageRuntime::IsAllowedRuntimeValue(ConstString name) {

``````````

</details>


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


More information about the lldb-commits mailing list