[Lldb-commits] [lldb] [lldb] Add support for disabling frame recognizers (PR #109219)

via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 18 16:36:09 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 e0ad34e56590fa2e6ffdf617e044de7eadee2139 c471c2fe615082fb9f9c5f39466bd47ec5b86bb0 --extensions h,cpp -- lldb/include/lldb/Target/StackFrameRecognizer.h lldb/source/Commands/CommandObjectFrame.cpp lldb/source/Target/StackFrameRecognizer.cpp
``````````

</details>

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

``````````diff
diff --git a/lldb/include/lldb/Target/StackFrameRecognizer.h b/lldb/include/lldb/Target/StackFrameRecognizer.h
index 0deb4d4645..d2797b548e 100644
--- a/lldb/include/lldb/Target/StackFrameRecognizer.h
+++ b/lldb/include/lldb/Target/StackFrameRecognizer.h
@@ -124,12 +124,12 @@ public:
                      Mangled::NamePreference symbol_mangling,
                      bool first_instruction_only = true);
 
-  void ForEach(std::function<
-               void(uint32_t recognizer_id, bool enabled,
-                    std::string recognizer_name, std::string module,
-                    llvm::ArrayRef<ConstString> symbols,
-                    Mangled::NamePreference name_reference, bool regexp)> const
-                   &callback);
+  void
+  ForEach(std::function<void(uint32_t recognizer_id, bool enabled,
+                             std::string recognizer_name, std::string module,
+                             llvm::ArrayRef<ConstString> symbols,
+                             Mangled::NamePreference name_reference,
+                             bool regexp)> const &callback);
 
   bool SetEnabledForID(uint32_t recognizer_id, bool enabled);
   bool RemoveRecognizerWithID(uint32_t recognizer_id);
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index 86db334ddc..d42cbeaba1 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -964,15 +964,15 @@ PrintRecognizerDetails(Stream &strm, const std::string &name, bool enabled,
 
 // Base class for commands which accept a single frame recognizer as an argument
 class CommandObjectWithFrameRecognizerArg : public CommandObjectParsed {
-  public:
-    CommandObjectWithFrameRecognizerArg(CommandInterpreter &interpreter,
-                                        const char *name,
-                                        const char *help = nullptr,
-                                        const char *syntax = nullptr,
-                                        uint32_t flags = 0)
-        : CommandObjectParsed(interpreter, name, help, syntax, flags) {
-      AddSimpleArgumentList(eArgTypeRecognizerID);
-    }
+public:
+  CommandObjectWithFrameRecognizerArg(CommandInterpreter &interpreter,
+                                      const char *name,
+                                      const char *help = nullptr,
+                                      const char *syntax = nullptr,
+                                      uint32_t flags = 0)
+      : CommandObjectParsed(interpreter, name, help, syntax, flags) {
+    AddSimpleArgumentList(eArgTypeRecognizerID);
+  }
 
   void
   HandleArgumentCompletion(CompletionRequest &request,
@@ -982,7 +982,8 @@ class CommandObjectWithFrameRecognizerArg : public CommandObjectParsed {
       return;
 
     GetTarget().GetFrameRecognizerManager().ForEach(
-        [&request](uint32_t rid, bool enabled, std::string rname, std::string module,
+        [&request](uint32_t rid, bool enabled, std::string rname,
+                   std::string module,
                    llvm::ArrayRef<lldb_private::ConstString> symbols,
                    Mangled::NamePreference symbol_mangling, bool regexp) {
           StreamString strm;
@@ -996,7 +997,8 @@ class CommandObjectWithFrameRecognizerArg : public CommandObjectParsed {
         });
   }
 
-  virtual void DoExecuteWithId(CommandReturnObject &result, uint32_t recognizer_id) = 0;
+  virtual void DoExecuteWithId(CommandReturnObject &result,
+                               uint32_t recognizer_id) = 0;
 
   void DoExecute(Args &command, CommandReturnObject &result) override {
     if (command.GetArgumentCount() != 1) {
@@ -1016,7 +1018,8 @@ class CommandObjectWithFrameRecognizerArg : public CommandObjectParsed {
   }
 };
 
-class CommandObjectFrameRecognizerEnable : public CommandObjectWithFrameRecognizerArg {
+class CommandObjectFrameRecognizerEnable
+    : public CommandObjectWithFrameRecognizerArg {
 public:
   CommandObjectFrameRecognizerEnable(CommandInterpreter &interpreter)
       : CommandObjectWithFrameRecognizerArg(
@@ -1028,8 +1031,9 @@ public:
   ~CommandObjectFrameRecognizerEnable() override = default;
 
 protected:
-  void DoExecuteWithId(CommandReturnObject &result, uint32_t recognizer_id) override {
-    auto& recognizer_mgr = GetTarget().GetFrameRecognizerManager();
+  void DoExecuteWithId(CommandReturnObject &result,
+                       uint32_t recognizer_id) override {
+    auto &recognizer_mgr = GetTarget().GetFrameRecognizerManager();
     if (!recognizer_mgr.SetEnabledForID(recognizer_id, true)) {
       result.AppendErrorWithFormat("'%u' is not a valid recognizer id.\n",
                                    recognizer_id);
@@ -1039,7 +1043,8 @@ protected:
   }
 };
 
-class CommandObjectFrameRecognizerDisable : public CommandObjectWithFrameRecognizerArg {
+class CommandObjectFrameRecognizerDisable
+    : public CommandObjectWithFrameRecognizerArg {
 public:
   CommandObjectFrameRecognizerDisable(CommandInterpreter &interpreter)
       : CommandObjectWithFrameRecognizerArg(
@@ -1051,8 +1056,9 @@ public:
   ~CommandObjectFrameRecognizerDisable() override = default;
 
 protected:
-  void DoExecuteWithId(CommandReturnObject &result, uint32_t recognizer_id) override {
-    auto& recognizer_mgr = GetTarget().GetFrameRecognizerManager();
+  void DoExecuteWithId(CommandReturnObject &result,
+                       uint32_t recognizer_id) override {
+    auto &recognizer_mgr = GetTarget().GetFrameRecognizerManager();
     if (!recognizer_mgr.SetEnabledForID(recognizer_id, false)) {
       result.AppendErrorWithFormat("'%u' is not a valid recognizer id.\n",
                                    recognizer_id);
@@ -1062,7 +1068,8 @@ protected:
   }
 };
 
-class CommandObjectFrameRecognizerDelete : public CommandObjectWithFrameRecognizerArg {
+class CommandObjectFrameRecognizerDelete
+    : public CommandObjectWithFrameRecognizerArg {
 public:
   CommandObjectFrameRecognizerDelete(CommandInterpreter &interpreter)
       : CommandObjectWithFrameRecognizerArg(
@@ -1074,8 +1081,9 @@ public:
   ~CommandObjectFrameRecognizerDelete() override = default;
 
 protected:
-  void DoExecuteWithId(CommandReturnObject &result, uint32_t recognizer_id) override {
-    auto& recognizer_mgr = GetTarget().GetFrameRecognizerManager();
+  void DoExecuteWithId(CommandReturnObject &result,
+                       uint32_t recognizer_id) override {
+    auto &recognizer_mgr = GetTarget().GetFrameRecognizerManager();
     if (!recognizer_mgr.RemoveRecognizerWithID(recognizer_id)) {
       result.AppendErrorWithFormat("'%u' is not a valid recognizer id.\n",
                                    recognizer_id);
@@ -1108,8 +1116,8 @@ protected:
             name = "(internal)";
 
           stream << std::to_string(recognizer_id) << ": ";
-          PrintRecognizerDetails(stream, name, enabled, module, symbols, symbol_mangling,
-                                 regexp);
+          PrintRecognizerDetails(stream, name, enabled, module, symbols,
+                                 symbol_mangling, regexp);
 
           stream.EOL();
           stream.Flush();
diff --git a/lldb/source/Target/StackFrameRecognizer.cpp b/lldb/source/Target/StackFrameRecognizer.cpp
index 4592702942..6feb91b365 100644
--- a/lldb/source/Target/StackFrameRecognizer.cpp
+++ b/lldb/source/Target/StackFrameRecognizer.cpp
@@ -83,9 +83,9 @@ void StackFrameRecognizerManager::AddRecognizer(
 }
 
 void StackFrameRecognizerManager::ForEach(
-    const std::function<
-        void(uint32_t, bool, std::string, std::string, llvm::ArrayRef<ConstString>,
-             Mangled::NamePreference name_reference, bool)> &callback) {
+    const std::function<void(
+        uint32_t, bool, std::string, std::string, llvm::ArrayRef<ConstString>,
+        Mangled::NamePreference name_reference, bool)> &callback) {
   for (auto entry : m_recognizers) {
     if (entry.is_regexp) {
       std::string module_name;
@@ -96,9 +96,9 @@ void StackFrameRecognizerManager::ForEach(
       if (entry.symbol_regexp)
         symbol_name = entry.symbol_regexp->GetText().str();
 
-      callback(entry.recognizer_id, entry.enabled, entry.recognizer->GetName(), module_name,
-               llvm::ArrayRef(ConstString(symbol_name)), entry.symbol_mangling,
-               true);
+      callback(entry.recognizer_id, entry.enabled, entry.recognizer->GetName(),
+               module_name, llvm::ArrayRef(ConstString(symbol_name)),
+               entry.symbol_mangling, true);
 
     } else {
       callback(entry.recognizer_id, entry.enabled, entry.recognizer->GetName(),

``````````

</details>


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


More information about the lldb-commits mailing list