1 # Copyright 2005 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 2 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, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 if ![istarget "alpha*-*-*"] then {
25 verbose "Skipping alpha step tests."
29 set testfile "alpha-step"
30 set srcfile ${testfile}.c
31 set binfile ${objdir}/${subdir}/${testfile}
33 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] != "" } {
34 unsupported "Testcase compile failed."
40 gdb_reinitialize_dir $srcdir/$subdir
43 proc test_stepi {function } {
44 # Restart the program from scratch. If GDB got confused during one
45 # of the previous tests, this makes sure that it doesn't affect
46 # this series of tests.
47 if ![runto_main] then {
48 fail "Can't run to main"
52 # Insert a breakpoint on the FP branch instruction inside FUNCTION.
53 # Since the function has been hand written, we know this instruction
54 # is a "fb$function" located at FUNCTION+4.
55 gdb_test "break *$function+4" \
56 "Breakpoint .* at .*" \
57 "breakpoint on fb$function instruction"
60 "Breakpoint .*, 0x\[0-9a-fA-F\]+ in $function\(\).*" \
61 "continue to fb$function instruction (first call)"
63 # Extra check to make sure we stopped on the FP branch instruction.
65 gdb_test "x /i \$pc" \
66 "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fb$function\[ \t\]+.*" \
67 "Check breakpoint on fb$function instruction (first call)"
69 # Step test, followed by the check that we landed on the expected
70 # instruction (the testcase should be written in such a way that
71 # the branch is taken on the first call to this function.
74 "0x\[0-9a-fA-F\]+.*" \
75 "stepi on fb$function (first call)"
77 gdb_test "x /i \$pc" \
78 "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+ret\[ \t\]+.*" \
79 "Check stepi over fb$function stopped on ret"
81 # Continue again. FUNCTION should be called a second time, this time
82 # with an argument such that the FP branch will not be taken.
85 "Breakpoint .*, 0x\[0-9a-fA-F\]+ in $function\(\).*" \
86 "continue to fb$function instruction (second call)"
88 # Extra check to make sure we stopped on the FP branch instruction.
90 gdb_test "x /i \$pc" \
91 "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fb$function\[ \t\]+.*" \
92 "Check breakpoint on fb$function instruction (second call)"
94 # Step test, branch should not be taken.
97 "0x\[0-9a-fA-F\]+.*" \
98 "stepi on fb$function (branch not taken)"
100 # Extra check to verify that we landed on the instruction we expected.
102 gdb_test "x /i \$pc" \
103 "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fneg\[ \t\]+.*" \
104 "Check stepi over fb$function stopped on fneg instruction"