blob: 1d40efb5ec82f28a4d00afb9e9332ea7c8f9d15a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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)
|