]>
Commit | Line | Data |
---|---|---|
1d506c26 | 1 | # Copyright 2006-2024 Free Software Foundation, Inc. |
29d73ae4 DJ |
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 | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
29d73ae4 DJ |
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 | |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
29d73ae4 DJ |
15 | |
16 | # Test ARM/Thumb prologue analyzer. | |
17 | ||
abdc86ca | 18 | require is_aarch32_target |
29d73ae4 | 19 | |
ffd19d61 | 20 | standard_testfile |
29d73ae4 DJ |
21 | |
22 | # Don't use "debug", so that we don't have line information for the assembly | |
23 | # fragments. | |
24 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {"additional_flags=-mthumb"}] != "" } { | |
25 | untested "ARM prologue tests" | |
26 | return -1 | |
27 | } | |
28 | ||
29 | ||
6dbbae3b | 30 | clean_restart $binfile |
29d73ae4 DJ |
31 | |
32 | # | |
33 | # Run to `main' where we begin our tests. | |
34 | # | |
35 | ||
75b6f386 | 36 | if {![runto_main]} { |
29d73ae4 DJ |
37 | return -1 |
38 | } | |
39 | ||
40 | # Testcase for TPCS prologue. | |
41 | ||
fd20f75b DJ |
42 | gdb_breakpoint "* *(int *)tpcs_offset + (int) &tpcs_frame_1" |
43 | gdb_test "continue" "Breakpoint .*, $hex in tpcs_frame_1 \\(\\)" \ | |
44 | "continue to TPCS" | |
29d73ae4 DJ |
45 | |
46 | gdb_test "backtrace 10" \ | |
47 | "#0\[ \t\]*$hex in tpcs_frame_1 .*\r\n#1\[ \t\]*$hex in tpcs_frame .*\r\n#2\[ \t\]*$hex in main.*" \ | |
48 | "backtrace in TPCS" | |
49 | ||
50 | gdb_test "info frame" \ | |
b39cc962 | 51 | ".*Saved registers:.*r7 at.*r10 at.*r11 at.*lr at.*" \ |
29d73ae4 | 52 | "saved registers in TPCS" |
72a2e3dc MI |
53 | |
54 | ||
55 | # Testcase for "switching" the stack to the same stack in the prologue. | |
56 | ||
57 | gdb_breakpoint "switch_stack_to_same" | |
58 | ||
59 | gdb_test "continue" "Breakpoint .*, $hex in switch_stack_to_same \\(\\)" \ | |
60 | "continue to switch_stack_to_same" | |
61 | ||
62 | gdb_test "stepi 2" "in write_sp \\(\\)" "stepi over mov sp, sp" | |
63 | ||
64 | gdb_test "backtrace 10" \ | |
65 | "#0\[ \t\]*$hex in write_sp .*\r\n#1\[ \t\]*$hex in switch_stack_to_same .*\r\n#2\[ \t\]*$hex in main.*" \ | |
66 | "backtrace in write_sp" | |
67 | ||
68 | # Testcase for switching to another stack in the prologue. | |
69 | ||
70 | gdb_breakpoint "switch_stack_to_other" | |
71 | ||
72 | gdb_test "continue" "Breakpoint .*, $hex in switch_stack_to_other \\(\\)" \ | |
73 | "continue to switch_stack_to_other" | |
74 | ||
75 | gdb_test "stepi 2" "in write_sp \\(\\)" "stepi over mov sp, 128" | |
76 | ||
77 | gdb_test "backtrace 10" \ | |
78 | "#0\[ \t\]*$hex in write_sp .*\r\n#1\[ \t\]*$hex in switch_stack_to_other .*\r\n#2\[ \t\]*$hex in main.*" \ | |
c2b75043 | 79 | "backtrace in write_sp, 2nd stop" |