Commit | Line | Data |
---|---|---|
b6ba6518 | 1 | # Copyright 1999 |
104c1213 JM |
2 | # Free Software Foundation, Inc. |
3 | ||
4 | # This program is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
6 | # the Free Software Foundation; either version 2 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
17 | ||
18 | # Please email any bugs, comments, and/or additions to this file to: | |
19 | # bug-gdb@prep.ai.mit.edu | |
20 | ||
21 | ||
22 | if $tracelevel then { | |
23 | strace $tracelevel | |
24 | } | |
25 | ||
26 | # | |
27 | # test running programs | |
28 | # | |
29 | set prms_id 0 | |
30 | set bug_id 0 | |
31 | ||
32 | set testfile "async" | |
33 | set srcfile ${testfile}.c | |
34 | set binfile ${objdir}/${subdir}/${testfile} | |
35 | ||
fc91c6c2 | 36 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } { |
b60f0898 JB |
37 | untested async.exp |
38 | return -1 | |
104c1213 JM |
39 | } |
40 | ||
41 | if [get_compiler_info ${binfile}] { | |
42 | return -1 | |
43 | } | |
44 | ||
45 | ######################################## | |
46 | ## | |
47 | ## Don't do any of these tests until we reach consensus on this file. | |
48 | ## | |
49 | return 0 | |
50 | ######################################## | |
51 | ||
52 | set board [target_info name] | |
53 | set current_target [target_info gdb_protocol] | |
54 | if { $current_target == "remote" } { | |
55 | unset_board_info "gdb_protocol" | |
56 | set_board_info "gdb_protocol" "async" | |
57 | } else { | |
58 | return 0 | |
59 | } | |
60 | ||
61 | gdb_exit | |
62 | gdb_start | |
63 | gdb_reinitialize_dir $srcdir/$subdir | |
64 | gdb_load ${binfile} | |
65 | if [target_info exists gdb_stub] { | |
66 | gdb_step_for_stub; | |
67 | } | |
68 | ||
69 | # | |
70 | # set it up at a breakpoint so we can play with it | |
71 | # | |
72 | if ![runto_main] then { | |
73 | perror "couldn't run to breakpoint" | |
74 | continue | |
75 | } | |
76 | ||
77 | gdb_test "break baz" "" "" | |
78 | ||
79 | # | |
80 | # Make sure we get a 'completed' message when the target is done. | |
81 | # | |
82 | gdb_test "set display-exec-done on" "" "" | |
83 | ||
84 | ||
85 | send_gdb "next&\n" | |
86 | gdb_expect { | |
87 | -re "^next&\r\n$gdb_prompt.*z = 9.*completed\.\r\n" { pass "next &" } | |
88 | -re "$gdb_prompt.*completed\.$" { fail "next &" } | |
89 | timeout { fail "(timeout) next &" } | |
90 | } | |
91 | ||
92 | send_gdb "step&\n" | |
93 | gdb_expect { | |
94 | -re "^step&\r\n$gdb_prompt.*y = foo \\(\\).*completed\.\r\n" { pass "step &" } | |
95 | -re "$gdb_prompt.*completed\.$" { fail "step &" } | |
96 | timeout { fail "(timeout) step &" } | |
97 | } | |
98 | ||
99 | send_gdb "step&\n" | |
100 | gdb_expect { | |
101 | -re "^step&\r\n$gdb_prompt foo \\(\\) at .*async.c.*x = 5.*completed\.\r\n" \ | |
102 | { pass "step &" } | |
103 | -re "$gdb_prompt.*completed\.$" { fail "step &" } | |
104 | timeout { fail "(timeout) step &" } | |
105 | } | |
106 | ||
107 | send_gdb "stepi&\n" | |
108 | gdb_expect { | |
109 | -re "^stepi&\r\n$gdb_prompt.*$hex.*x = 5.*completed\.\r\n" { pass "stepi &" } | |
110 | -re "$gdb_prompt.*completed\.$" { fail "stepi &" } | |
111 | timeout { fail "(timeout) stepi &" } | |
112 | } | |
113 | ||
114 | send_gdb "nexti&\n" | |
115 | gdb_expect { | |
116 | -re "^nexti&\r\n$gdb_prompt.*y = 3.*completed\.\r\n" { pass "nexti &" } | |
117 | -re "$gdb_prompt.*completed\.$" { fail "nexti &" } | |
118 | timeout { fail "(timeout) nexti &" } | |
119 | } | |
120 | ||
121 | send_gdb "finish&\n" | |
122 | gdb_expect { | |
123 | -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" \ | |
124 | { pass "finish &" } | |
125 | -re "$gdb_prompt.*completed\.$" { fail "finish &" } | |
126 | timeout { fail "(timeout) finish &" } | |
127 | } | |
128 | ||
129 | send_gdb "jump 33&\n" | |
130 | gdb_expect { | |
131 | -re "^jump 33&.*Continuing at $hex.*$gdb_prompt.*Breakpoint 2, baz \\(\\) at.*async.c.*return 5.*completed\.\r\n" \ | |
132 | { pass "jump &" } | |
133 | -re ".*$gdb_prompt.*completed\.$" { fail "jump &" } | |
134 | timeout { fail "(timeout) jump &" } | |
135 | } | |
136 | ||
137 | send_gdb "until 35&\n" | |
138 | gdb_expect { | |
139 | -re "^until 35&.*$gdb_prompt.*$hex in main \\(\\) at.*async.c.*y = baz \\(\\).*completed\.\r\n" \ | |
140 | { pass "until &" } | |
141 | -re "$gdb_prompt.*completed\.$" { fail "until &" } | |
142 | timeout { fail "(timeout) until &" } | |
143 | } | |
144 | ||
145 | gdb_test "set display-exec-done off" "" "" | |
146 | ||
147 | unset_board_info "gdb_protocol" | |
148 | set_board_info "gdb_protocol" "remote" | |
149 | ||
150 | ||
151 | ||
152 | ||
153 | ||
154 |