================
@@ -0,0 +1,548 @@
+"""
+Test SBFrameExtensions API.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestSBFrameExtensions(TestBase):
+    def setUp(self):
+        TestBase.setUp(self)
+        self.source = "main.c"
+
+    def test_properties_pc_addr_fp_sp(self):
+        """Test SBFrame extension properties: pc, addr, fp, sp"""
+        self.build()
+        self.setTearDownCleanup()
+        exe = self.getBuildArtifact("a.out")
+
+        target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
+            self, "Set breakpoint here", lldb.SBFileSpec(self.source)
+        )
+
+        frame = thread.GetFrameAtIndex(0)
+        self.assertTrue(frame.IsValid(), "Frame should be valid")
+
+        # Test pc property
+        pc = frame.pc
+        self.assertIsInstance(pc, int, "pc should be an integer")
+        self.assertGreater(pc, 0, "pc should be greater than 0")
+        self.assertEqual(pc, frame.GetPC(), "pc property should match GetPC()")
+
+        # Test addr property
+        addr = frame.addr
+        self.assertTrue(addr.IsValid(), "addr should be valid")
+        self.assertEqual(addr, frame.GetPCAddress(), "addr should match 
GetPCAddress()")
+
+        # Test fp property
+        fp = frame.fp
+        self.assertIsInstance(fp, int, "fp should be an integer")
+        self.assertEqual(fp, frame.GetFP(), "fp property should match GetFP()")
----------------
ahmednoursphinx wrote:

I think we can keep the current approach since explicit assertions provide 
clearer error messages. A helper would save us only couple of  lines.
I'm open to updating it if you think otherwise.

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

Reply via email to