* gdb.base/call-signal-resume.exp, gdb.base/unwindonsignal.exp: Skip
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / async.exp
CommitLineData
4c38e0a4 1# Copyright 1999, 2007, 2008, 2009, 2010 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
JM
16
17if $tracelevel then {
18 strace $tracelevel
19}
20
21#
22# test running programs
23#
24set prms_id 0
25set bug_id 0
26
27set testfile "async"
28set srcfile ${testfile}.c
29set binfile ${objdir}/${subdir}/${testfile}
30
fc91c6c2 31if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
b60f0898
JB
32 untested async.exp
33 return -1
104c1213
JM
34}
35
36if [get_compiler_info ${binfile}] {
37 return -1
38}
39
40########################################
41##
42## Don't do any of these tests until we reach consensus on this file.
43##
44return 0
45########################################
46
47set board [target_info name]
48set current_target [target_info gdb_protocol]
49if { $current_target == "remote" } {
50 unset_board_info "gdb_protocol"
51 set_board_info "gdb_protocol" "async"
52 } else {
53 return 0
54 }
55
56gdb_exit
57gdb_start
58gdb_reinitialize_dir $srcdir/$subdir
59gdb_load ${binfile}
60if [target_info exists gdb_stub] {
61 gdb_step_for_stub;
62}
63
64#
65# set it up at a breakpoint so we can play with it
66#
67if ![runto_main] then {
68 perror "couldn't run to breakpoint"
69 continue
70}
71
72gdb_test "break baz" "" ""
73
74#
75# Make sure we get a 'completed' message when the target is done.
76#
77gdb_test "set display-exec-done on" "" ""
78
79
80send_gdb "next&\n"
81gdb_expect {
82 -re "^next&\r\n$gdb_prompt.*z = 9.*completed\.\r\n" { pass "next &" }
83 -re "$gdb_prompt.*completed\.$" { fail "next &" }
84 timeout { fail "(timeout) next &" }
85}
86
87send_gdb "step&\n"
88gdb_expect {
89 -re "^step&\r\n$gdb_prompt.*y = foo \\(\\).*completed\.\r\n" { pass "step &" }
90 -re "$gdb_prompt.*completed\.$" { fail "step &" }
91 timeout { fail "(timeout) step &" }
92}
93
94send_gdb "step&\n"
95gdb_expect {
96 -re "^step&\r\n$gdb_prompt foo \\(\\) at .*async.c.*x = 5.*completed\.\r\n" \
97 { pass "step &" }
98 -re "$gdb_prompt.*completed\.$" { fail "step &" }
99 timeout { fail "(timeout) step &" }
100}
101
102send_gdb "stepi&\n"
103gdb_expect {
104 -re "^stepi&\r\n$gdb_prompt.*$hex.*x = 5.*completed\.\r\n" { pass "stepi &" }
105 -re "$gdb_prompt.*completed\.$" { fail "stepi &" }
106 timeout { fail "(timeout) stepi &" }
107}
108
109send_gdb "nexti&\n"
110gdb_expect {
111 -re "^nexti&\r\n$gdb_prompt.*y = 3.*completed\.\r\n" { pass "nexti &" }
112 -re "$gdb_prompt.*completed\.$" { fail "nexti &" }
113 timeout { fail "(timeout) nexti &" }
114}
115
116send_gdb "finish&\n"
117gdb_expect {
118 -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" \
119 { pass "finish &" }
120 -re "$gdb_prompt.*completed\.$" { fail "finish &" }
121 timeout { fail "(timeout) finish &" }
122}
123
124send_gdb "jump 33&\n"
125gdb_expect {
126 -re "^jump 33&.*Continuing at $hex.*$gdb_prompt.*Breakpoint 2, baz \\(\\) at.*async.c.*return 5.*completed\.\r\n" \
127 { pass "jump &" }
128 -re ".*$gdb_prompt.*completed\.$" { fail "jump &" }
129 timeout { fail "(timeout) jump &" }
130}
131
132send_gdb "until 35&\n"
133gdb_expect {
134 -re "^until 35&.*$gdb_prompt.*$hex in main \\(\\) at.*async.c.*y = baz \\(\\).*completed\.\r\n" \
135 { pass "until &" }
136 -re "$gdb_prompt.*completed\.$" { fail "until &" }
137 timeout { fail "(timeout) until &" }
138}
139
140gdb_test "set display-exec-done off" "" ""
141
142unset_board_info "gdb_protocol"
143set_board_info "gdb_protocol" "remote"
144
145
146
147
148
149
This page took 0.956484 seconds and 4 git commands to generate.