================
@@ -15,10 +15,23 @@ class FinishFromEmptyFunctionTestCase(TestBase):
def test_finish_from_empty_function(self):
"""Test that when stopped at a breakpoint in an empty function, finish
leaves it correctly."""
self.build()
- exe = self.getBuildArtifact("a.out")
- target, process, thread, _ = lldbutil.run_to_name_breakpoint(
- self, "done", exe_name=exe
+ target, _, thread, _ = lldbutil.run_to_source_breakpoint(
+ self, "// Set breakpoint here", lldb.SBFileSpec("main.c")
)
+ # Find the last instruction address of 'done()' and set a breakpoint
there.
+ error = lldb.SBError()
+ ret_bp_addr = lldb.SBAddress()
+ while True:
+ thread.StepInstruction(False, error)
+ self.assertTrue(error.Success())
+ frame = thread.GetSelectedFrame()
+ if "done" in frame.GetFunctionName():
+ ret_bp_addr = frame.GetPCAddress()
+ elif ret_bp_addr.IsValid():
+ break
+ ret_bp =
target.BreakpointCreateByAddress(ret_bp_addr.GetLoadAddress(target))
+ self.assertTrue(ret_bp.IsValid())
+ self.runCmd("cont")
----------------
DavidSpickett wrote:
Add a comment:
Run into the next "done()" call and hit the breakpoint.
https://github.com/llvm/llvm-project/pull/161788
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits