1 # Copyright
2018-2019 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 if {![is_aarch64_target
]} {
19 verbose
"Skipping ${gdb_test_file_name}."
23 set compile_flags
{debug
}
25 if { [skip_aarch64_sve_tests
] } {
26 unsupported
"target does not support SVE"
30 lappend compile_flags
"additional_flags=-DSVE"
34 if { [prepare_for_testing
"failed to prepare" ${testfile} ${srcfile} ${compile_flags}] } {
39 untested
"could not run to main"
43 set endianness
[get_endianness
]
45 if {$endianness
== "little"} {
46 set reg_handler_value_128
"0x5f5e5d5c5b5a59585756555453525150"
47 set reg_handler_value_64
"0x5756555453525150"
48 set reg_handler_value_32
"0x53525150"
49 set reg_handler_value_16
"0x5150"
50 set reg_handler_value_8
"0x50"
51 set reg_main_value_128
"0x1f1e1d1c1b1a19181716151413121110"
52 set reg_main_value_64
"0x1716151413121110"
53 set reg_main_value_32
"0x13121110"
54 set reg_main_value_16
"0x1110"
55 set reg_main_value_8
"0x10"
57 set reg_handler_value_128
"0x505152535455565758595a5b5c5d5e5f"
58 set reg_handler_value_64
"0x5051525354555657"
59 set reg_handler_value_32
"0x50515253"
60 set reg_handler_value_16
"0x5051"
61 set reg_handler_value_8
"0x50"
62 set reg_main_value_128
"0x101112131415161718191a1b1c1d1e1f"
63 set reg_main_value_64
"0x1011121314151617"
64 set reg_main_value_32
"0x10111213"
65 set reg_main_value_16
"0x1011"
66 set reg_main_value_8
"0x10"
68 set zreg_handler_value
"\\{0x5756555453525150, .*"
69 set zreg_main_value
"\\{0x1716151413121110, .*"
70 set preg_handler_value
"\\{0x11, .*"
71 set preg_main_value
"\\{0x1, 0x0, .*"
73 #Ignore x0
, and x29 to x31
74 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 \
76 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 \
77 24 25 26 27 28 29 30 31]
78 set preg_nums
[list
0 1 2 3 4 5 6 7 8 9 11 12 13 14 15]
80 proc check_regs
{regtype regnums value postfix
} {
81 foreach regnum $regnums
{
82 gdb_test
"print /x \$$regtype$regnum$postfix" \
84 "check register \$$regtype$regnum has value $value"
88 # Run until end of
signal handler
91 "Continuing.*Program received signal SIGILL.*" \
92 "continue until signal"
94 gdb_breakpoint
[gdb_get_line_number
"exit(0)"]
95 gdb_continue_to_breakpoint
"exit" ".*exit.*"
97 set handlerframe
[get_current_frame_number
]
98 set mainframe
[expr $handlerframe
+ 2]
101 # Check register
values
103 check_regs x $xreg_nums $reg_handler_value_64
""
104 check_regs v $vreg_nums $reg_handler_value_128
".q.u"
105 check_regs q $vreg_nums $reg_handler_value_128
".u"
106 check_regs d $vreg_nums $reg_handler_value_64
".u"
107 check_regs s $vreg_nums $reg_handler_value_32
".u"
108 check_regs h $vreg_nums $reg_handler_value_16
".u"
109 check_regs b $vreg_nums $reg_handler_value_8
".u"
111 check_regs z $vreg_nums $zreg_handler_value
".d.u"
112 check_regs p $preg_nums $preg_handler_value
""
115 #
Switch to the frame
for main
(), and check register
values
117 gdb_test
"frame $mainframe" \
118 "#$mainframe.*in main ().*" \
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
""
133 #
Switch back to the
signal handler frame
, and check register
values
135 gdb_test
"frame $handlerframe" \
136 "#$handlerframe.*handler \\\(sig=4\\\).*" \
137 "set to signal handler frame"
139 check_regs x $xreg_nums $reg_handler_value_64
""
140 check_regs v $vreg_nums $reg_handler_value_128
".q.u"
141 check_regs q $vreg_nums $reg_handler_value_128
".u"
142 check_regs d $vreg_nums $reg_handler_value_64
".u"
143 check_regs s $vreg_nums $reg_handler_value_32
".u"
144 check_regs h $vreg_nums $reg_handler_value_16
".u"
145 check_regs b $vreg_nums $reg_handler_value_8
".u"
147 check_regs z $vreg_nums $zreg_handler_value
".d.u"
148 check_regs p $preg_nums $preg_handler_value
""