2012-01-04 08:17:56 +00:00
|
|
|
# Copyright 1998-2004, 2007-2012 Free Software Foundation, Inc.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
2007-08-23 18:14:19 +00:00
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
1999-04-16 01:35:26 +00:00
|
|
|
# (at your option) any later version.
|
2007-08-23 18:14:19 +00:00
|
|
|
#
|
1999-04-16 01:35:26 +00:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
2007-08-23 18:14:19 +00:00
|
|
|
#
|
1999-04-16 01:35:26 +00:00
|
|
|
# You should have received a copy of the GNU General Public License
|
2007-08-23 18:14:19 +00:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
# written by Elena Zannoni (ezannoni@cygnus.com)
|
2004-01-01 09:46:21 +00:00
|
|
|
# Rewritten by Michael Chastain <mec.gnu@mindspring.com>
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
# This file is part of the gdb testsuite
|
|
|
|
|
2004-01-01 09:46:21 +00:00
|
|
|
# Tests for overloaded member functions.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2004-01-01 09:46:21 +00:00
|
|
|
set ws "\[\r\n\t \]+"
|
|
|
|
set nl "\[\r\n\]+"
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
1999-09-09 00:02:17 +00:00
|
|
|
if { [skip_cplus_tests] } { continue }
|
|
|
|
|
* gdb.cp/abstract-origin.exp: Use standard_testfile.
* gdb.cp/ambiguous.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/annota2.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/annota3.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/anon-ns.exp: Use standard_testfile.
* gdb.cp/anon-struct.exp: Use standard_testfile.
* gdb.cp/anon-union.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/arg-reference.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/bool.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/breakpoint.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/bs15503.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/call-c.exp: Use standard_testfile, clean_restart,
standard_output_file.
* gdb.cp/casts.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/class2.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/classes.exp: Use standard_testfile, prepare_for_testing.
(test_static_members): Update.
* gdb.cp/cmpd-minsyms.exp: Use standard_testfile.
* gdb.cp/converts.exp: Use standard_testfile.
* gdb.cp/cp-relocate.exp: Use standard_testfile.
* gdb.cp/cpcompletion.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/cpexprs.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/cplabel.exp: Use standard_testfile.
* gdb.cp/cplusfuncs.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/ctti.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/derivation.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/destrprint.exp: Use standard_testfile.
* gdb.cp/dispcxx.exp: Use standard_testfile.
* gdb.cp/exception.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/expand-psymtabs-cxx.exp: Use standard_testfile.
* gdb.cp/extern-c.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/formatted-ref.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/fpointer.exp: Use standard_testfile.
* gdb.cp/gdb1355.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/gdb2384.exp: Use standard_testfile, clean_restart,
standard_output_file.
* gdb.cp/gdb2495.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/hang.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/infcall-dlopen.exp: Use standard_testfile,
standard_output_file.
* gdb.cp/inherit.exp: Use standard_testfile, prepare_for_testing.
(do_tests): Update.
* gdb.cp/koenig.exp: Use standard_testfile.
* gdb.cp/local.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/m-data.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/m-static.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/mb-ctor.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/mb-inline.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/mb-templates.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/member-ptr.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/meth-typedefs.exp: Use standard_testfile.
* gdb.cp/method.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/method2.exp: Use standard_testfile.
* gdb.cp/minsym-fallback.exp: Use standard_testfile,
standard_output_file.
* gdb.cp/misc.exp: Use standard_testfile, prepare_for_testing.
(do_tests): Update.
* gdb.cp/namespace-enum.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/namespace-nested-import.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/namespace.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/nextoverthrow.exp: Use standard_testfile.
* gdb.cp/no-dmgl-verbose.exp: Use standard_testfile.
* gdb.cp/nsdecl.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/nsimport.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/nsnested.exp: Use standard_testfile.
* gdb.cp/nsnoimports.exp: Use standard_testfile.
* gdb.cp/nsrecurs.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/nsstress.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/nsusing.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/operator.exp: Use standard_testfile.
* gdb.cp/oranking.exp: Use standard_testfile.
* gdb.cp/overload-const.exp: Use standard_testfile.
* gdb.cp/overload.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/ovldbreak.exp: Use standard_testfile.
* gdb.cp/ovsrch.exp: Use standard_testfile.
* gdb.cp/paren-type.exp: Use standard_testfile.
* gdb.cp/pass-by-ref.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/pr-1023.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/pr-1210.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/pr-574.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/pr10687.exp: Use standard_testfile, clean_restart.
* gdb.cp/pr10728.exp: Use standard_testfile,
standard_output_file.
* gdb.cp/pr12028.exp: Use standard_testfile.
* gdb.cp/pr9067.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/pr9167.exp: Use standard_testfile.
* gdb.cp/pr9631.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/printmethod.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/psmang.exp: Use standard_testfile, clean_restart.
* gdb.cp/psymtab-parameter.exp: Use standard_testfile.
* gdb.cp/ptype-cv-cp.exp: Use standard_testfile.
* gdb.cp/re-set-overloaded.exp: Use standard_testfile,
standard_output_file.
* gdb.cp/readnow-language.exp: Use standard_testfile.
* gdb.cp/ref-params.exp: Use standard_testfile, build_executable.
(gdb_start_again): Use clean_restart.
* gdb.cp/ref-types.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/rtti.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/shadow.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/smartp.exp: Use standard_testfile.
* gdb.cp/static-method.exp: Use standard_testfile.
* gdb.cp/static-print-quit.exp: Use standard_testfile.
* gdb.cp/temargs.exp: Use standard_testfile.
* gdb.cp/templates.exp: Use standard_testfile,
prepare_for_testing.
(do_tests): Update.
* gdb.cp/try_catch.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/typedef-operator.exp: Use standard_testfile.
* gdb.cp/userdef.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/virtbase.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/virtfunc.exp: Use standard_testfile,
prepare_for_testing.
(do_tests): Update.
* gdb.cp/virtfunc2.exp: Use standard_testfile,
prepare_for_testing.
2012-07-10 15:18:18 +00:00
|
|
|
standard_testfile .cc
|
1999-04-16 01:35:26 +00:00
|
|
|
|
* gdb.cp/abstract-origin.exp: Use standard_testfile.
* gdb.cp/ambiguous.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/annota2.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/annota3.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/anon-ns.exp: Use standard_testfile.
* gdb.cp/anon-struct.exp: Use standard_testfile.
* gdb.cp/anon-union.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/arg-reference.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/bool.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/breakpoint.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/bs15503.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/call-c.exp: Use standard_testfile, clean_restart,
standard_output_file.
* gdb.cp/casts.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/class2.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/classes.exp: Use standard_testfile, prepare_for_testing.
(test_static_members): Update.
* gdb.cp/cmpd-minsyms.exp: Use standard_testfile.
* gdb.cp/converts.exp: Use standard_testfile.
* gdb.cp/cp-relocate.exp: Use standard_testfile.
* gdb.cp/cpcompletion.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/cpexprs.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/cplabel.exp: Use standard_testfile.
* gdb.cp/cplusfuncs.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/ctti.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/derivation.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/destrprint.exp: Use standard_testfile.
* gdb.cp/dispcxx.exp: Use standard_testfile.
* gdb.cp/exception.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/expand-psymtabs-cxx.exp: Use standard_testfile.
* gdb.cp/extern-c.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/formatted-ref.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/fpointer.exp: Use standard_testfile.
* gdb.cp/gdb1355.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/gdb2384.exp: Use standard_testfile, clean_restart,
standard_output_file.
* gdb.cp/gdb2495.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/hang.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/infcall-dlopen.exp: Use standard_testfile,
standard_output_file.
* gdb.cp/inherit.exp: Use standard_testfile, prepare_for_testing.
(do_tests): Update.
* gdb.cp/koenig.exp: Use standard_testfile.
* gdb.cp/local.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/m-data.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/m-static.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/mb-ctor.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/mb-inline.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/mb-templates.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/member-ptr.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/meth-typedefs.exp: Use standard_testfile.
* gdb.cp/method.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/method2.exp: Use standard_testfile.
* gdb.cp/minsym-fallback.exp: Use standard_testfile,
standard_output_file.
* gdb.cp/misc.exp: Use standard_testfile, prepare_for_testing.
(do_tests): Update.
* gdb.cp/namespace-enum.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/namespace-nested-import.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/namespace.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/nextoverthrow.exp: Use standard_testfile.
* gdb.cp/no-dmgl-verbose.exp: Use standard_testfile.
* gdb.cp/nsdecl.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/nsimport.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/nsnested.exp: Use standard_testfile.
* gdb.cp/nsnoimports.exp: Use standard_testfile.
* gdb.cp/nsrecurs.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/nsstress.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/nsusing.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/operator.exp: Use standard_testfile.
* gdb.cp/oranking.exp: Use standard_testfile.
* gdb.cp/overload-const.exp: Use standard_testfile.
* gdb.cp/overload.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/ovldbreak.exp: Use standard_testfile.
* gdb.cp/ovsrch.exp: Use standard_testfile.
* gdb.cp/paren-type.exp: Use standard_testfile.
* gdb.cp/pass-by-ref.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/pr-1023.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/pr-1210.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/pr-574.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/pr10687.exp: Use standard_testfile, clean_restart.
* gdb.cp/pr10728.exp: Use standard_testfile,
standard_output_file.
* gdb.cp/pr12028.exp: Use standard_testfile.
* gdb.cp/pr9067.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/pr9167.exp: Use standard_testfile.
* gdb.cp/pr9631.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/printmethod.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/psmang.exp: Use standard_testfile, clean_restart.
* gdb.cp/psymtab-parameter.exp: Use standard_testfile.
* gdb.cp/ptype-cv-cp.exp: Use standard_testfile.
* gdb.cp/re-set-overloaded.exp: Use standard_testfile,
standard_output_file.
* gdb.cp/readnow-language.exp: Use standard_testfile.
* gdb.cp/ref-params.exp: Use standard_testfile, build_executable.
(gdb_start_again): Use clean_restart.
* gdb.cp/ref-types.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/rtti.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/shadow.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/smartp.exp: Use standard_testfile.
* gdb.cp/static-method.exp: Use standard_testfile.
* gdb.cp/static-print-quit.exp: Use standard_testfile.
* gdb.cp/temargs.exp: Use standard_testfile.
* gdb.cp/templates.exp: Use standard_testfile,
prepare_for_testing.
(do_tests): Update.
* gdb.cp/try_catch.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/typedef-operator.exp: Use standard_testfile.
* gdb.cp/userdef.exp: Use standard_testfile, prepare_for_testing.
* gdb.cp/virtbase.exp: Use standard_testfile,
prepare_for_testing.
* gdb.cp/virtfunc.exp: Use standard_testfile,
prepare_for_testing.
(do_tests): Update.
* gdb.cp/virtfunc2.exp: Use standard_testfile,
prepare_for_testing.
2012-07-10 15:18:18 +00:00
|
|
|
if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
|
|
|
|
return -1
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
|
2004-01-01 09:46:21 +00:00
|
|
|
# Set it up at a breakpoint so we can play with the variable values.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2001-04-23 17:02:05 +00:00
|
|
|
if ![runto 'marker1'] then {
|
|
|
|
perror "couldn't run to marker1"
|
|
|
|
continue
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2001-04-23 17:02:05 +00:00
|
|
|
gdb_test "up" ".*main.*" "up from marker1"
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2004-01-01 09:46:21 +00:00
|
|
|
# Print the monster class type.
|
|
|
|
# See virtfunc.exp for a discussion of ptype.
|
|
|
|
#
|
|
|
|
# This is hairy to begin with. It is even more hairy because of the
|
|
|
|
# XX_* alternate patterns to catch the KFAIL and XFAIL cases.
|
|
|
|
|
|
|
|
set re_class "((struct|class) foo \{${ws}public:|struct foo \{)"
|
|
|
|
set re_fields "int ifoo;${ws}const char ?\\* ?ccpfoo;"
|
|
|
|
set XX_fields "int ifoo;${ws}char ?\\* ?ccpfoo;"
|
|
|
|
set re_ctor "foo\\(int\\);${ws}foo\\(int, (char const|const char) ?\\*\\);${ws}foo\\(foo ?&\\);"
|
|
|
|
set re_dtor "~foo\\((void|)\\);"
|
|
|
|
set XX_dtor "~foo\\(int\\);"
|
|
|
|
set re_methods "void foofunc\\(int\\);"
|
|
|
|
set re_methods "${re_methods}${ws}void foofunc\\(int, signed char ?\\*\\);"
|
|
|
|
set re_methods "${re_methods}${ws}int overload1arg\\((void|)\\);"
|
|
|
|
set re_methods "${re_methods}${ws}int overload1arg\\(char\\);"
|
|
|
|
set re_methods "${re_methods}${ws}int overload1arg\\(signed char\\);"
|
|
|
|
set re_methods "${re_methods}${ws}int overload1arg\\(unsigned char\\);"
|
* gdb.cp/cp-relocate.exp: Remove single-quoting of C++ methods.
* gdb.cp/cplusfuncs.cc (dm_type_short): New function.
(dm_type_long): New function.
(dm_type_unsigned_short): New function.
(dm_type_unsigned_long): New function.
(myint): New typedef.
* gdb.cp/cplusfuncs.exp (probe_demangler): Add tests for short,
long, unsigned shor and long, operator char*, and typedef.
(test_lookup_operator_functions): Add operator char* test.
(test_paddr_operator_functions): Likewise.
(test_paddr_overloaded_functions): Use probe values for
short, long, and unsigned short and long.
(test_paddr_hairy_functions): If the demangler probe detected
gdb type printers, "expect" them. Otherwise "expect" the v2 or v3
demangler.
* gdb.cp/expand-sals.exp: Backtrace may contain class names.
* gdb.cp/member-ptr.exp: Refine expected result for "print pmf"
and "print null_pmf".
Add test "ptype a.*pmf".
* gdb.cp/overload.exp: Allow optional "int" to appear with
"short" and "long".
* gdb.cp/ovldbreak.exp: Use append to construct super-duper
long expect value for men_overload1arg.
Allow "int" to appear with "short" and "long".
When testing "info break", add argument for main (void).
Also allow "int" to appear with "short" and "long".
Ditto with "unsigned" and "long long".
* gdb.java/jmain.exp: Do not enclose methods names in single
quotes.
* gdb.java/jmisc.exp: Likewise.
* gdb.java/jprint.exp: Likewise.
* gdb.python/py-symbol.exp: Update expected "linkage_name" value.
From Jan Kratochvil <jan.kratochvil@redhat.com>:
* gdb.cp/exception.exp (backtrace after first throw)
(backtrace after second throw): Allow a namespace before __cxa_throw.
(backtrace after first catch, backtrace after second catch): Allow
a namespace before __cxa_begin_catch.
* gdb.cp/cpexprs.exp: New file.
* gdb.cp/cpexprs.cc: New file.
From Daniel Jacobowitz <dan@codesourcery.com>
* gdb.cp/cpexprs.exp (escape): Delete. Change all callers
to use string_to_regexp.
(ctor, dtor): New functions. Use them to match constructor
and destructor function types.
(Top level): Use runto_main.
2010-03-09 18:08:05 +00:00
|
|
|
set re_methods "${re_methods}${ws}int overload1arg\\(short( int)?\\);"
|
|
|
|
set re_methods "${re_methods}${ws}int overload1arg\\((unsigned short|short unsigned)( int)?\\);"
|
2004-01-01 09:46:21 +00:00
|
|
|
set re_methods "${re_methods}${ws}int overload1arg\\(int\\);"
|
|
|
|
set re_methods "${re_methods}${ws}int overload1arg\\(unsigned int\\);"
|
* gdb.cp/cp-relocate.exp: Remove single-quoting of C++ methods.
* gdb.cp/cplusfuncs.cc (dm_type_short): New function.
(dm_type_long): New function.
(dm_type_unsigned_short): New function.
(dm_type_unsigned_long): New function.
(myint): New typedef.
* gdb.cp/cplusfuncs.exp (probe_demangler): Add tests for short,
long, unsigned shor and long, operator char*, and typedef.
(test_lookup_operator_functions): Add operator char* test.
(test_paddr_operator_functions): Likewise.
(test_paddr_overloaded_functions): Use probe values for
short, long, and unsigned short and long.
(test_paddr_hairy_functions): If the demangler probe detected
gdb type printers, "expect" them. Otherwise "expect" the v2 or v3
demangler.
* gdb.cp/expand-sals.exp: Backtrace may contain class names.
* gdb.cp/member-ptr.exp: Refine expected result for "print pmf"
and "print null_pmf".
Add test "ptype a.*pmf".
* gdb.cp/overload.exp: Allow optional "int" to appear with
"short" and "long".
* gdb.cp/ovldbreak.exp: Use append to construct super-duper
long expect value for men_overload1arg.
Allow "int" to appear with "short" and "long".
When testing "info break", add argument for main (void).
Also allow "int" to appear with "short" and "long".
Ditto with "unsigned" and "long long".
* gdb.java/jmain.exp: Do not enclose methods names in single
quotes.
* gdb.java/jmisc.exp: Likewise.
* gdb.java/jprint.exp: Likewise.
* gdb.python/py-symbol.exp: Update expected "linkage_name" value.
From Jan Kratochvil <jan.kratochvil@redhat.com>:
* gdb.cp/exception.exp (backtrace after first throw)
(backtrace after second throw): Allow a namespace before __cxa_throw.
(backtrace after first catch, backtrace after second catch): Allow
a namespace before __cxa_begin_catch.
* gdb.cp/cpexprs.exp: New file.
* gdb.cp/cpexprs.cc: New file.
From Daniel Jacobowitz <dan@codesourcery.com>
* gdb.cp/cpexprs.exp (escape): Delete. Change all callers
to use string_to_regexp.
(ctor, dtor): New functions. Use them to match constructor
and destructor function types.
(Top level): Use runto_main.
2010-03-09 18:08:05 +00:00
|
|
|
set re_methods "${re_methods}${ws}int overload1arg\\(long( int)?\\);"
|
|
|
|
set re_methods "${re_methods}${ws}int overload1arg\\((unsigned long|long unsigned)( int)?\\);"
|
2004-01-01 09:46:21 +00:00
|
|
|
set re_methods "${re_methods}${ws}int overload1arg\\(float\\);"
|
|
|
|
set re_methods "${re_methods}${ws}int overload1arg\\(double\\);"
|
2010-10-14 16:13:43 +00:00
|
|
|
set re_methods "${re_methods}${ws}int overload1arg\\(int \\*\\);"
|
|
|
|
set re_methods "${re_methods}${ws}int overload1arg\\(void \\*\\);"
|
2004-01-01 09:46:21 +00:00
|
|
|
set re_methods "${re_methods}${ws}int overloadfnarg\\((void|)\\);"
|
|
|
|
set re_methods "${re_methods}${ws}int overloadfnarg\\(int\\);"
|
|
|
|
set re_methods "${re_methods}${ws}int overloadfnarg\\(int, int ?\\(\\*\\) ?\\(int\\)\\);"
|
|
|
|
set re_methods "${re_methods}${ws}int overloadargs\\(int\\);"
|
|
|
|
set re_methods "${re_methods}${ws}int overloadargs\\(int, int\\);"
|
|
|
|
set re_methods "${re_methods}${ws}int overloadargs\\(int, int, int\\);"
|
|
|
|
set re_methods "${re_methods}${ws}int overloadargs\\(int, int, int, int\\);"
|
|
|
|
set re_methods "${re_methods}${ws}int overloadargs\\(int, int, int, int, int\\);"
|
|
|
|
set re_methods "${re_methods}${ws}int overloadargs\\(int, int, int, int, int, int\\);"
|
|
|
|
set re_methods "${re_methods}${ws}int overloadargs\\(int, int, int, int, int, int, int\\);"
|
|
|
|
set re_methods "${re_methods}${ws}int overloadargs\\(int, int, int, int, int, int, int, int\\);"
|
|
|
|
set re_methods "${re_methods}${ws}int overloadargs\\(int, int, int, int, int, int, int, int, int\\);"
|
|
|
|
set re_methods "${re_methods}${ws}int overloadargs\\(int, int, int, int, int, int, int, int, int, int\\);"
|
|
|
|
set re_methods "${re_methods}${ws}int overloadargs\\(int, int, int, int, int, int, int, int, int, int, int\\);"
|
|
|
|
set re_synth "foo & operator=\\(foo const ?&\\);"
|
2004-01-02 04:46:45 +00:00
|
|
|
|
|
|
|
gdb_test "print foo_instance1" "\\$\[0-9\]+ = \{ifoo = 111, ccpfoo = 0x0\}"
|
2004-01-01 09:46:21 +00:00
|
|
|
|
|
|
|
gdb_test_multiple "ptype foo_instance1" "ptype foo_instance1" {
|
2004-01-02 04:46:45 +00:00
|
|
|
-re "type = $re_class${ws}$re_fields${ws}$re_ctor${ws}$re_dtor${ws}$re_methods$nl\}$nl$gdb_prompt $" {
|
|
|
|
# gcc 2.95.3 -gdwarf-2
|
|
|
|
# TODO: this is not a quirk!
|
|
|
|
pass "ptype foo_instance1 (HP aCC -- known quirk with ~foo parameter list)"
|
1999-06-21 13:27:42 +00:00
|
|
|
}
|
2004-01-02 04:46:45 +00:00
|
|
|
-re "type = $re_class${ws}$XX_fields${ws}$re_synth${ws}$re_dtor${ws}$re_ctor${ws}$re_methods$nl\}$nl$gdb_prompt $" {
|
2004-01-01 09:46:21 +00:00
|
|
|
# gcc 2.95.3 -gstabs+, no "const" on "const char *"
|
|
|
|
# TODO: gdb.base/constvar.exp has XFAILed this kind of problem for a
|
|
|
|
# long time, but an XFAIL really needs an external bug report.
|
|
|
|
# -- chastain 2003-12-31
|
2004-01-02 04:46:45 +00:00
|
|
|
# setup_xfail "*-*-*"
|
|
|
|
# fail "ptype foo_instance1"
|
|
|
|
# TODO: this should be a KFAIL.
|
|
|
|
pass "ptype foo_instance1 (shorter match)"
|
|
|
|
}
|
|
|
|
-re "type = $re_class${ws}$re_fields${ws}$re_synth${ws}$re_dtor${ws}$re_ctor${ws}$re_methods$nl\}$nl$gdb_prompt $" {
|
|
|
|
# gcc 2.95.3 -gstabs+ if "const char *" ever gets fixed
|
|
|
|
pass "ptype foo_instance1"
|
2004-01-01 09:46:21 +00:00
|
|
|
}
|
2004-01-02 04:46:45 +00:00
|
|
|
-re "type = $re_class${ws}$re_fields${ws}$re_ctor${ws}$XX_dtor${ws}$re_methods$nl\}$nl$gdb_prompt $" {
|
2004-01-01 09:46:21 +00:00
|
|
|
# gcc 3.3.2 -gdwarf-2, "~foo(int)"
|
2004-01-02 04:46:45 +00:00
|
|
|
# TODO: kfail this
|
|
|
|
# kfail "gdb/1113" "ptype foo_instance1"
|
|
|
|
pass "ptype foo_instance1 (shorter match)"
|
|
|
|
}
|
|
|
|
-re "type = $re_class${ws}$re_fields${ws}$re_ctor${ws}$re_dtor${ws}$re_methods$nl\}$nl$gdb_prompt $" {
|
|
|
|
# gcc 3.3.2 -gdwarf-2, if the dtor bug gets fixed
|
|
|
|
# gcc HEAD -gdwarf-2 (abi-2)
|
|
|
|
# TODO: just pass this
|
|
|
|
pass "ptype foo_instance1 (shorter match)"
|
|
|
|
}
|
|
|
|
-re "type = $re_class${ws}$re_fields${ws}$re_synth${ws}$re_ctor${ws}$re_dtor${ws}$re_methods$nl\}$nl$gdb_prompt $" {
|
|
|
|
# gcc 3.3.2 -gstabs+
|
|
|
|
# TODO: enough with the "shorter match"
|
|
|
|
pass "ptype foo_instance1 (shorter match)"
|
|
|
|
}
|
|
|
|
-re "type = $re_class${ws}$re_fields${ws}$re_ctor${ws}$re_dtor${ws}$re_methods${ws}$re_synth$nl\}$nl$gdb_prompt $" {
|
|
|
|
# gcc HEAD -gstabs+ (abi-2)
|
2004-01-09 04:57:09 +00:00
|
|
|
pass "ptype foo_instance1 (shorter match)"
|
2004-01-01 09:46:21 +00:00
|
|
|
}
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2004-01-01 09:46:21 +00:00
|
|
|
# Print variables and method calls.
|
|
|
|
# This is a walk in the park.
|
|
|
|
|
|
|
|
gdb_test "print foo_instance2" "\\$\[0-9\]+ = \{ifoo = 222, ccpfoo = $hex \"A\"\}"
|
|
|
|
gdb_test "print foo_instance3" "\\$\[0-9\]+ = \{ifoo = 222, ccpfoo = $hex \"A\"\}"
|
|
|
|
|
|
|
|
gdb_test "print foo_instance1.overloadargs(1)" "\\$\[0-9\]+ = 1" \
|
|
|
|
"print call overloaded func 1 arg"
|
1999-06-21 13:27:42 +00:00
|
|
|
|
2003-04-09 23:21:14 +00:00
|
|
|
# If GDB fails to restore the selected frame properly after the
|
|
|
|
# inferior function call above (see GDB PR 1155 for an explanation of
|
|
|
|
# why this might happen), all the subsequent tests will fail. We
|
|
|
|
# should detect and report that failure, but let the marker call
|
|
|
|
# finish so that the rest of the tests can run undisturbed.
|
2004-01-01 09:46:21 +00:00
|
|
|
|
2003-04-09 23:21:14 +00:00
|
|
|
gdb_test_multiple "frame" "re-selected 'main' frame after inferior call" {
|
|
|
|
-re "#0 marker1.*$gdb_prompt $" {
|
|
|
|
setup_kfail "gdb/1155" s390-*-linux-gnu
|
|
|
|
fail "re-selected 'main' frame after inferior call"
|
2003-04-11 19:57:33 +00:00
|
|
|
gdb_test "finish" ".*main.*at .*overload.cc:.*// marker1-returns-here.*" \
|
2003-04-09 23:21:14 +00:00
|
|
|
"finish call to marker1"
|
|
|
|
}
|
|
|
|
-re "#1 ($hex in )?main.*$gdb_prompt $" {
|
|
|
|
pass "re-selected 'main' frame after inferior call"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-01 09:46:21 +00:00
|
|
|
gdb_test "print foo_instance1.overloadargs(1, 2)" \
|
|
|
|
"\\$\[0-9\]+ = 2" \
|
|
|
|
"print call overloaded func 2 args"
|
2003-04-09 23:21:14 +00:00
|
|
|
|
2004-01-01 09:46:21 +00:00
|
|
|
gdb_test "print foo_instance1.overloadargs(1, 2, 3)" \
|
|
|
|
"\\$\[0-9\]+ = 3" \
|
|
|
|
"print call overloaded func 3 args"
|
1999-09-22 03:28:34 +00:00
|
|
|
|
2004-01-01 09:46:21 +00:00
|
|
|
gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4)" \
|
|
|
|
"\\$\[0-9\]+ = 4" \
|
|
|
|
"print call overloaded func 4 args"
|
1999-09-22 03:28:34 +00:00
|
|
|
|
2004-01-01 09:46:21 +00:00
|
|
|
gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4, 5)" \
|
|
|
|
"\\$\[0-9\]+ = 5" \
|
|
|
|
"print call overloaded func 5 args"
|
|
|
|
|
|
|
|
gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6)" \
|
|
|
|
"\\$\[0-9\]+ = 6" \
|
|
|
|
"print call overloaded func 6 args"
|
|
|
|
|
|
|
|
gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7)" \
|
|
|
|
"\\$\[0-9\]+ = 7" \
|
|
|
|
"print call overloaded func 7 args"
|
2001-11-01 23:41:09 +00:00
|
|
|
|
2004-01-01 09:46:21 +00:00
|
|
|
gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8)" \
|
|
|
|
"\\$\[0-9\]+ = 8" \
|
|
|
|
"print call overloaded func 8 args"
|
|
|
|
|
|
|
|
gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9)" \
|
|
|
|
"\\$\[0-9\]+ = 9" \
|
|
|
|
"print call overloaded func 9 args"
|
|
|
|
|
|
|
|
gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)" \
|
|
|
|
"\\$\[0-9\]+ = 10" \
|
|
|
|
"print call overloaded func 10 args"
|
|
|
|
|
|
|
|
gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)" \
|
|
|
|
"\\$\[0-9\]+ = 11" \
|
|
|
|
"print call overloaded func 11 args"
|
|
|
|
|
|
|
|
gdb_test "print foo_instance1.overload1arg()" \
|
|
|
|
"\\$\[0-9\]+ = 1" \
|
|
|
|
"print call overloaded func void arg"
|
|
|
|
|
|
|
|
gdb_test "print foo_instance1.overload1arg((char)arg2)" \
|
|
|
|
"\\$\[0-9\]+ = 2" \
|
|
|
|
"print call overloaded func char arg"
|
|
|
|
|
|
|
|
gdb_test "print foo_instance1.overload1arg((signed char)arg3)" \
|
|
|
|
"\\$\[0-9\]+ = 3" \
|
|
|
|
"print call overloaded func signed char arg"
|
|
|
|
|
|
|
|
gdb_test "print foo_instance1.overload1arg((unsigned char)arg4)" \
|
|
|
|
"\\$\[0-9\]+ = 4" \
|
|
|
|
"print call overloaded func unsigned char arg"
|
|
|
|
|
|
|
|
gdb_test "print foo_instance1.overload1arg((short)arg5)" \
|
|
|
|
"\\$\[0-9\]+ = 5" \
|
|
|
|
"print call overloaded func short arg"
|
|
|
|
|
|
|
|
gdb_test "print foo_instance1.overload1arg((unsigned short)arg6)" \
|
|
|
|
"\\$\[0-9\]+ = 6" \
|
|
|
|
"print call overloaded func unsigned short arg"
|
|
|
|
|
|
|
|
gdb_test "print foo_instance1.overload1arg((int)arg7)" \
|
|
|
|
"\\$\[0-9\]+ = 7" \
|
|
|
|
"print call overloaded func int arg"
|
|
|
|
|
|
|
|
gdb_test "print foo_instance1.overload1arg((unsigned int)arg8)" \
|
|
|
|
"\\$\[0-9\]+ = 8" \
|
|
|
|
"print call overloaded func unsigned int arg"
|
|
|
|
|
|
|
|
gdb_test "print foo_instance1.overload1arg((long)arg9)" \
|
|
|
|
"\\$\[0-9\]+ = 9" \
|
|
|
|
"print call overloaded func long arg"
|
|
|
|
|
|
|
|
gdb_test "print foo_instance1.overload1arg((unsigned long)arg10)" \
|
|
|
|
"\\$\[0-9\]+ = 10" \
|
|
|
|
"print call overloaded func unsigned long arg"
|
|
|
|
|
|
|
|
gdb_test "print foo_instance1.overload1arg((float)arg11)" \
|
|
|
|
"\\$\[0-9\]+ = 11" \
|
|
|
|
"print call overloaded func float arg"
|
|
|
|
|
|
|
|
gdb_test "print foo_instance1.overload1arg((double)arg12)" \
|
|
|
|
"\\$\[0-9\]+ = 12" \
|
|
|
|
"print call overloaded func double arg"
|
|
|
|
|
2010-10-14 16:13:43 +00:00
|
|
|
gdb_test "print foo_instance1.overload1arg(&arg13)" \
|
|
|
|
"\\$\[0-9\]+ = 13" \
|
|
|
|
"print call overloaded func int\\* arg"
|
|
|
|
|
|
|
|
gdb_test "print foo_instance1.overload1arg(&arg14)" \
|
|
|
|
"\\$\[0-9\]+ = 14" \
|
|
|
|
"print call overloaded func char\\* arg"
|
|
|
|
|
2010-11-04 20:43:25 +00:00
|
|
|
gdb_test "print bar(a)" "= 11"
|
|
|
|
gdb_test "print bar(b)" "= 22"
|
|
|
|
gdb_test "print bar(c)" "= 22"
|
|
|
|
gdb_test "print bar(d)" "= 22"
|
|
|
|
|
2004-01-01 09:46:21 +00:00
|
|
|
# ---
|
|
|
|
|
|
|
|
# List overloaded functions.
|
|
|
|
|
|
|
|
# The void case is tricky because some compilers say "(void)"
|
|
|
|
# and some compilers say "()".
|
|
|
|
|
2010-06-03 23:54:18 +00:00
|
|
|
gdb_test_no_output "set listsize 1" ""
|
2004-01-01 09:46:21 +00:00
|
|
|
gdb_test_multiple "info func overloadfnarg" "list overloaded function with no args" {
|
2001-11-01 23:41:09 +00:00
|
|
|
-re ".*overloadfnarg\\(void\\).*$gdb_prompt $" {
|
2004-01-01 09:46:21 +00:00
|
|
|
# gcc 2
|
2001-11-01 23:41:09 +00:00
|
|
|
gdb_test "list foo::overloadfnarg(void)"\
|
|
|
|
".*int foo::overloadfnarg.*\\(void\\).*" \
|
|
|
|
"list overloaded function with no args"
|
|
|
|
}
|
|
|
|
-re ".*overloadfnarg\\(\\).*$gdb_prompt $" {
|
2004-01-01 09:46:21 +00:00
|
|
|
# gcc 3
|
2001-11-01 23:41:09 +00:00
|
|
|
gdb_test "list foo::overloadfnarg()"\
|
|
|
|
".*int foo::overloadfnarg.*\\(void\\).*" \
|
|
|
|
"list overloaded function with no args"
|
|
|
|
}
|
|
|
|
}
|
1999-09-22 03:28:34 +00:00
|
|
|
|
2004-01-01 09:46:21 +00:00
|
|
|
gdb_test "list foo::overloadfnarg(int)" \
|
1999-09-22 03:28:34 +00:00
|
|
|
"int foo::overloadfnarg.*\\(int arg\\).*" \
|
2001-11-01 23:41:09 +00:00
|
|
|
"list overloaded function with int arg"
|
1999-09-22 03:28:34 +00:00
|
|
|
|
|
|
|
gdb_test "list foo::overloadfnarg(int, int (*)(int))" \
|
|
|
|
"int foo::overloadfnarg.*\\(int arg, int \\(\\*foo\\) \\(int\\)\\).*" \
|
2001-11-01 23:41:09 +00:00
|
|
|
"list overloaded function with function ptr args"
|
1999-09-22 03:28:34 +00:00
|
|
|
|
|
|
|
gdb_test "list \"foo::overloadfnarg(int, int (*)(int))\"" \
|
|
|
|
"int foo::overloadfnarg.*\\(int arg, int \\(\\*foo\\) \\(int\\)\\).*" \
|
2001-11-01 23:41:09 +00:00
|
|
|
"list overloaded function with function ptr args - quotes around argument"
|
2003-02-04 21:19:27 +00:00
|
|
|
|
2010-02-16 20:51:51 +00:00
|
|
|
# Test list with filename.
|
|
|
|
|
|
|
|
gdb_test "list ${srcfile}:intToChar" "int intToChar.*"
|
|
|
|
gdb_test "list ${srcfile}:intToChar(char)" "int intToChar.*"
|
|
|
|
gdb_test "list ${srcfile}:'intToChar(char)'" "int intToChar.*"
|
|
|
|
gdb_test "list '${srcfile}:intToChar(char)'" "int intToChar.*"
|
2010-03-04 18:38:17 +00:00
|
|
|
gdb_test "list '${srcfile}':intToChar(char)" "int intToChar.*"
|
|
|
|
gdb_test "list '${srcfile}':'intToChar(char)'" "int intToChar.*"
|
2010-02-16 20:51:51 +00:00
|
|
|
|
2011-08-02 20:59:44 +00:00
|
|
|
# And with filename and namespace.
|
2010-02-16 20:51:51 +00:00
|
|
|
|
2011-08-02 20:59:44 +00:00
|
|
|
gdb_test "list ${srcfile}:foo::overloadfnarg(int)" "int foo::overloadfnarg.*}"
|
|
|
|
gdb_test "list ${srcfile}:'foo::overloadfnarg(int)'" "int foo::overloadfnarg.*}"
|
2010-02-16 20:51:51 +00:00
|
|
|
|
2004-02-02 20:44:53 +00:00
|
|
|
# Now some tests to see how overloading and namespaces interact.
|
|
|
|
|
|
|
|
gdb_test "print overloadNamespace(1)" ".\[0-9\]* = 1"
|
|
|
|
gdb_test "print overloadNamespace('a')" ".\[0-9\]* = 1"
|
|
|
|
gdb_test "print overloadNamespace(dummyInstance)" ".\[0-9\]* = 2"
|
|
|
|
|
2010-02-08 20:55:43 +00:00
|
|
|
# Static methods.
|
|
|
|
gdb_test "print K::staticoverload ()" " = 1"
|
|
|
|
gdb_test "print K::staticoverload (2)" " = 2"
|
|
|
|
gdb_test "print K::staticoverload (2, 3)" " = 5"
|
|
|
|
|
|
|
|
# Namespace-qualified functions.
|
|
|
|
gdb_test "print N::nsoverload ()" " = 1"
|
|
|
|
gdb_test "print N::nsoverload (2)" " = 2"
|
|
|
|
gdb_test "print N::nsoverload (2, 3)" " = 5"
|
|
|
|
|
2004-02-02 20:44:53 +00:00
|
|
|
if ![runto 'XXX::marker2'] then {
|
|
|
|
perror "couldn't run to XXX::marker2"
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test "print overloadNamespace(1)" ".\[0-9\]* = 3" "print overloadNamespace(1) in XXX"
|
|
|
|
gdb_test "print overloadNamespace('a')" ".\[0-9\]* = 3" "print overloadNamespace('a') in XXX"
|
|
|
|
gdb_test "print overloadNamespace(dummyInstance)" ".\[0-9\]* = 2" "print overloadNamespace(dummyInstance) in XXX"
|
|
|
|
|
2004-01-01 09:46:21 +00:00
|
|
|
# One last mysterious test.
|
|
|
|
# I wonder what this is for?
|
|
|
|
|
|
|
|
gdb_test "print intToChar(1)" "\\$\[0-9\]+ = 297"
|
2009-11-10 22:17:06 +00:00
|
|
|
|
|
|
|
# Test expression evaluation with overloaded methods
|
|
|
|
gdb_test "print foo::overload1arg" \
|
|
|
|
"non-unique member `overload1arg' requires type instantiation" \
|
|
|
|
"print foo::overload1arg"
|
|
|
|
|
|
|
|
gdb_test "print foo::overload1arg(char***)" \
|
|
|
|
"no member function matches that type instantiation" \
|
|
|
|
"print foo::overload1arg(char***)"
|
|
|
|
|
|
|
|
gdb_test "print foo::overload1arg(void)" \
|
2010-02-16 21:09:32 +00:00
|
|
|
"\\$$decimal = {int \\(foo \\*( const|)\\)} $hex <foo::overload1arg\\(\\)>" \
|
2009-11-10 22:17:06 +00:00
|
|
|
"print foo::overload1arg(void)"
|
|
|
|
|
|
|
|
foreach t [list char "signed char" "unsigned char" "short" \
|
|
|
|
"unsigned short" int "unsigned int" long "unsigned long" \
|
|
|
|
float double] {
|
|
|
|
gdb_test "print foo::overload1arg($t)" \
|
2010-02-16 21:09:32 +00:00
|
|
|
"\\$$decimal = {int \\(foo \\*( const|), $t\\)} $hex <foo::overload1arg\\($t\\)>" \
|
2009-11-10 22:17:06 +00:00
|
|
|
"print foo::overload1arg($t)"
|
|
|
|
}
|