OLD | NEW |
1 # Copyright (C) 1998-1999, 2001, 2004, 2007-2012 Free Software | 1 # Copyright (C) 1998-1999, 2001, 2004, 2007-2012 Free Software |
2 # Foundation, Inc. | 2 # Foundation, Inc. |
3 | 3 |
4 # This program is free software; you can redistribute it and/or modify | 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 | 5 # it under the terms of the GNU General Public License as published by |
6 # the Free Software Foundation; either version 3 of the License, or | 6 # the Free Software Foundation; either version 3 of the License, or |
7 # (at your option) any later version. | 7 # (at your option) any later version. |
8 # | 8 # |
9 # This program is distributed in the hope that it will be useful, | 9 # This program is distributed in the hope that it will be useful, |
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 # GNU General Public License for more details. | 12 # GNU General Public License for more details. |
13 # | 13 # |
14 # You should have received a copy of the GNU General Public License | 14 # You should have received a copy of the GNU General Public License |
15 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 |
17 # written by Elena Zannoni (ezannoni@cygnus.com) | 17 # written by Elena Zannoni (ezannoni@cygnus.com) |
18 # modified by Michael Chastain (chastain@redhat.com) | 18 # modified by Michael Chastain (chastain@redhat.com) |
19 | 19 |
20 # This file is part of the gdb testsuite | 20 # This file is part of the gdb testsuite |
21 # | 21 # |
22 # tests for overloaded member functions. Set breakpoints on | 22 # tests for overloaded member functions. Set breakpoints on |
23 # overloaded member functions | 23 # overloaded member functions |
24 # | 24 # |
25 | 25 |
26 global timeout | 26 global timeout |
27 set timeout 15 | 27 set timeout 15 |
28 if $tracelevel then { | |
29 strace $tracelevel | |
30 } | |
31 | |
32 # | 28 # |
33 # test running programs | 29 # test running programs |
34 # | 30 # |
35 | 31 |
36 if { [skip_cplus_tests] } { continue } | 32 if { [skip_cplus_tests] } { continue } |
37 | 33 |
38 set testfile "ovldbreak" | 34 standard_testfile .cc |
39 set srcfile ${testfile}.cc | |
40 set binfile ${objdir}/${subdir}/${testfile} | |
41 | 35 |
42 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug c++}] != "" } { | 36 if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} { |
43 untested ovldbreak.exp | 37 return -1 |
44 return -1 | |
45 } | 38 } |
46 | 39 |
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 | 40 # set it up at a breakpoint so we can play with the variable values |
53 # | 41 # |
54 if ![runto_main] then { | 42 if {![runto_main]} { |
55 perror "couldn't run to breakpoint" | 43 perror "couldn't run to breakpoint" |
56 continue | 44 continue |
57 } | 45 } |
58 | 46 |
59 | |
60 | |
61 # When I ask gdb to set a breakpoint on an overloaded function, | 47 # 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 | 48 # 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). | 49 # (for example, if C++ name mangling is not working properly). |
64 # | 50 # |
65 # This procedure issues a command that works at either the menu | 51 # This procedure issues a command that works at either the menu |
66 # prompt or the command prompt to get back to the command prompt. | 52 # prompt or the command prompt to get back to the command prompt. |
67 # | 53 # |
68 # Note that an empty line won't do it (it means 'repeat the previous command' | 54 # 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. | 55 # at top level). A line with a single space in it works nicely. |
70 | 56 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 -re ".*$gdb_prompt $" { | 103 -re ".*$gdb_prompt $" { |
118 fail "bp menu for $name choice $mychoice (no menu)" | 104 fail "bp menu for $name choice $mychoice (no menu)" |
119 } | 105 } |
120 timeout { | 106 timeout { |
121 fail "bp menu for $name choice $mychoice (timeout)" | 107 fail "bp menu for $name choice $mychoice (timeout)" |
122 take_gdb_out_of_choice_menu | 108 take_gdb_out_of_choice_menu |
123 } | 109 } |
124 } | 110 } |
125 } | 111 } |
126 | 112 |
127 # This is the expected menu for overload1arg. | 113 # Compute the expected menu for overload1arg. |
128 # Note the arg type variations for void and integer types. | 114 # Note the arg type variations for void and integer types. |
129 # This accommodates different versions of g++. | 115 # This accommodates different versions of g++. |
130 | 116 |
131 set menu_overload1arg "\\\[0\\\] cancel\r\n" | 117 # Probe for the real types. This will do some unnecessary checking |
132 append menu_overload1arg "\\\[1\\\] all\r\n" | 118 # for some simple types (like "int"), but it's just easier to loop |
133 append menu_overload1arg "\\\[2\\\] .*$srcfile:foo::overload1arg\\(double\\)\r\n
" | 119 # over all_types instead of calling out just the exceptions. |
134 append menu_overload1arg "\\\[3\\\] .*$srcfile:foo::overload1arg\\(float\\)\r\n" | 120 # This list /must/ remain in the same order that the methods are |
135 append menu_overload1arg "\\\[4\\\] .*$srcfile:foo::overload1arg\\((unsigned lon
g|long unsigned)( int)?\\)\r\n" | 121 # called in the source code. Otherwise the order in which breakpoints |
136 append menu_overload1arg "\\\[5\\\] .*$srcfile:foo::overload1arg\\(long( int)?\\
)\r\n" | 122 # are hit (tested below) will be incorrect. |
137 append menu_overload1arg "\\\[6\\\] .*$srcfile:foo::overload1arg\\((unsigned int
|unsigned)\\)\r\n" | 123 set all_types [list void char signed_char unsigned_char short_int \ |
138 append menu_overload1arg "\\\[7\\\] .*$srcfile:foo::overload1arg\\(int\\)\r\n" | 124 » » unsigned_short_int int unsigned_int long_int \ |
139 append menu_overload1arg "\\\[8\\\] .*$srcfile:foo::overload1arg\\((unsigned sho
rt|short unsigned)( int)?\\)\r\n" | 125 » » unsigned_long_int float double] |
140 append menu_overload1arg "\\\[9\\\] .*$srcfile:foo::overload1arg\\(short( int)?\
\)\r\n" | 126 |
141 append menu_overload1arg "\\\[10\\\] .*$srcfile:foo::overload1arg\\(unsigned cha
r\\)\r\n" | 127 # ARGUMENTS is an array that will map from synthetic type to argument |
142 append menu_overload1arg "\\\[11\\\] .*$srcfile:foo::overload1arg\\(signed char\
\)\r\n" | 128 # expressions in the source code, which is of the form "arg = $decimal". |
143 append menu_overload1arg "\\\[12\\\] .*$srcfile:foo::overload1arg\\(char\\)\r\n" | 129 # ARGUMENTS stores this decimal number. |
144 append menu_overload1arg "\\\[13\\\] .*$srcfile:foo::overload1arg\\((void|)\\)\r
\n" | 130 array set arguments { |
145 append menu_overload1arg "> $" | 131 void "" |
| 132 char 2 |
| 133 signed_char 3 |
| 134 unsigned_char 4 |
| 135 short_int 5 |
| 136 unsigned_short_int 6 |
| 137 int 7 |
| 138 unsigned_int 8 |
| 139 long_int 9 |
| 140 unsigned_long_int 10 |
| 141 float 100(.0)? |
| 142 double 200(.0)? |
| 143 } |
| 144 |
| 145 unset -nocomplain line types |
| 146 foreach type $all_types { |
| 147 # TYPES is an array that maps the synthetic names in ALL_TYPES |
| 148 # to the real type used in the debugger. These will be checked |
| 149 # below and changed if the debugger thinks they are different from |
| 150 # their default values. |
| 151 set types($type) [join [split $type "_"] " "] |
| 152 |
| 153 # LINE is an array that will map from synthetic type to line number. |
| 154 # in the source code. |
| 155 set line($type) [gdb_get_line_number "fo1 $type"] |
| 156 |
| 157 # Probe for the actual type. |
| 158 gdb_test_multiple "print &foo::overload1arg($types($type))" \ |
| 159 "probe $types($type)" { |
| 160 -re ".*\<foo::.*\>.*$gdb_prompt $" { |
| 161 » regexp {<.*>} $expect_out(0,string) func |
| 162 » regexp {\(.*\)} $func real_type |
| 163 |
| 164 » # Store the real type into TYPES. |
| 165 » set types($type) [string trim $real_type {()}] |
| 166 |
| 167 » # Create an inverse mapping of the actual type to |
| 168 » # the synthetic type. |
| 169 » set type_map("$types($type)") $type |
| 170 » pass "detect $type" |
| 171 » } |
| 172 } |
| 173 } |
| 174 |
| 175 # This is a list of the actual overloaded method arguments. |
| 176 set overloads {} |
| 177 foreach type $all_types { |
| 178 lappend overloads $types($type) |
| 179 } |
| 180 |
| 181 # Sort this list alphabetically. |
| 182 set overloads [lsort $overloads] |
| 183 |
| 184 # Create the menu list. |
| 185 set items {"cancel" "all"} |
| 186 foreach ovld $overloads { |
| 187 lappend items "$srcfile:foo::overload1arg\\($ovld\\)" |
| 188 } |
| 189 set menu_items {} |
| 190 set idx 0 |
| 191 foreach item $items { |
| 192 lappend menu_items ".$idx. .*$item" |
| 193 incr idx |
| 194 } |
| 195 set menu_overload1arg [join $menu_items {[\r\n]*}] |
| 196 append menu_overload1arg {[\r\n]*> $} |
146 | 197 |
147 # Set multiple-symbols to "ask", to allow us to test the use | 198 # Set multiple-symbols to "ask", to allow us to test the use |
148 # of the multiple-choice menu when breaking on an overloaded method. | 199 # of the multiple-choice menu when breaking on an overloaded method. |
149 gdb_test_no_output "set multiple-symbols ask" | 200 gdb_test_no_output "set multiple-symbols ask" |
150 | 201 |
151 # Set breakpoints on foo::overload1arg, one by one. | 202 # Set breakpoints on foo::overload1arg, one by one. |
152 | 203 set bpnum 1 |
153 set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 12 2 111 | 204 set method "foo::overload1arg" |
154 set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 11 3 112 | 205 for {set idx 0} {$idx < [llength $overloads]} {incr idx} { |
155 set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 10 4 113 | 206 set type [lindex $overloads $idx] |
156 set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 9 5 114 | 207 set_bp_overloaded $method $menu_overload1arg \ |
157 set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 8 6 115 | 208 » [expr {$idx + 2}] [incr bpnum] $line($type_map("$type")) |
158 set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 7 7 116 | 209 } |
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 | |
165 | |
166 | |
167 | 210 |
168 # Verify the breakpoints. | 211 # Verify the breakpoints. |
169 | 212 set bptable "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*" |
170 gdb_test "info break" \ | 213 append bptable "\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main
(\\((|void)\\))? at.*$srcfile:49\[\r\n\]+" |
171 "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* | 214 append bptable "\[\t \]+breakpoint already hit 1 time\[\r\n\]+" |
172 \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main(\\((|void)\\))?
at.*$srcfile:49\r | 215 foreach ovld $overloads { |
173 \[\t \]+breakpoint already hit 1 time\r | 216 append bptable [format "\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\
t \]+in foo::overload1arg\\(%s\\) at.*$srcfile:%d\[\r\n\]+" $ovld \ |
174 \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(
char\\) at.*$srcfile:111\r | 217 » » » $line($type_map("$ovld"))] |
175 \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(
signed char\\) at.*$srcfile:112\r | 218 } |
176 \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(
unsigned char\\) at.*$srcfile:113\r | 219 gdb_test "info break" $bptable "breakpoint info (after setting one-by-one)" |
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 | |
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 | |
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 | |
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" \ | |
186 "breakpoint info (after setting one-by-one)" | |
187 | |
188 | |
189 | 220 |
190 # Test choice "cancel". | 221 # Test choice "cancel". |
191 # This is copy-and-paste from set_bp_overloaded. | 222 # This is copy-and-paste from set_bp_overloaded. |
192 | 223 |
193 send_gdb "break foo::overload1arg\n" | 224 send_gdb "break foo::overload1arg\n" |
194 gdb_expect { | 225 gdb_expect { |
195 -re "$menu_overload1arg" { | 226 -re "$menu_overload1arg" { |
196 pass "bp menu for foo::overload1arg choice cancel" | 227 pass "bp menu for foo::overload1arg choice cancel" |
197 # Choose cancel. | 228 # Choose cancel. |
198 send_gdb "0\n" | 229 send_gdb "0\n" |
(...skipping 19 matching lines...) Expand all Loading... |
218 } | 249 } |
219 -re ".*$gdb_prompt $" { | 250 -re ".*$gdb_prompt $" { |
220 fail "bp menu for foo::overload1arg choice cancel (no menu)" | 251 fail "bp menu for foo::overload1arg choice cancel (no menu)" |
221 } | 252 } |
222 timeout { | 253 timeout { |
223 fail "bp menu for foo::overload1arg choice cancel (timeout)" | 254 fail "bp menu for foo::overload1arg choice cancel (timeout)" |
224 take_gdb_out_of_choice_menu | 255 take_gdb_out_of_choice_menu |
225 } | 256 } |
226 } | 257 } |
227 | 258 |
228 gdb_test "info break" \ | 259 gdb_test "info break" $bptable "breakpoint info (after cancel)" |
229 "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* | |
230 \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main(\\((|void)\\))?
at.*$srcfile:49\r | |
231 \[\t \]+breakpoint already hit 1 time\r | |
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 | |
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 | |
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 | |
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 | |
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" \ | |
244 "breakpoint info (after cancel)" | |
245 | |
246 | |
247 | 260 |
248 # Delete these breakpoints. | 261 # Delete these breakpoints. |
249 | 262 |
250 send_gdb "delete breakpoints\n" | 263 send_gdb "delete breakpoints\n" |
251 gdb_expect { | 264 gdb_expect { |
252 -re "Delete all breakpoints.* $" { | 265 -re "Delete all breakpoints.* $" { |
253 send_gdb "y\n" | 266 send_gdb "y\n" |
254 gdb_expect { | 267 gdb_expect { |
255 -re ".*$gdb_prompt $" { | 268 -re ".*$gdb_prompt $" { |
256 pass "delete all breakpoints" | 269 pass "delete all breakpoints" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 } | 310 } |
298 -re ".*$gdb_prompt $" { | 311 -re ".*$gdb_prompt $" { |
299 fail "bp menu for foo::overload1arg choice all (no menu)" | 312 fail "bp menu for foo::overload1arg choice all (no menu)" |
300 } | 313 } |
301 timeout { | 314 timeout { |
302 fail "bp menu for foo::overload1arg choice all (timeout)" | 315 fail "bp menu for foo::overload1arg choice all (timeout)" |
303 take_gdb_out_of_choice_menu | 316 take_gdb_out_of_choice_menu |
304 } | 317 } |
305 } | 318 } |
306 | 319 |
307 gdb_test "info break" \ | 320 # Create the breakpoint table for "info breakpoint". |
308 "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* | 321 set bptable "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*\[\r\n]+" |
309 \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+<MULTIPLE>\[\t \]*\r | 322 append bptable "\[0-9\]+\[\t \]+breakpoint\[\t \]+keep\[\t \]y\[\t \]+<MULTIPLE>
.*\[\r\n\]+" |
310 \[0-9\]+.1\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$src
file:121\r | 323 foreach ovld {void char signed_char unsigned_char short_int \ |
311 \[0-9\]+.2\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcf
ile:120\r | 324 » » unsigned_short_int int unsigned_int long_int \ |
312 \[0-9\]+.3\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned long|lon
g unsigned)( int)?\\) at.*$srcfile:119\r | 325 » » unsigned_long_int float double} { |
313 \[0-9\]+.4\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long( int)?\\) at.
*$srcfile:118\r | 326 append bptable [format "\[0-9\]+.\[0-9\]+\[\t \]+y\[\t \]+$hex\[\t \]+in foo::
overload1arg\\(%s\\) at.*$srcfile:%d\[\r\n\]+" \ |
314 \[0-9\]+.5\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned
int)\\) at.*$srcfile:117\r | 327 » » $types($ovld) $line($ovld)] |
315 \[0-9\]+.6\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfil
e:116\r | 328 } |
316 \[0-9\]+.7\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned short|sh
ort unsigned)( int)?\\) at.*$srcfile:115\r | |
317 \[0-9\]+.8\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short( int)?\\) at
.*$srcfile:114\r | |
318 \[0-9\]+.9\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) a
t.*$srcfile:113\r | |
319 \[0-9\]+.10\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at
.*$srcfile:112\r | |
320 \[0-9\]+.11\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcf
ile:111\r | |
321 \[0-9\]+.12\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((void|)\\) at.*$s
rcfile:110" \ | |
322 "breakpoint info (after setting on all)" | |
323 | 329 |
324 | 330 gdb_test "info break" $bptable "breakpoint info (after setting on all)" |
325 | 331 |
326 # Run through each breakpoint. | 332 # Run through each breakpoint. |
| 333 proc continue_to_bp_overloaded {bpnumber might_fail line argtype argument} { |
| 334 global gdb_prompt hex decimal srcfile |
327 | 335 |
328 # NOTE: carlton/2003-02-03: I'm seeing failures on some of the tests, | 336 if {$argument == ""} { |
329 # with the wrong arg being printed out. Michael Chastain sees | 337 set actuals "" |
330 # failures at times, too, albeit fewer than I do. | 338 } else { |
| 339 set actuals "arg=$argument" |
| 340 if {[regexp {char} $argtype]} { |
| 341 » append actuals " \\'\\\\00$argument\\'" |
| 342 } |
| 343 } |
331 | 344 |
332 proc continue_to_bp_overloaded {might_kfail bpnumber argtype actuals} { | 345 if {[string match $argtype "void"]} { |
333 global gdb_prompt hex decimal srcfile | 346 set body "return $decimal;" |
| 347 } else { |
| 348 set body "arg = 0; return $decimal;" |
| 349 } |
334 | 350 |
335 send_gdb "continue\n" | 351 gdb_test_multiple "continue" "continue to bp overloaded : $argtype" { |
336 gdb_expect { | 352 -re "Continuing.\r\n\r\nBreakpoint $bpnumber, foo::overload1arg \\(this=
${hex}(, )?$actuals\\) at .*$srcfile:$line\r\n$decimal\[\t \]+{ $body }.*$gdb_pr
ompt $" { |
337 » -re "Continuing.\r\n\r\nBreakpoint ${bpnumber}, foo::overload1arg \\(thi
s=${hex}(, )?${actuals}\\) at.*${srcfile}:${decimal}\r\n${decimal}\[\t \]+int fo
o::overload1arg \\(${argtype}( arg)?\\).*\r\n.*$gdb_prompt $" { | 353 pass "continue to bp overloaded : $argtype" |
338 » pass "continue to bp overloaded : ${argtype}" | 354 } |
339 » } | 355 |
340 » -re "Continuing.\r\n\r\nBreakpoint ${bpnumber}, foo::overload1arg \\(thi
s=${hex}, arg=.*\\) at.*${srcfile}:${decimal}\r\n${decimal}\[\t \]+int foo::over
load1arg \\(${argtype}( arg)?\\).*\r\n.*$gdb_prompt $" { | 356 -re "Continuing.\r\n\r\nBreakpoint $bpnumber, foo::overload1arg \\(this=
${hex}, arg=.*\\) at .*$srcfile:$line\r\n$decimal\[\t \]+{ $body }.*$gdb_prompt
$" { |
341 » if $might_kfail { | 357 if $might_kfail { |
342 » » kfail "gdb/1025" "continue to bp overloaded : ${argtype}" | 358 kfail "c++/8130" "continue to bp overloaded : $argtype" |
343 » } else { | 359 } else { |
344 » » fail "continue to bp overloaded : ${argtype}" | 360 fail "continue to bp overloaded : $argtype" |
345 » } | 361 } |
346 » } | 362 } |
347 -re ".*$gdb_prompt $" { | |
348 » fail "continue to bp overloaded : ${argtype}" | |
349 » } | |
350 timeout { | |
351 » fail "continue to bp overloaded : ${argtype} (timeout)" | |
352 » } | |
353 } | 363 } |
354 } | 364 } |
355 | 365 |
356 continue_to_bp_overloaded 0 14 "(void|)" "" | 366 # An array which describes which of these methods might be expected |
357 continue_to_bp_overloaded 1 14 "char" "arg=2 \\'\\\\002\\'" | 367 # to kfail on GCC 2.95. See C++/8210. |
358 continue_to_bp_overloaded 1 14 "signed char" "arg=3 \\'\\\\003\\'" | 368 array set might_fail { |
359 continue_to_bp_overloaded 1 14 "unsigned char" "arg=4 \\'\\\\004\\'" | 369 void 0 |
360 continue_to_bp_overloaded 1 14 "short" "arg=5" | 370 char 1 |
361 continue_to_bp_overloaded 1 14 "unsigned short" "arg=6" | 371 signed_char 1 |
362 continue_to_bp_overloaded 0 14 "int" "arg=7" | 372 unsigned_char 1 |
363 continue_to_bp_overloaded 0 14 "(unsigned|unsigned int)" "arg=8" | 373 short_int 1 |
364 continue_to_bp_overloaded 0 14 "long" "arg=9" | 374 unsigned_short_int 1 |
365 continue_to_bp_overloaded 0 14 "unsigned long" "arg=10" | 375 int 0 |
366 continue_to_bp_overloaded 0 14 "float" "arg=100" | 376 unsigned_int 0 |
367 continue_to_bp_overloaded 1 14 "double" "arg=200" | 377 long_int 0 |
| 378 unsigned_long_int 0 |
| 379 float 0 |
| 380 double 1 |
| 381 } |
| 382 |
| 383 foreach type $all_types { |
| 384 continue_to_bp_overloaded 14 $might_fail($type) $line($type) \ |
| 385 » $type $arguments($type) |
| 386 } |
368 | 387 |
369 # Test breaking on an overloaded function when multiple-symbols | 388 # Test breaking on an overloaded function when multiple-symbols |
370 # is set to "cancel" | 389 # is set to "cancel" |
371 gdb_test_no_output "set multiple-symbols cancel" | 390 gdb_test_no_output "set multiple-symbols cancel" |
372 gdb_test "break foo::foofunc" \ | 391 gdb_test "break foo::foofunc" \ |
373 "canceled.*" | 392 "canceled.*" |
374 | 393 |
375 # Test breaking on an overloaded function when multiple-symbols | 394 # Test breaking on an overloaded function when multiple-symbols |
376 # is set to "all" | 395 # is set to "all" |
377 gdb_test_no_output "set multiple-symbols all" | 396 gdb_test_no_output "set multiple-symbols all" |
378 gdb_test "break foo::foofunc" \ | 397 gdb_test "break foo::foofunc" \ |
379 "Breakpoint \[0-9\]+ at ${hex}: foo::foofunc. .2 locations..*" | 398 "Breakpoint \[0-9\]+ at ${hex}: foo::foofunc. .2 locations..*" |
380 | 399 |
381 # That's all, folks. | 400 # That's all, folks. |
382 | 401 |
| 402 unset -nocomplain line types |
383 gdb_continue_to_end "finish program" | 403 gdb_continue_to_end "finish program" |
OLD | NEW |