1 # Copyright 1999-2013 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 3 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, see <http://www.gnu.org/licenses/>.
18 # test running programs
23 if [get_compiler_info] {
27 if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
28 untested $testfile.exp
32 ########################################
34 ## Don't do any of these tests until we reach consensus on this file.
37 ########################################
39 set board [target_info name]
40 set current_target [target_info gdb_protocol]
41 if { $current_target == "remote" } {
42 unset_board_info "gdb_protocol"
43 set_board_info "gdb_protocol" "async"
50 gdb_reinitialize_dir $srcdir/$subdir
54 # set it up at a breakpoint so we can play with it
56 if ![runto_main] then {
57 perror "couldn't run to breakpoint"
61 gdb_test "break baz" ".*" ""
64 # Make sure we get a 'completed' message when the target is done.
66 gdb_test "set display-exec-done on" ".*" ""
71 -re "^next&\r\n$gdb_prompt.*z = 9.*completed\.\r\n" { pass "next &" }
72 -re "$gdb_prompt.*completed\.$" { fail "next &" }
73 timeout { fail "(timeout) next &" }
78 -re "^step&\r\n$gdb_prompt.*y = foo \\(\\).*completed\.\r\n" { pass "step &" }
79 -re "$gdb_prompt.*completed\.$" { fail "step &" }
80 timeout { fail "(timeout) step &" }
85 -re "^step&\r\n$gdb_prompt foo \\(\\) at .*async.c.*x = 5.*completed\.\r\n" \
87 -re "$gdb_prompt.*completed\.$" { fail "step &" }
88 timeout { fail "(timeout) step &" }
93 -re "^stepi&\r\n$gdb_prompt.*$hex.*x = 5.*completed\.\r\n" { pass "stepi &" }
94 -re "$gdb_prompt.*completed\.$" { fail "stepi &" }
95 timeout { fail "(timeout) stepi &" }
100 -re "^nexti&\r\n$gdb_prompt.*y = 3.*completed\.\r\n" { pass "nexti &" }
101 -re "$gdb_prompt.*completed\.$" { fail "nexti &" }
102 timeout { fail "(timeout) nexti &" }
107 -re "^finish&\r\nRun till exit from #0 foo \\(\\) at.*async.c.*\r\n$gdb_prompt.*$hex in main \\(\\) at.*async.c.*y = foo \\(\\).*Value returned is.*= 8.*completed\.\r\n" \
109 -re "$gdb_prompt.*completed\.$" { fail "finish &" }
110 timeout { fail "(timeout) finish &" }
113 send_gdb "jump 33&\n"
115 -re "^jump 33&.*Continuing at $hex.*$gdb_prompt.*Breakpoint 2, baz \\(\\) at.*async.c.*return 5.*completed\.\r\n" \
117 -re ".*$gdb_prompt.*completed\.$" { fail "jump &" }
118 timeout { fail "(timeout) jump &" }
121 send_gdb "until 35&\n"
123 -re "^until 35&.*$gdb_prompt.*$hex in main \\(\\) at.*async.c.*y = baz \\(\\).*completed\.\r\n" \
125 -re "$gdb_prompt.*completed\.$" { fail "until &" }
126 timeout { fail "(timeout) until &" }
129 gdb_test "set display-exec-done off" ".*" ""
131 unset_board_info "gdb_protocol"
132 set_board_info "gdb_protocol" "remote"