Update copyright year range in header of all files managed by GDB
[binutils-gdb.git] / gdb / testsuite / gdb.arch / thumb-prologue.exp
blob095c9d58de711b3ed3e9cdec1b5abfeebcbd93a5
1 # Copyright 2006-2023 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 # Test ARM/Thumb prologue analyzer.
18 if {![is_aarch32_target]} {
19     verbose "Skipping ARM prologue tests."
20     return
23 standard_testfile
25 # Don't use "debug", so that we don't have line information for the assembly
26 # fragments.
27 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {"additional_flags=-mthumb"}] != "" } {
28     untested "ARM prologue tests"
29     return -1
33 gdb_exit
34 gdb_start
35 gdb_reinitialize_dir $srcdir/$subdir
36 gdb_load ${binfile}
39 # Run to `main' where we begin our tests.
42 if {![runto_main]} {
43     return -1
46 # Testcase for TPCS prologue.
48 gdb_breakpoint "* *(int *)tpcs_offset + (int) &tpcs_frame_1"
49 gdb_test "continue" "Breakpoint .*, $hex in tpcs_frame_1 \\(\\)" \
50     "continue to TPCS"
52 gdb_test "backtrace 10" \
53         "#0\[ \t\]*$hex in tpcs_frame_1 .*\r\n#1\[ \t\]*$hex in tpcs_frame .*\r\n#2\[ \t\]*$hex in main.*" \
54         "backtrace in TPCS"
56 gdb_test "info frame" \
57         ".*Saved registers:.*r7 at.*r10 at.*r11 at.*lr at.*" \
58         "saved registers in TPCS"
61 # Testcase for "switching" the stack to the same stack in the prologue.
63 gdb_breakpoint "switch_stack_to_same"
65 gdb_test "continue" "Breakpoint .*, $hex in switch_stack_to_same \\(\\)" \
66         "continue to switch_stack_to_same"
68 gdb_test "stepi 2" "in write_sp \\(\\)" "stepi over mov sp, sp"
70 gdb_test "backtrace 10" \
71         "#0\[ \t\]*$hex in write_sp .*\r\n#1\[ \t\]*$hex in switch_stack_to_same .*\r\n#2\[ \t\]*$hex in main.*" \
72         "backtrace in write_sp"
74 # Testcase for switching to another stack in the prologue.
76 gdb_breakpoint "switch_stack_to_other"
78 gdb_test "continue" "Breakpoint .*, $hex in switch_stack_to_other \\(\\)" \
79         "continue to switch_stack_to_other"
81 gdb_test "stepi 2" "in write_sp \\(\\)" "stepi over mov sp, 128"
83 gdb_test "backtrace 10" \
84         "#0\[ \t\]*$hex in write_sp .*\r\n#1\[ \t\]*$hex in switch_stack_to_other .*\r\n#2\[ \t\]*$hex in main.*" \
85         "backtrace in write_sp, 2nd stop"