* gdb.cp/abstract-origin.exp: Use standard_testfile.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cp / cplusfuncs.exp
1 # Copyright 1992, 1997, 1999, 2001-2004, 2007-2012 Free Software
2 # 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 3 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, see <http://www.gnu.org/licenses/>.
16
17 # This file was written by Fred Fish. (fnf@cygnus.com)
18 # Adapted for g++ 3.0 ABI by Michael Chastain. (chastain@redhat.com)
19
20 if { [skip_cplus_tests] } { continue }
21
22 standard_testfile .cc
23
24 if { [get_compiler_info "c++"] } {
25 return -1
26 }
27
28 if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
29 return -1
30 }
31
32 #
33 # g++ changed its ABI between 2.95 and 3.0. gdb has two demanglers
34 # for the two different styles. The two demanglers have some subtle
35 # discrepancies in their output.
36 #
37 # old demangler new demangler
38 # --- --------- --- ---------
39 # "operator, " "operator,"
40 # "char *" "char*"
41 # "int *" "int*"
42 # "long *" "long*"
43 # "void *" "void*"
44 # "foo &" "foo&"
45 # "unsigned int" "unsigned"
46 # "void" ""
47 #
48 # I probe for the forms in use.
49 # The defaults are for the v3 demangler (as of 2001-02-13).
50 #
51
52 set dm_operator_comma ","
53 set dm_type_char_star "char*"
54 set dm_type_char_star_quoted "char\\*"
55 set dm_type_foo_ref "foo&"
56 set dm_type_int_star "int*"
57 set dm_type_long_star "long*"
58 set dm_type_unsigned_int "unsigned"
59 set dm_type_void "void"
60 set dm_type_void_star "void*"
61
62 # Some other vagaries of GDB's type printing machinery. The integer types
63 # may have unsigned before or after their length, and may have "int"
64 # appended. The char* conversion operator may have name "char*" even if
65 # the type is "char *", because the name comes from the debug information
66 # and the type from GDB. Function types may not see through typedefs.
67
68 set dm_type_short "short"
69 set dm_type_long "long"
70 set dm_type_unsigned_short "unsigned short"
71 set dm_type_unsigned_long "unsigned long"
72 set dm_operator_char_star "char*"
73 set dm_operator_char_star_quoted "char\\*"
74 set dm_type_typedef 0
75
76 proc probe_demangler { } {
77 global gdb_prompt
78 global dm_operator_comma
79 global dm_operator_char_star
80 global dm_operator_char_star_quoted
81 global dm_type_char_star
82 global dm_type_char_star_quoted
83 global dm_type_foo_ref
84 global dm_type_int_star
85 global dm_type_long_star
86 global dm_type_unsigned_int
87 global dm_type_void
88 global dm_type_void_star
89 global dm_type_short
90 global dm_type_unsigned_short
91 global dm_type_long
92 global dm_type_unsigned_long
93 global dm_type_typedef
94
95 gdb_test_multiple "print &foo::operator,(foo&)" \
96 "detect dm_operator_comma" {
97 -re ".*foo::operator, \\(.*foo.*&.*\\).*\r\n$gdb_prompt $" {
98 # v2 demangler
99 set dm_operator_comma ", "
100 pass "detect dm_operator_comma"
101 }
102 -re ".*foo::operator,\\(.*foo.*&.*\\).*\r\n$gdb_prompt $" {
103 # v3 demangler
104 pass "detect dm_operator_comma"
105 }
106 }
107
108 gdb_test_multiple "print &foo::operator char*($dm_type_void)" \
109 "detect dm_operator_char_star" {
110 -re ".*foo::operator char \\*\\(void\\).*\r\n$gdb_prompt $" {
111 # v2 demangler or GDB type printer
112 set dm_operator_char_star "char *"
113 set dm_operator_char_star_quoted "char \\*"
114 pass "detect dm_operator_char_star"
115 }
116 -re ".*foo::operator char\\*\\(\\).*\r\n$gdb_prompt $" {
117 # v3 demangler
118 pass "detect dm_operator_char_star"
119 }
120 }
121
122 gdb_test_multiple "print &dm_type_char_star" \
123 "detect dm_type_char_star" {
124 -re ".*dm_type_char_star\\(char \\*\\).*\r\n$gdb_prompt $" {
125 # v2 demangler
126 set dm_type_char_star "char *"
127 set dm_type_char_star_quoted "char \\*"
128 pass "detect dm_type_char_star"
129 }
130 -re ".*dm_type_char_star\\(char\\*\\).*\r\n$gdb_prompt $" {
131 # v3 demangler
132 pass "detect dm_type_char_star"
133 }
134 }
135
136 gdb_test_multiple "print &dm_type_foo_ref" \
137 "detect dm_type_foo_ref" {
138 -re ".*dm_type_foo_ref\\(foo &\\).*\r\n$gdb_prompt $" {
139 # v2 demangler
140 set dm_type_foo_ref "foo &"
141 pass "detect dm_type_foo_ref"
142 }
143 -re ".*dm_type_foo_ref\\(foo&\\).*\r\n$gdb_prompt $" {
144 # v3 demangler
145 pass "detect dm_type_foo_ref"
146 }
147 }
148
149 gdb_test_multiple "print &dm_type_int_star" \
150 "detect dm_type_int_star" {
151 -re ".*dm_type_int_star\\(int \\*\\).*\r\n$gdb_prompt $" {
152 # v2 demangler
153 set dm_type_int_star "int *"
154 pass "detect dm_type_int_star"
155 }
156 -re ".*dm_type_int_star\\(int\\*\\).*\r\n$gdb_prompt $" {
157 # v3 demangler
158 pass "detect dm_type_int_star"
159 }
160 }
161
162 gdb_test_multiple "print &dm_type_long_star" \
163 "detect dm_type_long_star" {
164 -re ".*dm_type_long_star\\(long \\*\\).*\r\n$gdb_prompt $" {
165 # v2 demangler
166 set dm_type_long_star "long *"
167 pass "detect dm_type_long_star"
168 }
169 -re ".*dm_type_long_star\\(long\\*\\).*\r\n$gdb_prompt $" {
170 # v3 demangler
171 pass "detect dm_type_long_star"
172 }
173 -re ".*dm_type_long_star\\(long int \\*\\).*\r\n$gdb_prompt $" {
174 # GCC v3 and GDB's type printer
175 set dm_type_long_star "long int *"
176 pass "detect dm_type_long_star"
177 }
178 }
179
180 gdb_test_multiple "print &dm_type_unsigned_int" \
181 "detect dm_type_unsigned_int" {
182 -re ".*dm_type_unsigned_int\\(unsigned int\\).*\r\n$gdb_prompt $" {
183 # v2 demangler
184 set dm_type_unsigned_int "unsigned int"
185 pass "detect dm_type_unsigned_int"
186 }
187 -re ".*dm_type_unsigned_int\\(unsigned\\).*\r\n$gdb_prompt $" {
188 # v3 demangler
189 pass "detect dm_type_unsigned_int"
190 }
191 }
192
193 gdb_test_multiple "print &dm_type_void" \
194 "detect dm_type_void" {
195 -re ".*dm_type_void\\(void\\).*\r\n$gdb_prompt $" {
196 # v2 demangler
197 set dm_type_void "void"
198 pass "detect dm_type_void"
199 }
200 -re ".*dm_type_void\\(\\).*\r\n$gdb_prompt $" {
201 # v3 demangler
202 pass "detect dm_type_void"
203 }
204 }
205
206 gdb_test_multiple "print &dm_type_void_star" \
207 "detect dm_type_void_star" {
208 -re ".*dm_type_void_star\\(void \\*\\).*\r\n$gdb_prompt $" {
209 # v2 demangler
210 set dm_type_void_star "void *"
211 pass "detect dm_type_void_star"
212 }
213 -re ".*dm_type_void_star\\(void\\*\\).*\r\n$gdb_prompt $" {
214 # v3 demangler
215 pass "detect dm_type_void_star"
216 }
217 }
218
219 gdb_test_multiple "print &dm_type_short" \
220 "detect dm_type_short" {
221 -re ".*dm_type_short\\(short\\).*\r\n$gdb_prompt $" {
222 # v2 and v3 demanglers
223 pass "detect dm_type_short"
224 }
225 -re ".*dm_type_short\\(short int\\).*\r\n$gdb_prompt $" {
226 # GDB type printer
227 set dm_type_short "short int"
228 pass "detect dm_type_short"
229 }
230 }
231
232 gdb_test_multiple "print &dm_type_unsigned_short" \
233 "detect dm_type_unsigned_short" {
234 -re ".*dm_type_unsigned_short\\(unsigned short\\).*\r\n$gdb_prompt $" {
235 # v2 and v3 demanglers
236 pass "detect dm_type_unsigned_short"
237 }
238 -re ".*dm_type_unsigned_short\\(short unsigned int\\).*\r\n$gdb_prompt $" {
239 # GDB type printer
240 set dm_type_unsigned_short "short unsigned int"
241 pass "detect dm_type_unsigned_short"
242 }
243 }
244
245 gdb_test_multiple "print &dm_type_long" \
246 "detect dm_type_long" {
247 -re ".*dm_type_long\\(long\\).*\r\n$gdb_prompt $" {
248 # v2 and v3 demanglers
249 pass "detect dm_type_long"
250 }
251 -re ".*dm_type_long\\(long int\\).*\r\n$gdb_prompt $" {
252 # GDB type printer
253 set dm_type_long "long int"
254 pass "detect dm_type_long"
255 }
256 }
257
258 gdb_test_multiple "print &dm_type_unsigned_long" \
259 "detect dm_type_unsigned_long" {
260 -re ".*dm_type_unsigned_long\\(unsigned long\\).*\r\n$gdb_prompt $" {
261 # v2 and v3 demanglers
262 pass "detect dm_type_unsigned_long"
263 }
264 -re ".*dm_type_unsigned_long\\(long unsigned int\\).*\r\n$gdb_prompt $" {
265 # GDB type printer
266 set dm_type_unsigned_long "long unsigned int"
267 pass "detect dm_type_unsigned_long"
268 }
269 }
270
271 gdb_test_multiple "print &dm_type_typedef" \
272 "detect dm_type_typedef" {
273 -re ".*dm_type_typedef\\(int\\).*\r\n$gdb_prompt $" {
274 # v2 and v3 demanglers
275 pass "detect dm_type_typedef"
276 }
277 -re ".*dm_type_typedef\\(myint\\).*\r\n$gdb_prompt $" {
278 # GDB type printer
279 set dm_type_typedef 1
280 pass "detect dm_type_typedef"
281 }
282 }
283 }
284
285 #
286 # Lookup a specific C++ function and print the demangled type.
287 # This form accepts the demangled type as a regexp.
288 #
289
290 proc info_func_regexp { name demangled } {
291 global gdb_prompt
292
293 regsub {\\\(void\\\)} $demangled {\(\)} demangled
294
295 gdb_test "info function $name" \
296 "File .*:\r\n(class|)${demangled}.*" \
297 "info function for \"$name\""
298 }
299
300 #
301 # Lookup a specific C++ function and print the demangled type.
302 # This form accepts the demangled type as a literal string.
303 #
304
305 proc info_func { name demangled } {
306 info_func_regexp "$name" [string_to_regexp "$demangled"]
307 }
308
309 #
310 # Print the address of a function.
311 # This checks that I can lookup a fully qualified C++ function.
312 # This also checks the argument types on the return string.
313
314 # Note: carlton/2003-01-16: If you modify this, make a corresponding
315 # modification to print_addr_2_kfail.
316
317 proc print_addr_2 { name good } {
318 global gdb_prompt
319 global hex
320
321 set good_pattern [string_to_regexp $good]
322
323 gdb_test "print &$name" \
324 ".* = .* $hex <$good_pattern>"
325 }
326
327 # NOTE: carlton/2003-01-16: hairyfunc5-6 fail on GCC 3.x (for at least
328 # x=1 and x=2.1). So I'm modifying print_addr_2 to accept a failure
329 # condition. FIXME: It would be nice if the failure condition were
330 # conditional on the compiler version, but I'm not sufficiently
331 # motivated. I did hardwire in the versions of char * and int *,
332 # which will give some compiler-specificity to the failure.
333
334 proc print_addr_2_kfail { name good bad bugid } {
335 global gdb_prompt
336 global hex
337
338 set good_pattern [string_to_regexp $good]
339 set bad_pattern [string_to_regexp $bad]
340
341 gdb_test_multiple "print &$name" "print &$name" {
342 -re ".* = .* $hex <$good_pattern>\r\n$gdb_prompt $" {
343 pass "print &$name"
344 }
345 -re ".* = .* $hex <$bad_pattern>\r\n$gdb_prompt $" {
346 kfail $bugid "print &$name"
347 }
348 }
349 }
350
351 #
352 # Simple interfaces to print_addr_2.
353 #
354
355 proc print_addr { name } {
356 regsub {\(void\)} $name {()} expected
357 if {[string first "::" $name] == -1} {
358 # C function -- must be qutoed
359 set name "'$name'"
360 }
361 print_addr_2 "$name" $expected
362 }
363
364 #
365 # Test name demangling for operators.
366 #
367 # The '(' at the end of each regex input pattern is so that we match only
368 # the one we are looking for. I.E. "operator&" would match both
369 # "operator&(foo &)" and "operator&&(foo &)".
370 #
371 # gdb-gnats bug gdb/18:
372 # "gdb can't parse "info func operator*" or "info func operator\*".
373 # The star in "operator*" is interpreted as a regexp, but the "\*"
374 # in "operator\*" is not a legal operator.
375 #
376
377 proc test_lookup_operator_functions {} {
378 global dm_operator_comma
379 global dm_operator_char_star
380 global dm_type_char_star
381 global dm_operator_char_star_quoted
382 global dm_type_foo_ref
383 global dm_type_void
384 global dm_type_void_star
385
386 # operator* requires quoting so that GDB does not treat it as a regexp.
387 info_func "operator\\*(" "void foo::operator*($dm_type_foo_ref);"
388 info_func "operator%(" "void foo::operator%($dm_type_foo_ref);"
389 info_func "operator-(" "void foo::operator-($dm_type_foo_ref);"
390 info_func "operator>>(" "void foo::operator>>($dm_type_foo_ref);"
391 info_func "operator!=(" "void foo::operator!=($dm_type_foo_ref);"
392 info_func "operator>(" "void foo::operator>($dm_type_foo_ref);"
393 info_func "operator>=(" "void foo::operator>=($dm_type_foo_ref);"
394 info_func "operator|(" "void foo::operator|($dm_type_foo_ref);"
395 info_func "operator&&(" "void foo::operator&&($dm_type_foo_ref);"
396 info_func "operator!(" "void foo::operator!($dm_type_void);"
397 info_func "operator++(" "void foo::operator++(int);"
398 info_func "operator=(" "void foo::operator=($dm_type_foo_ref);"
399 info_func "operator+=(" "void foo::operator+=($dm_type_foo_ref);"
400 # operator*= requires quoting so that GDB does not treat it as a regexp.
401 info_func "operator\\*=(" "void foo::operator*=($dm_type_foo_ref);"
402 info_func "operator%=(" "void foo::operator%=($dm_type_foo_ref);"
403 info_func "operator>>=(" "void foo::operator>>=($dm_type_foo_ref);"
404 info_func "operator|=(" "void foo::operator|=($dm_type_foo_ref);"
405 info_func "operator$dm_operator_comma\(" \
406 "void foo::operator$dm_operator_comma\($dm_type_foo_ref);"
407 info_func "operator/(" "void foo::operator/($dm_type_foo_ref);"
408 info_func "operator+(" "void foo::operator+($dm_type_foo_ref);"
409 info_func "operator<<(" "void foo::operator<<($dm_type_foo_ref);"
410 info_func "operator==(" "void foo::operator==($dm_type_foo_ref);"
411 info_func "operator<(" "void foo::operator<($dm_type_foo_ref);"
412 info_func "operator<=(" "void foo::operator<=($dm_type_foo_ref);"
413 info_func "operator&(" "void foo::operator&($dm_type_foo_ref);"
414 info_func "operator^(" "void foo::operator^($dm_type_foo_ref);"
415 info_func "operator||(" "void foo::operator||($dm_type_foo_ref);"
416 info_func "operator~(" "void foo::operator~($dm_type_void);"
417 info_func "operator--(" "void foo::operator--(int);"
418 info_func "operator->(" "foo *foo::operator->($dm_type_void);"
419 info_func "operator-=(" "void foo::operator-=($dm_type_foo_ref);"
420 info_func "operator/=(" "void foo::operator/=($dm_type_foo_ref);"
421 info_func "operator<<=(" "void foo::operator<<=($dm_type_foo_ref);"
422 info_func "operator&=(" "void foo::operator&=($dm_type_foo_ref);"
423 info_func "operator^=(" "void foo::operator^=($dm_type_foo_ref);"
424 # operator->* requires quoting so that GDB does not treat it as a regexp.
425 info_func "operator->\\*(" "void foo::operator->*($dm_type_foo_ref);"
426
427 # operator[] needs double backslashes, so that a single backslash
428 # will be sent to GDB, preventing the square brackets from being
429 # evaluated as a regular expression.
430 info_func "operator\\\[\\\](" "void foo::operator\[\]($dm_type_foo_ref);"
431
432 # These are gnarly because they might end with 'static'.
433 set dm_type_void_star_regexp [string_to_regexp $dm_type_void_star]
434 info_func_regexp "operator new(" "void \\*foo::operator new\\(.*\\)(| static);"
435 info_func_regexp "operator delete(" "void foo::operator delete\\($dm_type_void_star_regexp\\)(| static);"
436
437 info_func "operator int(" "int foo::operator int($dm_type_void);"
438 info_func "operator()(" "void foo::operator()($dm_type_foo_ref);"
439 info_func "operator $dm_operator_char_star_quoted\(" \
440 "char *foo::operator $dm_operator_char_star\($dm_type_void);"
441
442 }
443
444
445 proc test_paddr_operator_functions {} {
446 global hex
447 global hp_aCC_compiler
448 global dm_operator_comma
449 global dm_type_char_star
450 global dm_type_foo_ref
451 global dm_type_long_star
452 global dm_type_unsigned_int
453 global dm_type_void
454 global dm_type_void_star
455 global dm_operator_char_star
456
457 print_addr "foo::operator*($dm_type_foo_ref)"
458 print_addr "foo::operator%($dm_type_foo_ref)"
459 print_addr "foo::operator-($dm_type_foo_ref)"
460 print_addr "foo::operator>>($dm_type_foo_ref)"
461 print_addr "foo::operator!=($dm_type_foo_ref)"
462 print_addr "foo::operator>($dm_type_foo_ref)"
463 print_addr "foo::operator>=($dm_type_foo_ref)"
464 print_addr "foo::operator|($dm_type_foo_ref)"
465 print_addr "foo::operator&&($dm_type_foo_ref)"
466 print_addr "foo::operator!($dm_type_void)"
467 print_addr "foo::operator++(int)"
468 print_addr "foo::operator=($dm_type_foo_ref)"
469 print_addr "foo::operator+=($dm_type_foo_ref)"
470 print_addr "foo::operator*=($dm_type_foo_ref)"
471 print_addr "foo::operator%=($dm_type_foo_ref)"
472 print_addr "foo::operator>>=($dm_type_foo_ref)"
473 print_addr "foo::operator|=($dm_type_foo_ref)"
474 print_addr "foo::operator$dm_operator_comma\($dm_type_foo_ref)"
475 print_addr "foo::operator/($dm_type_foo_ref)"
476 print_addr "foo::operator+($dm_type_foo_ref)"
477 print_addr "foo::operator<<($dm_type_foo_ref)"
478 print_addr "foo::operator==($dm_type_foo_ref)"
479 print_addr "foo::operator<($dm_type_foo_ref)"
480 print_addr "foo::operator<=($dm_type_foo_ref)"
481 print_addr "foo::operator&($dm_type_foo_ref)"
482 print_addr "foo::operator^($dm_type_foo_ref)"
483 print_addr "foo::operator||($dm_type_foo_ref)"
484 print_addr "foo::operator~($dm_type_void)"
485 print_addr "foo::operator--(int)"
486 print_addr "foo::operator->($dm_type_void)"
487 print_addr "foo::operator-=($dm_type_foo_ref)"
488 print_addr "foo::operator/=($dm_type_foo_ref)"
489 print_addr "foo::operator<<=($dm_type_foo_ref)"
490 print_addr "foo::operator&=($dm_type_foo_ref)"
491 print_addr "foo::operator^=($dm_type_foo_ref)"
492 print_addr "foo::operator->*($dm_type_foo_ref)"
493 print_addr "foo::operator\[\]($dm_type_foo_ref)"
494 print_addr "foo::operator()($dm_type_foo_ref)"
495
496 gdb_test "print &foo::operator new" \
497 " = .* $hex <foo::operator new\\(.*\\)(| static)>"
498 gdb_test "print &foo::operator new\[\]" \
499 " = .* $hex <foo::operator new\\\[\\\]\\(.*\\)(| static)>"
500 if { !$hp_aCC_compiler } {
501 print_addr "foo::operator delete($dm_type_void_star)"
502 print_addr "foo::operator delete[]($dm_type_void_star)"
503 } else {
504 gdb_test "print &'foo::operator delete($dm_type_void_star) static'" \
505 " = .*(0x\[0-9a-f\]+|) <foo::operator delete.*>"
506 }
507
508 print_addr "foo::operator int($dm_type_void)"
509 print_addr "foo::operator $dm_operator_char_star\($dm_type_void)"
510 }
511
512 #
513 # Test overloaded functions (1 arg).
514 #
515
516 proc test_paddr_overloaded_functions {} {
517 global dm_type_unsigned_int
518 global dm_type_void
519 global dm_type_short
520 global dm_type_unsigned_short
521 global dm_type_long
522 global dm_type_unsigned_long
523
524 print_addr "overload1arg($dm_type_void)"
525 print_addr "overload1arg(char)"
526 print_addr "overload1arg(signed char)"
527 print_addr "overload1arg(unsigned char)"
528 print_addr "overload1arg($dm_type_short)"
529 print_addr "overload1arg($dm_type_unsigned_short)"
530 print_addr "overload1arg(int)"
531 print_addr "overload1arg($dm_type_unsigned_int)"
532 print_addr "overload1arg($dm_type_long)"
533 print_addr "overload1arg($dm_type_unsigned_long)"
534 print_addr "overload1arg(float)"
535 print_addr "overload1arg(double)"
536
537 print_addr "overloadargs(int)"
538 print_addr "overloadargs(int, int)"
539 print_addr "overloadargs(int, int, int)"
540 print_addr "overloadargs(int, int, int, int)"
541 print_addr "overloadargs(int, int, int, int, int)"
542 print_addr "overloadargs(int, int, int, int, int, int)"
543 print_addr "overloadargs(int, int, int, int, int, int, int)"
544 print_addr "overloadargs(int, int, int, int, int, int, int, int)"
545 print_addr "overloadargs(int, int, int, int, int, int, int, int, int)"
546 print_addr "overloadargs(int, int, int, int, int, int, int, int, int, int)"
547 print_addr "overloadargs(int, int, int, int, int, int, int, int, int, int, int)"
548 }
549
550 proc test_paddr_hairy_functions {} {
551 global gdb_prompt
552 global hex
553 global dm_type_char_star
554 global dm_type_int_star
555 global dm_type_long_star
556 global dm_type_typedef
557
558 print_addr_2 "hairyfunc1" "hairyfunc1(int)"
559
560 if {$dm_type_typedef == 0} {
561 print_addr_2 "hairyfunc2" "hairyfunc2(int (*)($dm_type_char_star))"
562 print_addr_2 "hairyfunc3" "hairyfunc3(int (*)(short (*)($dm_type_long_star)))"
563 print_addr_2 "hairyfunc4" "hairyfunc4(int (*)(short (*)($dm_type_char_star)))"
564
565 # gdb-gnats bug gdb/19:
566 # "gdb v3 demangler fails on hairyfunc5 hairyfunc6 hairyfunc7"
567 print_addr_2_kfail "hairyfunc5" "hairyfunc5(int (*(*)($dm_type_char_star))(long))" "hairyfunc5(int (*)(long) (*)(char*))" "gdb/19"
568 print_addr_2_kfail "hairyfunc6" "hairyfunc6(int (*(*)($dm_type_int_star))(long))" "hairyfunc6(int (*)(long) (*)(int*))" "gdb/19"
569 print_addr_2_kfail "hairyfunc7" "hairyfunc7(int (*(*)(int (*)($dm_type_char_star)))(long))" "hairyfunc7(int (*)(long) (*)(int (*)(char*)))" "gdb/19"
570 } else {
571 print_addr_2 "hairyfunc2" "hairyfunc2(PFPc_i)"
572 print_addr_2 "hairyfunc3" "hairyfunc3(PFPFPl_s_i)"
573 print_addr_2 "hairyfunc4" "hairyfunc4(PFPFPc_s_i)"
574
575 # gdb-gnats bug gdb/19:
576 # "gdb v3 demangler fails on hairyfunc5 hairyfunc6 hairyfunc7"
577 print_addr_2 "hairyfunc5" "hairyfunc5(PFPc_PFl_i)"
578 print_addr_2 "hairyfunc6" "hairyfunc6(PFPi_PFl_i)"
579 print_addr_2 "hairyfunc7" "hairyfunc7(PFPFPc_i_PFl_i)"
580 }
581 }
582
583 proc do_tests {} {
584 global binfile
585 global dm_type_int_star
586
587 clean_restart $binfile
588
589 gdb_test_no_output "set width 0"
590
591 runto_main
592
593 gdb_test_no_output "set language c++"
594 probe_demangler
595 test_paddr_overloaded_functions
596 test_paddr_operator_functions
597 test_paddr_hairy_functions
598 test_lookup_operator_functions
599
600 # A regression test on errors involving operators
601 gdb_test "list foo::operator $dm_type_int_star" \
602 "Function \"foo::operator [string_to_regexp $dm_type_int_star]\" not defined\\."
603 }
604
605 do_tests
This page took 0.047266 seconds and 5 git commands to generate.