Merge tag 'v9.1.0'
[qemu/ar7.git] / tests / tcg / aarch64 / gdbstub / test-sve-ioctl.py
bloba78a3a2514da28b1d09ca36f08e93fb21d7f58cd
1 from __future__ import print_function
3 # Test the SVE ZReg reports the right amount of data. It uses the
4 # sve-ioctl test and examines the register data each time the
5 # __sve_ld_done breakpoint is hit.
7 # This is launched via tests/guest-debug/run-test.py
10 import gdb
11 from test_gdbstub import main, report
13 initial_vlen = 0
16 class TestBreakpoint(gdb.Breakpoint):
17 def __init__(self, sym_name="__sve_ld_done"):
18 super(TestBreakpoint, self).__init__(sym_name)
19 # self.sym, ok = gdb.lookup_symbol(sym_name)
21 def stop(self):
22 val_i = gdb.parse_and_eval('i')
23 global initial_vlen
24 try:
25 for i in range(0, int(val_i)):
26 val_z = gdb.parse_and_eval("$z0.b.u[%d]" % i)
27 report(int(val_z) == i, "z0.b.u[%d] == %d" % (i, i))
28 for i in range(i + 1, initial_vlen):
29 val_z = gdb.parse_and_eval("$z0.b.u[%d]" % i)
30 report(int(val_z) == 0, "z0.b.u[%d] == 0" % (i))
31 except gdb.error:
32 report(False, "checking zregs (out of range)")
34 # Check the aliased V registers are set and GDB has correctly
35 # created them for us having recognised and handled SVE.
36 try:
37 for i in range(0, 16):
38 val_z = gdb.parse_and_eval("$z0.b.u[%d]" % i)
39 val_v = gdb.parse_and_eval("$v0.b.u[%d]" % i)
40 report(int(val_z) == int(val_v),
41 "v0.b.u[%d] == z0.b.u[%d]" % (i, i))
42 except gdb.error:
43 report(False, "checking vregs (out of range)")
46 def run_test():
47 "Run through the tests one by one"
49 print ("Setup breakpoint")
50 bp = TestBreakpoint()
52 global initial_vlen
53 vg = gdb.parse_and_eval("$vg")
54 initial_vlen = int(vg) * 8
56 gdb.execute("c")
59 main(run_test, expected_arch="aarch64")