]>
Commit | Line | Data |
---|---|---|
1d506c26 | 1 | # Copyright 2018-2024 Free Software Foundation, Inc. |
f5d420bb SM |
2 | |
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. | |
7 | # | |
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. | |
12 | # | |
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/>. | |
15 | ||
16 | # This test is in the same vein as amd64-pseudo-unwind, making sure we can | |
17 | # read write pseudo registers in outer frames. However, it tests a special | |
18 | # case where the debug info includes unwind information for a pseudo register | |
19 | # but not the underlying raw register. This can happen for the pseudo register | |
20 | # s16, which is the bottom half of the raw register d8. | |
21 | # | |
22 | # See "DWARF for the ARM architecture": | |
23 | # https://github.com/ARM-software/abi-aa/releases/download/2023Q3/aadwarf32.pdf | |
24 | ||
25 | if { ![istarget arm*-*-* ] } { | |
26 | verbose "Skipping arm pseudo register unwind." | |
27 | return | |
28 | } | |
29 | ||
30 | standard_testfile arm-pseudo-unwind-legacy.c arm-pseudo-unwind-legacy-asm.S | |
31 | ||
32 | if { [prepare_for_testing "failed to prepare" ${testfile} \ | |
33 | "${srcfile} ${srcfile2}" {debug additional_flags=-marm}] } { | |
34 | return -1 | |
35 | } | |
36 | ||
37 | clean_restart ${binfile} | |
38 | ||
39 | if ![runto_main] then { | |
40 | fail "could not run to main" | |
41 | } | |
42 | ||
43 | gdb_breakpoint break_here_asm temporary | |
44 | gdb_continue_to_breakpoint "continue to callee" | |
45 | ||
46 | # Verify the value of s16 in the inner frame (callee). | |
47 | with_test_prefix "callee, before change" { | |
48 | gdb_test "p/x \$s16" " = 0x20212223" | |
49 | } | |
50 | ||
51 | # Verify that we can change the value of s16 in the inner frame (callee). | |
52 | gdb_test_no_output "set \$s16 = 1.0" | |
53 | ||
54 | # Verify the value of s16 in the inner frame (callee) after the change. | |
55 | with_test_prefix "callee, after change" { | |
56 | gdb_test "p/x \$s16" " = 0x3f800000" | |
57 | } | |
58 | ||
59 | # Go up one frame, and do the same. | |
60 | gdb_test "up" | |
61 | ||
62 | # Verify the value of s16 in the outer frame (caller). | |
63 | with_test_prefix "caller, before change" { | |
64 | gdb_test "p/x \$s16" " = 0x10111213" | |
65 | } | |
66 | ||
67 | # Verify that we can change the value of s16 in the outer frame (caller). | |
68 | gdb_test_no_output "set \$s16 = 2.0" | |
69 | ||
70 | # Verify the value of s16 in the outer frame (caller) after the change. | |
71 | with_test_prefix "caller, after change" { | |
72 | gdb_test "p/x \$s16" " = 0x40000000" | |
73 | } | |
74 | ||
75 | # Go back to frame 0 (callee), check that the change to the outer frame didn't | |
76 | # mess up anything there. | |
77 | gdb_test "down" | |
78 | with_test_prefix "callee, after change in caller" { | |
79 | gdb_test "p/x \$s16" " = 0x3f800000" | |
80 | } | |
81 | ||
82 | # Verify that the value of the saved s16 we changed is correctly seen by the | |
83 | # inferior. | |
84 | gdb_breakpoint break_here_c temporary | |
85 | gdb_continue_to_breakpoint "continue to break_here_c" | |
86 | gdb_test "p/x value" " = 0x40000000" |