aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/multiarch/gdbstub/late-attach.py
diff options
context:
space:
mode:
authorIlya Leoshkevich <iii@linux.ibm.com>2025-02-07 15:31:12 +0000
committerAlex Bennée <alex.bennee@linaro.org>2025-02-10 13:47:59 +0000
commit24c61663dcec0e87bb4206a7623f0e222e188b47 (patch)
treeae327e96dda16dc89ee383199b343523f496c365 /tests/tcg/multiarch/gdbstub/late-attach.py
parent628d64222e6bef249d23ce3147cbfb47259f2ede (diff)
downloadqemu-24c61663dcec0e87bb4206a7623f0e222e188b47.zip
qemu-24c61663dcec0e87bb4206a7623f0e222e188b47.tar.gz
qemu-24c61663dcec0e87bb4206a7623f0e222e188b47.tar.bz2
tests/tcg: Add late gdbstub attach test
Add a small test to prevent regressions. Make sure that host_interrupt_signal is not visible to the guest. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Message-Id: <20250117001542.8290-9-iii@linux.ibm.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20250207153112.3939799-18-alex.bennee@linaro.org>
Diffstat (limited to 'tests/tcg/multiarch/gdbstub/late-attach.py')
-rw-r--r--tests/tcg/multiarch/gdbstub/late-attach.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/tcg/multiarch/gdbstub/late-attach.py b/tests/tcg/multiarch/gdbstub/late-attach.py
new file mode 100644
index 0000000..1d40efb
--- /dev/null
+++ b/tests/tcg/multiarch/gdbstub/late-attach.py
@@ -0,0 +1,28 @@
+"""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)