No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gdb6 / gdb / testsuite / gdb.arch / alpha-step.exp
blob40dcb0bfb961e4be5c773181f152144a8b34669b
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.
17 if $tracelevel {
18 strace $tracelevel
21 set prms_id 0
22 set bug_id 0
24 if ![istarget "alpha*-*-*"] then {
25 verbose "Skipping alpha step tests."
26 return
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."
35 return -1
38 gdb_exit
39 gdb_start
40 gdb_reinitialize_dir $srcdir/$subdir
41 gdb_load ${binfile}
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"
49 return 0
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"
59 gdb_test "continue" \
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.
73 gdb_test "stepi" \
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.
84 gdb_test "continue" \
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.
96 gdb_test "stepi" \
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"
108 test_stepi "gt"
109 test_stepi "ge"
110 test_stepi "lt"
111 test_stepi "le"
112 test_stepi "eq"
113 test_stepi "ne"