Skip to content

Commit 5ff7d66

Browse files
committed
fixup! Add comments to the test
1 parent def07ea commit 5ff7d66

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lldb/test/API/functionalities/thread/finish-from-empty-func/TestEmptyFuncThreadStepOut.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@ class FinishFromEmptyFunctionTestCase(TestBase):
1313

1414
@skipIf(compiler="clang", compiler_version=['<', '17.0'])
1515
def test_finish_from_empty_function(self):
16-
"""Test that when stopped at a breakpoint in an empty function, finish leaves it correctly."""
16+
"""Test that when stopped at a breakpoint located at the last instruction
17+
of a function, finish leaves it correctly."""
1718
self.build()
1819
target, _, thread, _ = lldbutil.run_to_source_breakpoint(
1920
self, "// Set breakpoint here", lldb.SBFileSpec("main.c")
2021
)
21-
# Find the last instruction address of 'done()' and set a breakpoint there.
22+
# Find the address of the last instruction of 'done()' and set a breakpoint there.
23+
# Even though 'done()' is empty, it may contain prologue and epilogue code, so
24+
# simply setting a breakpoint at the function can place it before 'ret'.
2225
error = lldb.SBError()
2326
ret_bp_addr = lldb.SBAddress()
2427
while True:
@@ -28,9 +31,12 @@ def test_finish_from_empty_function(self):
2831
if "done" in frame.GetFunctionName():
2932
ret_bp_addr = frame.GetPCAddress()
3033
elif ret_bp_addr.IsValid():
34+
# The entire function 'done()' has been stepped through, so 'ret_bp_addr'
35+
# now contains the address of its last instruction, i.e. 'ret'.
3136
break
3237
ret_bp = target.BreakpointCreateByAddress(ret_bp_addr.GetLoadAddress(target))
3338
self.assertTrue(ret_bp.IsValid())
39+
# Resume the execution and hit the new breakpoint.
3440
self.runCmd("cont")
3541
if self.TraceOn():
3642
self.runCmd("bt")

0 commit comments

Comments
 (0)