Merge tag 'qemu-macppc-20230206' of https://github.com/mcayland/qemu into staging
[qemu.git] / tests / tcg / multiarch / gdbstub / test-thread-breakpoint.py
blob798d508bc70aeb7edc0ddf5e33ed230d454aa37b
1 from __future__ import print_function
3 # Test auxiliary vector is loaded via gdbstub
5 # This is launched via tests/guest-debug/run-test.py
8 import gdb
9 import sys
11 failcount = 0
13 def report(cond, msg):
14 "Report success/fail of test"
15 if cond:
16 print ("PASS: %s" % (msg))
17 else:
18 print ("FAIL: %s" % (msg))
19 global failcount
20 failcount += 1
22 def run_test():
23 "Run through the tests one by one"
25 sym, ok = gdb.lookup_symbol("thread1_func")
26 gdb.execute("b thread1_func")
27 gdb.execute("c")
29 frame = gdb.selected_frame()
30 report(str(frame.function()) == "thread1_func", "break @ %s"%frame)
33 # This runs as the script it sourced (via -x, via run-test.py)
35 try:
36 inferior = gdb.selected_inferior()
37 arch = inferior.architecture()
38 print("ATTACHED: %s" % arch.name())
39 except (gdb.error, AttributeError):
40 print("SKIPPING (not connected)", file=sys.stderr)
41 exit(0)
43 if gdb.parse_and_eval('$pc') == 0:
44 print("SKIP: PC not set")
45 exit(0)
47 try:
48 # These are not very useful in scripts
49 gdb.execute("set pagination off")
50 gdb.execute("set confirm off")
52 # Run the actual tests
53 run_test()
54 except (gdb.error):
55 print ("GDB Exception: %s" % (sys.exc_info()[0]))
56 failcount += 1
57 pass
59 print("All tests complete: %d failures" % failcount)
60 exit(failcount)