1 # Copyright
2018-2024 Free Software Foundation
, Inc.
3 # This
program is free software
; you can redistribute it and
/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation
; either version
3 of the License
, or
6 #
(at your option
) any later version.
8 # This
program is distributed in the hope that it will be useful
,
9 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License
for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this
program.
If not
, see
<http
://www.gnu.org
/licenses
/>.
16 # This file is part of the gdb testsuite.
18 require is_aarch64_target
20 set compile_flags
{debug
}
22 if { ![allow_aarch64_sve_tests
] } {
23 unsupported
"target does not support SVE"
27 lappend compile_flags
"additional_flags=-DSVE"
31 if { [prepare_for_testing
"failed to prepare" ${testfile} ${srcfile} ${compile_flags}] } {
39 set endianness
[get_endianness
]
41 if {$endianness
== "little"} {
42 set reg_handler_value_128
"0x5f5e5d5c5b5a59585756555453525150"
43 set reg_handler_value_64
"0x5756555453525150"
44 set reg_handler_value_32
"0x53525150"
45 set reg_handler_value_16
"0x5150"
46 set reg_handler_value_8
"0x50"
47 set reg_main_value_128
"0x1f1e1d1c1b1a19181716151413121110"
48 set reg_main_value_64
"0x1716151413121110"
49 set reg_main_value_32
"0x13121110"
50 set reg_main_value_16
"0x1110"
51 set reg_main_value_8
"0x10"
53 set reg_handler_value_128
"0x505152535455565758595a5b5c5d5e5f"
54 set reg_handler_value_64
"0x5051525354555657"
55 set reg_handler_value_32
"0x50515253"
56 set reg_handler_value_16
"0x5051"
57 set reg_handler_value_8
"0x50"
58 set reg_main_value_128
"0x101112131415161718191a1b1c1d1e1f"
59 set reg_main_value_64
"0x1011121314151617"
60 set reg_main_value_32
"0x10111213"
61 set reg_main_value_16
"0x1011"
62 set reg_main_value_8
"0x10"
64 set zreg_handler_value
"\\{0x5756555453525150, .*"
65 set zreg_main_value
"\\{0x1716151413121110, .*"
66 set preg_handler_value
"\\{0x11, .*"
67 set preg_main_value
"\\{0x1, 0x0, .*"
69 #Ignore x0
, and x29 to x31
70 set xreg_nums
[list
1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 21 22 23 24 \
72 set vreg_nums
[list
0 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 21 22 23 \
73 24 25 26 27 28 29 30 31]
74 set preg_nums
[list
0 1 2 3 4 5 6 7 8 9 11 12 13 14 15]
76 proc check_regs
{regtype regnums value postfix
} {
77 foreach regnum $regnums
{
78 gdb_test
"print /x \$$regtype$regnum$postfix" \
80 "check register \$$regtype$regnum has value $value"
84 # Run until end of
signal handler
87 "Continuing.*Program received signal SIGILL.*" \
88 "continue until signal"
90 gdb_breakpoint
[gdb_get_line_number
"exit(0)"]
91 gdb_continue_to_breakpoint
"exit" ".*exit.*"
93 set handlerframe
[get_current_frame_number
]
94 set mainframe
[expr $handlerframe
+ 2]
97 # Check register
values
99 with_test_prefix
"handler frame 1st" {
100 check_regs x $xreg_nums $reg_handler_value_64
""
101 check_regs v $vreg_nums $reg_handler_value_128
".q.u"
102 check_regs q $vreg_nums $reg_handler_value_128
".u"
103 check_regs d $vreg_nums $reg_handler_value_64
".u"
104 check_regs s $vreg_nums $reg_handler_value_32
".u"
105 check_regs h $vreg_nums $reg_handler_value_16
".u"
106 check_regs b $vreg_nums $reg_handler_value_8
".u"
108 check_regs z $vreg_nums $zreg_handler_value
".d.u"
109 check_regs p $preg_nums $preg_handler_value
""
113 #
Switch to the frame
for main
(), and check register
values
115 gdb_test
"frame $mainframe" \
116 "#$mainframe.*in main ().*" \
120 with_test_prefix
"main frame" {
121 check_regs x $xreg_nums $reg_main_value_64
""
122 check_regs v $vreg_nums $reg_main_value_128
".q.u"
123 check_regs q $vreg_nums $reg_main_value_128
".u"
124 check_regs d $vreg_nums $reg_main_value_64
".u"
125 check_regs s $vreg_nums $reg_main_value_32
".u"
126 check_regs h $vreg_nums $reg_main_value_16
".u"
127 check_regs b $vreg_nums $reg_main_value_8
".u"
129 check_regs z $vreg_nums $zreg_main_value
".d.u"
130 check_regs p $preg_nums $preg_main_value
""
134 #
Switch back to the
signal handler frame
, and check register
values
136 gdb_test
"frame $handlerframe" \
137 "#$handlerframe.*handler \\\(sig=4\\\).*" \
138 "set to signal handler frame"
140 with_test_prefix
"handler frame 2nd" {
141 check_regs x $xreg_nums $reg_handler_value_64
""
142 check_regs v $vreg_nums $reg_handler_value_128
".q.u"
143 check_regs q $vreg_nums $reg_handler_value_128
".u"
144 check_regs d $vreg_nums $reg_handler_value_64
".u"
145 check_regs s $vreg_nums $reg_handler_value_32
".u"
146 check_regs h $vreg_nums $reg_handler_value_16
".u"
147 check_regs b $vreg_nums $reg_handler_value_8
".u"
149 check_regs z $vreg_nums $zreg_handler_value
".d.u"
150 check_regs p $preg_nums $preg_handler_value
""