https://github.com/ahmednoursphinx updated 
https://github.com/llvm/llvm-project/pull/169236

>From cb5775e228a313dc9058c1dd84271aa3af69ce8b Mon Sep 17 00:00:00 2001
From: ahmed <[email protected]>
Date: Sun, 23 Nov 2025 22:46:25 +0200
Subject: [PATCH 1/7] [LLDB] Add SBFrameExtensions Tests

---
 .../python_api/sbframe_extensions/Makefile    |   3 +
 .../TestSBFrameExtensions.py                  | 483 ++++++++++++++++++
 .../API/python_api/sbframe_extensions/main.c  |  36 ++
 3 files changed, 522 insertions(+)
 create mode 100644 lldb/test/API/python_api/sbframe_extensions/Makefile
 create mode 100644 
lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py
 create mode 100644 lldb/test/API/python_api/sbframe_extensions/main.c

diff --git a/lldb/test/API/python_api/sbframe_extensions/Makefile 
b/lldb/test/API/python_api/sbframe_extensions/Makefile
new file mode 100644
index 0000000000000..10495940055b6
--- /dev/null
+++ b/lldb/test/API/python_api/sbframe_extensions/Makefile
@@ -0,0 +1,3 @@
+C_SOURCES := main.c
+
+include Makefile.rules
diff --git 
a/lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py 
b/lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py
new file mode 100644
index 0000000000000..9823f8fdd6bb8
--- /dev/null
+++ b/lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py
@@ -0,0 +1,483 @@
+"""
+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()
+        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()")
+
+        # Test sp property
+        sp = frame.sp
+        self.assertIsInstance(sp, int, "sp should be an integer")
+        self.assertEqual(sp, frame.GetSP(), "sp property should match GetSP()")
+
+    def test_properties_module_compile_unit_function_symbol_block(self):
+        """Test SBFrame extension properties: module, compile_unit, function, 
symbol, block"""
+        self.build()
+        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 module property
+        module = frame.module
+        self.assertTrue(module.IsValid(), "module should be valid")
+        self.assertEqual(module, frame.GetModule(), "module should match 
GetModule()")
+
+        # Test compile_unit property
+        compile_unit = frame.compile_unit
+        self.assertTrue(compile_unit.IsValid(), "compile_unit should be valid")
+        self.assertEqual(
+            compile_unit, frame.GetCompileUnit(), "compile_unit should match 
GetCompileUnit()"
+        )
+
+        # Test function property
+        function = frame.function
+        self.assertTrue(function.IsValid(), "function should be valid")
+        self.assertEqual(function, frame.GetFunction(), "function should match 
GetFunction()")
+
+        # Test symbol property
+        symbol = frame.symbol
+        self.assertTrue(symbol.IsValid(), "symbol should be valid")
+        self.assertEqual(symbol, frame.GetSymbol(), "symbol should match 
GetSymbol()")
+
+        # Test block property
+        block = frame.block
+        self.assertTrue(block.IsValid(), "block should be valid")
+        self.assertEqual(block, frame.GetBlock(), "block should match 
GetBlock()")
+
+    def test_properties_is_inlined_name_line_entry_thread(self):
+        """Test SBFrame extension properties: is_inlined, name, line_entry, 
thread"""
+        self.build()
+        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 is_inlined property
+        is_inlined = frame.is_inlined
+        self.assertIsInstance(is_inlined, bool, "is_inlined should be a 
boolean")
+        self.assertEqual(
+            is_inlined, frame.IsInlined(), "is_inlined should match 
IsInlined()"
+        )
+
+        # Test name property
+        name = frame.name
+        self.assertIsInstance(name, str, "name should be a string")
+        self.assertEqual(name, frame.GetFunctionName(), "name should match 
GetFunctionName()")
+        # Should be one of our functions
+        self.assertIn(name, ["func1", "func2", "main"], "name should be a 
known function")
+
+        # Test line_entry property
+        line_entry = frame.line_entry
+        self.assertTrue(line_entry.IsValid(), "line_entry should be valid")
+        self.assertEqual(
+            line_entry, frame.GetLineEntry(), "line_entry should match 
GetLineEntry()"
+        )
+
+        # Test thread property
+        thread_prop = frame.thread
+        self.assertTrue(thread_prop.IsValid(), "thread should be valid")
+        self.assertEqual(thread_prop, frame.GetThread(), "thread should match 
GetThread()")
+        self.assertEqual(
+            thread_prop.GetThreadID(),
+            thread.GetThreadID(),
+            "thread should be the same thread",
+        )
+
+    def test_properties_disassembly_idx(self):
+        """Test SBFrame extension properties: disassembly, idx"""
+        self.build()
+        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 disassembly property
+        disassembly = frame.disassembly
+        self.assertIsInstance(disassembly, str, "disassembly should be a 
string")
+        self.assertGreater(len(disassembly), 0, "disassembly should not be 
empty")
+        self.assertEqual(
+            disassembly, frame.Disassemble(), "disassembly should match 
Disassemble()"
+        )
+
+        # Test idx property
+        idx = frame.idx
+        self.assertIsInstance(idx, int, "idx should be an integer")
+        self.assertEqual(idx, frame.GetFrameID(), "idx should match 
GetFrameID()")
+        self.assertEqual(idx, 0, "First frame should have idx 0")
+
+    def test_properties_variables_vars_locals_args_arguments_statics(self):
+        """Test SBFrame extension properties: variables, vars, locals, args, 
arguments, statics"""
+        self.build()
+        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 variables property (alias for get_all_variables)
+        variables = frame.variables
+        self.assertIsInstance(variables, lldb.SBValueList, "variables should 
be SBValueList")
+        all_vars = frame.GetVariables(True, True, True, True)
+        self.assertEqual(
+            variables.GetSize(),
+            all_vars.GetSize(),
+            "variables should match GetVariables(True, True, True, True)",
+        )
+
+        # Test vars property (alias for variables)
+        vars_prop = frame.vars
+        self.assertIsInstance(vars_prop, lldb.SBValueList, "vars should be 
SBValueList")
+        self.assertEqual(
+            vars_prop.GetSize(),
+            variables.GetSize(),
+            "vars should match variables",
+        )
+
+        # Test locals property
+        locals_prop = frame.locals
+        self.assertIsInstance(locals_prop, lldb.SBValueList, "locals should be 
SBValueList")
+        locals_direct = frame.GetVariables(False, True, False, False)
+        self.assertEqual(
+            locals_prop.GetSize(),
+            locals_direct.GetSize(),
+            "locals should match GetVariables(False, True, False, False)",
+        )
+
+        # Test args property
+        args_prop = frame.args
+        self.assertIsInstance(args_prop, lldb.SBValueList, "args should be 
SBValueList")
+        args_direct = frame.GetVariables(True, False, False, False)
+        self.assertEqual(
+            args_prop.GetSize(),
+            args_direct.GetSize(),
+            "args should match GetVariables(True, False, False, False)",
+        )
+
+        # Test arguments property (alias for args)
+        arguments_prop = frame.arguments
+        self.assertIsInstance(
+            arguments_prop, lldb.SBValueList, "arguments should be SBValueList"
+        )
+        self.assertEqual(
+            arguments_prop.GetSize(),
+            args_prop.GetSize(),
+            "arguments should match args",
+        )
+
+        # Test statics property
+        statics_prop = frame.statics
+        self.assertIsInstance(statics_prop, lldb.SBValueList, "statics should 
be SBValueList")
+        statics_direct = frame.GetVariables(False, False, True, False)
+        self.assertEqual(
+            statics_prop.GetSize(),
+            statics_direct.GetSize(),
+            "statics should match GetVariables(False, False, True, False)",
+        )
+
+    def test_properties_registers_regs_register_reg(self):
+        """Test SBFrame extension properties: registers, regs, register, reg"""
+        self.build()
+        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 registers property
+        registers = frame.registers
+        self.assertIsInstance(registers, list, "registers should be a list")
+        registers_direct = frame.GetRegisters()
+        self.assertEqual(
+            len(registers), len(registers_direct), "registers should match 
GetRegisters()"
+        )
+
+        # Test regs property (alias for registers)
+        regs = frame.regs
+        self.assertIsInstance(regs, list, "regs should be a list")
+        self.assertEqual(len(regs), len(registers), "regs should match 
registers")
+
+        # Test register property (flattened view)
+        register = frame.register
+        self.assertIsNotNone(register, "register should not be None")
+        # register is a helper object with __iter__ and __getitem__
+        reg_names = set()
+        for reg in register:
+            self.assertTrue(reg.IsValid(), "Register should be valid")
+            reg_names.add(reg.name)
+
+        # Test reg property (alias for register)
+        reg = frame.reg
+        self.assertIsNotNone(reg, "reg should not be None")
+        reg_names2 = set()
+        for r in reg:
+            reg_names2.add(r.name)
+        self.assertEqual(reg_names, reg_names2, "reg should match register")
+
+        # Test register indexing by name
+        if len(reg_names) > 0:
+            first_reg_name = list(reg_names)[0]
+            reg_by_name = register[first_reg_name]
+            self.assertTrue(reg_by_name.IsValid(), "Register by name should be 
valid")
+            self.assertEqual(reg_by_name.name, first_reg_name, "Register name 
should match")
+
+    def test_properties_parent_child(self):
+        """Test SBFrame extension properties: parent, child"""
+        self.build()
+        exe = self.getBuildArtifact("a.out")
+
+        target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
+            self, "Set breakpoint here", lldb.SBFileSpec(self.source)
+        )
+
+        # Get frame at func1 (should be frame 0)
+        frame0 = thread.GetFrameAtIndex(0)
+        self.assertTrue(frame0.IsValid(), "Frame 0 should be valid")
+
+        # If there's a parent frame (frame 1), test parent property
+        if thread.GetNumFrames() > 1:
+            frame1 = thread.GetFrameAtIndex(1)
+            parent = frame0.parent
+            self.assertTrue(parent.IsValid(), "parent should be valid")
+            self.assertEqual(
+                parent.GetFrameID(),
+                frame1.GetFrameID(),
+                "parent should be the next frame",
+            )
+            self.assertEqual(parent.pc, frame1.GetPC(), "parent PC should 
match frame 1")
+
+        # Test child property (should be frame -1, which doesn't exist, so 
should return invalid)
+        child = frame0.child
+        # Child of frame 0 would be frame -1, which doesn't exist
+        # So it should return an invalid frame
+        if thread.GetNumFrames() == 1:
+            self.assertFalse(child.IsValid(), "child of only frame should be 
invalid")
+
+    def 
test_methods_get_all_variables_get_arguments_get_locals_get_statics(self):
+        """Test SBFrame extension methods: get_all_variables, get_arguments, 
get_locals, get_statics"""
+        self.build()
+        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 get_all_variables method
+        all_vars = frame.get_all_variables()
+        self.assertIsInstance(all_vars, lldb.SBValueList, "get_all_variables 
should return SBValueList")
+        all_vars_direct = frame.GetVariables(True, True, True, True)
+        self.assertEqual(
+            all_vars.GetSize(),
+            all_vars_direct.GetSize(),
+            "get_all_variables should match GetVariables(True, True, True, 
True)",
+        )
+
+        # Test get_arguments method
+        args = frame.get_arguments()
+        self.assertIsInstance(args, lldb.SBValueList, "get_arguments should 
return SBValueList")
+        args_direct = frame.GetVariables(True, False, False, False)
+        self.assertEqual(
+            args.GetSize(),
+            args_direct.GetSize(),
+            "get_arguments should match GetVariables(True, False, False, 
False)",
+        )
+
+        # Test get_locals method
+        locals = frame.get_locals()
+        self.assertIsInstance(locals, lldb.SBValueList, "get_locals should 
return SBValueList")
+        locals_direct = frame.GetVariables(False, True, False, False)
+        self.assertEqual(
+            locals.GetSize(),
+            locals_direct.GetSize(),
+            "get_locals should match GetVariables(False, True, False, False)",
+        )
+
+        # Test get_statics method
+        statics = frame.get_statics()
+        self.assertIsInstance(statics, lldb.SBValueList, "get_statics should 
return SBValueList")
+        statics_direct = frame.GetVariables(False, False, True, False)
+        self.assertEqual(
+            statics.GetSize(),
+            statics_direct.GetSize(),
+            "get_statics should match GetVariables(False, False, True, False)",
+        )
+
+    def test_method_var(self):
+        """Test SBFrame extension method: var()"""
+        self.build()
+        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 var() method with a variable that should exist
+        # First, let's see what variables are available
+        all_vars = frame.GetVariables(True, True, True, True)
+        if all_vars.GetSize() > 0:
+            var_name = all_vars.GetValueAtIndex(0).GetName()
+            var_value = frame.var(var_name)
+            self.assertTrue(var_value.IsValid(), f"var('{var_name}') should be 
valid")
+            self.assertEqual(
+                var_value.GetName(),
+                var_name,
+                f"var('{var_name}') should return the correct variable",
+            )
+            # Compare with GetValueForVariablePath
+            var_direct = frame.GetValueForVariablePath(var_name)
+            self.assertEqual(
+                var_value.GetName(),
+                var_direct.GetName(),
+                "var() should match GetValueForVariablePath()",
+            )
+
+        # Test var() with non-existent variable
+        invalid_var = frame.var("NonExistentVariable12345")
+        self.assertFalse(invalid_var.IsValid(), "var() with non-existent 
variable should be invalid")
+
+    def test_method_get_parent_frame_get_child_frame(self):
+        """Test SBFrame extension methods: get_parent_frame, get_child_frame"""
+        self.build()
+        exe = self.getBuildArtifact("a.out")
+
+        target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
+            self, "Set breakpoint here", lldb.SBFileSpec(self.source)
+        )
+
+        frame0 = thread.GetFrameAtIndex(0)
+        self.assertTrue(frame0.IsValid(), "Frame 0 should be valid")
+
+        # Test get_parent_frame
+        if thread.GetNumFrames() > 1:
+            parent = frame0.get_parent_frame()
+            self.assertTrue(parent.IsValid(), "get_parent_frame should return 
valid frame")
+            frame1 = thread.GetFrameAtIndex(1)
+            self.assertEqual(
+                parent.GetFrameID(),
+                frame1.GetFrameID(),
+                "get_parent_frame should return frame 1",
+            )
+        else:
+            # If there's only one frame, parent should be invalid
+            parent = frame0.get_parent_frame()
+            # Note: get_parent_frame might return an invalid frame if idx+1 is 
out of bounds
+
+        # Test get_child_frame (frame -1 doesn't exist, so should be invalid)
+        child = frame0.get_child_frame()
+        if thread.GetNumFrames() == 1:
+            self.assertFalse(child.IsValid(), "get_child_frame of only frame 
should be invalid")
+
+    def test_special_methods_eq_int_hex(self):
+        """Test SBFrame extension special methods: __eq__, __int__, __hex__"""
+        self.build()
+        exe = self.getBuildArtifact("a.out")
+
+        target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
+            self, "Set breakpoint here", lldb.SBFileSpec(self.source)
+        )
+
+        frame0 = thread.GetFrameAtIndex(0)
+        self.assertTrue(frame0.IsValid(), "Frame 0 should be valid")
+
+        # Test __int__ (converts frame to its frame ID)
+        frame_id = int(frame0)
+        self.assertIsInstance(frame_id, int, "__int__ should return an 
integer")
+        self.assertEqual(frame_id, frame0.GetFrameID(), "__int__ should return 
frame ID")
+
+        # Test __hex__ (converts frame to its PC)
+        # Note: __hex__ returns the PC as an integer, not a hex string
+        # In Python 3, hex() builtin calls __index__ if __hex__ doesn't exist,
+        # but since __hex__ is defined, it will be called
+        pc_hex = frame0.__hex__()
+        self.assertIsInstance(pc_hex, int, "__hex__ should return an integer 
(PC)")
+        self.assertEqual(pc_hex, frame0.GetPC(), "__hex__ should return PC")
+
+        # Test __eq__ and __ne__
+        frame0_copy = thread.GetFrameAtIndex(0)
+        self.assertTrue(frame0 == frame0_copy, "Same frame should be equal")
+        self.assertFalse(frame0 != frame0_copy, "Same frame should not be 
not-equal")
+
+        if thread.GetNumFrames() > 1:
+            frame1 = thread.GetFrameAtIndex(1)
+            self.assertFalse(frame0 == frame1, "Different frames should not be 
equal")
+            self.assertTrue(frame0 != frame1, "Different frames should be 
not-equal")
+
+    def test_pc_property_settable(self):
+        """Test that pc property is settable"""
+        self.build()
+        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")
+
+        original_pc = frame.GetPC()
+        # Test that we can set pc (though this might not work on all platforms)
+        # We'll just verify the property exists and can be read
+        pc = frame.pc
+        self.assertIsInstance(pc, int, "pc should be readable")
+        # Note: Setting pc might not be supported on all platforms, so we just 
test reading
+
diff --git a/lldb/test/API/python_api/sbframe_extensions/main.c 
b/lldb/test/API/python_api/sbframe_extensions/main.c
new file mode 100644
index 0000000000000..657a6524da8dc
--- /dev/null
+++ b/lldb/test/API/python_api/sbframe_extensions/main.c
@@ -0,0 +1,36 @@
+#include <stdio.h>
+
+// Global and static variables for testing
+int g_global_var = 42;
+static int g_static_var = 100;
+
+// Function declarations
+int func1(int arg1, char arg2);
+int func2(int arg1, int arg2);
+
+int func1(int arg1, char arg2)
+{
+    static int static_var = 200;
+    int local1 = arg1 * 2;
+    char local2 = arg2;
+    // Set breakpoint here
+    return local1 + local2 + static_var;
+}
+
+int func2(int arg1, int arg2)
+{
+    int local1 = arg1 + arg2;
+    int local2 = arg1 * arg2;
+    // Set breakpoint here
+    return func1(local1, 'X');
+}
+
+int main(int argc, char const *argv[])
+{
+    int main_local = 10;
+    static int main_static = 50;
+    // Set breakpoint here
+    int result = func2(5, 7);
+    printf("Result: %d\n", result);
+    return 0;
+}

>From cc87db663e7fbadf2a84d7cbcf3cf3009f4b5b04 Mon Sep 17 00:00:00 2001
From: ahmed <[email protected]>
Date: Sun, 23 Nov 2025 22:53:05 +0200
Subject: [PATCH 2/7] chore: apply formatting

---
 .../TestSBFrameExtensions.py                  | 77 ++++++++++++++-----
 1 file changed, 57 insertions(+), 20 deletions(-)

diff --git 
a/lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py 
b/lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py
index 9823f8fdd6bb8..0533caeecec33 100644
--- a/lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py
+++ b/lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py
@@ -67,13 +67,17 @@ def 
test_properties_module_compile_unit_function_symbol_block(self):
         compile_unit = frame.compile_unit
         self.assertTrue(compile_unit.IsValid(), "compile_unit should be valid")
         self.assertEqual(
-            compile_unit, frame.GetCompileUnit(), "compile_unit should match 
GetCompileUnit()"
+            compile_unit,
+            frame.GetCompileUnit(),
+            "compile_unit should match GetCompileUnit()",
         )
 
         # Test function property
         function = frame.function
         self.assertTrue(function.IsValid(), "function should be valid")
-        self.assertEqual(function, frame.GetFunction(), "function should match 
GetFunction()")
+        self.assertEqual(
+            function, frame.GetFunction(), "function should match 
GetFunction()"
+        )
 
         # Test symbol property
         symbol = frame.symbol
@@ -107,9 +111,13 @@ def 
test_properties_is_inlined_name_line_entry_thread(self):
         # Test name property
         name = frame.name
         self.assertIsInstance(name, str, "name should be a string")
-        self.assertEqual(name, frame.GetFunctionName(), "name should match 
GetFunctionName()")
+        self.assertEqual(
+            name, frame.GetFunctionName(), "name should match 
GetFunctionName()"
+        )
         # Should be one of our functions
-        self.assertIn(name, ["func1", "func2", "main"], "name should be a 
known function")
+        self.assertIn(
+            name, ["func1", "func2", "main"], "name should be a known function"
+        )
 
         # Test line_entry property
         line_entry = frame.line_entry
@@ -121,7 +129,9 @@ def test_properties_is_inlined_name_line_entry_thread(self):
         # Test thread property
         thread_prop = frame.thread
         self.assertTrue(thread_prop.IsValid(), "thread should be valid")
-        self.assertEqual(thread_prop, frame.GetThread(), "thread should match 
GetThread()")
+        self.assertEqual(
+            thread_prop, frame.GetThread(), "thread should match GetThread()"
+        )
         self.assertEqual(
             thread_prop.GetThreadID(),
             thread.GetThreadID(),
@@ -168,7 +178,9 @@ def 
test_properties_variables_vars_locals_args_arguments_statics(self):
 
         # Test variables property (alias for get_all_variables)
         variables = frame.variables
-        self.assertIsInstance(variables, lldb.SBValueList, "variables should 
be SBValueList")
+        self.assertIsInstance(
+            variables, lldb.SBValueList, "variables should be SBValueList"
+        )
         all_vars = frame.GetVariables(True, True, True, True)
         self.assertEqual(
             variables.GetSize(),
@@ -187,7 +199,9 @@ def 
test_properties_variables_vars_locals_args_arguments_statics(self):
 
         # Test locals property
         locals_prop = frame.locals
-        self.assertIsInstance(locals_prop, lldb.SBValueList, "locals should be 
SBValueList")
+        self.assertIsInstance(
+            locals_prop, lldb.SBValueList, "locals should be SBValueList"
+        )
         locals_direct = frame.GetVariables(False, True, False, False)
         self.assertEqual(
             locals_prop.GetSize(),
@@ -218,7 +232,9 @@ def 
test_properties_variables_vars_locals_args_arguments_statics(self):
 
         # Test statics property
         statics_prop = frame.statics
-        self.assertIsInstance(statics_prop, lldb.SBValueList, "statics should 
be SBValueList")
+        self.assertIsInstance(
+            statics_prop, lldb.SBValueList, "statics should be SBValueList"
+        )
         statics_direct = frame.GetVariables(False, False, True, False)
         self.assertEqual(
             statics_prop.GetSize(),
@@ -243,7 +259,9 @@ def test_properties_registers_regs_register_reg(self):
         self.assertIsInstance(registers, list, "registers should be a list")
         registers_direct = frame.GetRegisters()
         self.assertEqual(
-            len(registers), len(registers_direct), "registers should match 
GetRegisters()"
+            len(registers),
+            len(registers_direct),
+            "registers should match GetRegisters()",
         )
 
         # Test regs property (alias for registers)
@@ -273,7 +291,9 @@ def test_properties_registers_regs_register_reg(self):
             first_reg_name = list(reg_names)[0]
             reg_by_name = register[first_reg_name]
             self.assertTrue(reg_by_name.IsValid(), "Register by name should be 
valid")
-            self.assertEqual(reg_by_name.name, first_reg_name, "Register name 
should match")
+            self.assertEqual(
+                reg_by_name.name, first_reg_name, "Register name should match"
+            )
 
     def test_properties_parent_child(self):
         """Test SBFrame extension properties: parent, child"""
@@ -298,7 +318,9 @@ def test_properties_parent_child(self):
                 frame1.GetFrameID(),
                 "parent should be the next frame",
             )
-            self.assertEqual(parent.pc, frame1.GetPC(), "parent PC should 
match frame 1")
+            self.assertEqual(
+                parent.pc, frame1.GetPC(), "parent PC should match frame 1"
+            )
 
         # Test child property (should be frame -1, which doesn't exist, so 
should return invalid)
         child = frame0.child
@@ -321,7 +343,9 @@ def 
test_methods_get_all_variables_get_arguments_get_locals_get_statics(self):
 
         # Test get_all_variables method
         all_vars = frame.get_all_variables()
-        self.assertIsInstance(all_vars, lldb.SBValueList, "get_all_variables 
should return SBValueList")
+        self.assertIsInstance(
+            all_vars, lldb.SBValueList, "get_all_variables should return 
SBValueList"
+        )
         all_vars_direct = frame.GetVariables(True, True, True, True)
         self.assertEqual(
             all_vars.GetSize(),
@@ -331,7 +355,9 @@ def 
test_methods_get_all_variables_get_arguments_get_locals_get_statics(self):
 
         # Test get_arguments method
         args = frame.get_arguments()
-        self.assertIsInstance(args, lldb.SBValueList, "get_arguments should 
return SBValueList")
+        self.assertIsInstance(
+            args, lldb.SBValueList, "get_arguments should return SBValueList"
+        )
         args_direct = frame.GetVariables(True, False, False, False)
         self.assertEqual(
             args.GetSize(),
@@ -341,7 +367,9 @@ def 
test_methods_get_all_variables_get_arguments_get_locals_get_statics(self):
 
         # Test get_locals method
         locals = frame.get_locals()
-        self.assertIsInstance(locals, lldb.SBValueList, "get_locals should 
return SBValueList")
+        self.assertIsInstance(
+            locals, lldb.SBValueList, "get_locals should return SBValueList"
+        )
         locals_direct = frame.GetVariables(False, True, False, False)
         self.assertEqual(
             locals.GetSize(),
@@ -351,7 +379,9 @@ def 
test_methods_get_all_variables_get_arguments_get_locals_get_statics(self):
 
         # Test get_statics method
         statics = frame.get_statics()
-        self.assertIsInstance(statics, lldb.SBValueList, "get_statics should 
return SBValueList")
+        self.assertIsInstance(
+            statics, lldb.SBValueList, "get_statics should return SBValueList"
+        )
         statics_direct = frame.GetVariables(False, False, True, False)
         self.assertEqual(
             statics.GetSize(),
@@ -393,7 +423,9 @@ def test_method_var(self):
 
         # Test var() with non-existent variable
         invalid_var = frame.var("NonExistentVariable12345")
-        self.assertFalse(invalid_var.IsValid(), "var() with non-existent 
variable should be invalid")
+        self.assertFalse(
+            invalid_var.IsValid(), "var() with non-existent variable should be 
invalid"
+        )
 
     def test_method_get_parent_frame_get_child_frame(self):
         """Test SBFrame extension methods: get_parent_frame, get_child_frame"""
@@ -410,7 +442,9 @@ def test_method_get_parent_frame_get_child_frame(self):
         # Test get_parent_frame
         if thread.GetNumFrames() > 1:
             parent = frame0.get_parent_frame()
-            self.assertTrue(parent.IsValid(), "get_parent_frame should return 
valid frame")
+            self.assertTrue(
+                parent.IsValid(), "get_parent_frame should return valid frame"
+            )
             frame1 = thread.GetFrameAtIndex(1)
             self.assertEqual(
                 parent.GetFrameID(),
@@ -425,7 +459,9 @@ def test_method_get_parent_frame_get_child_frame(self):
         # Test get_child_frame (frame -1 doesn't exist, so should be invalid)
         child = frame0.get_child_frame()
         if thread.GetNumFrames() == 1:
-            self.assertFalse(child.IsValid(), "get_child_frame of only frame 
should be invalid")
+            self.assertFalse(
+                child.IsValid(), "get_child_frame of only frame should be 
invalid"
+            )
 
     def test_special_methods_eq_int_hex(self):
         """Test SBFrame extension special methods: __eq__, __int__, __hex__"""
@@ -442,7 +478,9 @@ def test_special_methods_eq_int_hex(self):
         # Test __int__ (converts frame to its frame ID)
         frame_id = int(frame0)
         self.assertIsInstance(frame_id, int, "__int__ should return an 
integer")
-        self.assertEqual(frame_id, frame0.GetFrameID(), "__int__ should return 
frame ID")
+        self.assertEqual(
+            frame_id, frame0.GetFrameID(), "__int__ should return frame ID"
+        )
 
         # Test __hex__ (converts frame to its PC)
         # Note: __hex__ returns the PC as an integer, not a hex string
@@ -480,4 +518,3 @@ def test_pc_property_settable(self):
         pc = frame.pc
         self.assertIsInstance(pc, int, "pc should be readable")
         # Note: Setting pc might not be supported on all platforms, so we just 
test reading
-

>From e188e0a66f9d680cbe299d4c331155f89ff509be Mon Sep 17 00:00:00 2001
From: ahmed <[email protected]>
Date: Sun, 23 Nov 2025 22:53:38 +0200
Subject: [PATCH 3/7] chore: apply clang formatter

---
 .../API/python_api/sbframe_extensions/main.c  | 39 +++++++++----------
 1 file changed, 18 insertions(+), 21 deletions(-)

diff --git a/lldb/test/API/python_api/sbframe_extensions/main.c 
b/lldb/test/API/python_api/sbframe_extensions/main.c
index 657a6524da8dc..8e2d3ed8e5a5f 100644
--- a/lldb/test/API/python_api/sbframe_extensions/main.c
+++ b/lldb/test/API/python_api/sbframe_extensions/main.c
@@ -8,29 +8,26 @@ static int g_static_var = 100;
 int func1(int arg1, char arg2);
 int func2(int arg1, int arg2);
 
-int func1(int arg1, char arg2)
-{
-    static int static_var = 200;
-    int local1 = arg1 * 2;
-    char local2 = arg2;
-    // Set breakpoint here
-    return local1 + local2 + static_var;
+int func1(int arg1, char arg2) {
+  static int static_var = 200;
+  int local1 = arg1 * 2;
+  char local2 = arg2;
+  // Set breakpoint here
+  return local1 + local2 + static_var;
 }
 
-int func2(int arg1, int arg2)
-{
-    int local1 = arg1 + arg2;
-    int local2 = arg1 * arg2;
-    // Set breakpoint here
-    return func1(local1, 'X');
+int func2(int arg1, int arg2) {
+  int local1 = arg1 + arg2;
+  int local2 = arg1 * arg2;
+  // Set breakpoint here
+  return func1(local1, 'X');
 }
 
-int main(int argc, char const *argv[])
-{
-    int main_local = 10;
-    static int main_static = 50;
-    // Set breakpoint here
-    int result = func2(5, 7);
-    printf("Result: %d\n", result);
-    return 0;
+int main(int argc, char const *argv[]) {
+  int main_local = 10;
+  static int main_static = 50;
+  // Set breakpoint here
+  int result = func2(5, 7);
+  printf("Result: %d\n", result);
+  return 0;
 }

>From 3c7fa369bd6eaa4407554d92ab924d28853add38 Mon Sep 17 00:00:00 2001
From: ahmed <[email protected]>
Date: Sun, 23 Nov 2025 23:14:37 +0200
Subject: [PATCH 4/7] fix:Update tests

---
 .../TestSBFrameExtensions.py                  | 21 +++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git 
a/lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py 
b/lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py
index 0533caeecec33..b47e8370d6af6 100644
--- a/lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py
+++ b/lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py
@@ -87,7 +87,11 @@ def 
test_properties_module_compile_unit_function_symbol_block(self):
         # Test block property
         block = frame.block
         self.assertTrue(block.IsValid(), "block should be valid")
-        self.assertEqual(block, frame.GetBlock(), "block should match 
GetBlock()")
+        block_direct = frame.GetBlock()
+        self.assertTrue(
+            block.IsEqual(block_direct),
+            "block should match GetBlock()",
+        )
 
     def test_properties_is_inlined_name_line_entry_thread(self):
         """Test SBFrame extension properties: is_inlined, name, line_entry, 
