GDB: trad-frame: Store length of value_bytes in trad_frame_saved_reg
[binutils-gdb.git] / gdb / testsuite / gdb.arch / aarch64-pseudo-unwind.exp
blob8b7c14812a1b0fa8cd15f8bfd1c2c4fea656fb2c
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 AArch64. We
17 # use the raw register x19 which is 64 bits long and pseudo register w19, which
18 # is the bottom half of x19.
20 if { ![istarget aarch64-*-* ] } {
21 verbose "Skipping aarch64 pseudo register unwind."
22 return
25 standard_testfile aarch64-pseudo-unwind.c aarch64-pseudo-unwind-asm.S
27 if { [prepare_for_testing "failed to prepare" ${testfile} \
28 "${srcfile} ${srcfile2}" {debug}] } {
29 return -1
32 clean_restart ${binfile}
34 if {![runto_main]} {
35 return
38 gdb_breakpoint break_here_asm temporary
39 gdb_continue_to_breakpoint "continue to callee"
41 # Verify the value of x19/w19 in the inner frame (callee).
42 with_test_prefix "callee, before change" {
43 gdb_test "p/x \$x19" " = 0x2021222324252627"
44 gdb_test "p/x \$w19" " = 0x24252627"
47 # Verify that we can change the value of the pseudo register (w19) in the inner
48 # frame (callee).
49 gdb_test_no_output "set \$w19 = 0x34353637"
51 # Verify the value of x19/w19 in the inner frame (callee) after the change.
52 with_test_prefix "callee, after change" {
53 gdb_test "p/x \$x19" " = 0x34353637"
54 gdb_test "p/x \$w19" " = 0x34353637"
57 # Go up one frame (to caller) and do the same.
58 gdb_test "up"
60 # Verify the value of x19/w19 in the outer frame (caller).
61 with_test_prefix "caller, before change" {
62 gdb_test "p/x \$x19" " = 0x1011121314151617"
63 gdb_test "p/x \$w19" " = 0x14151617"
66 # Verify that we can change the value of the pseudo register (w19) in the outer
67 # frame (caller).
68 gdb_test_no_output "set \$w19 = 0x44454647"
70 # Verify the value of x19/w19 in the outer frame (caller) after the change.
71 with_test_prefix "caller, after change" {
72 gdb_test "p/x \$x19" " = 0x44454647"
73 gdb_test "p/x \$w19" " = 0x44454647"
76 # Go back to frame 0 (callee), check that the change to the outer frame didn't
77 # mess up anything there.
78 gdb_test "down"
79 with_test_prefix "callee, after change in caller" {
80 gdb_test "p/x \$x19" " = 0x34353637"
81 gdb_test "p/x \$w19" " = 0x34353637"
84 # Verify that the value of the saved x19 we changed is correctly seen by the
85 # inferior.
86 gdb_breakpoint break_here_c temporary
87 gdb_continue_to_breakpoint "continue to break_here_c"
88 gdb_test "p/x value" " = 0x44454647"