[Lldb-commits] [lldb] 773d9c3 - [lldb] Add more asserts to TestExec
Dave Lee via lldb-commits
lldb-commits at lists.llvm.org
Mon Apr 17 18:43:47 PDT 2023
Author: Dave Lee
Date: 2023-04-17T18:43:42-07:00
New Revision: 773d9c36043204c284324bc37a1de769a7575034
URL: https://github.com/llvm/llvm-project/commit/773d9c36043204c284324bc37a1de769a7575034
DIFF: https://github.com/llvm/llvm-project/commit/773d9c36043204c284324bc37a1de769a7575034.diff
LOG: [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
Added:
Modified:
lldb/test/API/functionalities/exec/TestExec.py
Removed:
################################################################################
diff --git a/lldb/test/API/functionalities/exec/TestExec.py b/lldb/test/API/functionalities/exec/TestExec.py
index 864abb6533aef..ed7cc2f4f5b85 100644
--- a/lldb/test/API/functionalities/exec/TestExec.py
+++ b/lldb/test/API/functionalities/exec/TestExec.py
@@ -102,13 +102,18 @@ def cleanup():
# Run and we should stop at breakpoint in main after exec
process.Continue()
+ self.assertState(process.GetState(), lldb.eStateStopped)
+ for t in process.threads:
+ if t.stop_reason != lldb.eStopReasonNone:
+ self.assertStopReason(t.stop_reason, lldb.eStopReasonBreakpoint,
+ "Unexpected stop reason")
+ if self.TraceOn():
+ print(t)
+ if t.stop_reason != lldb.eStopReasonBreakpoint:
+ self.runCmd("bt")
+
threads = lldbutil.get_threads_stopped_at_breakpoint(
process, breakpoint2)
- if self.TraceOn():
- for t in process.threads:
- print(t)
- if t.GetStopReason() != lldb.eStopReasonBreakpoint:
- self.runCmd("bt")
self.assertEqual(len(threads), 1,
"Stopped at breakpoint in exec'ed process.")
More information about the lldb-commits
mailing list