thread"""
@@ -256,18 +260,23 @@ def test_properties_registers_regs_register_reg(self):
 
         # Test registers property
         registers = frame.registers
-        self.assertIsInstance(registers, list, "registers should be a list")
+        # registers returns an SBValueList that can be iterated
+        self.assertTrue(hasattr(registers, "__iter__"), "registers should be 
iterable")
         registers_direct = frame.GetRegisters()
+        # Compare by iterating and counting
+        registers_count = sum(1 for _ in registers)
+        registers_direct_count = sum(1 for _ in registers_direct)
         self.assertEqual(
-            len(registers),
-            len(registers_direct),
+            registers_count,
+            registers_direct_count,
             "registers should match GetRegisters()",
         )
 
         # Test regs property (alias for registers)
         regs = frame.regs
-        self.assertIsInstance(regs, list, "regs should be a list")
-        self.assertEqual(len(regs), len(registers), "regs should match 
registers")
+        self.assertTrue(hasattr(regs, "__iter__"), "regs should be iterable")
+        regs_count = sum(1 for _ in regs)
+        self.assertEqual(regs_count, registers_count, "regs should match 
registers")
 
         # Test register property (flattened view)
         register = frame.register

>From f91a4d508d47080ec80de379b7be59146d289c70 Mon Sep 17 00:00:00 2001
From: ahmed <[email protected]>
Date: Sun, 23 Nov 2025 23:24:58 +0200
Subject: [PATCH 5/7] fix: use GetRangeStartAddress

---
 .../sbframe_extensions/TestSBFrameExtensions.py        | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git 
a/lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py 
b/lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py
index b47e8370d6af6..ddbf272cb04d8 100644
--- a/lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py
+++ b/lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py
@@ -88,9 +88,13 @@ def 
test_properties_module_compile_unit_function_symbol_block(self):
         block = frame.block
         self.assertTrue(block.IsValid(), "block should be valid")
         block_direct = frame.GetBlock()
-        self.assertTrue(
-            block.IsEqual(block_direct),
-            "block should match GetBlock()",
+        self.assertTrue(block_direct.IsValid(), "GetBlock() should return 
valid block")
+        # Verify both blocks are valid and the property returns the same object
+        # by comparing their address ranges
+        self.assertEqual(
+            block.GetRangeStartAddress(),
+            block_direct.GetRangeStartAddress(),
+            "block should match GetBlock() start address",
         )
 
     def test_properties_is_inlined_name_line_entry_thread(self):

>From f83018821b346d7f3047bd251f169426f397894f Mon Sep 17 00:00:00 2001
From: ahmed <[email protected]>
Date: Mon, 24 Nov 2025 10:05:51 +0200
Subject: [PATCH 6/7] fix: update tests to have correct range index

---
 .../TestSBFrameExtensions.py                  | 29 ++++++++++++++-----
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git 
a/lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py 
b/lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py
index ddbf272cb04d8..ce6c6de81199d 100644
--- a/lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py
+++ b/lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py
@@ -16,6 +16,7 @@ def setUp(self):
     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(
@@ -49,6 +50,7 @@ def test_properties_pc_addr_fp_sp(self):
     def test_properties_module_compile_unit_function_symbol_block(self):
         """Test SBFrame extension properties: module, compile_unit, function, 
