aboutsummaryrefslogtreecommitdiff
path: root/lldb/packages/Python/lldbsuite/test
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2022-07-07 09:53:05 -0700
committerJonas Devlieghere <jonas@devlieghere.com>2022-07-07 10:22:45 -0700
commitec48a0df9151a5192381e44bee6a48a08ed8932b (patch)
treee5bd46b07f5a98f70da3d37b185ca7ccf03f3bfe /lldb/packages/Python/lldbsuite/test
parent75e551e5d830754104f5cce8c7a97b69e56aac7d (diff)
downloadllvm-ec48a0df9151a5192381e44bee6a48a08ed8932b.zip
llvm-ec48a0df9151a5192381e44bee6a48a08ed8932b.tar.gz
llvm-ec48a0df9151a5192381e44bee6a48a08ed8932b.tar.bz2
[lldb] Improve the error message in run_to_breakpoint_do_run
Improve the error message when we fail to hit the initial breakpoint in run_to_breakpoint_do_run. In addition to the process state, we now also report the exit code and reason (if the process exited) as well as the inferior's output. Differential revision: https://reviews.llvm.org/D111978
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r--lldb/packages/Python/lldbsuite/test/lldbutil.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py
index 74ca7dd0..7863e64 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -235,7 +235,7 @@ def state_type_to_str(enum):
elif enum == lldb.eStateSuspended:
return "suspended"
else:
- raise Exception("Unknown StateType enum")
+ raise Exception("Unknown StateType enum: " + str(enum))
def stop_reason_to_str(enum):
@@ -945,7 +945,22 @@ def run_to_breakpoint_do_run(test, target, bkpt, launch_info = None,
test.assertFalse(error.Fail(),
"Process launch failed: %s" % (error.GetCString()))
- test.assertState(process.GetState(), lldb.eStateStopped)
+ def processStateInfo(process):
+ info = "state: {}".format(state_type_to_str(process.state))
+ if process.state == lldb.eStateExited:
+ info += ", exit code: {}".format(process.GetExitStatus())
+ if process.exit_description:
+ info += ", exit description: '{}'".format(process.exit_description)
+ stdout = process.GetSTDOUT(999)
+ if stdout:
+ info += ", stdout: '{}'".format(stdout)
+ stderr = process.GetSTDERR(999)
+ if stderr:
+ info += ", stderr: '{}'".format(stderr)
+ return info
+
+ if process.state != lldb.eStateStopped:
+ test.fail("Test process is not stopped at breakpoint: {}".format(processStateInfo(process)))
# Frame #0 should be at our breakpoint.
threads = get_threads_stopped_at_breakpoint(