1
0
Fork 0
qemu/tests/tcg/multiarch/gdbstub/late-attach.py
Daniel Baumann ea34ddeea6
Adding upstream version 1:10.0.2+ds.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-22 14:27:05 +02:00

28 lines
721 B
Python

"""Test attaching GDB to a running process.
SPDX-License-Identifier: GPL-2.0-or-later
"""
from test_gdbstub import main, report
def run_test():
"""Run through the tests one by one"""
try:
phase = gdb.parse_and_eval("phase").string()
except gdb.error:
# Assume the guest did not reach main().
phase = "start"
if phase == "start":
gdb.execute("break sigwait")
gdb.execute("continue")
phase = gdb.parse_and_eval("phase").string()
report(phase == "sigwait", "{} == \"sigwait\"".format(phase))
gdb.execute("signal SIGUSR1")
exitcode = int(gdb.parse_and_eval("$_exitcode"))
report(exitcode == 0, "{} == 0".format(exitcode))
main(run_test)