-# Copyright 1992, 1997, 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+# Copyright 1992, 1997, 1999, 2001, 2002, 2003, 2004, 2007, 2008, 2009
+# Free Software Foundation, Inc.
# 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
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
-#
+#
# 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.
-#
+#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This file was written by Fred Fish. (fnf@cygnus.com)
# Adapted for g++ 3.0 ABI by Michael Chastain. (chastain@redhat.com)
}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+ untested cplusfuncs.exp
+ return -1
}
#
set dm_type_int_star "int*"
set dm_type_long_star "long*"
set dm_type_unsigned_int "unsigned"
-set dm_type_void ""
+set dm_type_void "void"
set dm_type_void_star "void*"
proc probe_demangler { } {
global dm_type_void
global dm_type_void_star
- send_gdb "print &'foo::operator,(foo&)'\n"
+ send_gdb "print &foo::operator,(foo&)\n"
gdb_expect {
-re ".*foo::operator, \\(.*foo.*&.*\\).*\r\n$gdb_prompt $" {
# v2 demangler
}
}
- send_gdb "print &'dm_type_char_star'\n"
+ send_gdb "print &dm_type_char_star\n"
gdb_expect {
-re ".*dm_type_char_star\\(char \\*\\).*\r\n$gdb_prompt $" {
# v2 demangler
}
}
- send_gdb "print &'dm_type_foo_ref'\n"
+ send_gdb "print &dm_type_foo_ref\n"
gdb_expect {
-re ".*dm_type_foo_ref\\(foo &\\).*\r\n$gdb_prompt $" {
# v2 demangler
}
}
- send_gdb "print &'dm_type_int_star'\n"
+ send_gdb "print &dm_type_int_star\n"
gdb_expect {
-re ".*dm_type_int_star\\(int \\*\\).*\r\n$gdb_prompt $" {
# v2 demangler
}
}
- send_gdb "print &'dm_type_long_star'\n"
+ send_gdb "print &dm_type_long_star\n"
gdb_expect {
-re ".*dm_type_long_star\\(long \\*\\).*\r\n$gdb_prompt $" {
# v2 demangler
}
}
- send_gdb "print &'dm_type_unsigned_int'\n"
+ send_gdb "print &dm_type_unsigned_int\n"
gdb_expect {
-re ".*dm_type_unsigned_int\\(unsigned int\\).*\r\n$gdb_prompt $" {
# v2 demangler
}
}
- send_gdb "print &'dm_type_void'\n"
+ send_gdb "print &dm_type_void\n"
gdb_expect {
-re ".*dm_type_void\\(void\\).*\r\n$gdb_prompt $" {
# v2 demangler
}
}
- send_gdb "print &'dm_type_void_star'\n"
+ send_gdb "print &dm_type_void_star\n"
gdb_expect {
-re ".*dm_type_void_star\\(void \\*\\).*\r\n$gdb_prompt $" {
# v2 demangler
global gdb_prompt
send_gdb "info function $name\n"
+ regsub {\\\(void\\\)} $demangled {\(\)} demangled
gdb_expect {
-re ".*File .*:\r\n(class |)$demangled\r\n.*$gdb_prompt $" {
pass "info function for \"$name\""
set good_pattern [string_to_regexp $good]
- send_gdb "print &'$name'\n"
+ send_gdb "print &$name\n"
gdb_expect {
-re ".* = .* $hex <$good_pattern>\r\n$gdb_prompt $" {
- pass "print &'$name'"
+ pass "print &$name"
}
-re ".*$gdb_prompt $" {
- fail "print &'$name'"
+ fail "print &$name"
}
timeout {
- fail "print &'$name' (timeout)"
+ fail "print &$name (timeout)"
}
}
}
set good_pattern [string_to_regexp $good]
set bad_pattern [string_to_regexp $bad]
- send_gdb "print &'$name'\n"
+ send_gdb "print &$name\n"
gdb_expect {
-re ".* = .* $hex <$good_pattern>\r\n$gdb_prompt $" {
- pass "print &'$name'"
+ pass "print &$name"
}
-re ".* = .* $hex <$bad_pattern>\r\n$gdb_prompt $" {
- kfail $bugid "print &'$name'"
+ kfail $bugid "print &$name"
}
-re ".*$gdb_prompt $" {
- fail "print &'$name'"
+ fail "print &$name"
}
timeout {
- fail "print &'$name' (timeout)"
+ fail "print &$name (timeout)"
}
}
}
#
proc print_addr { name } {
- print_addr_2 "$name" "$name"
+ regsub {\(void\)} $name {()} expected
+ if {[string first "::" $name] == -1} {
+ # C function -- must be qutoed
+ set name "'$name'"
+ }
+ print_addr_2 "$name" $expected
}
#
print_addr "foo::operator\[\]($dm_type_foo_ref)"
print_addr "foo::operator()($dm_type_foo_ref)"
- gdb_test "print &'foo::operator new'" \
+ gdb_test "print &foo::operator new" \
" = .* $hex <foo::operator new\\(.*\\)(| static)>"
+ gdb_test "print &foo::operator new\[\]" \
+ " = .* $hex <foo::operator new\\\[\\\]\\(.*\\)(| static)>"
if { !$hp_aCC_compiler } {
print_addr "foo::operator delete($dm_type_void_star)"
+ print_addr "foo::operator delete[]($dm_type_void_star)"
} else {
gdb_test "print &'foo::operator delete($dm_type_void_star) static'" \
" = .*(0x\[0-9a-f\]+|) <foo::operator delete.*>"
global srcdir
global binfile
global gdb_prompt
+ global dm_type_int_star
set prms_id 0
set bug_id 0
test_paddr_operator_functions
test_paddr_hairy_functions
test_lookup_operator_functions
+
+ # 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.*"
}
do_tests