1"""Test that gdbstub has access to proc mappings.
2
3This runs as a sourced script (via -x, via run-test.py)."""
4from __future__ import print_function
5import gdb
6from test_gdbstub import main, report
7
8
9def run_test():
10    """Run through the tests one by one"""
11    if gdb.selected_inferior().architecture().name() == "m68k":
12        # m68k GDB supports only GDB_OSABI_SVR4, but GDB_OSABI_LINUX is
13        # required for the info proc support (see set_gdbarch_info_proc()).
14        print("SKIP: m68k GDB does not support GDB_OSABI_LINUX")
15        exit(0)
16    mappings = gdb.execute("info proc mappings", False, True)
17    report(isinstance(mappings, str), "Fetched the mappings from the inferior")
18    # Broken with host page size > guest page size
19    # report("/sha1" in mappings, "Found the test binary name in the mappings")
20
21
22main(run_test)
23