symbol, block"""
         self.build()
+        self.setTearDownCleanup()
         exe = self.getBuildArtifact("a.out")
 
         target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
@@ -89,17 +91,21 @@ def 
test_properties_module_compile_unit_function_symbol_block(self):
         self.assertTrue(block.IsValid(), "block should be valid")
         block_direct = frame.GetBlock()
         self.assertTrue(block_direct.IsValid(), "GetBlock() should return 
valid block")
-        # Verify both blocks are valid and the property returns the same object
-        # by comparing their address ranges
-        self.assertEqual(
-            block.GetRangeStartAddress(),
-            block_direct.GetRangeStartAddress(),
-            "block should match GetBlock() start address",
-        )
+        # Verify both blocks are valid and have the same ranges
+        # by comparing their first range start address
+        block_ranges = block.GetRanges()
+        block_direct_ranges = block_direct.GetRanges()
+        if block_ranges.GetSize() > 0 and block_direct_ranges.GetSize() > 0:
+            self.assertEqual(
+                block.GetRangeStartAddress(0),
+                block_direct.GetRangeStartAddress(0),
+                "block should match GetBlock() start address",
+            )
 
     def test_properties_is_inlined_name_line_entry_thread(self):
         """Test SBFrame extension properties: is_inlined, name, line_entry, 
