2011-01-01 15:34:07 +00:00
|
|
|
# Copyright 1992, 1997, 1999, 2001, 2002, 2003, 2004, 2007, 2008, 2009, 2010,
|
|
|
|
# 2011 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
|
|
|
|
|
|
|
# This file was written by Fred Fish. (fnf@cygnus.com)
|
2001-02-14 19:54:04 +00:00
|
|
|
# Adapted for g++ 3.0 ABI by Michael Chastain. (chastain@redhat.com)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
if $tracelevel then {
|
|
|
|
strace $tracelevel
|
|
|
|
}
|
|
|
|
|
1999-09-09 00:02:17 +00:00
|
|
|
if { [skip_cplus_tests] } { continue }
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
set testfile "cplusfuncs"
|
|
|
|
set srcfile ${testfile}.cc
|
|
|
|
set binfile ${objdir}/${subdir}/${testfile}
|
|
|
|
|
1999-09-09 00:02:17 +00:00
|
|
|
if { [get_compiler_info $binfile "c++"] } {
|
1999-08-02 23:48:37 +00:00
|
|
|
return -1
|
|
|
|
}
|
|
|
|
|
1999-09-09 00:02:17 +00:00
|
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
|
2006-08-10 05:27:22 +00:00
|
|
|
untested cplusfuncs.exp
|
|
|
|
return -1
|
1999-09-09 00:02:17 +00:00
|
|
|
}
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
#
|
2001-02-14 19:54:04 +00:00
|
|
|
# g++ changed its ABI between 2.95 and 3.0. gdb has two demanglers
|
|
|
|
# for the two different styles. The two demanglers have some subtle
|
|
|
|
# discrepancies in their output.
|
|
|
|
#
|
|
|
|
# old demangler new demangler
|
|
|
|
# --- --------- --- ---------
|
|
|
|
# "operator, " "operator,"
|
|
|
|
# "char *" "char*"
|
|
|
|
# "int *" "int*"
|
|
|
|
# "long *" "long*"
|
|
|
|
# "void *" "void*"
|
|
|
|
# "foo &" "foo&"
|
|
|
|
# "unsigned int" "unsigned"
|
|
|
|
# "void" ""
|
|
|
|
#
|
|
|
|
# I probe for the forms in use.
|
|
|
|
# The defaults are for the v3 demangler (as of 2001-02-13).
|
1999-04-16 01:35:26 +00:00
|
|
|
#
|
|
|
|
|
2001-02-14 19:54:04 +00:00
|
|
|
set dm_operator_comma ","
|
|
|
|
set dm_type_char_star "char*"
|
2001-11-05 23:31:26 +00:00
|
|
|
set dm_type_char_star_quoted "char\\*"
|
2001-02-14 19:54:04 +00:00
|
|
|
set dm_type_foo_ref "foo&"
|
|
|
|
set dm_type_int_star "int*"
|
|
|
|
set dm_type_long_star "long*"
|
|
|
|
set dm_type_unsigned_int "unsigned"
|
2009-11-11 16:45:16 +00:00
|
|
|
set dm_type_void "void"
|
2001-02-14 19:54:04 +00:00
|
|
|
set dm_type_void_star "void*"
|
|
|
|
|
* 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
|
|
|
# Some other vagaries of GDB's type printing machinery. The integer types
|
|
|
|
# may have unsigned before or after their length, and may have "int"
|
|
|
|
# appended. The char* conversion operator may have name "char*" even if
|
|
|
|
# the type is "char *", because the name comes from the debug information
|
|
|
|
# and the type from GDB. Function types may not see through typedefs.
|
|
|
|
|
|
|
|
set dm_type_short "short"
|
|
|
|
set dm_type_long "long"
|
|
|
|
set dm_type_unsigned_short "unsigned short"
|
|
|
|
set dm_type_unsigned_long "unsigned long"
|
|
|
|
set dm_operator_char_star "char*"
|
|
|
|
set dm_operator_char_star_quoted "char\\*"
|
|
|
|
set dm_type_typedef 0
|
|
|
|
|
2001-02-14 19:54:04 +00:00
|
|
|
proc probe_demangler { } {
|
1999-04-16 01:35:26 +00:00
|
|
|
global gdb_prompt
|
2001-02-14 19:54:04 +00:00
|
|
|
global dm_operator_comma
|
* 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
|
|
|
global dm_operator_char_star
|
|
|
|
global dm_operator_char_star_quoted
|
2001-02-14 19:54:04 +00:00
|
|
|
global dm_type_char_star
|
2001-11-05 23:31:26 +00:00
|
|
|
global dm_type_char_star_quoted
|
2001-02-14 19:54:04 +00:00
|
|
|
global dm_type_foo_ref
|
|
|
|
global dm_type_int_star
|
|
|
|
global dm_type_long_star
|
|
|
|
global dm_type_unsigned_int
|
|
|
|
global dm_type_void
|
|
|
|
global dm_type_void_star
|
* 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
|
|
|
global dm_type_short
|
|
|
|
global dm_type_unsigned_short
|
|
|
|
global dm_type_long
|
|
|
|
global dm_type_unsigned_long
|
|
|
|
global dm_type_typedef
|
2001-02-14 19:54:04 +00:00
|
|
|
|
2010-06-01 18:18:35 +00:00
|
|
|
gdb_test_multiple "print &foo::operator,(foo&)" \
|
|
|
|
"detect dm_operator_comma" {
|
|
|
|
-re ".*foo::operator, \\(.*foo.*&.*\\).*\r\n$gdb_prompt $" {
|
|
|
|
# v2 demangler
|
|
|
|
set dm_operator_comma ", "
|
|
|
|
pass "detect dm_operator_comma"
|
|
|
|
}
|
|
|
|
-re ".*foo::operator,\\(.*foo.*&.*\\).*\r\n$gdb_prompt $" {
|
|
|
|
# v3 demangler
|
|
|
|
pass "detect dm_operator_comma"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_multiple "print &foo::operator char*($dm_type_void)" \
|
|
|
|
"detect dm_operator_char_star" {
|
|
|
|
-re ".*foo::operator char \\*\\(void\\).*\r\n$gdb_prompt $" {
|
|
|
|
# v2 demangler or GDB type printer
|
|
|
|
set dm_operator_char_star "char *"
|
|
|
|
set dm_operator_char_star_quoted "char \\*"
|
|
|
|
pass "detect dm_operator_char_star"
|
|
|
|
}
|
|
|
|
-re ".*foo::operator char\\*\\(\\).*\r\n$gdb_prompt $" {
|
|
|
|
# v3 demangler
|
|
|
|
pass "detect dm_operator_char_star"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_multiple "print &dm_type_char_star" \
|
|
|
|
"detect dm_type_char_star" {
|
|
|
|
-re ".*dm_type_char_star\\(char \\*\\).*\r\n$gdb_prompt $" {
|
|
|
|
# v2 demangler
|
|
|
|
set dm_type_char_star "char *"
|
|
|
|
set dm_type_char_star_quoted "char \\*"
|
|
|
|
pass "detect dm_type_char_star"
|
|
|
|
}
|
|
|
|
-re ".*dm_type_char_star\\(char\\*\\).*\r\n$gdb_prompt $" {
|
|
|
|
# v3 demangler
|
|
|
|
pass "detect dm_type_char_star"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_multiple "print &dm_type_foo_ref" \
|
|
|
|
"detect dm_type_foo_ref" {
|
|
|
|
-re ".*dm_type_foo_ref\\(foo &\\).*\r\n$gdb_prompt $" {
|
|
|
|
# v2 demangler
|
|
|
|
set dm_type_foo_ref "foo &"
|
|
|
|
pass "detect dm_type_foo_ref"
|
|
|
|
}
|
|
|
|
-re ".*dm_type_foo_ref\\(foo&\\).*\r\n$gdb_prompt $" {
|
|
|
|
# v3 demangler
|
|
|
|
pass "detect dm_type_foo_ref"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_multiple "print &dm_type_int_star" \
|
|
|
|
"detect dm_type_int_star" {
|
|
|
|
-re ".*dm_type_int_star\\(int \\*\\).*\r\n$gdb_prompt $" {
|
|
|
|
# v2 demangler
|
|
|
|
set dm_type_int_star "int *"
|
|
|
|
pass "detect dm_type_int_star"
|
|
|
|
}
|
|
|
|
-re ".*dm_type_int_star\\(int\\*\\).*\r\n$gdb_prompt $" {
|
|
|
|
# v3 demangler
|
|
|
|
pass "detect dm_type_int_star"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_multiple "print &dm_type_long_star" \
|
|
|
|
"detect dm_type_long_star" {
|
|
|
|
-re ".*dm_type_long_star\\(long \\*\\).*\r\n$gdb_prompt $" {
|
|
|
|
# v2 demangler
|
|
|
|
set dm_type_long_star "long *"
|
|
|
|
pass "detect dm_type_long_star"
|
|
|
|
}
|
|
|
|
-re ".*dm_type_long_star\\(long\\*\\).*\r\n$gdb_prompt $" {
|
|
|
|
# v3 demangler
|
|
|
|
pass "detect dm_type_long_star"
|
|
|
|
}
|
|
|
|
-re ".*dm_type_long_star\\(long int \\*\\).*\r\n$gdb_prompt $" {
|
|
|
|
# GCC v3 and GDB's type printer
|
|
|
|
set dm_type_long_star "long int *"
|
|
|
|
pass "detect dm_type_long_star"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_multiple "print &dm_type_unsigned_int" \
|
|
|
|
"detect dm_type_unsigned_int" {
|
|
|
|
-re ".*dm_type_unsigned_int\\(unsigned int\\).*\r\n$gdb_prompt $" {
|
|
|
|
# v2 demangler
|
|
|
|
set dm_type_unsigned_int "unsigned int"
|
|
|
|
pass "detect dm_type_unsigned_int"
|
|
|
|
}
|
|
|
|
-re ".*dm_type_unsigned_int\\(unsigned\\).*\r\n$gdb_prompt $" {
|
|
|
|
# v3 demangler
|
|
|
|
pass "detect dm_type_unsigned_int"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_multiple "print &dm_type_void" \
|
|
|
|
"detect dm_type_void" {
|
|
|
|
-re ".*dm_type_void\\(void\\).*\r\n$gdb_prompt $" {
|
|
|
|
# v2 demangler
|
|
|
|
set dm_type_void "void"
|
|
|
|
pass "detect dm_type_void"
|
|
|
|
}
|
|
|
|
-re ".*dm_type_void\\(\\).*\r\n$gdb_prompt $" {
|
|
|
|
# v3 demangler
|
|
|
|
pass "detect dm_type_void"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_multiple "print &dm_type_void_star" \
|
|
|
|
"detect dm_type_void_star" {
|
|
|
|
-re ".*dm_type_void_star\\(void \\*\\).*\r\n$gdb_prompt $" {
|
|
|
|
# v2 demangler
|
|
|
|
set dm_type_void_star "void *"
|
|
|
|
pass "detect dm_type_void_star"
|
|
|
|
}
|
|
|
|
-re ".*dm_type_void_star\\(void\\*\\).*\r\n$gdb_prompt $" {
|
|
|
|
# v3 demangler
|
|
|
|
pass "detect dm_type_void_star"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_multiple "print &dm_type_short" \
|
|
|
|
"detect dm_type_short" {
|
|
|
|
-re ".*dm_type_short\\(short\\).*\r\n$gdb_prompt $" {
|
|
|
|
# v2 and v3 demanglers
|
|
|
|
pass "detect dm_type_short"
|
|
|
|
}
|
|
|
|
-re ".*dm_type_short\\(short int\\).*\r\n$gdb_prompt $" {
|
|
|
|
# GDB type printer
|
|
|
|
set dm_type_short "short int"
|
|
|
|
pass "detect dm_type_short"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_multiple "print &dm_type_unsigned_short" \
|
|
|
|
"detect dm_type_unsigned_short" {
|
|
|
|
-re ".*dm_type_unsigned_short\\(unsigned short\\).*\r\n$gdb_prompt $" {
|
|
|
|
# v2 and v3 demanglers
|
|
|
|
pass "detect dm_type_unsigned_short"
|
|
|
|
}
|
|
|
|
-re ".*dm_type_unsigned_short\\(short unsigned int\\).*\r\n$gdb_prompt $" {
|
|
|
|
# GDB type printer
|
|
|
|
set dm_type_unsigned_short "short unsigned int"
|
|
|
|
pass "detect dm_type_unsigned_short"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_multiple "print &dm_type_long" \
|
|
|
|
"detect dm_type_long" {
|
|
|
|
-re ".*dm_type_long\\(long\\).*\r\n$gdb_prompt $" {
|
|
|
|
# v2 and v3 demanglers
|
|
|
|
pass "detect dm_type_long"
|
|
|
|
}
|
|
|
|
-re ".*dm_type_long\\(long int\\).*\r\n$gdb_prompt $" {
|
|
|
|
# GDB type printer
|
|
|
|
set dm_type_long "long int"
|
|
|
|
pass "detect dm_type_long"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_multiple "print &dm_type_unsigned_long" \
|
|
|
|
"detect dm_type_unsigned_long" {
|
|
|
|
-re ".*dm_type_unsigned_long\\(unsigned long\\).*\r\n$gdb_prompt $" {
|
|
|
|
# v2 and v3 demanglers
|
|
|
|
pass "detect dm_type_unsigned_long"
|
|
|
|
}
|
|
|
|
-re ".*dm_type_unsigned_long\\(long unsigned int\\).*\r\n$gdb_prompt $" {
|
|
|
|
# GDB type printer
|
|
|
|
set dm_type_unsigned_long "long unsigned int"
|
|
|
|
pass "detect dm_type_unsigned_long"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_test_multiple "print &dm_type_typedef" \
|
|
|
|
"detect dm_type_typedef" {
|
|
|
|
-re ".*dm_type_typedef\\(int\\).*\r\n$gdb_prompt $" {
|
|
|
|
# v2 and v3 demanglers
|
|
|
|
pass "detect dm_type_typedef"
|
|
|
|
}
|
|
|
|
-re ".*dm_type_typedef\\(myint\\).*\r\n$gdb_prompt $" {
|
|
|
|
# GDB type printer
|
|
|
|
set dm_type_typedef 1
|
|
|
|
pass "detect dm_type_typedef"
|
|
|
|
}
|
2001-02-14 19:54:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Lookup a specific C++ function and print the demangled type.
|
|
|
|
# This form accepts the demangled type as a regexp.
|
|
|
|
#
|
|
|
|
|
|
|
|
proc info_func_regexp { name demangled } {
|
|
|
|
global gdb_prompt
|
|
|
|
|
2009-11-21 05:17:41 +00:00
|
|
|
regsub {\\\(void\\\)} $demangled {\(\)} demangled
|
2010-06-01 18:18:35 +00:00
|
|
|
|
|
|
|
gdb_test "info function $name" \
|
|
|
|
"File .*:\r\n(class|)${demangled}.*" \
|
|
|
|
"info function for \"$name\""
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
2001-02-14 19:54:04 +00:00
|
|
|
# Lookup a specific C++ function and print the demangled type.
|
|
|
|
# This form accepts the demangled type as a literal string.
|
1999-04-16 01:35:26 +00:00
|
|
|
#
|
|
|
|
|
2001-02-14 19:54:04 +00:00
|
|
|
proc info_func { name demangled } {
|
|
|
|
info_func_regexp "$name" [string_to_regexp "$demangled"]
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Print the address of a function.
|
|
|
|
# This checks that I can lookup a fully qualified C++ function.
|
|
|
|
# This also checks the argument types on the return string.
|
2003-01-17 19:22:27 +00:00
|
|
|
|
|
|
|
# Note: carlton/2003-01-16: If you modify this, make a corresponding
|
|
|
|
# modification to print_addr_2_kfail.
|
2001-02-14 19:54:04 +00:00
|
|
|
|
|
|
|
proc print_addr_2 { name good } {
|
1999-04-16 01:35:26 +00:00
|
|
|
global gdb_prompt
|
|
|
|
global hex
|
|
|
|
|
2001-02-14 19:54:04 +00:00
|
|
|
set good_pattern [string_to_regexp $good]
|
|
|
|
|
2010-06-01 18:18:35 +00:00
|
|
|
gdb_test "print &$name" \
|
|
|
|
".* = .* $hex <$good_pattern>"
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
|
2003-01-17 19:22:27 +00:00
|
|
|
# NOTE: carlton/2003-01-16: hairyfunc5-6 fail on GCC 3.x (for at least
|
|
|
|
# x=1 and x=2.1). So I'm modifying print_addr_2 to accept a failure
|
|
|
|
# condition. FIXME: It would be nice if the failure condition were
|
|
|
|
# conditional on the compiler version, but I'm not sufficiently
|
|
|
|
# motivated. I did hardwire in the versions of char * and int *,
|
|
|
|
# which will give some compiler-specificity to the failure.
|
|
|
|
|
|
|
|
proc print_addr_2_kfail { name good bad bugid } {
|
|
|
|
global gdb_prompt
|
|
|
|
global hex
|
|
|
|
|
|
|
|
set good_pattern [string_to_regexp $good]
|
|
|
|
set bad_pattern [string_to_regexp $bad]
|
|
|
|
|
2010-06-01 18:18:35 +00:00
|
|
|
gdb_test_multiple "print &$name" "print &$name" {
|
2003-01-17 19:22:27 +00:00
|
|
|
-re ".* = .* $hex <$good_pattern>\r\n$gdb_prompt $" {
|
2009-11-11 16:45:16 +00:00
|
|
|
pass "print &$name"
|
2003-01-17 19:22:27 +00:00
|
|
|
}
|
|
|
|
-re ".* = .* $hex <$bad_pattern>\r\n$gdb_prompt $" {
|
2009-11-11 16:45:16 +00:00
|
|
|
kfail $bugid "print &$name"
|
2003-01-17 19:22:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-14 19:54:04 +00:00
|
|
|
#
|
|
|
|
# Simple interfaces to print_addr_2.
|
|
|
|
#
|
|
|
|
|
|
|
|
proc print_addr { name } {
|
2009-11-21 05:17:41 +00:00
|
|
|
regsub {\(void\)} $name {()} expected
|
2009-11-11 16:45:16 +00:00
|
|
|
if {[string first "::" $name] == -1} {
|
|
|
|
# C function -- must be qutoed
|
|
|
|
set name "'$name'"
|
|
|
|
}
|
|
|
|
print_addr_2 "$name" $expected
|
2001-02-14 19:54:04 +00:00
|
|
|
}
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
#
|
|
|
|
# Test name demangling for operators.
|
|
|
|
#
|
|
|
|
# The '(' at the end of each regex input pattern is so that we match only
|
|
|
|
# the one we are looking for. I.E. "operator&" would match both
|
|
|
|
# "operator&(foo &)" and "operator&&(foo &)".
|
|
|
|
#
|
2001-02-14 19:54:04 +00:00
|
|
|
# gdb-gnats bug gdb/18:
|
|
|
|
# "gdb can't parse "info func operator*" or "info func operator\*".
|
|
|
|
# The star in "operator*" is interpreted as a regexp, but the "\*"
|
|
|
|
# in "operator\*" is not a legal operator.
|
|
|
|
#
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
proc test_lookup_operator_functions {} {
|
2001-02-14 19:54:04 +00:00
|
|
|
global dm_operator_comma
|
* 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
|
|
|
global dm_operator_char_star
|
2001-02-14 19:54:04 +00:00
|
|
|
global dm_type_char_star
|
* 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
|
|
|
global dm_operator_char_star_quoted
|
2001-02-14 19:54:04 +00:00
|
|
|
global dm_type_foo_ref
|
|
|
|
global dm_type_void
|
|
|
|
global dm_type_void_star
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2001-11-05 23:31:26 +00:00
|
|
|
# operator* requires quoting so that GDB does not treat it as a regexp.
|
|
|
|
info_func "operator\\*(" "void foo::operator*($dm_type_foo_ref);"
|
2001-02-14 19:54:04 +00:00
|
|
|
info_func "operator%(" "void foo::operator%($dm_type_foo_ref);"
|
|
|
|
info_func "operator-(" "void foo::operator-($dm_type_foo_ref);"
|
|
|
|
info_func "operator>>(" "void foo::operator>>($dm_type_foo_ref);"
|
|
|
|
info_func "operator!=(" "void foo::operator!=($dm_type_foo_ref);"
|
|
|
|
info_func "operator>(" "void foo::operator>($dm_type_foo_ref);"
|
|
|
|
info_func "operator>=(" "void foo::operator>=($dm_type_foo_ref);"
|
|
|
|
info_func "operator|(" "void foo::operator|($dm_type_foo_ref);"
|
|
|
|
info_func "operator&&(" "void foo::operator&&($dm_type_foo_ref);"
|
|
|
|
info_func "operator!(" "void foo::operator!($dm_type_void);"
|
|
|
|
info_func "operator++(" "void foo::operator++(int);"
|
|
|
|
info_func "operator=(" "void foo::operator=($dm_type_foo_ref);"
|
|
|
|
info_func "operator+=(" "void foo::operator+=($dm_type_foo_ref);"
|
2001-11-05 23:31:26 +00:00
|
|
|
# operator*= requires quoting so that GDB does not treat it as a regexp.
|
|
|
|
info_func "operator\\*=(" "void foo::operator*=($dm_type_foo_ref);"
|
2001-02-14 19:54:04 +00:00
|
|
|
info_func "operator%=(" "void foo::operator%=($dm_type_foo_ref);"
|
|
|
|
info_func "operator>>=(" "void foo::operator>>=($dm_type_foo_ref);"
|
|
|
|
info_func "operator|=(" "void foo::operator|=($dm_type_foo_ref);"
|
|
|
|
info_func "operator$dm_operator_comma\(" \
|
|
|
|
"void foo::operator$dm_operator_comma\($dm_type_foo_ref);"
|
|
|
|
info_func "operator/(" "void foo::operator/($dm_type_foo_ref);"
|
|
|
|
info_func "operator+(" "void foo::operator+($dm_type_foo_ref);"
|
|
|
|
info_func "operator<<(" "void foo::operator<<($dm_type_foo_ref);"
|
|
|
|
info_func "operator==(" "void foo::operator==($dm_type_foo_ref);"
|
|
|
|
info_func "operator<(" "void foo::operator<($dm_type_foo_ref);"
|
|
|
|
info_func "operator<=(" "void foo::operator<=($dm_type_foo_ref);"
|
|
|
|
info_func "operator&(" "void foo::operator&($dm_type_foo_ref);"
|
|
|
|
info_func "operator^(" "void foo::operator^($dm_type_foo_ref);"
|
|
|
|
info_func "operator||(" "void foo::operator||($dm_type_foo_ref);"
|
|
|
|
info_func "operator~(" "void foo::operator~($dm_type_void);"
|
|
|
|
info_func "operator--(" "void foo::operator--(int);"
|
|
|
|
info_func "operator->(" "foo *foo::operator->($dm_type_void);"
|
|
|
|
info_func "operator-=(" "void foo::operator-=($dm_type_foo_ref);"
|
|
|
|
info_func "operator/=(" "void foo::operator/=($dm_type_foo_ref);"
|
|
|
|
info_func "operator<<=(" "void foo::operator<<=($dm_type_foo_ref);"
|
|
|
|
info_func "operator&=(" "void foo::operator&=($dm_type_foo_ref);"
|
|
|
|
info_func "operator^=(" "void foo::operator^=($dm_type_foo_ref);"
|
2001-11-05 23:31:26 +00:00
|
|
|
# operator->* requires quoting so that GDB does not treat it as a regexp.
|
|
|
|
info_func "operator->\\*(" "void foo::operator->*($dm_type_foo_ref);"
|
2001-02-14 19:54:04 +00:00
|
|
|
|
2001-11-05 23:31:26 +00:00
|
|
|
# operator[] needs double backslashes, so that a single backslash
|
|
|
|
# will be sent to GDB, preventing the square brackets from being
|
|
|
|
# evaluated as a regular expression.
|
|
|
|
info_func "operator\\\[\\\](" "void foo::operator\[\]($dm_type_foo_ref);"
|
2001-02-14 19:54:04 +00:00
|
|
|
|
|
|
|
# These are gnarly because they might end with 'static'.
|
|
|
|
set dm_type_void_star_regexp [string_to_regexp $dm_type_void_star]
|
|
|
|
info_func_regexp "operator new(" "void \\*foo::operator new\\(.*\\)(| static);"
|
|
|
|
info_func_regexp "operator delete(" "void foo::operator delete\\($dm_type_void_star_regexp\\)(| static);"
|
|
|
|
|
|
|
|
info_func "operator int(" "int foo::operator int($dm_type_void);"
|
|
|
|
info_func "operator()(" "void foo::operator()($dm_type_foo_ref);"
|
* 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
|
|
|
info_func "operator $dm_operator_char_star_quoted\(" \
|
|
|
|
"char *foo::operator $dm_operator_char_star\($dm_type_void);"
|
2001-02-14 19:54:04 +00:00
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
proc test_paddr_operator_functions {} {
|
|
|
|
global hex
|
1999-08-02 23:48:37 +00:00
|
|
|
global hp_aCC_compiler
|
2001-02-14 19:54:04 +00:00
|
|
|
global dm_operator_comma
|
|
|
|
global dm_type_char_star
|
|
|
|
global dm_type_foo_ref
|
|
|
|
global dm_type_long_star
|
|
|
|
global dm_type_unsigned_int
|
|
|
|
global dm_type_void
|
|
|
|
global dm_type_void_star
|
* 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
|
|
|
global dm_operator_char_star
|
2001-02-14 19:54:04 +00:00
|
|
|
|
|
|
|
print_addr "foo::operator*($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator%($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator-($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator>>($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator!=($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator>($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator>=($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator|($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator&&($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator!($dm_type_void)"
|
|
|
|
print_addr "foo::operator++(int)"
|
|
|
|
print_addr "foo::operator=($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator+=($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator*=($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator%=($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator>>=($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator|=($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator$dm_operator_comma\($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator/($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator+($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator<<($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator==($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator<($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator<=($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator&($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator^($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator||($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator~($dm_type_void)"
|
|
|
|
print_addr "foo::operator--(int)"
|
|
|
|
print_addr "foo::operator->($dm_type_void)"
|
|
|
|
print_addr "foo::operator-=($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator/=($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator<<=($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator&=($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator^=($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator->*($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator\[\]($dm_type_foo_ref)"
|
|
|
|
print_addr "foo::operator()($dm_type_foo_ref)"
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2009-11-11 16:45:16 +00:00
|
|
|
gdb_test "print &foo::operator new" \
|
2001-02-14 19:54:04 +00:00
|
|
|
" = .* $hex <foo::operator new\\(.*\\)(| static)>"
|
2009-11-11 16:45:16 +00:00
|
|
|
gdb_test "print &foo::operator new\[\]" \
|
|
|
|
" = .* $hex <foo::operator new\\\[\\\]\\(.*\\)(| static)>"
|
1999-08-02 23:48:37 +00:00
|
|
|
if { !$hp_aCC_compiler } {
|
2001-02-14 19:54:04 +00:00
|
|
|
print_addr "foo::operator delete($dm_type_void_star)"
|
2009-11-11 16:45:16 +00:00
|
|
|
print_addr "foo::operator delete[]($dm_type_void_star)"
|
1999-08-02 23:48:37 +00:00
|
|
|
} else {
|
2001-02-14 19:54:04 +00:00
|
|
|
gdb_test "print &'foo::operator delete($dm_type_void_star) static'" \
|
1999-08-02 23:48:37 +00:00
|
|
|
" = .*(0x\[0-9a-f\]+|) <foo::operator delete.*>"
|
|
|
|
}
|
2001-02-14 19:54:04 +00:00
|
|
|
|
|
|
|
print_addr "foo::operator int($dm_type_void)"
|
* 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
|
|
|
print_addr "foo::operator $dm_operator_char_star\($dm_type_void)"
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Test overloaded functions (1 arg).
|
|
|
|
#
|
|
|
|
|
|
|
|
proc test_paddr_overloaded_functions {} {
|
2001-02-14 19:54:04 +00:00
|
|
|
global dm_type_unsigned_int
|
|
|
|
global dm_type_void
|
* 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
|
|
|
global dm_type_short
|
|
|
|
global dm_type_unsigned_short
|
|
|
|
global dm_type_long
|
|
|
|
global dm_type_unsigned_long
|
2001-02-14 19:54:04 +00:00
|
|
|
|
|
|
|
print_addr "overload1arg($dm_type_void)"
|
|
|
|
print_addr "overload1arg(char)"
|
|
|
|
print_addr "overload1arg(signed char)"
|
|
|
|
print_addr "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
|
|
|
print_addr "overload1arg($dm_type_short)"
|
|
|
|
print_addr "overload1arg($dm_type_unsigned_short)"
|
2001-02-14 19:54:04 +00:00
|
|
|
print_addr "overload1arg(int)"
|
|
|
|
print_addr "overload1arg($dm_type_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
|
|
|
print_addr "overload1arg($dm_type_long)"
|
|
|
|
print_addr "overload1arg($dm_type_unsigned_long)"
|
2001-02-14 19:54:04 +00:00
|
|
|
print_addr "overload1arg(float)"
|
|
|
|
print_addr "overload1arg(double)"
|
|
|
|
|
|
|
|
print_addr "overloadargs(int)"
|
|
|
|
print_addr "overloadargs(int, int)"
|
|
|
|
print_addr "overloadargs(int, int, int)"
|
|
|
|
print_addr "overloadargs(int, int, int, int)"
|
|
|
|
print_addr "overloadargs(int, int, int, int, int)"
|
|
|
|
print_addr "overloadargs(int, int, int, int, int, int)"
|
|
|
|
print_addr "overloadargs(int, int, int, int, int, int, int)"
|
|
|
|
print_addr "overloadargs(int, int, int, int, int, int, int, int)"
|
|
|
|
print_addr "overloadargs(int, int, int, int, int, int, int, int, int)"
|
|
|
|
print_addr "overloadargs(int, int, int, int, int, int, int, int, int, int)"
|
|
|
|
print_addr "overloadargs(int, int, int, int, int, int, int, int, int, int, int)"
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
proc test_paddr_hairy_functions {} {
|
2001-02-14 19:54:04 +00:00
|
|
|
global gdb_prompt
|
|
|
|
global hex
|
|
|
|
global dm_type_char_star
|
|
|
|
global dm_type_int_star
|
|
|
|
global dm_type_long_star
|
* 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
|
|
|
global dm_type_typedef
|
2001-02-14 19:54:04 +00:00
|
|
|
|
|
|
|
print_addr_2 "hairyfunc1" "hairyfunc1(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
|
|
|
|
|
|
|
if {$dm_type_typedef == 0} {
|
|
|
|
print_addr_2 "hairyfunc2" "hairyfunc2(int (*)($dm_type_char_star))"
|
|
|
|
print_addr_2 "hairyfunc3" "hairyfunc3(int (*)(short (*)($dm_type_long_star)))"
|
|
|
|
print_addr_2 "hairyfunc4" "hairyfunc4(int (*)(short (*)($dm_type_char_star)))"
|
|
|
|
|
|
|
|
# gdb-gnats bug gdb/19:
|
|
|
|
# "gdb v3 demangler fails on hairyfunc5 hairyfunc6 hairyfunc7"
|
|
|
|
print_addr_2_kfail "hairyfunc5" "hairyfunc5(int (*(*)($dm_type_char_star))(long))" "hairyfunc5(int (*)(long) (*)(char*))" "gdb/19"
|
|
|
|
print_addr_2_kfail "hairyfunc6" "hairyfunc6(int (*(*)($dm_type_int_star))(long))" "hairyfunc6(int (*)(long) (*)(int*))" "gdb/19"
|
|
|
|
print_addr_2_kfail "hairyfunc7" "hairyfunc7(int (*(*)(int (*)($dm_type_char_star)))(long))" "hairyfunc7(int (*)(long) (*)(int (*)(char*)))" "gdb/19"
|
|
|
|
} else {
|
|
|
|
print_addr_2 "hairyfunc2" "hairyfunc2(PFPc_i)"
|
|
|
|
print_addr_2 "hairyfunc3" "hairyfunc3(PFPFPl_s_i)"
|
|
|
|
print_addr_2 "hairyfunc4" "hairyfunc4(PFPFPc_s_i)"
|
|
|
|
|
|
|
|
# gdb-gnats bug gdb/19:
|
|
|
|
# "gdb v3 demangler fails on hairyfunc5 hairyfunc6 hairyfunc7"
|
|
|
|
print_addr_2 "hairyfunc5" "hairyfunc5(PFPc_PFl_i)"
|
|
|
|
print_addr_2 "hairyfunc6" "hairyfunc6(PFPi_PFl_i)"
|
|
|
|
print_addr_2 "hairyfunc7" "hairyfunc7(PFPFPc_i_PFl_i)"
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
proc do_tests {} {
|
|
|
|
global subdir
|
|
|
|
global objdir
|
|
|
|
global srcdir
|
|
|
|
global binfile
|
|
|
|
global gdb_prompt
|
2009-09-21 19:46:15 +00:00
|
|
|
global dm_type_int_star
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Start with a fresh gdb.
|
|
|
|
|
|
|
|
gdb_exit
|
|
|
|
gdb_start
|
|
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
|
|
|
gdb_load $binfile
|
|
|
|
|
2010-06-01 18:18:35 +00:00
|
|
|
gdb_test_no_output "set language c++"
|
|
|
|
gdb_test_no_output "set width 0"
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2003-02-13 21:33:20 +00:00
|
|
|
runto_main
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2001-02-14 19:54:04 +00:00
|
|
|
probe_demangler
|
1999-04-16 01:35:26 +00:00
|
|
|
test_paddr_overloaded_functions
|
|
|
|
test_paddr_operator_functions
|
|
|
|
test_paddr_hairy_functions
|
|
|
|
test_lookup_operator_functions
|
2009-09-21 19:46:15 +00:00
|
|
|
|
|
|
|
# A regression test on errors involving operators
|
|
|
|
gdb_test "list foo::operator $dm_type_int_star" \
|
|
|
|
".*the class foo does not have any method named operator $dm_type_int_star.*"
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
do_tests
|