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

Adrian Vogelsgesang via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 20 09:04:46 PDT 2024


================
@@ -395,6 +389,138 @@ def test_frame_recognizer_not_only_first_instruction(self):
             variables.GetValueAtIndex(1).GetValueType(), lldb.eValueTypeVariableArgument
         )
 
+    def test_frame_recognizer_disable(self):
+        self.build()
+        exe = self.getBuildArtifact("a.out")
+        target, process, thread, _ = lldbutil.run_to_name_breakpoint(
+            self, "foo", exe_name=exe
+        )
+
+        # Clear internal & plugins recognizers that get initialized at launch.
+        self.runCmd("frame recognizer clear")
+
+        self.runCmd(
+            "command script import "
+            + os.path.join(self.getSourceDir(), "recognizer.py")
+        )
+
+        # Add a frame recognizer in that target.
+        self.runCmd(
+            "frame recognizer add -l recognizer.MyFrameRecognizer -s a.out -n foo -n bar"
+        )
+
+        # The frame is recognized
+        self.expect(
+            "frame recognizer info 0",
+            substrs=["frame 0 is recognized by recognizer.MyFrameRecognizer"],
+        )
+
+        # Disable the recognizer
+        self.runCmd("frame recognizer disable 0")
+
+        self.expect(
+            "frame recognizer list",
+            substrs=[
+                "0: [disabled] recognizer.MyFrameRecognizer, module a.out, demangled symbol foo"
+            ],
+        )
+
+        self.expect(
+            "frame recognizer info 0",
+            substrs=["frame 0 not recognized by any recognizer"],
+        )
+
+        # Re-enable the recognizer
+        self.runCmd("frame recognizer enable 0")
+
+        self.expect(
+            "frame recognizer list",
+            substrs=[
+                "0: recognizer.MyFrameRecognizer, module a.out, demangled symbol foo"
+            ],
+        )
+
+        self.expect(
+            "frame recognizer info 0",
+            substrs=["frame 0 is recognized by recognizer.MyFrameRecognizer"],
+        )
+
+    def test_frame_recognizer_disable(self):
+        self.build()
+        exe = self.getBuildArtifact("a.out")
----------------
vogelsgesang wrote:

copy-paste mistake. Removed, and thereby also solved the issue with duplicated test case names

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


More information about the lldb-commits mailing list