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 test is equivalent to amd64
-pseudo
-unwind
, but specific to ARM. We
17 # use the raw register d8 which is
64 bits long. We use pseudo register s16
,
18 # which is the low
32 bits of d8.
20 if { ![istarget arm
*-*-* ] } {
21 verbose
"Skipping arm pseudo register unwind."
25 standard_testfile arm
-pseudo
-unwind.c arm
-pseudo
-unwind
-asm.S
27 if { [prepare_for_testing
"failed to prepare" ${testfile} \
28 "${srcfile} ${srcfile2}" {debug additional_flags=-marm}] } {
32 clean_restart $
{binfile
}
38 gdb_breakpoint break_here_asm temporary
39 gdb_continue_to_breakpoint
"continue to callee"
41 # Verify the value of d8
/s16 in the inner frame
(callee
).
42 with_test_prefix
"callee, before change" {
43 gdb_test
"p/x \$d8" " = 0x2021222324252627"
44 gdb_test
"p/x \$s16" " = 0x24252627"
47 # Verify that we can change the value of the pseudo register
(s16
) in the inner
49 gdb_test_no_output
"set \$s16 = 1.0"
51 # Verify the value of d8
/s16 in the inner frame
(callee
) after the change.
52 with_test_prefix
"callee, after change" {
53 gdb_test
"p/x \$d8" " = 0x202122233f800000"
54 gdb_test
"p/x \$s16" " = 0x3f800000"
57 # Go up one frame
(to caller
), and
do the same.
60 # Verify the value of d8
/s16 in the outer frame
(caller
).
61 with_test_prefix
"caller, before change" {
62 gdb_test
"p/x \$d8" " = 0x1011121314151617"
63 gdb_test
"p/x \$s16" " = 0x14151617"
66 # Verify that we can change the value of the pseudo register
(s16
) in the outer
68 gdb_test_no_output
"set \$s16 = 2.0"
70 # Verify the value of d8
/s16 in the outer frame
(caller
) after the change.
71 with_test_prefix
"caller, after change" {
72 gdb_test
"p/x \$d8" " = 0x1011121340000000"
73 gdb_test
"p/x \$s16" " = 0x40000000"
76 # Go
back to frame
0 (callee
), check that the change to the outer frame didn
't
77 # mess up anything there.
79 with_test_prefix "callee, after change in caller" {
80 gdb_test "p/x \$d8" " = 0x202122233f800000"
81 gdb_test "p/x \$s16" " = 0x3f800000"
84 # Verify that the value of the saved d8 we changed is correctly seen by the
86 gdb_breakpoint break_here_c temporary
87 gdb_continue_to_breakpoint "continue to break_here_c"
88 gdb_test "p/x value" " = 0x1011121340000000"