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