1from __future__ import print_function
2#
3# Test gdbstub Xfer:siginfo:read stub.
4#
5# The test runs a binary that causes a SIGSEGV and then looks for additional
6# info about the signal through printing GDB's '$_siginfo' special variable,
7# which sends a Xfer:siginfo:read query to the gdbstub.
8#
9# The binary causes a SIGSEGV at dereferencing a pointer with value 0xdeadbeef,
10# so the test looks for and checks if this address is correctly reported by the
11# gdbstub.
12#
13# This is launched via tests/guest-debug/run-test.py
14#
15
16import gdb
17from test_gdbstub import main, report
18
19def run_test():
20    "Run through the test"
21
22    gdb.execute("continue", False, True)
23    resp = gdb.execute("print/x $_siginfo", False, True)
24    report(resp.find("si_addr = 0xdeadbeef"), "Found fault address.")
25
26main(run_test)
27