thread"""
         self.build()
+        self.setTearDownCleanup()
         exe = self.getBuildArtifact("a.out")
 
         target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
@@ -149,6 +155,7 @@ def test_properties_is_inlined_name_line_entry_thread(self):
     def test_properties_disassembly_idx(self):
         """Test SBFrame extension properties: disassembly, idx"""
         self.build()
+        self.setTearDownCleanup()
         exe = self.getBuildArtifact("a.out")
 
         target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
@@ -175,6 +182,7 @@ def test_properties_disassembly_idx(self):
     def test_properties_variables_vars_locals_args_arguments_statics(self):
         """Test SBFrame extension properties: variables, vars, locals, args, 
arguments, statics"""
         self.build()
+        self.setTearDownCleanup()
         exe = self.getBuildArtifact("a.out")
 
         target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
@@ -253,6 +261,7 @@ def 
test_properties_variables_vars_locals_args_arguments_statics(self):
     def test_properties_registers_regs_register_reg(self):
         """Test SBFrame extension properties: registers, regs, register, reg"""
         self.build()
+        self.setTearDownCleanup()
         exe = self.getBuildArtifact("a.out")
 
         target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
@@ -311,6 +320,7 @@ def test_properties_registers_regs_register_reg(self):
     def test_properties_parent_child(self):
         """Test SBFrame extension properties: parent, child"""
         self.build()
+        self.setTearDownCleanup()
         exe = self.getBuildArtifact("a.out")
 
         target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
@@ -345,6 +355,7 @@ def test_properties_parent_child(self):
     def 
test_methods_get_all_variables_get_arguments_get_locals_get_statics(self):
         """Test SBFrame extension methods: get_all_variables, get_arguments, 
