Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright 2006-2020 Free Software Foundation, Inc. |
5625b943 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 |
5625b943 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/>. |
5625b943 DJ |
15 | |
16 | # Test PowerPC prologue analyzer. | |
17 | ||
18 | # Do not run on AIX (where we won't be able to build the tests without | |
19 | # some surgery) or on PowerPC64 (ditto, dot symbols). | |
20 | if {[istarget *-*-aix*] || ![istarget "powerpc-*-*"]} then { | |
21 | verbose "Skipping PowerPC prologue tests." | |
22 | return | |
23 | } | |
24 | ||
25 | set testfile "powerpc-prologue" | |
26 | set srcfile ${testfile}.c | |
16c85b5d | 27 | set binfile [standard_output_file ${testfile}] |
5625b943 DJ |
28 | |
29 | # Don't use "debug", so that we don't have line information for the assembly | |
30 | # fragments. | |
31 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] != "" } { | |
32 | untested "PowerPC prologue tests" | |
33 | return -1 | |
34 | } | |
35 | ||
36 | ||
37 | gdb_exit | |
38 | gdb_start | |
39 | gdb_reinitialize_dir $srcdir/$subdir | |
40 | gdb_load ${binfile} | |
41 | ||
42 | # | |
43 | # Run to `main' where we begin our tests. | |
44 | # | |
45 | ||
46 | if ![runto_main] then { | |
c8ee3f04 PW |
47 | fail "can't run to main" |
48 | return 0 | |
5625b943 DJ |
49 | } |
50 | ||
51 | # Testcase for PIC prologue. | |
52 | ||
4e463ff5 | 53 | gdb_breakpoint "gdb2029_marker" |
3cb51905 | 54 | gdb_test "continue" "Breakpoint $decimal, $hex in gdb2029_marker \\(\\).*" \ |
4e463ff5 | 55 | "continue to PIC" |
5625b943 DJ |
56 | |
57 | gdb_test "backtrace 10" \ | |
4e463ff5 DJ |
58 | "#0\[ \t\]*$hex in gdb2029_marker.*\r\n#1\[ \t\]*$hex in gdb2029.*\r\n#2\[ \t\]*$hex in main.*" \ |
59 | "backtrace in PIC marker" | |
60 | ||
61 | gdb_test "finish" ".*$hex in gdb2029 .*" "finish from PIC" | |
62 | ||
63 | gdb_test "backtrace 10" \ | |
64 | "#0\[ \t\]*$hex in gdb2029 .*\r\n#1\[ \t\]*$hex in main.*" \ | |
5625b943 DJ |
65 | "backtrace in PIC" |
66 | ||
67 | gdb_test "info frame" \ | |
d9c78d7d | 68 | ".*Saved registers:.*r30 at.*pc at.*lr at.*" \ |
5625b943 | 69 | "saved registers in PIC" |
4e463ff5 DJ |
70 | |
71 | # Testcase for scheduled prologue. | |
72 | ||
73 | gdb_breakpoint "optimized_1_marker" | |
3cb51905 | 74 | gdb_test "continue" "Breakpoint $decimal, $hex in optimized_1_marker \\(\\).*" \ |
4e463ff5 DJ |
75 | "continue to optimized" |
76 | ||
77 | gdb_test "backtrace 10" \ | |
78 | "#0\[ \t\]*$hex in optimized_1_marker.*\r\n#1\[ \t\]*$hex in optimized_1.*\r\n#2\[ \t\]*$hex in main.*" \ | |
79 | "backtrace in optimized marker" | |
80 | ||
81 | gdb_test "finish" ".*$hex in optimized_1 .*" "finish from optimized" | |
82 | ||
83 | gdb_test "backtrace 10" \ | |
84 | "#0\[ \t\]*$hex in optimized_1 .*\r\n#1\[ \t\]*$hex in main.*" \ | |
85 | "backtrace in optimized" | |
86 | ||
87 | gdb_test "info frame" \ | |
46a9b8ed | 88 | ".*Saved registers:.*r30 at.*pc at.*lr at.*" \ |
4e463ff5 | 89 | "saved registers in optimized" |