]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.arch/alpha-step.exp
Copyright updates for 2007.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / alpha-step.exp
CommitLineData
6aba47ca 1# Copyright 2005, 2007 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
5# the Free Software Foundation; either version 2 of the License, or
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
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.
16
17if $tracelevel {
18 strace $tracelevel
19}
20
21set prms_id 0
22set bug_id 0
23
24if ![istarget "alpha*-*-*"] then {
25 verbose "Skipping alpha step tests."
26 return
27}
28
29set testfile "alpha-step"
30set srcfile ${testfile}.c
31set binfile ${objdir}/${subdir}/${testfile}
32
33if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] != "" } {
34 unsupported "Testcase compile failed."
35 return -1
36}
37
38gdb_exit
39gdb_start
40gdb_reinitialize_dir $srcdir/$subdir
41gdb_load ${binfile}
42
43proc 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
50 }
51
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"
58
59 gdb_test "continue" \
60 "Breakpoint .*, 0x\[0-9a-fA-F\]+ in $function\(\).*" \
61 "continue to fb$function instruction (first call)"
62
63 # Extra check to make sure we stopped on the FP branch instruction.
64
65 gdb_test "x /i \$pc" \
1dff4b64 66 "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fb$function.*" \
0915f927
JB
67 "Check breakpoint on fb$function instruction (first call)"
68
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.
72
73 gdb_test "stepi" \
74 "0x\[0-9a-fA-F\]+.*" \
75 "stepi on fb$function (first call)"
76
77 gdb_test "x /i \$pc" \
1dff4b64 78 "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+ret.*" \
0915f927
JB
79 "Check stepi over fb$function stopped on ret"
80
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.
83
84 gdb_test "continue" \
85 "Breakpoint .*, 0x\[0-9a-fA-F\]+ in $function\(\).*" \
86 "continue to fb$function instruction (second call)"
87
88 # Extra check to make sure we stopped on the FP branch instruction.
89
90 gdb_test "x /i \$pc" \
1dff4b64 91 "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fb$function.*" \
0915f927
JB
92 "Check breakpoint on fb$function instruction (second call)"
93
94 # Step test, branch should not be taken.
95
96 gdb_test "stepi" \
97 "0x\[0-9a-fA-F\]+.*" \
98 "stepi on fb$function (branch not taken)"
99
100 # Extra check to verify that we landed on the instruction we expected.
101
102 gdb_test "x /i \$pc" \
1dff4b64 103 "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fneg.*" \
0915f927
JB
104 "Check stepi over fb$function stopped on fneg instruction"
105
106}
107
108test_stepi "gt"
109test_stepi "ge"
110test_stepi "lt"
111test_stepi "le"
112test_stepi "eq"
113test_stepi "ne"
114