]>
git.proxmox.com Git - mirror_qemu.git/blob - tests/tcg/multiarch/gdbstub/test-proc-mappings.py
1 """Test that gdbstub has access to proc mappings.
3 This runs as a sourced script (via -x, via run-test.py)."""
4 from __future__
import print_function
12 def report(cond
, msg
):
13 """Report success/fail of a test"""
15 print("PASS: {}".format(msg
))
17 print("FAIL: {}".format(msg
))
23 """Run through the tests one by one"""
25 mappings
= gdb
.execute("info proc mappings", False, True)
26 except gdb
.error
as exc
:
28 if "Not supported on this target." in exc_str
:
29 # Detect failures due to an outstanding issue with how GDB handles
30 # the x86_64 QEMU's target.xml, which does not contain the
31 # definition of orig_rax. Skip the test in this case.
32 print("SKIP: {}".format(exc_str
))
35 report(isinstance(mappings
, str), "Fetched the mappings from the inferior")
36 # Broken with host page size > guest page size
37 # report("/sha1" in mappings, "Found the test binary name in the mappings")
41 """Prepare the environment and run through the tests"""
43 inferior
= gdb
.selected_inferior()
44 print("ATTACHED: {}".format(inferior
.architecture().name()))
45 except (gdb
.error
, AttributeError):
46 print("SKIPPING (not connected)")
49 if gdb
.parse_and_eval('$pc') == 0:
50 print("SKIP: PC not set")
54 # Run the actual tests
57 report(False, "GDB Exception: {}".format(sys
.exc_info()[0]))
58 print("All tests complete: %d failures" % n_failures
)