Fixup testcases outputting own name as a test name and standardize failed compilation...
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.arch / alpha-step.exp
CommitLineData
618f726f 1# Copyright 2005-2016 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
JB
16
17if ![istarget "alpha*-*-*"] then {
18 verbose "Skipping alpha step tests."
19 return
20}
21
22set testfile "alpha-step"
23set srcfile ${testfile}.c
24set binfile ${objdir}/${subdir}/${testfile}
25
26if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] != "" } {
84c93cd5 27 unsupported "failed to compile"
0915f927
JB
28 return -1
29}
30
31gdb_exit
32gdb_start
33gdb_reinitialize_dir $srcdir/$subdir
34gdb_load ${binfile}
35
36proc 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.
40 if ![runto_main] then {
bc6c7af4 41 fail "can't run to main"
0915f927
JB
42 return 0
43 }
44
45 # Insert a breakpoint on the FP branch instruction inside FUNCTION.
46 # Since the function has been hand written, we know this instruction
47 # is a "fb$function" located at FUNCTION+4.
48 gdb_test "break *$function+4" \
49 "Breakpoint .* at .*" \
50 "breakpoint on fb$function instruction"
51
52 gdb_test "continue" \
53 "Breakpoint .*, 0x\[0-9a-fA-F\]+ in $function\(\).*" \
54 "continue to fb$function instruction (first call)"
55
56 # Extra check to make sure we stopped on the FP branch instruction.
57
58 gdb_test "x /i \$pc" \
1dff4b64 59 "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fb$function.*" \
0915f927
JB
60 "Check breakpoint on fb$function instruction (first call)"
61
62 # Step test, followed by the check that we landed on the expected
63 # instruction (the testcase should be written in such a way that
64 # the branch is taken on the first call to this function.
65
66 gdb_test "stepi" \
67 "0x\[0-9a-fA-F\]+.*" \
68 "stepi on fb$function (first call)"
69
70 gdb_test "x /i \$pc" \
1dff4b64 71 "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+ret.*" \
0915f927
JB
72 "Check stepi over fb$function stopped on ret"
73
74 # Continue again. FUNCTION should be called a second time, this time
75 # with an argument such that the FP branch will not be taken.
76
77 gdb_test "continue" \
78 "Breakpoint .*, 0x\[0-9a-fA-F\]+ in $function\(\).*" \
79 "continue to fb$function instruction (second call)"
80
81 # Extra check to make sure we stopped on the FP branch instruction.
82
83 gdb_test "x /i \$pc" \
1dff4b64 84 "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fb$function.*" \
0915f927
JB
85 "Check breakpoint on fb$function instruction (second call)"
86
87 # Step test, branch should not be taken.
88
89 gdb_test "stepi" \
90 "0x\[0-9a-fA-F\]+.*" \
91 "stepi on fb$function (branch not taken)"
92
93 # Extra check to verify that we landed on the instruction we expected.
94
95 gdb_test "x /i \$pc" \
1dff4b64 96 "0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fneg.*" \
bb95117e 97 "check stepi over fb$function stopped on fneg instruction"
0915f927
JB
98
99}
100
101test_stepi "gt"
102test_stepi "ge"
103test_stepi "lt"
104test_stepi "le"
105test_stepi "eq"
106test_stepi "ne"
107
This page took 1.164789 seconds and 4 git commands to generate.