get_locals, get_statics"""
         self.build()
+        self.setTearDownCleanup()
         exe = self.getBuildArtifact("a.out")
 
         target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
@@ -405,6 +416,7 @@ def 
test_methods_get_all_variables_get_arguments_get_locals_get_statics(self):
     def test_method_var(self):
         """Test SBFrame extension method: var()"""
         self.build()
+        self.setTearDownCleanup()
         exe = self.getBuildArtifact("a.out")
 
         target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
@@ -443,6 +455,7 @@ def test_method_var(self):
     def test_method_get_parent_frame_get_child_frame(self):
         """Test SBFrame extension methods: get_parent_frame, get_child_frame"""
         self.build()
+        self.setTearDownCleanup()
         exe = self.getBuildArtifact("a.out")
 
         target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
@@ -479,6 +492,7 @@ def test_method_get_parent_frame_get_child_frame(self):
     def test_special_methods_eq_int_hex(self):
         """Test SBFrame extension special methods: __eq__, __int__, __hex__"""
         self.build()
+        self.setTearDownCleanup()
         exe = self.getBuildArtifact("a.out")
 
         target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
@@ -516,6 +530,7 @@ def test_special_methods_eq_int_hex(self):
     def test_pc_property_settable(self):
         """Test that pc property is settable"""
         self.build()
+        self.setTearDownCleanup()
         exe = self.getBuildArtifact("a.out")
 
         target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(

>From 50251bbf4b34a8281058dbfcf630da0ca5b96b0d Mon Sep 17 00:00:00 2001
From: ahmed <[email protected]>
Date: Sun, 30 Nov 2025 21:30:29 +0200
Subject: [PATCH 7/7] refactor: seperate to individual test functions

---
 .../TestSBFrameExtensions.py                  | 321 +++++++++---------
 1 file changed, 153 insertions(+), 168 deletions(-)

diff --git 
a/lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py 
b/lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py
index ce6c6de81199d..8653e47159dcb 100644
--- a/lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py
+++ b/lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py
@@ -13,59 +13,62 @@ 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"""
+    def _get_frame(self):
+        """Helper method to get a valid frame for testing."""
         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")
