github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r origin/main...HEAD
lldb/test/API/python_api/sbframe_extensions/TestSBFrameExtensions.py
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- TestSBFrameExtensions.py 2025-11-23 20:46:25.000000 +0000
+++ TestSBFrameExtensions.py 2025-11-23 20:48:19.948424 +0000
@@ -65,17 +65,21 @@
# 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()"
+ 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
self.assertTrue(symbol.IsValid(), "symbol should be valid")
self.assertEqual(symbol, frame.GetSymbol(), "symbol should match
GetSymbol()")
@@ -105,13 +109,17 @@
)
# 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
self.assertTrue(line_entry.IsValid(), "line_entry should be valid")
self.assertEqual(
@@ -119,11 +127,13 @@
)
# 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(),
"thread should be the same thread",
)
@@ -166,11 +176,13 @@
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")
+ 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)",
@@ -185,11 +197,13 @@
"vars should match variables",
)
# 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(),
locals_direct.GetSize(),
"locals should match GetVariables(False, True, False, False)",
@@ -216,11 +230,13 @@
"arguments should match args",
)
# 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(),
statics_direct.GetSize(),
"statics should match GetVariables(False, False, True, False)",
@@ -241,11 +257,13 @@
# 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()"
+ 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")
@@ -271,11 +289,13 @@
# 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")
+ 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")
@@ -296,11 +316,13 @@
self.assertEqual(
parent.GetFrameID(),
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
# Child of frame 0 would be frame -1, which doesn't exist
# So it should return an invalid frame
@@ -319,41 +341,49 @@
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")
+ 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")
+ 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")
+ 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")
+ 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)",
@@ -391,11 +421,13 @@
"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")
+ 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")
@@ -408,11 +440,13 @@
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")
+ 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",
@@ -423,11 +457,13 @@
# 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")
+ 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")
@@ -440,11 +476,13 @@
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")
+ 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
@@ -478,6 +516,5 @@
# 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
-
``````````
</details>
https://github.com/llvm/llvm-project/pull/169236
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits