]>
Commit | Line | Data |
---|---|---|
1d506c26 | 1 | # Copyright 2005-2024 Free Software Foundation, Inc. |
0915f927 JB |
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 |
0915f927 JB |
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/>. |
0915f927 | 15 | |
0915f927 | 16 | |
73c06197 | 17 | require {istarget "alpha*-*-*"} |
0915f927 JB |
18 | |
19 | set testfile "alpha-step" | |
20 | set srcfile ${testfile}.c | |
21 | set binfile ${objdir}/${subdir}/${testfile} | |
22 | ||
23 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] != "" } { | |
84c93cd5 | 24 | unsupported "failed to compile" |
0915f927 JB |
25 | return -1 |
26 | } | |
27 | ||
6dbbae3b | 28 | clean_restart $binfile |
0915f927 JB |
29 | |
30 | proc test_stepi {function } { | |
31 | # Restart the program from scratch. If GDB got confused during one | |
32 | # of the previous tests, this makes sure that it doesn't affect | |
33 | # this series of tests. | |
75b6f386 | 34 | if {![runto_main]} { |
0915f927 JB |
35 | return 0 |
36 | } | |
37 | ||
38 | # Insert a breakpoint on the FP branch instruction inside FUNCTION. | |
39 | # Since the function has been hand written, we know this instruction | |
40 | # is a "fb$function" located at FUNCTION+4. | |
41 | gdb_test "break *$function+4" \ | |
42 | "Breakpoint .* at .*" \ | |
43 | "breakpoint on fb$function instruction" | |
44 | ||
45 | gdb_test "continue" \ | |
46 | "Breakpoint .*, 0x\[0-9a-fA-F\]+ in $function\(\).*" \ | |
47 | "continue to fb$function instruction (first call)" | |
48 | ||
49 | # Extra check to make sure we stopped on the FP branch instruction. | |
50 | ||
51 | gdb_test "x /i \$pc" \ | |
1dff4b64 | 52 | "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fb$function.*" \ |
0915f927 JB |
53 | "Check breakpoint on fb$function instruction (first call)" |
54 | ||
55 | # Step test, followed by the check that we landed on the expected | |
56 | # instruction (the testcase should be written in such a way that | |
57 | # the branch is taken on the first call to this function. | |
58 | ||
59 | gdb_test "stepi" \ | |
60 | "0x\[0-9a-fA-F\]+.*" \ | |
61 | "stepi on fb$function (first call)" | |
62 | ||
63 | gdb_test "x /i \$pc" \ | |
1dff4b64 | 64 | "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+ret.*" \ |
0915f927 JB |
65 | "Check stepi over fb$function stopped on ret" |
66 | ||
67 | # Continue again. FUNCTION should be called a second time, this time | |
68 | # with an argument such that the FP branch will not be taken. | |
69 | ||
70 | gdb_test "continue" \ | |
71 | "Breakpoint .*, 0x\[0-9a-fA-F\]+ in $function\(\).*" \ | |
72 | "continue to fb$function instruction (second call)" | |
73 | ||
74 | # Extra check to make sure we stopped on the FP branch instruction. | |
75 | ||
76 | gdb_test "x /i \$pc" \ | |
1dff4b64 | 77 | "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fb$function.*" \ |
0915f927 JB |
78 | "Check breakpoint on fb$function instruction (second call)" |
79 | ||
80 | # Step test, branch should not be taken. | |
81 | ||
82 | gdb_test "stepi" \ | |
83 | "0x\[0-9a-fA-F\]+.*" \ | |
84 | "stepi on fb$function (branch not taken)" | |
85 | ||
86 | # Extra check to verify that we landed on the instruction we expected. | |
87 | ||
88 | gdb_test "x /i \$pc" \ | |
1dff4b64 | 89 | "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fneg.*" \ |
bb95117e | 90 | "check stepi over fb$function stopped on fneg instruction" |
0915f927 JB |
91 | |
92 | } | |
93 | ||
94 | test_stepi "gt" | |
95 | test_stepi "ge" | |
96 | test_stepi "lt" | |
97 | test_stepi "le" | |
98 | test_stepi "eq" | |
99 | test_stepi "ne" | |
100 |