+        return frame, thread
+
+    def test_property_pc(self):
+        """Test SBFrame extension property: pc"""
+        frame, _ = self._get_frame()
 
-        # 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
+    def test_property_addr(self):
+        """Test SBFrame extension property: addr"""
+        frame, _ = self._get_frame()
+
         addr = frame.addr
         self.assertTrue(addr.IsValid(), "addr should be valid")
         self.assertEqual(addr, frame.GetPCAddress(), "addr should match 
GetPCAddress()")
 
-        # Test fp property
+    def test_property_fp(self):
+        """Test SBFrame extension property: fp"""
+        frame, _ = self._get_frame()
+
         fp = frame.fp
         self.assertIsInstance(fp, int, "fp should be an integer")
         self.assertEqual(fp, frame.GetFP(), "fp property should match GetFP()")
 
-        # Test sp property
+    def test_property_sp(self):
+        """Test SBFrame extension property: sp"""
+        frame, _ = self._get_frame()
+
         sp = frame.sp
         self.assertIsInstance(sp, int, "sp should be an integer")
         self.assertEqual(sp, frame.GetSP(), "sp property should match GetSP()")
 
-    def test_properties_module_compile_unit_function_symbol_block(self):
-        """Test SBFrame extension properties: module, compile_unit, function, 
symbol, block"""
-        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)
-        )
+    def test_property_module(self):
+        """Test SBFrame extension property: module"""
+        frame, _ = self._get_frame()
 
