Skip to content

Commit d07bd3c

Browse files
committed
[lldb] Add more asserts to TestExec
If this test fails, the error message isn't helpful: ``` self.assertEqual(len(threads), 1, AssertionError: 0 != 1 : Stopped at breakpoint in exec'ed process ``` This change adds asserts to verify that: 1. The process is stopped 2. For each thread, that the stop reason is None, or Breakpoint The latter will indicate if execution has stopped for some other reason, and if so what that reason is. Differential Revision: https://reviews.llvm.org/D148588
1 parent 944fc85 commit d07bd3c

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lldb/test/API/functionalities/exec/TestExec.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,18 @@ def cleanup():
102102
# Run and we should stop at breakpoint in main after exec
103103
process.Continue()
104104

105+
self.assertState(process.GetState(), lldb.eStateStopped)
106+
for t in process.threads:
107+
if t.stop_reason != lldb.eStopReasonNone:
108+
self.assertStopReason(t.stop_reason, lldb.eStopReasonBreakpoint,
109+
"Unexpected stop reason")
110+
if self.TraceOn():
111+
print(t)
112+
if t.stop_reason != lldb.eStopReasonBreakpoint:
113+
self.runCmd("bt")
114+
105115
threads = lldbutil.get_threads_stopped_at_breakpoint(
106116
process, breakpoint2)
107-
if self.TraceOn():
108-
for t in process.threads:
109-
print(t)
110-
if t.GetStopReason() != lldb.eStopReasonBreakpoint:
111-
self.runCmd("bt")
112117
self.assertEqual(len(threads), 1,
113118
"Stopped at breakpoint in exec'ed process.")
114119

0 commit comments

Comments
 (0)