Add support for --start option in -exec-run GDB/MI command.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / async.exp
CommitLineData
28e7fd62 1# Copyright 1999-2013 Free Software Foundation, Inc.
104c1213
JM
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
104c1213 6# (at your option) any later version.
e22f8b7c 7#
104c1213
JM
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.
e22f8b7c 12#
104c1213 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/>.
104c1213 15
104c1213 16
104c1213
JM
17#
18# test running programs
19#
104c1213 20
a64d2530 21standard_testfile
104c1213 22
a64d2530 23if [get_compiler_info] {
b60f0898 24 return -1
104c1213
JM
25}
26
a64d2530
TT
27if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
28 untested $testfile.exp
104c1213
JM
29 return -1
30}
31
32########################################
33##
34## Don't do any of these tests until we reach consensus on this file.
35##
36return 0
37########################################
38
39set board [target_info name]
40set current_target [target_info gdb_protocol]
41if { $current_target == "remote" } {
42 unset_board_info "gdb_protocol"
43 set_board_info "gdb_protocol" "async"
44 } else {
45 return 0
46 }
47
48gdb_exit
49gdb_start
50gdb_reinitialize_dir $srcdir/$subdir
51gdb_load ${binfile}
104c1213
JM
52
53#
54# set it up at a breakpoint so we can play with it
55#
56if ![runto_main] then {
57 perror "couldn't run to breakpoint"
58 continue
59}
60
de7ff789 61gdb_test "break baz" ".*" ""
104c1213
JM
62
63#
64# Make sure we get a 'completed' message when the target is done.
65#
de7ff789 66gdb_test "set display-exec-done on" ".*" ""
104c1213
JM
67
68
69send_gdb "next&\n"
70gdb_expect {
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 &" }
74}
75
76send_gdb "step&\n"
77gdb_expect {
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 &" }
81}
82
83send_gdb "step&\n"
84gdb_expect {
85 -re "^step&\r\n$gdb_prompt foo \\(\\) at .*async.c.*x = 5.*completed\.\r\n" \
86 { pass "step &" }
87 -re "$gdb_prompt.*completed\.$" { fail "step &" }
88 timeout { fail "(timeout) step &" }
89}
90
91send_gdb "stepi&\n"
92gdb_expect {
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 &" }
96}
97
98send_gdb "nexti&\n"
99gdb_expect {
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 &" }
103}
104
105send_gdb "finish&\n"
106gdb_expect {
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" \
108 { pass "finish &" }
109 -re "$gdb_prompt.*completed\.$" { fail "finish &" }
110 timeout { fail "(timeout) finish &" }
111}
112
113send_gdb "jump 33&\n"
114gdb_expect {
115 -re "^jump 33&.*Continuing at $hex.*$gdb_prompt.*Breakpoint 2, baz \\(\\) at.*async.c.*return 5.*completed\.\r\n" \
116 { pass "jump &" }
117 -re ".*$gdb_prompt.*completed\.$" { fail "jump &" }
118 timeout { fail "(timeout) jump &" }
119}
120
121send_gdb "until 35&\n"
122gdb_expect {
123 -re "^until 35&.*$gdb_prompt.*$hex in main \\(\\) at.*async.c.*y = baz \\(\\).*completed\.\r\n" \
124 { pass "until &" }
125 -re "$gdb_prompt.*completed\.$" { fail "until &" }
126 timeout { fail "(timeout) until &" }
127}
128
de7ff789 129gdb_test "set display-exec-done off" ".*" ""
104c1213
JM
130
131unset_board_info "gdb_protocol"
132set_board_info "gdb_protocol" "remote"
133
134
135
136
137
138
This page took 1.31614 seconds and 4 git commands to generate.