1from __future__ import print_function 2 3# 4# Test that signals and debugging mix well together on s390x. 5# 6# This is launched via tests/guest-debug/run-test.py 7# 8 9import gdb 10from test_gdbstub import main, report 11 12 13def run_test(): 14 """Run through the tests one by one""" 15 illegal_op = gdb.Breakpoint("illegal_op") 16 stg = gdb.Breakpoint("stg") 17 mvc_8 = gdb.Breakpoint("mvc_8") 18 19 # Expect the following events: 20 # 1x illegal_op breakpoint 21 # 2x stg breakpoint, segv, breakpoint 22 # 2x mvc_8 breakpoint, segv, breakpoint 23 for _ in range(14): 24 gdb.execute("c") 25 report(illegal_op.hit_count == 1, "illegal_op.hit_count == 1") 26 report(stg.hit_count == 4, "stg.hit_count == 4") 27 report(mvc_8.hit_count == 4, "mvc_8.hit_count == 4") 28 29 # The test must succeed. 30 gdb.Breakpoint("_exit") 31 gdb.execute("c") 32 status = int(gdb.parse_and_eval("$r2")) 33 report(status == 0, "status == 0") 34 35 36main(run_test) 37