-        frame = thread.GetFrameAtIndex(0)
-        self.assertTrue(frame.IsValid(), "Frame should be valid")
-
-        # Test module property
         module = frame.module
         self.assertTrue(module.IsValid(), "module should be valid")
         self.assertEqual(module, frame.GetModule(), "module should match 
GetModule()")
 
-        # Test compile_unit property
+    def test_property_compile_unit(self):
+        """Test SBFrame extension property: compile_unit"""
+        frame, _ = self._get_frame()
+
         compile_unit = frame.compile_unit
         self.assertTrue(compile_unit.IsValid(), "compile_unit should be valid")
         self.assertEqual(
@@ -74,19 +77,28 @@ def 
test_properties_module_compile_unit_function_symbol_block(self):
             "compile_unit should match GetCompileUnit()",
         )
 
-        # Test function property
+    def test_property_function(self):
+        """Test SBFrame extension property: function"""
+        frame, _ = self._get_frame()
+
         function = frame.function
         self.assertTrue(function.IsValid(), "function should be valid")
         self.assertEqual(
             function, frame.GetFunction(), "function should match 
GetFunction()"
         )
 
-        # Test symbol property
+    def test_property_symbol(self):
+        """Test SBFrame extension property: symbol"""
+        frame, _ = self._get_frame()
+
         symbol = frame.symbol
         self.assertTrue(symbol.IsValid(), "symbol should be valid")
         self.assertEqual(symbol, frame.GetSymbol(), "symbol should match 
GetSymbol()")
 
-        # Test block property
+    def test_property_block(self):
+        """Test SBFrame extension property: block"""
+        frame, _ = self._get_frame()
+
         block = frame.block
         self.assertTrue(block.IsValid(), "block should be valid")
         block_direct = frame.GetBlock()
@@ -102,27 +114,20 @@ def 
test_properties_module_compile_unit_function_symbol_block(self):
                 "block should match GetBlock() start address",
             )
 
-    def test_properties_is_inlined_name_line_entry_thread(self):
-        """Test SBFrame extension properties: is_inlined, name, line_entry, 
thread"""
-        self.build()
-        self.setTearDownCleanup()
-        exe = self.getBuildArtifact("a.out")
+    def test_property_is_inlined(self):
+        """Test SBFrame extension property: is_inlined"""
+        frame, _ = self._get_frame()
 
-        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 is_inlined property
         is_inlined = frame.is_inlined
         self.assertIsInstance(is_inlined, bool, "is_inlined should be a 
boolean")
         self.assertEqual(
             is_inlined, frame.IsInlined(), "is_inlined should match 
IsInlined()"
         )
 
-        # Test name property
+    def test_property_name(self):
+        """Test SBFrame extension property: name"""
+        frame, _ = self._get_frame()
+
         name = frame.name
         self.assertIsInstance(name, str, "name should be a string")
         self.assertEqual(
@@ -133,14 +138,20 @@ def 
test_properties_is_inlined_name_line_entry_thread(self):
             name, ["func1", "func2", "main"], "name should be a known function"
         )
 
-        # Test line_entry property
+    def test_property_line_entry(self):
+        """Test SBFrame extension property: line_entry"""
+        frame, _ = self._get_frame()
+
         line_entry = frame.line_entry
         self.assertTrue(line_entry.IsValid(), "line_entry should be valid")
         self.assertEqual(
             line_entry, frame.GetLineEntry(), "line_entry should match 
GetLineEntry()"
         )
 
-        # Test thread property
+    def test_property_thread(self):
+        """Test SBFrame extension property: thread"""
+        frame, thread = self._get_frame()
+
         thread_prop = frame.thread
         self.assertTrue(thread_prop.IsValid(), "thread should be valid")
         self.assertEqual(
@@ -152,20 +163,10 @@ def 
test_properties_is_inlined_name_line_entry_thread(self):
             "thread should be the same thread",
         )
 
-    def test_properties_disassembly_idx(self):
-        """Test SBFrame extension properties: disassembly, idx"""
-        self.build()
-        self.setTearDownCleanup()
-        exe = self.getBuildArtifact("a.out")
+    def test_property_disassembly(self):
+        """Test SBFrame extension property: disassembly"""
+        frame, _ = self._get_frame()
 
-        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 disassembly property
         disassembly = frame.disassembly
         self.assertIsInstance(disassembly, str, "disassembly should be a 
string")
         self.assertGreater(len(disassembly), 0, "disassembly should not be 
empty")
@@ -173,26 +174,19 @@ def test_properties_disassembly_idx(self):
             disassembly, frame.Disassemble(), "disassembly should match 
Disassemble()"
         )
 
-        # Test idx property
+    def test_property_idx(self):
+        """Test SBFrame extension property: idx"""
+        frame, _ = self._get_frame()
+
         idx = frame.idx
         self.assertIsInstance(idx, int, "idx should be an integer")
         self.assertEqual(idx, frame.GetFrameID(), "idx should match 
GetFrameID()")
         self.assertEqual(idx, 0, "First frame should have idx 0")
 
-    def test_properties_variables_vars_locals_args_arguments_statics(self):
-        """Test SBFrame extension properties: variables, vars, locals, args, 
arguments, statics"""
-        self.build()
-        self.setTearDownCleanup()
-        exe = self.getBuildArtifact("a.out")
+    def test_property_variables(self):
+        """Test SBFrame extension property: variables"""
+        frame, _ = self._get_frame()
 
-        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 variables property (alias for get_all_variables)
         variables = frame.variables
         self.assertIsInstance(
             variables, lldb.SBValueList, "variables should be SBValueList"
@@ -204,16 +198,23 @@ def 
test_properties_variables_vars_locals_args_arguments_statics(self):
             "variables should match GetVariables(True, True, True, True)",
         )
 
-        # Test vars property (alias for variables)
+    def test_property_vars(self):
+        """Test SBFrame extension property: vars (alias for variables)"""
+        frame, _ = self._get_frame()
+
         vars_prop = frame.vars
         self.assertIsInstance(vars_prop, lldb.SBValueList, "vars should be 
SBValueList")
+        variables = frame.variables
         self.assertEqual(
             vars_prop.GetSize(),
             variables.GetSize(),
             "vars should match variables",
         )
 
-        # Test locals property
+    def test_property_locals(self):
+        """Test SBFrame extension property: locals"""
+        frame, _ = self._get_frame()
+
         locals_prop = frame.locals
         self.assertIsInstance(
             locals_prop, lldb.SBValueList, "locals should be SBValueList"
@@ -225,7 +226,10 @@ def 
test_properties_variables_vars_locals_args_arguments_statics(self):
             "locals should match GetVariables(False, True, False, False)",
         )
 
-        # Test args property
+    def test_property_args(self):
+        """Test SBFrame extension property: args"""
+        frame, _ = self._get_frame()
+
         args_prop = frame.args
         self.assertIsInstance(args_prop, lldb.SBValueList, "args should be 
SBValueList")
         args_direct = frame.GetVariables(True, False, False, False)
@@ -235,18 +239,25 @@ def 
test_properties_variables_vars_locals_args_arguments_statics(self):
             "args should match GetVariables(True, False, False, False)",
         )
 
-        # Test arguments property (alias for args)
+    def test_property_arguments(self):
+        """Test SBFrame extension property: arguments (alias for args)"""
+        frame, _ = self._get_frame()
+
         arguments_prop = frame.arguments
         self.assertIsInstance(
             arguments_prop, lldb.SBValueList, "arguments should be SBValueList"
         )
+        args_prop = frame.args
         self.assertEqual(
             arguments_prop.GetSize(),
             args_prop.GetSize(),
             "arguments should match args",
         )
 
-        # Test statics property
+    def test_property_statics(self):
+        """Test SBFrame extension property: statics"""
+        frame, _ = self._get_frame()
+
         statics_prop = frame.statics
         self.assertIsInstance(
             statics_prop, lldb.SBValueList, "statics should be SBValueList"
@@ -258,20 +269,10 @@ def 
test_properties_variables_vars_locals_args_arguments_statics(self):
             "statics should match GetVariables(False, False, True, False)",
         )
 
-    def test_properties_registers_regs_register_reg(self):
-        """Test SBFrame extension properties: registers, regs, register, reg"""
-        self.build()
-        self.setTearDownCleanup()
-        exe = self.getBuildArtifact("a.out")
+    def test_property_registers(self):
+        """Test SBFrame extension property: registers"""
+        frame, _ = self._get_frame()
 
-        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 registers property
         registers = frame.registers
         # registers returns an SBValueList that can be iterated
         self.assertTrue(hasattr(registers, "__iter__"), "registers should be 
iterable")
@@ -285,13 +286,21 @@ def test_properties_registers_regs_register_reg(self):
             "registers should match GetRegisters()",
         )
 
-        # Test regs property (alias for registers)
+    def test_property_regs(self):
+        """Test SBFrame extension property: regs (alias for registers)"""
+        frame, _ = self._get_frame()
+
         regs = frame.regs
         self.assertTrue(hasattr(regs, "__iter__"), "regs should be iterable")
+        registers = frame.registers
         regs_count = sum(1 for _ in regs)
+        registers_count = sum(1 for _ in registers)
         self.assertEqual(regs_count, registers_count, "regs should match 
registers")
 
-        # Test register property (flattened view)
+    def test_property_register(self):
+        """Test SBFrame extension property: register (flattened view)"""
+        frame, _ = self._get_frame()
+
         register = frame.register
         self.assertIsNotNone(register, "register should not be None")
         # register is a helper object with __iter__ and __getitem__
@@ -300,14 +309,6 @@ def test_properties_registers_regs_register_reg(self):
             self.assertTrue(reg.IsValid(), "Register should be valid")
             reg_names.add(reg.name)
 
-        # Test reg property (alias for register)
-        reg = frame.reg
-        self.assertIsNotNone(reg, "reg should not be None")
-        reg_names2 = set()
-        for r in reg:
-            reg_names2.add(r.name)
-        self.assertEqual(reg_names, reg_names2, "reg should match register")
-
         # Test register indexing by name
         if len(reg_names) > 0:
             first_reg_name = list(reg_names)[0]
@@ -317,19 +318,24 @@ def test_properties_registers_regs_register_reg(self):
                 reg_by_name.name, first_reg_name, "Register name should match"
             )
 
-    def test_properties_parent_child(self):
-        """Test SBFrame extension properties: parent, child"""
-        self.build()
-        self.setTearDownCleanup()
-        exe = self.getBuildArtifact("a.out")
+    def test_property_reg(self):
+        """Test SBFrame extension property: reg (alias for register)"""
+        frame, _ = self._get_frame()
 
-        target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
-            self, "Set breakpoint here", lldb.SBFileSpec(self.source)
-        )
+        reg = frame.reg
+        self.assertIsNotNone(reg, "reg should not be None")
+        register = frame.register
+        reg_names = set()
+        for r in reg:
+            reg_names.add(r.name)
+        reg_names2 = set()
+        for r in register:
+            reg_names2.add(r.name)
+        self.assertEqual(reg_names, reg_names2, "reg should match register")
 
-        # Get frame at func1 (should be frame 0)
-        frame0 = thread.GetFrameAtIndex(0)
-        self.assertTrue(frame0.IsValid(), "Frame 0 should be valid")
+    def test_property_parent(self):
+        """Test SBFrame extension property: parent"""
+        frame0, thread = self._get_frame()
 
         # If there's a parent frame (frame 1), test parent property
         if thread.GetNumFrames() > 1:
@@ -345,6 +351,10 @@ def test_properties_parent_child(self):
                 parent.pc, frame1.GetPC(), "parent PC should match frame 1"
             )
 
+    def test_property_child(self):
+        """Test SBFrame extension property: child"""
+        frame0, thread = self._get_frame()
+
         # Test child property (should be frame -1, which doesn't exist, so 
should return invalid)
         child = frame0.child
         # Child of frame 0 would be frame -1, which doesn't exist
@@ -352,20 +362,10 @@ def test_properties_parent_child(self):
         if thread.GetNumFrames() == 1:
             self.assertFalse(child.IsValid(), "child of only frame should be 
invalid")
 
-    def 
test_methods_get_all_variables_get_arguments_get_locals_get_statics(self):
-        """Test SBFrame extension methods: get_all_variables, get_arguments, 
get_locals, get_statics"""
-        self.build()
-        self.setTearDownCleanup()
-        exe = self.getBuildArtifact("a.out")
+    def test_method_get_all_variables(self):
+        """Test SBFrame extension method: get_all_variables()"""
+        frame, _ = self._get_frame()
 
-        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 get_all_variables method
         all_vars = frame.get_all_variables()
         self.assertIsInstance(
             all_vars, lldb.SBValueList, "get_all_variables should return 
SBValueList"
@@ -377,7 +377,10 @@ def 
test_methods_get_all_variables_get_arguments_get_locals_get_statics(self):
             "get_all_variables should match GetVariables(True, True, True, 
True)",
         )
 
-        # Test get_arguments method
+    def test_method_get_arguments(self):
+        """Test SBFrame extension method: get_arguments()"""
+        frame, _ = self._get_frame()
+
         args = frame.get_arguments()
         self.assertIsInstance(
             args, lldb.SBValueList, "get_arguments should return SBValueList"
@@ -389,7 +392,10 @@ def 
test_methods_get_all_variables_get_arguments_get_locals_get_statics(self):
             "get_arguments should match GetVariables(True, False, False, 
False)",
         )
 
-        # Test get_locals method
+    def test_method_get_locals(self):
+        """Test SBFrame extension method: get_locals()"""
+        frame, _ = self._get_frame()
+
         locals = frame.get_locals()
         self.assertIsInstance(
             locals, lldb.SBValueList, "get_locals should return SBValueList"
@@ -401,7 +407,10 @@ def 
test_methods_get_all_variables_get_arguments_get_locals_get_statics(self):
             "get_locals should match GetVariables(False, True, False, False)",
         )
 
-        # Test get_statics method
+    def test_method_get_statics(self):
+        """Test SBFrame extension method: get_statics()"""
+        frame, _ = self._get_frame()
+
         statics = frame.get_statics()
         self.assertIsInstance(
             statics, lldb.SBValueList, "get_statics should return SBValueList"
@@ -415,16 +424,7 @@ def 
test_methods_get_all_variables_get_arguments_get_locals_get_statics(self):
 
     def test_method_var(self):
         """Test SBFrame extension method: var()"""
-        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")
+        frame, _ = self._get_frame()
 
         # Test var() method with a variable that should exist
         # First, let's see what variables are available
@@ -452,18 +452,9 @@ def test_method_var(self):
             invalid_var.IsValid(), "var() with non-existent variable should be 
invalid"
         )
 
-    def test_method_get_parent_frame_get_child_frame(self):
-        """Test SBFrame extension methods: get_parent_frame, get_child_frame"""
-        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)
-        )
-
-        frame0 = thread.GetFrameAtIndex(0)
-        self.assertTrue(frame0.IsValid(), "Frame 0 should be valid")
+    def test_method_get_parent_frame(self):
+        """Test SBFrame extension method: get_parent_frame()"""
+        frame0, thread = self._get_frame()
 
         # Test get_parent_frame
         if thread.GetNumFrames() > 1:
