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