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
11 from test_gdbstub
import main
, report
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)
22 val_i
= gdb
.parse_and_eval('i')
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
))
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.
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
))
43 report(False, "checking vregs (out of range)")
47 "Run through the tests one by one"
49 print ("Setup breakpoint")
53 vg
= gdb
.parse_and_eval("$vg")
54 initial_vlen
= int(vg
) * 8
59 main(run_test
, expected_arch
="aarch64")