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