@@ -482,6 +473,10 @@ def test_method_get_parent_frame_get_child_frame(self):
             parent = frame0.get_parent_frame()
             # Note: get_parent_frame might return an invalid frame if idx+1 is 
out of bounds
 
+    def test_method_get_child_frame(self):
+        """Test SBFrame extension method: get_child_frame()"""
+        frame0, thread = self._get_frame()
+
         # Test get_child_frame (frame -1 doesn't exist, so should be invalid)
         child = frame0.get_child_frame()
         if thread.GetNumFrames() == 1:
@@ -489,18 +484,9 @@ def test_method_get_parent_frame_get_child_frame(self):
                 child.IsValid(), "get_child_frame of only frame should be 
invalid"
             )
 
-    def test_special_methods_eq_int_hex(self):
-        """Test SBFrame extension special methods: __eq__, __int__, __hex__"""
-        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)
-        )
-
-        frame0 = thread.GetFrameAtIndex(0)
-        self.assertTrue(frame0.IsValid(), "Frame 0 should be valid")
+    def test_special_method_int(self):
+        """Test SBFrame extension special method: __int__"""
+        frame0, _ = self._get_frame()
 
         # Test __int__ (converts frame to its frame ID)
         frame_id = int(frame0)
@@ -509,6 +495,10 @@ def test_special_methods_eq_int_hex(self):
             frame_id, frame0.GetFrameID(), "__int__ should return frame ID"
         )
 
+    def test_special_method_hex(self):
+        """Test SBFrame extension special method: __hex__"""
+        frame0, _ = self._get_frame()
+
         # Test __hex__ (converts frame to its PC)
         # Note: __hex__ returns the PC as an integer, not a hex string
         # In Python 3, hex() builtin calls __index__ if __hex__ doesn't exist,
@@ -517,6 +507,10 @@ def test_special_methods_eq_int_hex(self):
         self.assertIsInstance(pc_hex, int, "__hex__ should return an integer 
(PC)")
         self.assertEqual(pc_hex, frame0.GetPC(), "__hex__ should return PC")
 
+    def test_special_method_eq(self):
+        """Test SBFrame extension special method: __eq__ and __ne__"""
+        frame0, thread = self._get_frame()
+
         # Test __eq__ and __ne__
         frame0_copy = thread.GetFrameAtIndex(0)
         self.assertTrue(frame0 == frame0_copy, "Same frame should be equal")
@@ -529,16 +523,7 @@ def test_special_methods_eq_int_hex(self):
 
     def test_pc_property_settable(self):
         """Test that pc property is settable"""
-        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")
+        frame, _ = self._get_frame()
 
         original_pc = frame.GetPC()
         # Test that we can set pc (though this might not work on all platforms)

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

Reply via email to