1 # Copyright (C) 2022-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 # Check if the W registers have the expected size and if setting/fetching
17 # values from W registers works correctly for both big and little endian.
19 require is_aarch64_target
22 if { [prepare_for_testing "failed to prepare" $testfile $srcfile {nodebug}]} {
27 untested "could not run to main"
55 # Exercise various things for register w<rn>
57 proc test_register { rn } {
58 gdb_test "ptype \$w${rn}" "type = uint32_t"
59 gdb_test "p sizeof(\$w${rn})" " = 4"
61 # Set all bits of x<rn>
62 gdb_test_no_output "set \$x${rn}=0xffffffffffffffff" \
63 "set all bits of x${rn}"
65 # Test setting/fetching values
66 for {set i 0} {$i < 9} {incr i} {
70 with_test_prefix "set w${rn} to $x_values($i)" {
71 # Set value of W and see the effects on W and X.
72 gdb_test_no_output "set \$w${rn}=$x_values($i)"
73 gdb_test "p/x \$w${rn}" "= $w_values($i)"
74 gdb_test "p/x \$x${rn}" "= $w_values($i)"
77 with_test_prefix "set x${rn} to $x_values($i)" {
78 # Set value of X and see the effects on W and X.
79 gdb_test_no_output "set \$x${rn}=$x_values($i)"
80 gdb_test "p/x \$w${rn}" "= $w_values($i)"
81 gdb_test "p/x \$x${rn}" "= $x_values($i)"
83 # Set all bits of x<rn>
84 gdb_test_no_output "set \$x${rn}=0xffffffffffffffff" \
85 "set all bits of x${rn}"
91 foreach_with_prefix endian {"little" "big"} {
92 gdb_test "set endian ${endian}" "The target is set to ${endian} endian\."
94 for {set i 0} {$i < 31} {incr i} {