Commit | Line | Data |
---|---|---|
7b6bb8da | 1 | # Copyright (C) 1998, 1999, 2001, 2004, 2007, 2008, 2009, 2010, 2011 |
9b254dd1 | 2 | # Free Software Foundation, Inc. |
c906108c SS |
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 | |
e22f8b7c | 6 | # the Free Software Foundation; either version 3 of the License, or |
c906108c | 7 | # (at your option) any later version. |
e22f8b7c | 8 | # |
c906108c SS |
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. | |
e22f8b7c | 13 | # |
c906108c | 14 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
c906108c | 16 | |
c906108c | 17 | # written by Elena Zannoni (ezannoni@cygnus.com) |
b2bbed47 | 18 | # modified by Michael Chastain (chastain@redhat.com) |
c906108c SS |
19 | |
20 | # This file is part of the gdb testsuite | |
21 | # | |
22 | # tests for overloaded member functions. Set breakpoints on | |
23 | # overloaded member functions | |
24 | # | |
25 | ||
cec808ec KS |
26 | global timeout |
27 | set timeout 15 | |
c906108c SS |
28 | if $tracelevel then { |
29 | strace $tracelevel | |
30 | } | |
31 | ||
32 | # | |
33 | # test running programs | |
34 | # | |
c906108c | 35 | |
d4f3574e SS |
36 | if { [skip_cplus_tests] } { continue } |
37 | ||
c906108c SS |
38 | set testfile "ovldbreak" |
39 | set srcfile ${testfile}.cc | |
40 | set binfile ${objdir}/${subdir}/${testfile} | |
41 | ||
42 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { | |
b60f0898 JB |
43 | untested ovldbreak.exp |
44 | return -1 | |
c906108c SS |
45 | } |
46 | ||
47 | gdb_exit | |
48 | gdb_start | |
49 | gdb_reinitialize_dir $srcdir/$subdir | |
50 | gdb_load ${binfile} | |
51 | ||
52 | # set it up at a breakpoint so we can play with the variable values | |
53 | # | |
54 | if ![runto_main] then { | |
55 | perror "couldn't run to breakpoint" | |
56 | continue | |
57 | } | |
58 | ||
59 | ||
60 | ||
b2bbed47 MC |
61 | # When I ask gdb to set a breakpoint on an overloaded function, |
62 | # gdb gives me a choice menu. I might get stuck in that choice menu | |
63 | # (for example, if C++ name mangling is not working properly). | |
64 | # | |
65 | # This procedure issues a command that works at either the menu | |
66 | # prompt or the command prompt to get back to the command prompt. | |
67 | # | |
68 | # Note that an empty line won't do it (it means 'repeat the previous command' | |
69 | # at top level). A line with a single space in it works nicely. | |
c906108c | 70 | |
b2bbed47 MC |
71 | proc take_gdb_out_of_choice_menu {} { |
72 | global gdb_prompt | |
f8d3bf8f | 73 | gdb_test_multiple " " " " { |
b2bbed47 MC |
74 | -re ".*$gdb_prompt $" { |
75 | } | |
76 | timeout { | |
77 | perror "could not resynchronize to command prompt (timeout)" | |
78 | continue | |
79 | } | |
80 | } | |
81 | } | |
c906108c SS |
82 | |
83 | ||
c906108c | 84 | |
b2bbed47 MC |
85 | # This procedure sets an overloaded breakpoint. |
86 | # When I ask for such a breakpoint, gdb gives me a menu of 'cancel' 'all' | |
87 | # and a bunch of choices. I then choose from that menu by number. | |
c906108c | 88 | |
b2bbed47 MC |
89 | proc set_bp_overloaded {name expectedmenu mychoice bpnumber linenumber} { |
90 | global gdb_prompt hex srcfile | |
c906108c | 91 | |
b2bbed47 MC |
92 | # Get into the overload menu. |
93 | send_gdb "break $name\n" | |
94 | gdb_expect { | |
95 | -re "$expectedmenu" { | |
96 | pass "bp menu for $name choice $mychoice" | |
c906108c | 97 | |
b2bbed47 MC |
98 | # Choose my choice. |
99 | send_gdb "$mychoice\n" | |
c906108c | 100 | gdb_expect { |
b2bbed47 MC |
101 | -re "Breakpoint $bpnumber at $hex: file.*$srcfile, line $linenumber.\r\n$gdb_prompt $" { |
102 | pass "set bp $bpnumber on $name $mychoice line $linenumber" | |
103 | } | |
104 | -re ".*$gdb_prompt $" { | |
105 | fail "set bp $bpnumber on $name $mychoice line $linenumber (bad bp)" | |
106 | } | |
107 | timeout { | |
108 | fail "set bp $bpnumber on $name $mychoice line $linenumber (timeout)" | |
109 | take_gdb_out_of_choice_menu | |
110 | } | |
111 | } | |
112 | } | |
113 | -re ".*\r\n> " { | |
114 | fail "bp menu for $name choice $mychoice (bad menu)" | |
115 | take_gdb_out_of_choice_menu | |
116 | } | |
117 | -re ".*$gdb_prompt $" { | |
118 | fail "bp menu for $name choice $mychoice (no menu)" | |
119 | } | |
120 | timeout { | |
121 | fail "bp menu for $name choice $mychoice (timeout)" | |
122 | take_gdb_out_of_choice_menu | |
123 | } | |
124 | } | |
125 | } | |
c906108c | 126 | |
b2bbed47 | 127 | # This is the expected menu for overload1arg. |
cec808ec | 128 | # Note the arg type variations for void and integer types. |
b2bbed47 | 129 | # This accommodates different versions of g++. |
c906108c | 130 | |
cec808ec KS |
131 | set menu_overload1arg "\\\[0\\\] cancel\r\n" |
132 | append menu_overload1arg "\\\[1\\\] all\r\n" | |
133 | append menu_overload1arg "\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n" | |
134 | append menu_overload1arg "\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n" | |
135 | append menu_overload1arg "\\\[4\\\] foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:119\r\n" | |
136 | append menu_overload1arg "\\\[5\\\] foo::overload1arg\\(long( int)?\\) at.*$srcfile:118\r\n" | |
137 | append menu_overload1arg "\\\[6\\\] foo::overload1arg\\((unsigned int|unsigned)\\) at.*$srcfile:117\r\n" | |
138 | append menu_overload1arg "\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n" | |
139 | append menu_overload1arg "\\\[8\\\] foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:115\r\n" | |
140 | append menu_overload1arg "\\\[9\\\] foo::overload1arg\\(short( int)?\\) at.*$srcfile:114\r\n" | |
141 | append menu_overload1arg "\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n" | |
142 | append menu_overload1arg "\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n" | |
143 | append menu_overload1arg "\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n" | |
144 | append menu_overload1arg "\\\[13\\\] foo::overload1arg\\((void|)\\) at.*$srcfile:110\r\n" | |
145 | append menu_overload1arg "> $" | |
c906108c | 146 | |
eae06beb JB |
147 | # Set multiple-symbols to "ask", to allow us to test the use |
148 | # of the multiple-choice menu when breaking on an overloaded method. | |
a8d52276 | 149 | gdb_test_no_output "set multiple-symbols ask" |
c906108c | 150 | |
b2bbed47 | 151 | # Set breakpoints on foo::overload1arg, one by one. |
c906108c | 152 | |
b2bbed47 MC |
153 | set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 12 2 111 |
154 | set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 11 3 112 | |
155 | set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 10 4 113 | |
156 | set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 9 5 114 | |
157 | set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 8 6 115 | |
158 | set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 7 7 116 | |
159 | set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 6 8 117 | |
160 | set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 5 9 118 | |
161 | set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 4 10 119 | |
162 | set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 3 11 120 | |
163 | set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 2 12 121 | |
164 | set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 13 13 110 | |
c906108c SS |
165 | |
166 | ||
c906108c | 167 | |
b2bbed47 | 168 | # Verify the breakpoints. |
c906108c SS |
169 | |
170 | gdb_test "info break" \ | |
54e52265 | 171 | "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* |
cec808ec | 172 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main(\\((|void)\\))? at.*$srcfile:49\r |
c906108c | 173 | \[\t \]+breakpoint already hit 1 time\r |
d8937120 MC |
174 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:111\r |
175 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r | |
176 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r | |
cec808ec KS |
177 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short( int)?\\) at.*$srcfile:114\r |
178 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:115\r | |
d8937120 MC |
179 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfile:116\r |
180 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:117\r | |
cec808ec KS |
181 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long( int)?\\) at.*$srcfile:118\r |
182 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:119\r | |
d8937120 MC |
183 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:120\r |
184 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:121\r | |
185 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((void|)\\) at.*$srcfile:110" \ | |
b2bbed47 | 186 | "breakpoint info (after setting one-by-one)" |
c906108c SS |
187 | |
188 | ||
189 | ||
b2bbed47 MC |
190 | # Test choice "cancel". |
191 | # This is copy-and-paste from set_bp_overloaded. | |
c906108c SS |
192 | |
193 | send_gdb "break foo::overload1arg\n" | |
194 | gdb_expect { | |
b2bbed47 MC |
195 | -re "$menu_overload1arg" { |
196 | pass "bp menu for foo::overload1arg choice cancel" | |
197 | # Choose cancel. | |
198 | send_gdb "0\n" | |
199 | gdb_expect { | |
200 | -re "canceled\r\n$gdb_prompt $" { | |
201 | pass "set bp on overload1arg canceled" | |
202 | } | |
203 | -re "cancelled\r\n$gdb_prompt $" { | |
204 | pass "set bp on overload1arg canceled" | |
205 | } | |
206 | -re ".*$gdb_prompt $" { | |
207 | fail "set bp on overload1arg canceled (bad message)" | |
208 | } | |
209 | timeout { | |
210 | fail "set bp on overload1arg canceled (timeout)" | |
211 | take_gdb_out_of_choice_menu | |
212 | } | |
213 | } | |
214 | } | |
215 | -re ".*\r\n> " { | |
216 | fail "bp menu for foo::overload1arg choice cancel (bad menu)" | |
217 | take_gdb_out_of_choice_menu | |
218 | } | |
219 | -re ".*$gdb_prompt $" { | |
220 | fail "bp menu for foo::overload1arg choice cancel (no menu)" | |
221 | } | |
222 | timeout { | |
223 | fail "bp menu for foo::overload1arg choice cancel (timeout)" | |
224 | take_gdb_out_of_choice_menu | |
225 | } | |
226 | } | |
c906108c SS |
227 | |
228 | gdb_test "info break" \ | |
54e52265 | 229 | "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* |
cec808ec | 230 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main(\\((|void)\\))? at.*$srcfile:49\r |
c906108c | 231 | \[\t \]+breakpoint already hit 1 time\r |
d8937120 MC |
232 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:111\r |
233 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r | |
234 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r | |
cec808ec KS |
235 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short( int)?\\) at.*$srcfile:114\r |
236 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:115\r | |
d8937120 MC |
237 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfile:116\r |
238 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:117\r | |
cec808ec KS |
239 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long( int)?\\) at.*$srcfile:118\r |
240 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:119\r | |
d8937120 MC |
241 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:120\r |
242 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:121\r | |
243 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((void|)\\) at.*$srcfile:110" \ | |
b2bbed47 | 244 | "breakpoint info (after cancel)" |
c906108c SS |
245 | |
246 | ||
247 | ||
b2bbed47 | 248 | # Delete these breakpoints. |
c906108c SS |
249 | |
250 | send_gdb "delete breakpoints\n" | |
251 | gdb_expect { | |
b2bbed47 | 252 | -re "Delete all breakpoints.* $" { |
c906108c SS |
253 | send_gdb "y\n" |
254 | gdb_expect { | |
255 | -re ".*$gdb_prompt $" { | |
b2bbed47 MC |
256 | pass "delete all breakpoints" |
257 | } | |
258 | timeout { | |
259 | fail "delete all breakpoints (timeout)" | |
c906108c | 260 | } |
c906108c SS |
261 | } |
262 | } | |
b2bbed47 MC |
263 | timeout { |
264 | fail "delete all breakpoints (timeout)" | |
265 | } | |
c906108c SS |
266 | } |
267 | ||
b2bbed47 | 268 | gdb_test "info breakpoints" "No breakpoints or watchpoints." "breakpoint info (after delete)" |
c906108c SS |
269 | |
270 | ||
c906108c | 271 | |
b2bbed47 MC |
272 | # Test choice "all". |
273 | # This is copy-and-paste from set_bp_overloaded. | |
c906108c | 274 | |
b2bbed47 MC |
275 | send_gdb "break foo::overload1arg\n" |
276 | gdb_expect { | |
277 | -re "$menu_overload1arg" { | |
278 | pass "bp menu for foo::overload1arg choice all" | |
279 | # Choose all. | |
280 | send_gdb "1\n" | |
281 | gdb_expect { | |
ab5b5d61 | 282 | -re "Breakpoint $decimal at $hex: file.*$srcfile, line 121.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 120.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 119.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 118.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 117.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 116.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 115.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 114.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 113.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 112.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 111.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 110.\r\nwarning: Multiple breakpoints were set.\r\nUse the .delete. command to delete unwanted breakpoints.\r\n$gdb_prompt $" { |
b2bbed47 MC |
283 | pass "set bp on overload1arg all" |
284 | } | |
285 | -re ".*$gdb_prompt $" { | |
286 | fail "set bp on overload1arg all (bad message)" | |
287 | } | |
288 | timeout { | |
289 | fail "set bp on overload1arg all (timeout)" | |
290 | take_gdb_out_of_choice_menu | |
291 | } | |
292 | } | |
293 | } | |
294 | -re ".*\r\n> " { | |
295 | fail "bp menu for foo::overload1arg choice all (bad menu)" | |
296 | take_gdb_out_of_choice_menu | |
297 | } | |
298 | -re ".*$gdb_prompt $" { | |
299 | fail "bp menu for foo::overload1arg choice all (no menu)" | |
300 | } | |
301 | timeout { | |
302 | fail "bp menu for foo::overload1arg choice all (timeout)" | |
303 | take_gdb_out_of_choice_menu | |
304 | } | |
305 | } | |
c906108c SS |
306 | |
307 | gdb_test "info break" \ | |
54e52265 | 308 | "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* |
d8937120 MC |
309 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:121\r |
310 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:120\r | |
cec808ec KS |
311 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:119\r |
312 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long( int)?\\) at.*$srcfile:118\r | |
d8937120 MC |
313 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:117\r |
314 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfile:116\r | |
cec808ec KS |
315 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:115\r |
316 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short( int)?\\) at.*$srcfile:114\r | |
d8937120 MC |
317 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r |
318 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r | |
319 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:111\r | |
320 | \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((void|)\\) at.*$srcfile:110" \ | |
b2bbed47 MC |
321 | "breakpoint info (after setting on all)" |
322 | ||
c906108c SS |
323 | |
324 | ||
b2bbed47 MC |
325 | # Run through each breakpoint. |
326 | ||
d1fe6965 DC |
327 | # NOTE: carlton/2003-02-03: I'm seeing failures on some of the tests, |
328 | # with the wrong arg being printed out. Michael Chastain sees | |
329 | # failures at times, too, albeit fewer than I do. | |
330 | ||
331 | proc continue_to_bp_overloaded {might_kfail bpnumber argtype actuals} { | |
dfcd3bfb | 332 | global gdb_prompt hex decimal srcfile |
b2bbed47 MC |
333 | |
334 | send_gdb "continue\n" | |
c906108c | 335 | gdb_expect { |
b2bbed47 MC |
336 | -re "Continuing.\r\n\r\nBreakpoint ${bpnumber}, (${hex} in )?foo::overload1arg(\\(${argtype}\\))? \\(this=${hex}(, )?${actuals}\\) at.*${srcfile}:${decimal}\r\n${decimal}\[\t \]+int foo::overload1arg \\(${argtype}( arg)?\\).*\r\n.*$gdb_prompt $" { |
337 | pass "continue to bp overloaded : ${argtype}" | |
338 | } | |
d1fe6965 DC |
339 | -re "Continuing.\r\n\r\nBreakpoint ${bpnumber}, (${hex} in )?foo::overload1arg(\\(${argtype}\\))? \\(this=${hex}, arg=.*\\) at.*${srcfile}:${decimal}\r\n${decimal}\[\t \]+int foo::overload1arg \\(${argtype}( arg)?\\).*\r\n.*$gdb_prompt $" { |
340 | if $might_kfail { | |
341 | kfail "gdb/1025" "continue to bp overloaded : ${argtype}" | |
342 | } else { | |
343 | fail "continue to bp overloaded : ${argtype}" | |
344 | } | |
345 | } | |
b2bbed47 MC |
346 | -re ".*$gdb_prompt $" { |
347 | fail "continue to bp overloaded : ${argtype}" | |
348 | } | |
349 | timeout { | |
350 | fail "continue to bp overloaded : ${argtype} (timeout)" | |
351 | } | |
c906108c | 352 | } |
dfcd3bfb | 353 | } |
c906108c | 354 | |
d1fe6965 DC |
355 | continue_to_bp_overloaded 0 25 "(void|)" "" |
356 | continue_to_bp_overloaded 1 24 "char" "arg=2 \\'\\\\002\\'" | |
357 | continue_to_bp_overloaded 1 23 "signed char" "arg=3 \\'\\\\003\\'" | |
358 | continue_to_bp_overloaded 1 22 "unsigned char" "arg=4 \\'\\\\004\\'" | |
359 | continue_to_bp_overloaded 1 21 "short" "arg=5" | |
360 | continue_to_bp_overloaded 1 20 "unsigned short" "arg=6" | |
361 | continue_to_bp_overloaded 0 19 "int" "arg=7" | |
362 | continue_to_bp_overloaded 0 18 "(unsigned|unsigned int)" "arg=8" | |
363 | continue_to_bp_overloaded 0 17 "long" "arg=9" | |
364 | continue_to_bp_overloaded 0 16 "unsigned long" "arg=10" | |
365 | continue_to_bp_overloaded 0 15 "float" "arg=100" | |
366 | continue_to_bp_overloaded 1 14 "double" "arg=200" | |
b2bbed47 | 367 | |
eae06beb JB |
368 | # Test breaking on an overloaded function when multiple-symbols |
369 | # is set to "cancel" | |
a8d52276 | 370 | gdb_test_no_output "set multiple-symbols cancel" |
eae06beb JB |
371 | gdb_test "break foo::foofunc" \ |
372 | "canceled.*" | |
373 | ||
374 | # Test breaking on an overloaded function when multiple-symbols | |
375 | # is set to "all" | |
a8d52276 | 376 | gdb_test_no_output "set multiple-symbols all" |
eae06beb JB |
377 | gdb_test "break foo::foofunc" \ |
378 | "Breakpoint \[0-9\]+ at ${hex}: file .*ovldbreak\\.cc, line \[0-9\]+\\.\r\nBreakpoint \[0-9\]+ at ${hex}: file .*ovldbreak\\.cc, line \[0-9\]+\\.\r\nwarning: Multiple breakpoints were set\\.\r\nUse the \"delete\" command to delete unwanted breakpoints\\." | |
dfcd3bfb | 379 | |
b2bbed47 | 380 | # That's all, folks. |
dfcd3bfb JM |
381 | |
382 | gdb_continue_to_end "finish program" |