Skip to content

Commit 5d72757

Browse files
committed
Get more info if lldbutil.run_to_XXX_breakpoint doesn't hit the breakpoint.
We interrupt the process. If that fails, we report the error. If it stops the process successfully, we print the stacktraces for all the threads in the inferior so we can see whether it overshot the breakpoint, or stalled before getting to it, etc...
1 parent d946ed9 commit 5d72757

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lldb/packages/Python/lldbsuite/test/lldbutil.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,19 @@ def run_to_breakpoint_do_run(test, target, bkpt, launch_info = None,
878878
test.assertFalse(error.Fail(),
879879
"Process launch failed: %s" % (error.GetCString()))
880880

881-
test.assertEqual(process.GetState(), lldb.eStateStopped)
881+
if process.GetState() == lldb.eStateRunning:
882+
# If we get here with eStateRunning, it means we missed the
883+
# initial breakpoint. Figure out where the process is
884+
# so we can report that:
885+
error = lldb.SBError()
886+
error = process.Stop()
887+
if not error.Success():
888+
test.fail("Failed to stop: %s"%(error.GetCString()))
889+
890+
error_string = "Failed to hit initial breakpoint:\n%s\n"%(print_stacktraces(process, True))
891+
test.fail(error_string)
892+
893+
test.assertEqual(process.GetState(), lldb.eStateStopped, error_string)
882894

883895
# Frame #0 should be at our breakpoint.
884896
threads = get_threads_stopped_at_breakpoint(

0 commit comments

Comments
 (0)