summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.c++
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.c++')
-rw-r--r--gdb/testsuite/gdb.c++/Makefile.in20
-rw-r--r--gdb/testsuite/gdb.c++/anon-union.cc54
-rw-r--r--gdb/testsuite/gdb.c++/anon-union.exp337
-rw-r--r--gdb/testsuite/gdb.c++/classes.exp850
-rw-r--r--gdb/testsuite/gdb.c++/compiler.cc34
-rw-r--r--gdb/testsuite/gdb.c++/configure899
-rw-r--r--gdb/testsuite/gdb.c++/configure.in15
-rw-r--r--gdb/testsuite/gdb.c++/cplusfuncs.cc185
-rw-r--r--gdb/testsuite/gdb.c++/cplusfuncs.exp300
-rw-r--r--gdb/testsuite/gdb.c++/demangle.exp1517
-rw-r--r--gdb/testsuite/gdb.c++/derivation.cc240
-rw-r--r--gdb/testsuite/gdb.c++/derivation.exp316
-rw-r--r--gdb/testsuite/gdb.c++/inherit.exp859
-rw-r--r--gdb/testsuite/gdb.c++/local.cc67
-rw-r--r--gdb/testsuite/gdb.c++/local.exp110
-rw-r--r--gdb/testsuite/gdb.c++/member-ptr.cc106
-rw-r--r--gdb/testsuite/gdb.c++/member-ptr.exp510
-rw-r--r--gdb/testsuite/gdb.c++/method.cc80
-rw-r--r--gdb/testsuite/gdb.c++/method.exp233
-rw-r--r--gdb/testsuite/gdb.c++/misc.cc517
-rw-r--r--gdb/testsuite/gdb.c++/misc.exp106
-rw-r--r--gdb/testsuite/gdb.c++/overload.cc151
-rw-r--r--gdb/testsuite/gdb.c++/overload.exp338
-rw-r--r--gdb/testsuite/gdb.c++/ovldbreak.cc177
-rw-r--r--gdb/testsuite/gdb.c++/ovldbreak.exp680
-rw-r--r--gdb/testsuite/gdb.c++/ref-types.cc30
-rw-r--r--gdb/testsuite/gdb.c++/ref-types.exp276
-rw-r--r--gdb/testsuite/gdb.c++/ref-types2.cc47
-rw-r--r--gdb/testsuite/gdb.c++/ref-types2.exp450
-rw-r--r--gdb/testsuite/gdb.c++/templates.cc785
-rw-r--r--gdb/testsuite/gdb.c++/templates.exp202
-rw-r--r--gdb/testsuite/gdb.c++/userdef.cc339
-rw-r--r--gdb/testsuite/gdb.c++/userdef.exp317
-rw-r--r--gdb/testsuite/gdb.c++/virtfunc.cc199
-rw-r--r--gdb/testsuite/gdb.c++/virtfunc.exp751
35 files changed, 12097 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.c++/Makefile.in b/gdb/testsuite/gdb.c++/Makefile.in
new file mode 100644
index 00000000000..13a1234a890
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/Makefile.in
@@ -0,0 +1,20 @@
+VPATH = @srcdir@
+srcdir = @srcdir@
+
+PROGS = anon-union compiler cplusfuncs derivation inherit local \
+ member-ptr method misc \
+ overload ovldbreak ref-types ref-types2 templates userdef virtfunc
+
+all:
+ @echo "Nothing to be done for all..."
+
+#### host, target, and site specific Makefile frags come in here.
+
+clean mostlyclean:
+ -rm -f *.ci *.o ${OBJS} ${PROGS} *~ core
+
+distclean maintainer-clean realclean: clean
+ -rm -f Makefile config.status config.log
+
+Makefile: $(srcdir)/Makefile.in $(srcdir)/configure.in
+ $(SHELL) ./config.status --recheck
diff --git a/gdb/testsuite/gdb.c++/anon-union.cc b/gdb/testsuite/gdb.c++/anon-union.cc
new file mode 100644
index 00000000000..c58a3068223
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/anon-union.cc
@@ -0,0 +1,54 @@
+
+struct Foo {
+ union {
+ int zero;
+ unsigned int one;
+ } num1;
+
+ union {
+ int pebble;
+ struct {
+ int rock;
+ unsigned int rock2;
+ } x;
+ union {
+ int qux;
+ unsigned int mux;
+ };
+ unsigned int boulder;
+ };
+ union {
+ int paper;
+ unsigned int cloth;
+ };
+ union {
+ int two;
+ unsigned int three;
+ } num2;
+};
+
+union Bar {
+ int x;
+ unsigned int y;
+};
+
+Foo foo;
+Bar bar;
+
+int main()
+{
+ foo.paper = 33;
+ foo.pebble = 44;
+ foo.mux = 55;
+
+ bar.x = 33;
+
+ union
+ {
+ int z;
+ unsigned int w;
+ };
+
+ w = 45;
+
+}
diff --git a/gdb/testsuite/gdb.c++/anon-union.exp b/gdb/testsuite/gdb.c++/anon-union.exp
new file mode 100644
index 00000000000..83171a27e85
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/anon-union.exp
@@ -0,0 +1,337 @@
+# Copyright (C) 1998 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
+# (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
+
+#
+# Tests for anonymous union support
+# Written by Satish Pai <pai@apollo.hp.com> 1997-08-19
+
+# This file is part of the gdb testsuite
+
+if $tracelevel then {
+ strace $tracelevel
+ }
+
+#
+# test running programs
+#
+
+set prms_id 0
+set bug_id 0
+
+set testfile "anon-union"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+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."
+}
+
+# Start with a fresh gdb
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+
+if ![runto_main] then {
+ perror "couldn't run to breakpoint"
+ continue
+}
+
+send_gdb "set width 0\n"
+gdb_expect -re "$gdb_prompt $"
+
+#send_gdb "ptype foo\n"
+#gdb_expect {
+# -re "\r\n$gdb_prompt $" {
+# pass "ptype foo"
+# }
+# -re ".*$gdb_prompt $" { fail "ptype foo" }
+# timeout { fail "(timeout) ptype foo" }
+#}
+
+#send_gdb "ptype bar\n"
+#gdb_expect {
+# -re "\r\n$gdb_prompt $" {
+# pass "ptype foo"
+# }
+# -re ".*$gdb_prompt $" { fail "ptype foo" }
+# timeout { fail "(timeout) ptype foo" }
+#}
+
+# NOTE: Add -- ptype foo.x, etc. when things are working
+
+# Print out the big anon union.
+send_gdb "print foo\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 0, x = \{rock = 0, rock2 = 0\}, \{qux = 0, mux = 0\}, boulder = 0\}, \{paper = 0, cloth = 0\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" {
+ pass "print foo 1"
+ }
+ -re ".*$gdb_prompt $" { fail "print foo 1" }
+ timeout { fail "(timeout) print foo 1" }
+}
+
+# Step over assignment to member
+
+send_gdb "next\n"
+gdb_expect {
+ -re "41\[ \t\]*foo.pebble = 44;\r\n$gdb_prompt $" {
+ pass "next 1"
+ }
+ -re ".*$gdb_prompt $" { fail "next 1" }
+ timeout { fail "(timeout) next 1" }
+}
+
+# Now print out anon union again
+send_gdb "print foo\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 0, x = \{rock = 0, rock2 = 0\}, \{qux = 0, mux = 0\}, boulder = 0\}, \{paper = 33, cloth = 33\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" {
+ pass "print foo 2"
+ }
+ -re ".*$gdb_prompt $" { fail "print foo 2" }
+ timeout { fail "(timeout) print foo 2" }
+}
+
+# Modify the member just set
+send_gdb "set var foo.cloth = 35\n"
+gdb_expect {
+ -re "\r\n$gdb_prompt $" {
+ pass "set var foo.cloth"
+ }
+ timeout { fail "(timeout) set var foo.cloth" }
+}
+
+# Now print out anon union again to see if the right member was set
+send_gdb "print foo\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 0, x = \{rock = 0, rock2 = 0\}, \{qux = 0, mux = 0\}, boulder = 0\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" {
+ pass "print foo 3"
+ }
+ -re ".*$gdb_prompt $" { fail "print foo 3" }
+ timeout { fail "(timeout) print foo 3" }
+}
+
+
+# Step over next assignment to member
+
+send_gdb "next\n"
+gdb_expect {
+ -re "42\[ \t\]*foo.mux = 55;\r\n$gdb_prompt $" {
+ pass "next 2"
+ }
+ -re ".*$gdb_prompt $" { fail "next 2" }
+ timeout { fail "(timeout) next 2" }
+}
+
+# Now print out anon union again
+send_gdb "print foo\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 44, x = \{rock = 44, rock2 = 0\}, \{qux = 44, mux = 44\}, boulder = 44\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" {
+ pass "print foo 4"
+ }
+ -re ".*$gdb_prompt $" { fail "print foo 4" }
+ timeout { fail "(timeout) print foo 4" }
+}
+
+# Modify the member just set
+send_gdb "set var foo.pebble = 45\n"
+gdb_expect {
+ -re "\r\n$gdb_prompt $" {
+ pass "set var foo.pebble"
+ }
+ timeout { fail "(timeout) set var foo.pebble" }
+}
+
+# Now print out anon union again to see if the right member was set
+send_gdb "print foo\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 45, x = \{rock = 45, rock2 = 0\}, \{qux = 45, mux = 45\}, boulder = 45\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" {
+ pass "print foo 5"
+ }
+ -re ".*$gdb_prompt $" { fail "print foo 5" }
+ timeout { fail "(timeout) print foo 5" }
+}
+
+# Modify another member at a different level
+send_gdb "set var foo.qux = 46\n"
+gdb_expect {
+ -re "\r\n$gdb_prompt $" {
+ pass "set var foo.qux"
+ }
+ timeout { fail "(timeout) set var foo.qux" }
+}
+
+# Now print out anon union again to see if the right member was set
+send_gdb "print foo\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 46, x = \{rock = 46, rock2 = 0\}, \{qux = 46, mux = 46\}, boulder = 46\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" {
+ pass "print foo 6"
+ }
+ -re ".*$gdb_prompt $" { fail "print foo 6" }
+ timeout { fail "(timeout) print foo 6" }
+}
+
+# Modify the member at another level, but not the first one in the union
+send_gdb "set var foo.mux = 47\n"
+gdb_expect {
+ -re "\r\n$gdb_prompt $" {
+ pass "set var foo.mux"
+ }
+ timeout { fail "(timeout) set var foo.mux" }
+}
+
+# Now print out anon union again to see if things worked
+send_gdb "print foo\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 47, x = \{rock = 47, rock2 = 0\}, \{qux = 47, mux = 47\}, boulder = 47\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" {
+ pass "print foo 7"
+ }
+ -re ".*$gdb_prompt $" { fail "print foo 7" }
+ timeout { fail "(timeout) print foo 7" }
+}
+
+# Modify a member of a struct in an anon union
+send_gdb "set var foo.x.rock = 48\n"
+gdb_expect {
+ -re "\r\n$gdb_prompt $" {
+ pass "set var foo.x.rock"
+ }
+ timeout { fail "(timeout) set var foo.x.rock" }
+}
+
+# Now print out anon union again to see if things worked
+send_gdb "print foo\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 48, x = \{rock = 48, rock2 = 0\}, \{qux = 48, mux = 48\}, boulder = 48\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" {
+ pass "print foo 8"
+ }
+ -re ".*$gdb_prompt $" { fail "print foo 8" }
+ timeout { fail "(timeout) print foo 8" }
+}
+
+# Modify a member of a struct in an anon union, but something
+# that doesn't alias to some other union member
+send_gdb "set var foo.x.rock2 = 49\n"
+gdb_expect {
+ -re "\r\n$gdb_prompt $" {
+ pass "set var foo.x.rock2"
+ }
+ timeout { fail "(timeout) set var foo.x.rock2" }
+}
+
+# Now print out anon union again to see if things worked
+send_gdb "print foo\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 48, x = \{rock = 48, rock2 = 49\}, \{qux = 48, mux = 48\}, boulder = 48\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" {
+ pass "print foo 9"
+ }
+ -re ".*$gdb_prompt $" { fail "print foo 9" }
+ timeout { fail "(timeout) print foo 9" }
+}
+
+
+# Step over next two assignments
+send_gdb "next 2\n"
+gdb_expect {
+ -re "52\[ \t\]*w = 45;\r\n$gdb_prompt $" {
+ pass "next 3"
+ }
+ -re ".*$gdb_prompt $" { fail "next 3" }
+ timeout { fail "(timeout) next 3" }
+}
+
+# Tests for anon unions that are not members of a class or struct
+
+# w is not yet initialized; it contains garbage
+#send_gdb "print w\n"
+#gdb_expect {
+# -re "\\$\[0-9\]* = 0\r\n$gdb_prompt $" {
+# pass "print w 1"
+# }
+# -re ".*$gdb_prompt $" { fail "print w 1" }
+# timeout { fail "(timeout) print w 1" }
+#}
+#
+# z is not yet initialized; it contains garbage
+#send_gdb "print z\n"
+#gdb_expect {
+# -re "\\$\[0-9\]* = 0\r\n$gdb_prompt $" {
+# pass "print z 1"
+# }
+# -re ".*$gdb_prompt $" { fail "print z 1" }
+# timeout { fail "(timeout) print z 1" }
+#}
+
+# Step over next assignment to w
+send_gdb "next\n"
+gdb_expect {
+ -re "54\[ \t\]*\}\r\n$gdb_prompt $" {
+ pass "next 4"
+ }
+ -re ".*$gdb_prompt $" { fail "next 4" }
+ timeout { fail "(timeout) next 4" }
+}
+
+# See if the change in value is noticed
+send_gdb "print w\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = 45\r\n$gdb_prompt $" {
+ pass "print w 2"
+ }
+ -re ".*$gdb_prompt $" { fail "print w 2" }
+ timeout { fail "(timeout) print w 2" }
+}
+
+# See if z shows the same value
+send_gdb "print z\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = 45\r\n$gdb_prompt $" {
+ pass "print z 2"
+ }
+ -re ".*$gdb_prompt $" { fail "print z 2" }
+ timeout { fail "(timeout) print z 2" }
+}
+
+# Set the anon union member
+send_gdb "set var z = 27\n"
+gdb_expect {
+ -re "\r\n$gdb_prompt $" {
+ pass "set var z"
+ }
+ timeout { fail "(timeout) set var z" }
+}
+
+# See if the change in value is noticed
+send_gdb "print w\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = 27\r\n$gdb_prompt $" {
+ pass "print w 3"
+ }
+ -re ".*$gdb_prompt $" { fail "print w 3" }
+ timeout { fail "(timeout) print w 3" }
+}
+
+# See if z shows the same value
+send_gdb "print z\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = 27\r\n$gdb_prompt $" {
+ pass "print z 3"
+ }
+ -re ".*$gdb_prompt $" { fail "print z 3" }
+ timeout { fail "(timeout) print z 3" }
+}
diff --git a/gdb/testsuite/gdb.c++/classes.exp b/gdb/testsuite/gdb.c++/classes.exp
new file mode 100644
index 00000000000..5e97cb4eb4c
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/classes.exp
@@ -0,0 +1,850 @@
+# Copyright (C) 1992, 1994, 1995, 1997 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
+# (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
+
+# This file was written by Fred Fish. (fnf@cygnus.com)
+
+set ws "\[\r\n\t \]+"
+set nl "\[\r\n\]+"
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+
+# Check to see if we have an executable to test. If not, then either we
+# haven't tried to compile one, or the compilation failed for some reason.
+# In either case, just notify the user and skip the tests in this file.
+
+set testfile "misc"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+
+# Create and source the file that provides information about the compiler
+# used to compile the test case.
+
+if [get_compiler_info ${binfile} "c++"] {
+ return -1
+}
+
+# if we are on HPUX and we are not compiled with gcc, then skip these tests.
+
+if [istarget hppa*-*-hpux*] {
+ if {!$gcc_compiled} {
+ continue
+ }
+}
+
+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."
+}
+
+#
+# Test ptype of class objects.
+#
+
+proc test_ptype_class_objects {} {
+ global gdb_prompt
+ global ws
+ global nl
+
+ # Note that struct members are public by default, so we don't print
+ # "public:" for the public members of structs.
+ # Accept it as an expected failure if gdb just fails to distinguish between
+ # class and struct, and everything else is OK.
+
+ send_gdb "ptype struct default_public_struct\n"
+ gdb_expect {
+ -re "type = struct default_public_struct \{${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
+ pass "ptype struct default_public_struct"
+ }
+ -re "type = class default_public_struct \{$nl.*int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "ptype struct default_public_struct"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype struct default_public_struct" }
+ timeout { fail "ptype struct default_public_struct (timeout)" ; return }
+ }
+
+ # Note that struct members are public by default, so we don't print
+ # "public:" for the public members of structs.
+ # Accept it as an expected failure if gdb just fails to distinguish between
+ # class and struct, and everything else is OK.
+
+ send_gdb "ptype struct explicit_public_struct\n"
+ gdb_expect {
+ -re "type = struct explicit_public_struct \{${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
+ pass "ptype struct explicit_public_struct"
+ }
+ -re "type = class explicit_public_struct \{$nl.*int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "ptype struct explicit_public_struct"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype struct explicit_public_struct" }
+ timeout { fail "ptype struct explicit_public_struct (timeout)" ; return }
+ }
+
+ # Accept it as an expected failure if gdb just fails to distinguish between
+ # class and struct, and everything else is OK.
+
+ setup_xfail_format "DWARF 1"
+ send_gdb "ptype struct protected_struct\n"
+ gdb_expect {
+ -re "type = struct protected_struct \{${ws}protected:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
+ pass "ptype struct protected_struct (FIXME)"
+ }
+ -re "type = class protected_struct \{${ws}protected:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "ptype struct protected_struct (FIXME)"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype struct protected_struct" }
+ timeout { fail "ptype struct protected_struct (timeout)" ; return }
+ }
+
+ # Accept it as an expected failure if gdb just fails to distinguish between
+ # class and struct, and everything else is OK.
+
+ setup_xfail_format "DWARF 1"
+ send_gdb "ptype struct private_struct\n"
+ gdb_expect {
+ -re "type = struct private_struct \{${ws}private:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
+ pass "ptype struct private_struct (FIXME)"
+ }
+ -re "type = class private_struct \{${ws}private:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "ptype struct private_struct (FIXME)"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype struct private_struct" }
+ timeout { fail "ptype struct private_struct (timeout)" ; return }
+ }
+
+ # Accept it as an expected failure if gdb just fails to distinguish between
+ # class and struct, and everything else is OK.
+
+ setup_xfail_format "DWARF 1"
+ send_gdb "ptype struct mixed_protection_struct\n"
+ gdb_expect {
+ -re "type = struct mixed_protection_struct \{${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;$nl\}$nl$gdb_prompt $" {
+ pass "ptype struct mixed_protection_struct (FIXME)"
+ }
+ -re "type = class mixed_protection_struct \{${ws}public:${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;$nl.*\}$nl$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "ptype struct mixed_protection_struct (FIXME)"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype struct mixed_protection_struct" }
+ timeout { fail "ptype struct mixed_protection_struct (timeout)" ; return }
+ }
+
+ # Accept it as an expected failure if gdb just fails to distinguish between
+ # class and struct, and everything else is OK.
+
+ send_gdb "ptype class public_class\n"
+ gdb_expect {
+ -re "type = class public_class \{${ws}public:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
+ pass "ptype class public_class (FIXME)"
+ }
+ -re "type = struct public_class \{${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "ptype class public_class (FIXME)"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype class public_class" }
+ timeout { fail "ptype class public_class (timeout)" ; return }
+ }
+
+ send_gdb "ptype class protected_class\n"
+ gdb_expect {
+ -re "type = class protected_class \{${ws}protected:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
+ pass "ptype class protected_class"
+ }
+ -re "type = struct protected_class \{${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "ptype class protected_class"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype class protected_class" }
+ timeout { fail "ptype class protected_class (timeout)" ; return }
+ }
+
+ # Accept it as an expected failure if gdb just emits a superflous "private:"
+ # attribute, since classes default to private and for consistency with
+ # structs (where we don't print the "public:" attribute) we don't print
+ # the "private:" attribute.
+
+ setup_xfail_format "DWARF 1"
+ send_gdb "ptype class default_private_class\n"
+ gdb_expect {
+ -re "type = class default_private_class \{${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
+ pass "ptype class default_private_class (FIXME)"
+ }
+ -re "type = class default_private_class \{${ws}private:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "ptype class default_private_class (FIXME)"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype class default_private_class" }
+ timeout { fail "ptype class default_private_class (timeout)" ; return }
+ }
+
+ send_gdb "ptype class explicit_private_class\n"
+ gdb_expect {
+ -re "type = class explicit_private_class \{${ws}private:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
+ pass "ptype class explicit_private_class"
+ }
+ -re "type = struct explicit_private_class \{${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "ptype class explicit_private_class"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype class explicit_private_class" }
+ timeout { fail "ptype class explicit_private_class (timeout)" ; return }
+ }
+
+ send_gdb "ptype class mixed_protection_class\n"
+ gdb_expect {
+ -re "type = class mixed_protection_class \{${ws}public:${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;$nl.*\}$nl$gdb_prompt $" {
+ pass "ptype class mixed_protection_class"
+ }
+ -re "type = struct mixed_protection_class \{${ws}int a;${ws}int b;${ws}int c;${ws}int d;${ws}int e;${ws}int f;${ws}int g;${ws}int h;${ws}int i;$nl.*\}$nl$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "ptype class mixed_protection_class"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype class mixed_protection_class" }
+ timeout { fail "ptype class mixed_protection_class (timeout)" ; return }
+ }
+
+ # This class does not use any C++-specific features, so it's fine for
+ # it to print as "struct".
+ send_gdb "ptype class A\n"
+ gdb_expect {
+ -re "type = (class|struct) A \{(${ws}public:|)${ws}int a;${ws}int x;((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(A const &\\);)|(${ws}A\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype class A"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype class A"
+ }
+ timeout {
+ fail "ptype class A (timeout)"
+ return
+ }
+ }
+
+ setup_xfail_format "DWARF 1"
+ send_gdb "ptype class B\n"
+ gdb_expect {
+ -re "type = class B : public A \{${ws}public:${ws}int b;${ws}int x;${ws}B & operator=\\(B const &\\);${ws}B\\(B const &\\);${ws}B\\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype class B"
+ }
+ -re "type = class B : public A \{${ws}public:${ws}int b;${ws}int x;((${ws}B & operator=\\(B const &\\);)|(${ws}B\\(B const &\\);)|(${ws}B\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype class B (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype class B"
+ }
+ timeout {
+ fail "ptype class B (timeout)"
+ return
+ }
+ }
+
+ setup_xfail_format "DWARF 1"
+ send_gdb "ptype class C\n"
+ gdb_expect {
+ -re "type = class C : public A \{${ws}public:${ws}int c;${ws}int x;${ws}C & operator=\\(C const &\\);${ws}C\\(C const &\\);${ws}C\\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype class C"
+ }
+ -re "type = class C : public A \{${ws}public:${ws}int c;${ws}int x;((${ws}C & operator=\\(C const &\\);)|(${ws}C\\(C const &\\);)|(${ws}C\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype class C (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype class C"
+ }
+ timeout {
+ fail "ptype class C (timeout)"
+ return
+ }
+ }
+
+ setup_xfail_format "DWARF 1"
+ send_gdb "ptype class D\n"
+ gdb_expect {
+ -re "type = class D : public B, public C \{${ws}public:${ws}int d;${ws}int x;${ws}D & operator=\\(D const &\\);${ws}D\\(D const &\\);${ws}D\\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype class D"
+ }
+ -re "type = class D : public B, public C \{${ws}public:${ws}int d;${ws}int x;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(D const &\\);)|(${ws}D\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype class D (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype class D"
+ }
+ timeout {
+ fail "ptype class D (timeout)"
+ return
+ }
+ }
+
+ setup_xfail_format "DWARF 1"
+ send_gdb "ptype class E\n"
+ gdb_expect {
+ -re "type = class E : public D \{${ws}public:${ws}int e;${ws}int x;${ws}E & operator=\\(E const &\\);${ws}E\\(E const &\\);${ws}E\\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype class E"
+ }
+ -re "type = class E : public D \{${ws}public:${ws}int e;${ws}int x;((${ws}E & operator=\\(E const &\\);)|(${ws}E\\(E const &\\);)|(${ws}E\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype class E"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype class E"
+ }
+ timeout {
+ fail "ptype class E (timeout)"
+ return
+ }
+ }
+
+ send_gdb "ptype class vA\n"
+ gdb_expect {
+ -re "type = (class|struct) vA \{(${ws}public:|)${ws}int va;${ws}int vx;${ws}vA & operator=\\(vA const &\\);${ws}vA\\(vA const &\\);${ws}vA\\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype class vA"
+ }
+ -re "type = (class|struct) vA \{(${ws}public:|)${ws}int va;${ws}int vx;((${ws}vA & operator=\\(vA const &\\);)|(${ws}vA\\(vA const &\\);)|(${ws}vA\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype class vA (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype class vA"
+ }
+ timeout {
+ fail "ptype class vA (timeout)"
+ return
+ }
+ }
+
+ # Accept the form with embedded GNU style mangled virtual table constructs
+ # for now, but with a FIXME. At some future point, gdb should use a
+ # portable representation for the virtual table constructs.
+
+ setup_xfail_format "DWARF 1"
+ send_gdb "ptype class vB\n"
+ gdb_expect {
+ -re "type = class vB : public virtual vA \{${ws}private:${ws}vA \\*_vb.vA;${ws}public:${ws}int vb;${ws}int vx;${ws}vB & operator=\\(vB const &\\);${ws}vB\\(int, vB const &\\);${ws}vB\\(int\\);${ws}\}$nl$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "ptype class vB (FIXME: non-portable virtual table constructs)"
+ }
+ -re "type = class vB : public virtual vA \{${ws}private:${ws}vA \\*_vb.vA;${ws}public:${ws}int vb;${ws}int vx;((${ws}vB & operator=\\(vB const &\\);)|(${ws}vB\\(int, vB const &\\);)|(${ws}vB\\(int\\);))*${ws}\}$nl$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "ptype class vB (FIXME) (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype class vB"
+ }
+ timeout {
+ fail "ptype class vB (timeout)"
+ return
+ }
+ }
+
+ # Accept the form with embedded GNU style mangled virtual table constructs
+ # for now, but with a FIXME. At some future point, gdb should use a
+ # portable representation for the virtual table constructs.
+
+ setup_xfail_format "DWARF 1"
+ send_gdb "ptype class vC\n"
+ gdb_expect {
+ -re "type = class vC : public virtual vA \{${ws}private:${ws}vA \\*_vb.vA;${ws}public:${ws}int vc;${ws}int vx;${ws}vC & operator=\\(vC const &\\);${ws}vC\\(int, vC const &\\);${ws}vC\\(int\\);${ws}\}$nl$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "ptype class vC (FIXME: non-portable virtual table constructs)"
+ }
+ -re "type = class vC : public virtual vA \{${ws}private:${ws}vA \\*_vb.vA;${ws}public:${ws}int vc;${ws}int vx;((${ws}vC & operator=\\(vC const &\\);)|(${ws}vC\\(int, vC const &\\);)|(${ws}vC\\(int\\);))*${ws}\}$nl$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "ptype class vC (FIXME) (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype class vC"
+ }
+ timeout {
+ fail "ptype class vC (timeout)"
+ return
+ }
+ }
+
+ # Accept the form with embedded GNU style mangled virtual table constructs
+ # for now, but with a FIXME. At some future point, gdb should use a
+ # portable representation for the virtual table constructs.
+
+ setup_xfail_format "DWARF 1"
+ send_gdb "ptype class vD\n"
+ gdb_expect {
+ -re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \\*_vb.vC;${ws}vB \\*_vb.vB;${ws}public:${ws}int vd;${ws}int vx;${ws}vD & operator=\\(vD const &\\);${ws}vD\\(int, vD const &\\);${ws}vD\\(int\\);${ws}\}$nl$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "ptype class vD (FIXME: non-portable virtual table constructs)"
+ }
+ -re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \\*_vb.vC;${ws}vB \\*_vb.vB;${ws}public:${ws}int vd;${ws}int vx;((${ws}vD & operator=\\(vD const &\\);)|(${ws}vD\\(int, vD const &\\);)|(${ws}vD\\(int\\);))*${ws}\}$nl$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "ptype class vD (FIXME) (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype class vD"
+ }
+ timeout {
+ fail "ptype class vD (timeout)"
+ return
+ }
+ }
+
+ # Accept the form with embedded GNU style mangled virtual table constructs
+ # for now, but with a FIXME. At some future point, gdb should use a
+ # portable representation for the virtual table constructs.
+
+ setup_xfail_format "DWARF 1"
+ send_gdb "ptype class vE\n"
+ gdb_expect {
+ -re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*_vb.vD;${ws}public:${ws}int ve;${ws}int vx;${ws}vE & operator=\\(vE const &\\);${ws}vE\\(int, vE const &\\);${ws}vE\\(int\\);${ws}\}$nl$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "ptype class vE (FIXME: non-portable virtual table constructs)"
+ }
+ -re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*_vb.vD;${ws}public:${ws}int ve;${ws}int vx;((${ws}vE & operator=\\(vE const &\\);)|(${ws}vE\\(int, vE const &\\);)|(${ws}vE\\(int\\);))*${ws}\}$nl$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "ptype class vE (FIXME) (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype class vE"
+ }
+ timeout {
+ fail "ptype class vE (timeout)"
+ return
+ }
+ }
+
+ setup_xfail_format "DWARF 1"
+ send_gdb "ptype class Base1\n"
+ gdb_expect {
+ -re "type = class Base1 \{${ws}public:${ws}int x;${ws}Base1 & operator=\\(Base1 const &\\);${ws}Base1\\(Base1 const &\\);${ws}Base1\\(int\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype class Base1"
+ }
+ -re "type = class Base1 \{${ws}public:${ws}int x;((${ws}Base1 & operator=\\(Base1 const &\\);)|(${ws}Base1\\(Base1 const &\\);)|(${ws}Base1\\(int\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype class Base1 (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype class Base1"
+ }
+ timeout {
+ fail "ptype class Base1 (timeout)"
+ return
+ }
+ }
+
+ setup_xfail_format "DWARF 1"
+ send_gdb "ptype class Foo\n"
+ gdb_expect {
+ -re "type = class Foo \{${ws}public:${ws}int x;${ws}int y;${ws}static int st;${ws}Foo & operator=\\(Foo const &\\);${ws}Foo\\(Foo const &\\);${ws}Foo\\(int, int\\);${ws}int operator!\\(void\\);${ws}int operator int\\(void\\);${ws}int times\\(int\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype class Foo"
+ }
+ -re "type = class Foo \{${ws}public:${ws}int x;${ws}int y;${ws}static int st;((${ws}Foo & operator=\\(Foo const &\\);)|(${ws}Foo\\(Foo const &\\);)|(${ws}Foo\\(int, int\\);)|(${ws}int operator!\\(void\\);)|(${ws}int operator int\\(void\\);)|(${ws}int times\\(int\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype class Foo (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype class Foo"
+ }
+ timeout {
+ fail "ptype class Foo (timeout)"
+ return
+ }
+ }
+
+ setup_xfail_format "DWARF 1"
+ send_gdb "ptype class Bar\n"
+ gdb_expect {
+ -re "type = class Bar : public Base1, public Foo \{${ws}public:${ws}int z;${ws}Bar & operator=\\(Bar const &\\);${ws}Bar\\(Bar const &\\);${ws}Bar\\(int, int, int\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype class Bar"
+ }
+ -re "type = class Bar : public Base1, public Foo \{${ws}public:${ws}int z;((${ws}Bar & operator=\\(Bar const &\\);)|(${ws}Bar\\(Bar const &\\);)|(${ws}Bar\\(int, int, int\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype class Bar (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype class Bar"
+ }
+ timeout {
+ fail "ptype class Bar (timeout)"
+ return
+ }
+ }
+}
+
+#
+# Test simple access to class members.
+#
+
+proc test_non_inherited_member_access {} {
+ global gdb_prompt
+
+ # Print non-inherited members of g_A.
+
+ gdb_test "print g_A.a" ".* = 1" "g_A.a incorrect"
+
+ gdb_test "print g_A.x" ".* = 2" "g_A.x incorrect"
+
+ # Print non-inherited members of g_B.
+
+ gdb_test "print g_B.b" ".* = 5" "g_B.b incorrect"
+
+ gdb_test "print g_B.x" ".* = 6" "g_B.x incorrect"
+
+ # Print non-inherited members of g_C.
+
+ gdb_test "print g_C.c" ".* = 9" "g_C.c incorrect"
+
+ gdb_test "print g_C.x" ".* = 10" "g_C.x incorrect"
+
+ # Print non-inherited members of g_D.
+
+ gdb_test "print g_D.d" ".* = 19" "g_D.d incorrect"
+
+ gdb_test "print g_D.x" ".* = 20" "g_D.x incorrect"
+
+ # Print non-inherited members of g_E.
+
+ gdb_test "print g_E.e" ".* = 31" "g_E.e incorrect"
+
+ gdb_test "print g_E.x" ".* = 32" "g_E.x incorrect"
+}
+
+#
+# Try access to non-members that are members of another class.
+# Should give errors.
+#
+
+proc test_wrong_class_members {} {
+ global gdb_prompt
+
+ gdb_test "print g_A.b" "There is no member( or method|) named b." "print g_A.b should be error"
+
+ gdb_test "print g_B.c" "There is no member( or method|) named c." "print g_B.c should be error"
+
+ gdb_test "print g_B.d" "There is no member( or method|) named d." "print g_B.d should be error"
+
+ gdb_test "print g_C.b" "There is no member( or method|) named b." "print g_C.b should be error"
+
+ gdb_test "print g_C.d" "There is no member( or method|) named d." "print g_C.d should be error"
+
+ gdb_test "print g_D.e" "There is no member( or method|) named e." "print g_D.e should be error"
+}
+
+#
+# Try access to non-members that are not members of any class.
+# Should give errors.
+#
+
+proc test_nonexistant_members {} {
+ global gdb_prompt
+
+ gdb_test "print g_A.y" "There is no member( or method|) named y." "print g_A.y should be error"
+
+ gdb_test "print g_B.z" "There is no member( or method|) named z." "print g_B.z should be error"
+
+ gdb_test "print g_C.q" "There is no member( or method|) named q." "print g_C.q should be error"
+
+ gdb_test "print g_D.p" "There is no member( or method|) named p." "print g_D.p should be error"
+}
+
+#
+# Pointers to class members
+#
+
+proc test_pointers_to_class_members {} {
+ global gdb_prompt
+ global decimal
+ global nl
+
+ gdb_test "print Bar::z" ".* = .int\[ \]*\[( \]*Bar::&\[)\]+\[ \]*Bar::z" "print Bar::z"
+
+ gdb_test "print &Foo::x" ".* = .int\[ \]*\[( \]*Foo::\[*)\]+\[ \]*&Foo::x" "print &Foo::x"
+
+ gdb_test "print (int)&Foo::x" ".* = 0" "print (int)&Foo::x"
+
+ send_gdb "print (int)&Bar::y == 2*sizeof(int)\n"
+ gdb_expect {
+ -re ".* = true$nl$gdb_prompt $" {
+ pass "print (int)&Bar::y == 2*sizeof(int)"
+ }
+ -re "There is no field named y.*$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "print (int)&Bar::y == 2*sizeof(int)"
+ }
+ -re ".*$gdb_prompt $" { fail "print (int)&Bar::y == 2*sizeof(int)" }
+ timeout { fail "print (int)&Bar::y == 2*sizeof(int) (timeout)" ; return }
+ }
+
+ send_gdb "next\n"
+ setup_xfail "*-*-*"
+ gdb_expect {
+ -re "$decimal\[ \t\]+inheritance3 \[)(\]+;$nl$gdb_prompt $" {}
+ -re ".*$gdb_prompt $" { fail "next to inheritance3" ; return }
+ }
+ clear_xfail "*-*-*"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print (int)pmi == sizeof(int)" ".* = false" "print (int)pmi == sizeof(int)"
+}
+
+#
+# Test static members.
+#
+
+proc test_static_members {} {
+ global gdb_prompt
+ global hex
+ global nl
+
+ send_gdb "print Foo::st\n"
+ gdb_expect {
+ -re ".* = 100$nl$gdb_prompt $" {
+ pass "print Foo::st"
+ }
+ -re "There is no field named st.*$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "print Foo::st"
+ }
+ -re ".*$gdb_prompt $" { fail "print Foo::st" }
+ timeout { fail "print Foo::st (timeout)" ; return }
+ }
+
+ send_gdb "set foo.st = 200\n"
+ gdb_expect {
+ -re ".*$gdb_prompt $" {}
+ }
+
+ send_gdb "print bar.st\n"
+ gdb_expect {
+ -re ".* = 200$nl$gdb_prompt $" {
+ pass "print bar.st"
+ }
+ -re "There is no member( or method|) named st.*$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "print bar.st"
+ }
+ -re ".*$gdb_prompt $" { fail "print bar.st" }
+ timeout { fail "print bar.st (timeout)" ; return }
+ }
+
+ send_gdb "print &foo.st\n"
+ gdb_expect {
+ -re ".* = .int \[*)\]+ $hex$nl$gdb_prompt $" {
+ pass "print &foo.st"
+ }
+ -re "There is no member( or method|) named st.*$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "print &foo.st"
+ }
+ -re ".*$gdb_prompt $" { fail "print &foo.st" }
+ timeout { fail "print &foo.st (timeout)" ; return }
+ }
+
+ set got_bar_st 0
+ send_gdb "print &Bar::st\n"
+ gdb_expect {
+ -re ".* = .int \[*)\]+ $hex$nl$gdb_prompt $" {
+ pass "print &Bar::st"
+ set got_bar_st 1
+ }
+ -re "There is no field named st.*$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "print &Bar::st"
+ }
+ -re ".*$gdb_prompt $" { fail "print &Bar::st" }
+ timeout { fail "print &Bar::st (timeout)" ; return }
+ }
+
+ if $got_bar_st then {
+ gdb_test "print *\$" ".* = 200" "print *\$"
+ }
+
+ gdb_test "set print static-members off" ""
+ gdb_test "print csi" \
+ "{x = 10, y = 20}" \
+ "print csi without static members"
+ gdb_test "print cnsi" \
+ "{x = 30, y = 40}" \
+ "print cnsi without static members"
+
+ gdb_test "set print static-members on" ""
+ setup_xfail_format "DWARF 1"
+ gdb_test "print csi" \
+ "{x = 10, y = 20, static null = {x = 0, y = 0, static null = <same as static member of an already seen type>}}" \
+ "print csi with static members"
+ setup_xfail_format "DWARF 1"
+ gdb_test "print cnsi" \
+ "{x = 30, y = 40, static null = {x = 0, y = 0, static null = <same as static member of an already seen type>, static yy = {z = 5, static xx = {x = 1, y = 2, static null = <same as static member of an already seen type>, static yy = <same as static member of an already seen type>}}}, static yy = <same as static member of an already seen type>}" \
+ "print cnsi with static members"
+}
+
+proc do_tests {} {
+ global prms_id
+ global bug_id
+ global subdir
+ global objdir
+ global srcdir
+ global binfile
+ global gdb_prompt
+
+ set prms_id 0
+ set bug_id 0
+
+ # Start with a fresh gdb.
+
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load $binfile
+
+ send_gdb "set language c++\n"
+ gdb_expect -re "$gdb_prompt $"
+ send_gdb "set width 0\n"
+ gdb_expect -re "$gdb_prompt $"
+
+ # Get the debug format for the compiled test case.
+
+ if [ runto_main ] then {
+ get_debug_format
+ }
+
+ test_ptype_class_objects
+
+ if [ runto 'inheritance2(void)' ] then {
+ test_non_inherited_member_access
+ test_wrong_class_members
+ test_nonexistant_members
+ }
+
+ if [istarget "mips-idt-*"] then {
+ # Restart because IDT/SIM runs out of file descriptors.
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load $binfile
+ }
+
+ if [ runto_main ] then {
+ test_pointers_to_class_members
+ test_static_members
+ }
+
+ if [istarget "mips-idt-*"] then {
+ # Restart because IDT/SIM runs out of file descriptors.
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load $binfile
+ }
+
+ if [ runto marker_reg1 ] then {
+
+ gdb_test "finish" "Run till exit from.*" "finish from marker_reg1"
+
+ send_gdb "print v.method ()\n"
+ gdb_expect {
+ -re "= 82.*$gdb_prompt $" {
+ pass "calling method for small class"
+ }
+ -re "Address requested for identifier .v. which is in a register.*$gdb_prompt $" {
+ setup_xfail "*-*-*" 2972
+ fail "calling method for small class"
+ }
+ -re ".*$gdb_prompt $" { fail "calling method for small class" }
+ timeout { fail "calling method for small class (timeout)" }
+ eof { fail "calling method for small class (eof)" }
+ }
+ }
+
+}
+
+do_tests
+
+
+# Some additional tests for enums inside classes
+
+
+# set a breakpoint and go there
+send_gdb "break 498\n"
+gdb_expect {
+ -re "Breakpoint \[0-9\] at.*$gdb_prompt $" { pass "set break 498" }
+ -re "$gdb_prompt $" { fail "set break 498" }
+ timeout { fail "(timeout) set break 498" }
+}
+send_gdb "continue\n"
+gdb_expect {
+ -re "Continuing\\.\r\n\r\nBreakpoint \[0-9\]*, main....at.*misc\\.cc:498\r\n498.*\r\n$gdb_prompt $" { pass "continue" }
+ -re "$gdb_prompt $" { fail "continue" }
+ timeout { fail "(timeout) continue" }
+}
+
+# print the object
+send_gdb "print obj_with_enum\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \\{priv_enum = red, x = 0\\}.*$gdb_prompt $" { pass "print obj_with_enum (1)" }
+ -re "$gdb_prompt $" { fail "print obj_with_enum (1)" }
+ timeout { fail "(timeout) print obj_with_enum (1)" }
+}
+
+send_gdb "next\n"
+gdb_expect {
+ -re "$gdb_prompt $" { pass "next" }
+ timeout { fail "(timeout) next" }
+}
+
+# print the object again
+send_gdb "print obj_with_enum\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \\{priv_enum = green, x = 0\\}.*$gdb_prompt $" { pass "print obj_with_enum (2)" }
+ -re "$gdb_prompt $" { fail "print obj_with_enum (2)" }
+ timeout { fail "(timeout) print obj_with_enum (2)" }
+}
+
+# print out the enum member
+send_gdb "print obj_with_enum.priv_enum\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = green.*$gdb_prompt $" { pass "print obj_with_enum.priv_enum" }
+ -re "$gdb_prompt $" { fail "print obj_with_enum.priv_enum" }
+ timeout { fail "(timeout) print obj_with_enum.priv_enum" }
+}
+
+# ptype on the enum member
+send_gdb "ptype obj_with_enum.priv_enum\n"
+gdb_expect {
+ -re "type = enum ClassWithEnum::PrivEnum \\{red, green, blue, yellow = 42\\}.*$gdb_prompt $" { pass "ptype obj_with_enum.priv_enum" }
+ -re "$gdb_prompt $" { fail "ptype obj_with_enum.priv_enum" }
+ timeout { fail "(timeout) ptype obj_with_enum.priv_enum" }
+}
+
+# ptype on the object
+send_gdb "ptype obj_with_enum\n"
+gdb_expect {
+ -re "type = class ClassWithEnum \\{\r\n\[ \t\]*public:\r\n\[ \t\]*enum ClassWithEnum::PrivEnum priv_enum;\r\n\[ \t\]*int x;\r\n\\}\r\n$gdb_prompt $" { pass "ptype obj_with_enum" }
+ -re "$gdb_prompt $" { fail "ptype obj_with_enum" }
+ timeout { fail "(timeout) ptype obj_with_enum" }
+}
+
+send_gdb "print (ClassWithEnum::PrivEnum) 42\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = yellow.*$gdb_prompt $" { pass "print (ClassWithEnum::PrivEnum) 42" }
+ -re "$gdb_prompt $" { fail "print (ClassWithEnum::PrivEnum) 42" }
+ timeout { fail "(timeout) print (ClassWithEnum::PrivEnum) 42" }
+}
+
+
+send_gdb "maint demangle inheritance1__Fv\n"
+gdb_expect {
+ -re "inheritance1\\(void\\).*$gdb_prompt $" { pass "demangle" }
+ -re ".*$gdb_prompt $" { fail "demangle" }
+ timeout { fail "(timeout) demangle" }
+}
+
diff --git a/gdb/testsuite/gdb.c++/compiler.cc b/gdb/testsuite/gdb.c++/compiler.cc
new file mode 100644
index 00000000000..aa35c7510ff
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/compiler.cc
@@ -0,0 +1,34 @@
+/* Often the behavior of any particular test depends upon what compiler was
+ used to compile the test. As each test is compiled, this file is
+ preprocessed by the same compiler used to compile that specific test
+ (different tests might be compiled by different compilers, particularly
+ if compiled at different times), and used to generate a *.ci (compiler
+ info) file for that test.
+
+ I.E., when callfuncs is compiled, a callfuncs.ci file will be generated,
+ which can then be sourced by callfuncs.exp to give callfuncs.exp access
+ to information about the compilation environment.
+
+ TODO: It might be a good idea to add expect code that tests each
+ definition made with 'set" to see if one already exists, and if so
+ warn about conflicts if it is being set to something else. */
+
+#if defined(__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 6
+set supports_template_debugging 1
+#else
+set supports_template_debugging 0
+#endif
+
+#if defined(__cplusplus)
+set supports_template_debugging 1
+#else
+set supports_template_debugging 0
+#endif
+
+#if defined (__GNUC__)
+set gcc_compiled __GNUC__
+#else
+set gcc_compiled 0
+#endif
+
+return 0
diff --git a/gdb/testsuite/gdb.c++/configure b/gdb/testsuite/gdb.c++/configure
new file mode 100644
index 00000000000..6d0b517b4a6
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/configure
@@ -0,0 +1,899 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.12.1
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ case "$ac_option" in
+ -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) ac_optarg= ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case "$ac_option" in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build="$ac_optarg" ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file="$ac_optarg" ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ eval "enable_${ac_feature}=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he)
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+ --cache-file=FILE cache test results in FILE
+ --help print this message
+ --no-create do not create output files
+ --quiet, --silent do not print \`checking...' messages
+ --version print the version of autoconf that created configure
+Directory and file names:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [same as prefix]
+ --bindir=DIR user executables in DIR [EPREFIX/bin]
+ --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
+ --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data in DIR
+ [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data in DIR
+ [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
+ --libdir=DIR object code libraries in DIR [EPREFIX/lib]
+ --includedir=DIR C header files in DIR [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
+ --infodir=DIR info documentation in DIR [PREFIX/info]
+ --mandir=DIR man documentation in DIR [PREFIX/man]
+ --srcdir=DIR find the sources in DIR [configure dir or ..]
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM
+ run sed PROGRAM on installed program names
+EOF
+ cat << EOF
+Host type:
+ --build=BUILD configure for building on BUILD [BUILD=HOST]
+ --host=HOST configure for HOST [guessed]
+ --target=TARGET configure for TARGET [TARGET=HOST]
+Features and packages:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+EOF
+ if test -n "$ac_help"; then
+ echo "--enable and --with options recognized:$ac_help"
+ fi
+ exit 0 ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host="$ac_optarg" ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir="$ac_optarg" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir="$ac_optarg" ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir="$ac_optarg" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir="$ac_optarg" ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir="$ac_optarg" ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix="$ac_optarg" ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix="$ac_optarg" ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix="$ac_optarg" ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name="$ac_optarg" ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site="$ac_optarg" ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir="$ac_optarg" ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir="$ac_optarg" ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target="$ac_optarg" ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers)
+ echo "configure generated by autoconf version 2.12.1"
+ exit 0 ;;
+
+ -with-* | --with-*)
+ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_${ac_package}='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval "with_${ac_package}=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes="$ac_optarg" ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries="$ac_optarg" ;;
+
+ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ ;;
+
+ *)
+ if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+ echo "configure: warning: $ac_option: invalid host type" 1>&2
+ fi
+ if test "x$nonopt" != xNONE; then
+ { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+ fi
+ nonopt="$ac_option"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+ case "$ac_arg" in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c) ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set. These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=cplusfuncs.cc
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_prog=$0
+ ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ else
+ { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ echo "loading site script $ac_site_file"
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+CC=${CC-cc}
+
+ac_aux_dir=
+for ac_dir in `cd $srcdir;pwd`/../../.. $srcdir/`cd $srcdir;pwd`/../../..; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in `cd $srcdir;pwd`/../../.. $srcdir/`cd $srcdir;pwd`/../../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+
+# Do some error checking and defaulting for the host and target type.
+# The inputs are:
+# configure --host=HOST --target=TARGET --build=BUILD NONOPT
+#
+# The rules are:
+# 1. You are not allowed to specify --host, --target, and nonopt at the
+# same time.
+# 2. Host defaults to nonopt.
+# 3. If nonopt is not specified, then host defaults to the current host,
+# as determined by config.guess.
+# 4. Target and build default to nonopt.
+# 5. If nonopt is not specified, then target and build default to host.
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+case $host---$target---$nonopt in
+NONE---*---* | *---NONE---* | *---*---NONE) ;;
+*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
+esac
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:573: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+ case $nonopt in
+ NONE)
+ if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+ else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+ fi ;;
+ *) host_alias=$nonopt ;;
+ esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+echo $ac_n "checking target system type""... $ac_c" 1>&6
+echo "configure:594: checking target system type" >&5
+
+target_alias=$target
+case "$target_alias" in
+NONE)
+ case $nonopt in
+ NONE) target_alias=$host_alias ;;
+ *) target_alias=$nonopt ;;
+ esac ;;
+esac
+
+target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
+target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$target" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:612: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+ case $nonopt in
+ NONE) build_alias=$host_alias ;;
+ *) build_alias=$nonopt ;;
+ esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+test "$host_alias" != "$target_alias" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_prefix=${target_alias}-
+
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set) 2>&1 | grep ac_space` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+cat > conftest.defs <<\EOF
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
+s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
+s%\[%\\&%g
+s%\]%\\&%g
+s%\$%$$%g
+EOF
+DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
+rm -f conftest.defs
+
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+ case "\$ac_option" in
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+ exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+ -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+ echo "$CONFIG_STATUS generated by autoconf version 2.12.1"
+ exit 0 ;;
+ -help | --help | --hel | --he | --h)
+ echo "\$ac_cs_usage"; exit 0 ;;
+ *) echo "\$ac_cs_usage"; exit 1 ;;
+ esac
+done
+
+ac_given_srcdir=$srcdir
+
+trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@CC@%$CC%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@target@%$target%g
+s%@target_alias@%$target_alias%g
+s%@target_cpu@%$target_cpu%g
+s%@target_vendor@%$target_vendor%g
+s%@target_os@%$target_os%g
+s%@build@%$build%g
+s%@build_alias@%$build_alias%g
+s%@build_cpu@%$build_cpu%g
+s%@build_vendor@%$build_vendor%g
+s%@build_os@%$build_os%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+ else
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ if test ! -s conftest.s$ac_file; then
+ ac_more_lines=false
+ rm -f conftest.s$ac_file
+ else
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f conftest.s$ac_file"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ fi
+ ac_file=`expr $ac_file + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ fi
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
+
+ case "$ac_given_srcdir" in
+ .) srcdir=.
+ if test -z "$ac_dots"; then top_srcdir=.
+ else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+ /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+ *) # Relative path.
+ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+ case "$ac_file" in
+ *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+ *) ac_comsub= ;;
+ esac
+
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
diff --git a/gdb/testsuite/gdb.c++/configure.in b/gdb/testsuite/gdb.c++/configure.in
new file mode 100644
index 00000000000..f989cb82865
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/configure.in
@@ -0,0 +1,15 @@
+dnl Process this file file with autoconf to produce a configure script.
+dnl This file is a shell script fragment that supplies the information
+dnl necessary to tailor a template configure script into the configure
+dnl script appropriate for this directory. For more information, check
+dnl any existing configure script.
+
+AC_PREREQ(2.5)
+AC_INIT(cplusfuncs.cc)
+
+CC=${CC-cc}
+AC_SUBST(CC)
+AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../../..)
+AC_CANONICAL_SYSTEM
+
+AC_OUTPUT(Makefile)
diff --git a/gdb/testsuite/gdb.c++/cplusfuncs.cc b/gdb/testsuite/gdb.c++/cplusfuncs.cc
new file mode 100644
index 00000000000..924cf54b262
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/cplusfuncs.cc
@@ -0,0 +1,185 @@
+#include <stddef.h>
+
+class foo {
+public:
+ foo (int);
+ foo (int, const char *);
+ foo (foo&);
+ ~foo ();
+
+ void operator * (foo&);
+ void operator % (foo&);
+ void operator - (foo&);
+ void operator >> (foo&);
+ void operator != (foo&);
+ void operator > (foo&);
+ void operator >= (foo&);
+ void operator | (foo&);
+ void operator && (foo&);
+ void operator ! (void);
+ void operator ++ (int);
+ void operator = (foo&);
+ void operator += (foo&);
+ void operator *= (foo&);
+ void operator %= (foo&);
+ void operator >>= (foo&);
+ void operator |= (foo&);
+ void operator , (foo&);
+ void operator / (foo&);
+ void operator + (foo&);
+ void operator << (foo&);
+ void operator == (foo&);
+ void operator < (foo&);
+ void operator <= (foo&);
+ void operator & (foo&);
+ void operator ^ (foo&);
+ void operator || (foo&);
+ void operator ~ (void);
+ void operator -- (int);
+ void operator -> (void);
+ void operator -= (foo&);
+ void operator /= (foo&);
+ void operator <<= (foo&);
+ void operator &= (foo&);
+ void operator ^= (foo&);
+ void operator ->* (foo&);
+ void operator [] (foo&);
+ void operator () (foo&);
+ void* operator new (size_t);
+ void operator delete (void *);
+ /**/ operator int ();
+ /**/ operator char* ();
+
+ int foofunc (int); // forced to have int return type, which is required
+ int foofunc (int, signed char *); // forced to have int return type, which is required
+ int ifoo;
+ const char *ccpfoo;
+};
+
+#ifdef usestubs
+extern "C" {
+ void set_debug_traps();
+ void breakpoint();
+};
+#endif
+
+main () {
+#ifdef usestubs
+ set_debug_traps();
+ breakpoint();
+#endif
+ int z=3;
+}
+
+foo::foo (int i) { ifoo = i;}
+foo::foo (int i, const char *ccp) { ifoo = i; ccpfoo = ccp; }
+foo::foo (foo& afoo) { afoo.ifoo = 0; }
+foo::~foo () {}
+
+void foo::operator * (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator % (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator - (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator >> (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator != (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator > (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator >= (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator | (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator && (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator ! (void) {}
+void foo::operator ++ (int ival) { ival = 0; }
+void foo::operator = (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator += (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator *= (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator %= (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator >>= (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator |= (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator , (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator / (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator + (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator << (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator == (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator < (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator <= (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator & (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator ^ (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator || (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator ~ (void) {}
+void foo::operator -- (int ival) { ival = 0; }
+void foo::operator -> (void) {}
+void foo::operator -= (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator /= (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator <<= (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator &= (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator ^= (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator ->* (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator [] (foo& afoo) { afoo.ifoo = 0; }
+void foo::operator () (foo& afoo) { afoo.ifoo = 0; }
+void* foo::operator new (size_t ival) { ival = 0; return 0; }
+void foo::operator delete (void *ptr) { ptr = 0; }
+/**/ foo::operator int () { return 0; }
+/**/ foo::operator char* () { return 0; }
+
+/* Some functions to test overloading by varying one argument type. */
+
+void overload1arg (void) { }
+void overload1arg (char arg) { arg = 0; }
+void overload1arg (signed char arg) { arg = 0; }
+void overload1arg (unsigned char arg) { arg = 0; }
+void overload1arg (short arg) { arg = 0; }
+void overload1arg (unsigned short arg) { arg = 0; }
+void overload1arg (int arg) { arg = 0; }
+void overload1arg (unsigned int arg) { arg = 0; }
+void overload1arg (long arg) { arg = 0; }
+void overload1arg (unsigned long arg) { arg = 0; }
+void overload1arg (float arg) { arg = 0; }
+void overload1arg (double arg) { arg = 0; }
+
+/* Some functions to test overloading by varying argument count. */
+
+void overloadargs (int a1) { a1 = 0; }
+void overloadargs (int a1, int a2) { a1 = a2 = 0; }
+void overloadargs (int a1, int a2, int a3) { a1 = a2 = a3 = 0; }
+void overloadargs (int a1, int a2, int a3, int a4)
+ { a1 = a2 = a3 = a4 = 0; }
+void overloadargs (int a1, int a2, int a3, int a4, int a5)
+ { a1 = a2 = a3 = a4 = a5 = 0; }
+void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6)
+ { a1 = a2 = a3 = a4 = a5 = a6 = 0; }
+void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7)
+ { a1 = a2 = a3 = a4 = a5 = a6 = a7 = 0; }
+void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
+ int a8)
+ { a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = 0; }
+void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
+ int a8, int a9)
+ { a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = 0; }
+void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
+ int a8, int a9, int a10)
+ { a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 =
+ a10 = 0; }
+void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
+ int a8, int a9, int a10, int a11)
+ { a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 =
+ a10 = a11 == 0; }
+
+/* Some hairy function definitions.
+ Use typedefs to help maintain sanity. */
+
+typedef int (*PFPc_i)(char *);
+typedef short (*PFPl_s)(long *);
+typedef short (*PFPc_s)(char *);
+typedef int (*PFl_i)(long);
+typedef PFl_i (*PFPc_PFl_i)(char *);
+typedef PFl_i (*PFPi_PFl_i)(int *);
+typedef PFl_i (*PFPFPc_i_PFl_i)(PFPc_i);
+typedef PFl_i (*PFs_PFl_i)(short);
+typedef int (*PFPFPl_s_i)(PFPl_s);
+typedef int (*PFPFPc_s_i)(PFPc_s);
+
+PFs_PFl_i hairyfunc1 (int arg) { arg = 0; return 0; }
+int hairyfunc2 (PFPc_i arg) { arg = 0; return 0; }
+int hairyfunc3 (PFPFPl_s_i arg) { arg = 0; return 0; }
+int hairyfunc4 (PFPFPc_s_i arg) { arg = 0; return 0; }
+int hairyfunc5 (PFPc_PFl_i arg) { arg = 0; return 0; }
+int hairyfunc6 (PFPi_PFl_i arg) { arg = 0; return 0; }
+int hairyfunc7 (PFPFPc_i_PFl_i arg) { arg = 0; return 0; }
diff --git a/gdb/testsuite/gdb.c++/cplusfuncs.exp b/gdb/testsuite/gdb.c++/cplusfuncs.exp
new file mode 100644
index 00000000000..e36d3793447
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/cplusfuncs.exp
@@ -0,0 +1,300 @@
+# Copyright (C) 1992, 1997 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
+# (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
+
+# This file was written by Fred Fish. (fnf@cygnus.com)
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# Check to see if we have an executable to test. If not, then either we
+# haven't tried to compile one, or the compilation failed for some reason.
+# In either case, just notify the user and skip the tests in this file.
+
+set testfile "cplusfuncs"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+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."
+}
+
+#
+# Cause gdb to lookup a specific C++ function and print the demangled
+# form.
+#
+
+proc info_func { regex demangled } {
+ global gdb_prompt
+
+ send_gdb "info function $regex\n"
+ gdb_expect {
+ -re "File .*:\r\n$demangled\r\n$gdb_prompt $" {
+ pass "info function for \"$regex\""
+ }
+ -re ".*$gdb_prompt $" {
+ fail "info function for \"$regex\""
+ }
+ timeout {
+ fail "info function for \"$regex\" (timeout)"
+ }
+ }
+}
+
+#
+# Run print &'$arg' on the input arg and verify that we can correctly
+# lookup the fully qualified C++ function.
+# We ignore the return type of the function since we are only interested
+# in the rootname and arguments part.
+#
+
+proc print_addr_of { arg } {
+ global gdb_prompt
+ global hex
+
+ set pattern [string_to_regexp $arg]
+ send_gdb "print &'$arg'\n"
+ gdb_expect {
+ -re ".* = .* $hex <$pattern>\r\n$gdb_prompt $" { pass "print &'$arg'" }
+ -re ".*$gdb_prompt $" {
+ fail "print &'$arg'"
+ }
+ timeout {
+ fail "print &'$arg' (timeout)"
+ }
+ }
+}
+
+#
+# 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 &)".
+#
+
+proc test_lookup_operator_functions {} {
+
+ # These tests don't work for COFF targets; don't even try them
+ if [istarget "a29k-*-udi"] then {
+ setup_xfail "a29k-*-udi"
+ fail "skipping operator tests"
+ return
+ }
+
+ info_func "operator&&(" "void foo::operator&&\\(foo &\\);"
+ info_func "operator&=(" "void foo::operator&=\\(foo &\\);"
+ info_func "operator&(" "void foo::operator&\\(foo &\\);"
+ info_func "operator/=(" "void foo::operator/=\\(foo &\\);"
+ info_func "operator^=(" "void foo::operator.=\\(foo &\\);"
+ info_func "operator<<=(" "void foo::operator<<=\\(foo &\\);"
+ info_func "operator%=(" "void foo::operator%=\\(foo &\\);"
+ info_func "operator-=(" "void foo::operator-=\\(foo &\\);"
+
+ # There doesn't appear to be any way to get GDB to treat '*' as a
+ # character to match, rather than as a regex special character.
+ setup_xfail "*-*-*"
+ info_func "operator\*=(" "void foo::operator\\*=\\(foo &\\);"
+
+ info_func "operator|=(" "void foo::operator\\|=\\(foo &\\);"
+ info_func "operator+=(" "void foo::operator.=\\(foo &\\);"
+ info_func "operator>>=(" "void foo::operator\>\>=\\(foo &\\);"
+ info_func "operator=(" "void foo::operator=\\(foo &\\);"
+ info_func "operator()(" "void foo::operator\\(\\)\\(foo &\\);"
+
+ # The function should be "operator," not "operator, ". (note space)
+ # This test will work; I've commented it out because it should not
+ # count as a pass, since it is incorrect. Ian Taylor.
+ # info_func "operator, (" "void foo::operator, \\(foo &\\);"
+ setup_xfail "*-*-*"
+ info_func "operator,(" "void foo::operator,\\(foo &\\);"
+
+ info_func "operator~(" "void foo::operator~\\(void\\);"
+ info_func "operator delete(" "void foo::operator delete\\(void \\*\\);"
+ info_func "operator/(" "void foo::operator/\\(foo &\\);"
+ info_func "operator==(" "void foo::operator==\\(foo &\\);"
+ info_func "operator^(" "void foo::operator\\^\\(foo &\\);"
+
+ info_func "operator>=(" "void foo::operator>=\\(foo &\\);"
+ info_func "operator>(" "void foo::operator>\\(foo &\\);"
+ info_func "operator<=(" "void foo::operator<=\\(foo &\\);"
+ info_func "operator<<(" "void foo::operator<<\\(foo &\\);"
+ info_func "operator<(" "void foo::operator<\\(foo &\\);"
+ info_func "operator%(" "void foo::operator%\\(foo &\\);"
+ info_func "operator-(" "void foo::operator-\\(foo &\\);"
+
+ # There doesn't appear to be anyway to get '*' treated as a character
+ # to match, rather than as a regex special character.
+ setup_xfail "*-*-*"
+ info_func "operator\*(" "void foo::operator\\*\\(foo &\\);"
+
+ info_func "operator--(" "void foo::operator--\\(int\\);"
+ info_func "operator!=(" "void foo::operator!=\\(foo &\\);"
+ info_func "operator!(" "void foo::operator!\\(void\\);"
+ info_func "operator new(" "void \\*foo::operator new\\(.*\\);"
+ info_func "operator||(" "void foo::operator\\|\\|\\(foo &\\);"
+ info_func "operator char \\*(" "char \\*foo::operator char \\*\\(void\\);"
+ info_func "operator int(" "int foo::operator int\\(void\\);"
+ info_func "operator|(" "void foo::operator\\|\\(foo &\\);"
+ info_func "operator+(" "void foo::operator\\+\\(foo &\\);"
+ info_func "operator++(" "void foo::operator\\+\\+\\(int\\);"
+ info_func "operator->(" "void foo::operator->\\(void\\);"
+ info_func "operator->\\*(" "void foo::operator->\\*\\(foo &\\);"
+ info_func "operator>>(" "void foo::operator\>\>\\(foo &\\);"
+
+ # GDB says "`operator \[\](' not supported". I don't know why.
+ setup_xfail "*-*-*"
+ info_func "operator\\\[\\\](" "void foo::operator\\\[\\\]\\(foo &\\);"
+ # But this works, for some reason.
+ info_func ".perator\\\[\\\](" "void foo::operator\\\[\\\]\\(foo &\\);"
+}
+
+
+proc test_paddr_operator_functions {} {
+ global hex
+
+ print_addr_of "foo::operator&&(foo &)"
+ print_addr_of "foo::operator&=(foo &)"
+ print_addr_of "foo::operator&(foo &)"
+ print_addr_of "foo::operator/=(foo &)"
+ print_addr_of "foo::operator^=(foo &)"
+ print_addr_of "foo::operator<<=(foo &)"
+ print_addr_of "foo::operator%=(foo &)"
+ print_addr_of "foo::operator-=(foo &)"
+ print_addr_of "foo::operator*=(foo &)"
+ print_addr_of "foo::operator|=(foo &)"
+ print_addr_of "foo::operator+=(foo &)"
+ print_addr_of "foo::operator>>=(foo &)"
+ print_addr_of "foo::operator=(foo &)"
+ print_addr_of "foo::operator()(foo &)"
+ print_addr_of "foo::operator, (foo &)"
+ print_addr_of "foo::operator~(void)"
+ print_addr_of "foo::operator delete(void *)"
+ print_addr_of "foo::operator/(foo &)"
+ print_addr_of "foo::operator==(foo &)"
+ print_addr_of "foo::operator^(foo &)"
+ print_addr_of "foo::operator>=(foo &)"
+ print_addr_of "foo::operator>(foo &)"
+ print_addr_of "foo::operator<=(foo &)"
+ print_addr_of "foo::operator<<(foo &)"
+ print_addr_of "foo::operator<(foo &)"
+ print_addr_of "foo::operator%(foo &)"
+ print_addr_of "foo::operator-(foo &)"
+ print_addr_of "foo::operator*(foo &)"
+ print_addr_of "foo::operator--(int)"
+ print_addr_of "foo::operator!=(foo &)"
+ print_addr_of "foo::operator!(void)"
+ gdb_test "print &'foo::operator new'" \
+ " = .* $hex <foo::operator new\\(.*\\)>"
+ print_addr_of "foo::operator||(foo &)"
+ print_addr_of "foo::operator char *(void)"
+ print_addr_of "foo::operator int(void)"
+ print_addr_of "foo::operator|(foo &)"
+ print_addr_of "foo::operator+(foo &)"
+ print_addr_of "foo::operator++(int)"
+ print_addr_of "foo::operator->(void)"
+ print_addr_of "foo::operator->*(foo &)"
+ print_addr_of "foo::operator>>(foo &)"
+ gdb_test "print &'foo::operator\[\](foo &)'" \
+ " = .*0x\[0-9a-f\]+ <foo::operator\\\[\\\]\\(foo &\\)>"
+}
+
+#
+# Test overloaded functions (1 arg).
+#
+
+proc test_paddr_overloaded_functions {} {
+ print_addr_of "overload1arg(signed char)"
+ print_addr_of "overload1arg(unsigned char)"
+ print_addr_of "overload1arg(unsigned int)"
+ print_addr_of "overload1arg(unsigned long)"
+ print_addr_of "overload1arg(unsigned short)"
+ print_addr_of "overload1arg(char)"
+ print_addr_of "overload1arg(double)"
+ print_addr_of "overload1arg(float)"
+ print_addr_of "overload1arg(int)"
+ print_addr_of "overload1arg(long)"
+ print_addr_of "overload1arg(short)"
+ print_addr_of "overload1arg(void)"
+ print_addr_of "overloadargs(int)"
+ print_addr_of "overloadargs(int, int)"
+ print_addr_of "overloadargs(int, int, int)"
+ print_addr_of "overloadargs(int, int, int, int)"
+ print_addr_of "overloadargs(int, int, int, int, int)"
+ print_addr_of "overloadargs(int, int, int, int, int, int)"
+ print_addr_of "overloadargs(int, int, int, int, int, int, int)"
+ print_addr_of "overloadargs(int, int, int, int, int, int, int, int)"
+ print_addr_of "overloadargs(int, int, int, int, int, int, int, int, int)"
+ print_addr_of "overloadargs(int, int, int, int, int, int, int, int, int, int)"
+ print_addr_of "overloadargs(int, int, int, int, int, int, int, int, int, int, int)"
+}
+
+proc test_paddr_hairy_functions {} {
+ print_addr_of "hairyfunc1(int)"
+ print_addr_of "hairyfunc2(int (*)(char *))"
+ print_addr_of "hairyfunc3(int (*)(short (*)(long *)))"
+ print_addr_of "hairyfunc4(int (*)(short (*)(char *)))"
+ print_addr_of "hairyfunc5(int (*(*)(char *))(long))"
+ print_addr_of "hairyfunc6(int (*(*)(int *))(long))"
+ print_addr_of "hairyfunc7(int (*(*)(int (*)(char *)))(long))"
+}
+
+proc do_tests {} {
+ global prms_id
+ global bug_id
+ global subdir
+ global objdir
+ global srcdir
+ global binfile
+ global gdb_prompt
+
+ set prms_id 0
+ set bug_id 0
+
+ # Start with a fresh gdb.
+
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load $binfile
+
+ send_gdb "set language c++\n"
+ gdb_expect -re "$gdb_prompt $"
+ send_gdb "set width 0\n"
+ gdb_expect -re "$gdb_prompt $"
+
+ # Get the debug format for the compiled test case. If that
+ # format is DWARF 1 then just skip all the tests since none of
+ # them will pass.
+
+ if [ runto_main] then {
+ get_debug_format
+ if [ setup_xfail_format "DWARF 1" ] then {
+ fail "C++ tests skipped due to limited C++ support in DWARF 1 debug format"
+ return
+ }
+ clear_xfail "*-*-*"
+ }
+
+ test_paddr_overloaded_functions
+ test_paddr_operator_functions
+ test_paddr_hairy_functions
+ test_lookup_operator_functions
+}
+
+do_tests
diff --git a/gdb/testsuite/gdb.c++/demangle.exp b/gdb/testsuite/gdb.c++/demangle.exp
new file mode 100644
index 00000000000..fd1d344adcd
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/demangle.exp
@@ -0,0 +1,1517 @@
+# Copyright (C) 1992, 1997 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
+# (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
+
+# This file was written by Fred Fish. (fnf@cygnus.com)
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+#
+# Test gnu style name demangling
+#
+
+proc test_gnu_style_demangling {} {
+ global gdb_prompt
+
+ # Set the demangling style to "gnu" and then check to make sure
+ # it really got set. Return if the style failed to get set for
+ # some reason.
+
+ send_gdb "set demangle-style gnu\n"
+ gdb_expect {
+ -re "set demangle-style gnu\[\r\n\]+$gdb_prompt $" {}
+ -re ".*$gdb_prompt $" { fail "set demangle-style gnu failed" ; return }
+ timeout { fail "set demangle-style gnu failed (timeout)" ; return }
+ }
+
+ send_gdb "show demangle-style\n"
+ gdb_expect {
+ -re "The current C\[+\]+ demangling style is \"gnu\".\r\n$gdb_prompt $" {}
+ -re ".*$gdb_prompt $" { fail "demangling style not set to gnu" }
+ timeout { fail "show demangle-style timed out" }
+ }
+
+ gdb_test "maint dem Abort__FP6EditoriPCc" \
+ "Abort\[(\]+Editor \[*\]+, int, (const char|char const) \[*\]+\[)\]+"
+ gdb_test_exact "maint demangle AddAlignment__9ivTSolverUiP12ivInteractorP7ivTGlue" "ivTSolver::AddAlignment(unsigned int, ivInteractor *, ivTGlue *)"
+ gdb_test "maint dem Append__15NameChooserViewPCc" \
+ "NameChooserView::Append\[(\]+(const char|char const) \[*\]+\[)\]+"
+ gdb_test_exact "maint demangle ArrowheadIntersects__9ArrowLineP9ArrowheadR6BoxObjP7Graphic" "ArrowLine::ArrowheadIntersects(Arrowhead *, BoxObj &, Graphic *)"
+ gdb_test_exact "maint demangle AtEnd__13ivRubberGroup" "ivRubberGroup::AtEnd(void)"
+ gdb_test_exact "maint demangle BgFilter__9ivTSolverP12ivInteractor" "ivTSolver::BgFilter(ivInteractor *)"
+ gdb_test "maint dem BitPatterntoa__FRC10BitPatternccc" \
+ "BitPatterntoa\[(\]+(const BitPattern|BitPattern const) &, char, char, char\[)\]+"
+ gdb_test_exact "maint demangle Check__6UArrayi" "UArray::Check(int)"
+ gdb_test_exact "maint demangle CoreConstDecls__8TextCodeR7ostream" "TextCode::CoreConstDecls(ostream &)"
+ gdb_test_exact "maint demangle Detach__8StateVarP12StateVarView" "StateVar::Detach(StateVarView *)"
+ gdb_test_exact "maint demangle Done__9ComponentG8Iterator" "Component::Done(Iterator)"
+ gdb_test "maint dem DrawDestinationTransformedImage__FP7_XImageiiT0iiUlUiiiUiUlUlP4_XGCRC13ivTransformeriiii" \
+ "DrawDestinationTransformedImage\[(\]+_XImage \[*\]+, int, int, _XImage \[*\]+, int, int, unsigned long, unsigned int, int, int, unsigned int, unsigned long, unsigned long, _XGC \[*\]+, (const ivTransformer|ivTransformer const) &, int, int, int, int\[)\]+"
+
+ gdb_test "maint dem Edit__12StringEditorPCcii" \
+ "StringEditor::Edit\[(\]+(const char|char const) \[*\]+, int, int\[)\]+"
+ gdb_test_exact "maint demangle Effect__11RelateManipR7ivEvent" "RelateManip::Effect(ivEvent &)"
+ gdb_test "maint dem FilterName__FPCc" \
+ "FilterName\[(\]+(const char|char const) \[*\]+\[)\]+"
+ gdb_test "maint dem Filter__6PSTextPCci" \
+ "PSText::Filter\[(\]+(const char|char const) \[*\]+, int\[)\]+"
+ gdb_test "maint dem FindColor__7CatalogPCciii" \
+ "Catalog::FindColor\[(\]+(const char|char const) \[*\]+, int, int, int\[)\]+"
+ gdb_test_exact "maint demangle FindFixed__FRP4CNetP4CNet" "FindFixed(CNet *&, CNet *)"
+ gdb_test "maint dem FindFont__7CatalogPCcN21" \
+ "Catalog::FindFont\[(\]+(const char|char const) \[*\]+, (const char|char const) \[*\]+, (const char|char const) \[*\]+\[)\]+"
+ gdb_test_exact "maint demangle Fix48_abort__FR8twolongs" "Fix48_abort(twolongs &)"
+ gdb_test_exact "maint demangle GetBarInfo__15iv2_6_VScrollerP13ivPerspectiveRiT2" "iv2_6_VScroller::GetBarInfo(ivPerspective *, int &, int &)"
+ gdb_test_exact "maint demangle GetBgColor__C9ivPainter" "ivPainter::GetBgColor(void) const"
+
+ gdb_test "maint dem Iisdouble__FPC6IntRep" \
+ "Iisdouble\[(\]+(const IntRep|IntRep const) \[*\]+\[)\]+"
+ gdb_test_exact "maint demangle InsertBody__15H_PullrightMenuii" "H_PullrightMenu::InsertBody(int, int)"
+ gdb_test_exact "maint demangle InsertCharacter__9TextManipc" "TextManip::InsertCharacter(char)"
+
+ gdb_test_exact "maint demangle InsertToplevel__7ivWorldP12ivInteractorT1" "ivWorld::InsertToplevel(ivInteractor *, ivInteractor *)"
+ gdb_test_exact "maint demangle InsertToplevel__7ivWorldP12ivInteractorT1iiUi" "ivWorld::InsertToplevel(ivInteractor *, ivInteractor *, int, int, unsigned int)"
+ gdb_test "maint dem IsADirectory__FPCcR4stat" \
+ "IsADirectory\[(\]+(const char|char const) \[*\]+, stat &\[)\]+"
+ gdb_test_exact "maint demangle IsAGroup__FP11GraphicViewP11GraphicComp" "IsAGroup(GraphicView *, GraphicComp *)"
+ gdb_test_exact "maint demangle IsA__10ButtonCodeUl" "ButtonCode::IsA(unsigned long)"
+
+ gdb_test_exact "maint demangle ReadName__FR7istreamPc" "ReadName(istream &, char *)"
+ gdb_test_exact "maint demangle Redraw__13StringBrowseriiii" "StringBrowser::Redraw(int, int, int, int)"
+ gdb_test_exact "maint demangle Rotate__13ivTransformerf" "ivTransformer::Rotate(float)"
+ gdb_test_exact "maint demangle Rotated__C13ivTransformerf" "ivTransformer::Rotated(float) const"
+ gdb_test_exact "maint demangle Round__Ff" "Round(float)"
+
+ gdb_test_exact "maint demangle SetExport__16MemberSharedNameUi" "MemberSharedName::SetExport(unsigned int)"
+ gdb_test_exact "maint demangle Set__14ivControlState13ControlStatusUi" "ivControlState::Set(ControlStatus, unsigned int)"
+ gdb_test_exact "maint demangle Set__5DFacePcii" "DFace::Set(char *, int, int)"
+
+ gdb_test_exact "maint demangle VConvert__9ivTSolverP12ivInteractorRP8TElementT2" "ivTSolver::VConvert(ivInteractor *, TElement *&, TElement *&)"
+ gdb_test_exact "maint demangle VConvert__9ivTSolverP7ivTGlueRP8TElement" "ivTSolver::VConvert(ivTGlue *, TElement *&)"
+ gdb_test_exact "maint demangle VOrder__9ivTSolverUiRP12ivInteractorT2" "ivTSolver::VOrder(unsigned int, ivInteractor *&, ivInteractor *&)"
+ gdb_test "maint dem Valid__7CatalogPCcRP4Tool" \
+ "Catalog::Valid\[(\]+(const char|char const) \[*\]+, Tool \[*\]+&\[)\]+"
+ gdb_test_exact "maint demangle _10PageButton\$__both" "PageButton::__both"
+ gdb_test_exact "maint demangle _3RNG\$singleMantissa" "RNG::singleMantissa"
+ gdb_test_exact "maint demangle _5IComp\$_release" "IComp::_release"
+ gdb_test_exact "maint demangle _\$_10BitmapComp" "BitmapComp::~BitmapComp(void)"
+
+ gdb_test_exact "maint demangle _\$_9__io_defs" "__io_defs::~__io_defs(void)"
+ gdb_test_exact "maint demangle _\$_Q23foo3bar" "foo::bar::~bar(void)"
+ gdb_test_exact "maint demangle _\$_Q33foo3bar4bell" "foo::bar::bell::~bell(void)"
+ gdb_test_exact "maint demangle __10ivTelltaleiP7ivGlyph" "ivTelltale::ivTelltale(int, ivGlyph *)"
+ gdb_test_exact "maint demangle __10ivViewportiP12ivInteractorUi" "ivViewport::ivViewport(int, ivInteractor *, unsigned int)"
+ gdb_test_exact "maint demangle __10ostrstream" "ostrstream::ostrstream(void)"
+ gdb_test_exact "maint demangle __10ostrstreamPcii" "ostrstream::ostrstream(char *, int, int)"
+ gdb_test "maint dem __11BasicDialogiPCcP13ivButtonStateN22Ui" \
+ "BasicDialog::BasicDialog\[(\]+int, (const char|char const) \[*\]+, ivButtonState \[*\]+, (const char|char const) \[*\]+, (const char|char const) \[*\]+, unsigned int\[)\]+"
+ gdb_test_exact "maint demangle __11BitmapTablei" "BitmapTable::BitmapTable(int)"
+ gdb_test_exact "maint demangle __12ViewportCodeP12ViewportComp" "ViewportCode::ViewportCode(ViewportComp *)"
+ gdb_test "maint dem __12iv2_6_BorderiPCci" \
+ "iv2_6_Border::iv2_6_Border\[(\]+int, (const char|char const) \[*\]+, int\[)\]+"
+ gdb_test_exact "maint demangle __12iv2_6_Borderii" "iv2_6_Border::iv2_6_Border(int, int)"
+ gdb_test "maint dem __12ivBackgroundiP7ivGlyphPC7ivColor" \
+ "ivBackground::ivBackground\[(\]+int, ivGlyph \[*\]+, (const ivColor|ivColor const) \[*\]+\[)\]+"
+ gdb_test_exact "maint demangle __12ivBreak_Listl" "ivBreak_List::ivBreak_List(long)"
+ gdb_test "maint dem __14TextInteractoriPCcUi" \
+ "TextInteractor::TextInteractor\[(\]+int, (const char|char const) \[*\]+, unsigned int\[)\]+"
+ gdb_test_exact "maint demangle __14iv2_6_MenuItemiP12ivInteractor" "iv2_6_MenuItem::iv2_6_MenuItem(int, ivInteractor *)"
+ gdb_test "maint dem __14iv2_6_MenuItemiPCcP12ivInteractor" \
+ "iv2_6_MenuItem::iv2_6_MenuItem\[(\]+int, (const char|char const) \[*\]+, ivInteractor \[*\]+\[)\]+"
+
+ gdb_test_exact "maint demangle __20DisplayList_IteratorR11DisplayList" "DisplayList_Iterator::DisplayList_Iterator(DisplayList &)"
+ gdb_test_exact "maint demangle __3fooRT0" "foo::foo(foo &)"
+ gdb_test_exact "maint demangle __3fooiN31" "foo::foo(int, int, int, int)"
+ gdb_test "maint dem __3fooiPCc" \
+ "foo::foo\[(\]+int, (const char|char const) \[*\]+\[)\]+"
+ gdb_test_exact "maint demangle __3fooiRT0iT2iT2" "foo::foo(int, foo &, int, foo &, int, foo &)"
+ gdb_test "maint dem __6GetOptiPPcPCc" \
+ "GetOpt::GetOpt\[(\]+int, char \[*\]+\[*\]+, (const char|char const) \[*\]+\[)\]+"
+ gdb_test_exact "maint demangle __6KeyMapPT0" "KeyMap::KeyMap(KeyMap *)"
+ gdb_test "maint dem __7ivWorldPCcRiPPcPC12ivOptionDescPC14ivPropertyData" \
+ "ivWorld::ivWorld\[(\]+(const char|char const) \[*\]+, int &, char \[*\]+\[*\]+, (const ivOptionDesc|ivOptionDesc const) \[*\]+, (const ivPropertyData|ivPropertyData const) \[*\]+\[)\]+"
+ gdb_test "maint dem __7procbufPCci" \
+ "procbuf::procbuf\[(\]+(const char|char const) \[*\]+, int\[)\]+"
+ gdb_test_exact "maint demangle __8ArrowCmdP6EditorUiUi" "ArrowCmd::ArrowCmd(Editor *, unsigned int, unsigned int)"
+
+ gdb_test_exact "maint demangle __9F_EllipseiiiiP7Graphic" "F_Ellipse::F_Ellipse(int, int, int, int, Graphic *)"
+ gdb_test_exact "maint demangle __9FrameDataP9FrameCompi" "FrameData::FrameData(FrameComp *, int)"
+ gdb_test_exact "maint demangle __9HVGraphicP9CanvasVarP7Graphic" "HVGraphic::HVGraphic(CanvasVar *, Graphic *)"
+ gdb_test_exact "maint demangle __Q23foo3bar" "foo::bar::bar(void)"
+ gdb_test_exact "maint demangle __Q33foo3bar4bell" "foo::bar::bell::bell(void)"
+ gdb_test_exact "maint demangle __aa__3fooRT0" "foo::operator&&(foo &)"
+ gdb_test_exact "maint demangle __aad__3fooRT0" "foo::operator&=(foo &)"
+ gdb_test_exact "maint demangle __ad__3fooRT0" "foo::operator&(foo &)"
+ gdb_test_exact "maint demangle __adv__3fooRT0" "foo::operator/=(foo &)"
+ gdb_test_exact "maint demangle __aer__3fooRT0" "foo::operator^=(foo &)"
+ gdb_test_exact "maint demangle __als__3fooRT0" "foo::operator<<=(foo &)"
+ gdb_test_exact "maint demangle __amd__3fooRT0" "foo::operator%=(foo &)"
+ gdb_test_exact "maint demangle __ami__3fooRT0" "foo::operator-=(foo &)"
+ gdb_test_exact "maint demangle __aml__3FixRT0" "Fix::operator*=(Fix &)"
+ gdb_test_exact "maint demangle __aml__5Fix16i" "Fix16::operator*=(int)"
+ gdb_test_exact "maint demangle __aml__5Fix32RT0" "Fix32::operator*=(Fix32 &)"
+ gdb_test_exact "maint demangle __aor__3fooRT0" "foo::operator|=(foo &)"
+ gdb_test_exact "maint demangle __apl__3fooRT0" "foo::operator+=(foo &)"
+ gdb_test_exact "maint demangle __ars__3fooRT0" "foo::operator>>=(foo &)"
+
+ gdb_test_exact "maint demangle __as__3fooRT0" "foo::operator=(foo &)"
+ gdb_test_exact "maint demangle __cl__3fooRT0" "foo::operator()(foo &)"
+ gdb_test_exact "maint demangle __cl__6Normal" "Normal::operator()(void)"
+ gdb_test_exact "maint demangle __cl__6Stringii" "String::operator()(int, int)"
+ gdb_test_exact "maint demangle __cm__3fooRT0" "foo::operator, (foo &)"
+ gdb_test_exact "maint demangle __co__3foo" "foo::operator~(void)"
+ gdb_test_exact "maint demangle __dl__3fooPv" "foo::operator delete(void *)"
+ gdb_test_exact "maint demangle __dv__3fooRT0" "foo::operator/(foo &)"
+ gdb_test_exact "maint demangle __eq__3fooRT0" "foo::operator==(foo &)"
+ gdb_test_exact "maint demangle __er__3fooRT0" "foo::operator^(foo &)"
+ gdb_test_exact "maint demangle __ge__3fooRT0" "foo::operator>=(foo &)"
+ gdb_test_exact "maint demangle __gt__3fooRT0" "foo::operator>(foo &)"
+ gdb_test_exact "maint demangle __le__3fooRT0" "foo::operator<=(foo &)"
+ gdb_test_exact "maint demangle __ls__3fooRT0" "foo::operator<<(foo &)"
+ gdb_test_exact "maint demangle __ls__FR7ostreamPFR3ios_R3ios" "operator<<(ostream &, ios &(*)(ios &))"
+ gdb_test_exact "maint demangle __ls__FR7ostreamR3Fix" "operator<<(ostream &, Fix &)"
+ gdb_test_exact "maint demangle __lt__3fooRT0" "foo::operator<(foo &)"
+ gdb_test_exact "maint demangle __md__3fooRT0" "foo::operator%(foo &)"
+ gdb_test_exact "maint demangle __mi__3fooRT0" "foo::operator-(foo &)"
+ gdb_test_exact "maint demangle __ml__3fooRT0" "foo::operator*(foo &)"
+ gdb_test_exact "maint demangle __mm__3fooi" "foo::operator--(int)"
+
+ gdb_test_exact "maint demangle __ne__3fooRT0" "foo::operator!=(foo &)"
+ gdb_test "maint dem __ne__FRC7ComplexT0" \
+ "operator!=\[(\]+(const Complex|Complex const) &, (const Complex|Complex const) &\[)\]+"
+ gdb_test "maint dem __ne__FRC7Complexd" \
+ "operator!=\[(\]+(const Complex|Complex const) &, double\[)\]+"
+ gdb_test "maint dem __ne__FRC9SubStringRC6String" \
+ "operator!=\[(\]+(const SubString|SubString const) &, (const String|String const) &\[)\]+"
+ gdb_test_exact "maint demangle __nt__3foo" "foo::operator!(void)"
+ gdb_test_exact "maint demangle __nw__3fooi" "foo::operator new(int)"
+ gdb_test_exact "maint demangle __oo__3fooRT0" "foo::operator||(foo &)"
+ gdb_test_exact "maint demangle __opPc__3foo" "foo::operator char *(void)"
+ gdb_test_exact "maint demangle __opi__3foo" "foo::operator int(void)"
+ gdb_test_exact "maint demangle __or__3fooRT0" "foo::operator|(foo &)"
+ gdb_test_exact "maint demangle __pl__3fooRT0" "foo::operator+(foo &)"
+ gdb_test_exact "maint demangle __pp__3fooi" "foo::operator++(int)"
+ gdb_test_exact "maint demangle __rf__3foo" "foo::operator->(void)"
+ gdb_test_exact "maint demangle __rm__3fooRT0" "foo::operator->*(foo &)"
+ gdb_test_exact "maint demangle __rs__3fooRT0" "foo::operator>>(foo &)"
+ gdb_test "maint dem __vc__3fooRT0" "foo::operator\\\[\\\]\\(foo &\\)"
+ gdb_test "maint dem _gsub__6StringRC5RegexPCci" \
+ "String::_gsub\[(\]+(const Regex|Regex const) &, (const char|char const) \[*\]+, int\[)\]+"
+ gdb_test_exact "maint demangle _new_Fix__FUs" "_new_Fix(unsigned short)"
+
+ # gcc 2.4.5 (and earlier) style virtual tables. We want to continue to
+ # correctly demangle these even if newer compilers use a different form.
+ gdb_test_exact "maint demangle _vt.foo" "foo virtual table"
+ gdb_test_exact "maint demangle _vt.foo.bar" "foo::bar virtual table"
+ gdb_test_exact "maint demangle _vt\$foo" "foo virtual table"
+ gdb_test_exact "maint demangle _vt\$foo\$bar" "foo::bar virtual table"
+
+ gdb_test_exact "maint demangle append__7ivGlyphPT0" "ivGlyph::append(ivGlyph *)"
+ gdb_test "maint dem arg__FRC7Complex" \
+ "arg\[(\]+(const Complex|Complex const) &\[)\]+"
+ gdb_test_exact "maint demangle clearok__FP7_win_sti" "clearok(_win_st *, int)"
+
+ gdb_test_exact "maint demangle complexfunc2__FPFPc_i" "complexfunc2(int (*)(char *))"
+ gdb_test_exact "maint demangle complexfunc3__FPFPFPl_s_i" "complexfunc3(int (*)(short (*)(long *)))"
+ gdb_test_exact "maint demangle complexfunc4__FPFPFPc_s_i" "complexfunc4(int (*)(short (*)(char *)))"
+ gdb_test_exact "maint demangle complexfunc5__FPFPc_PFl_i" "complexfunc5(int (*(*)(char *))(long))"
+ gdb_test_exact "maint demangle complexfunc6__FPFPi_PFl_i" "complexfunc6(int (*(*)(int *))(long))"
+ gdb_test_exact "maint demangle complexfunc7__FPFPFPc_i_PFl_i" "complexfunc7(int (*(*)(int (*)(char *)))(long))"
+ gdb_test "maint dem contains__C9BitStringRC10BitPattern" \
+ "BitString::contains\[(\]+(const BitPattern|BitPattern const) &\[)\]+ const"
+ gdb_test "maint dem contains__C9BitStringRC12BitSubStringi" \
+ "BitString::contains\[(\]+(const BitSubString|BitSubString const) &, int\[)\]+ const"
+ gdb_test "maint dem contains__C9BitStringRT0" \
+ "BitString::contains\[(\]+(const BitString|BitString const) &\[)\]+ const"
+ gdb_test "maint dem div__FPC6IntRepT0P6IntRep" \
+ "div\[(\]+(const IntRep|IntRep const) \[*\]+, (const IntRep|IntRep const) \[*\]+, IntRep \[*\]+\[)\]+"
+ gdb_test "maint dem div__FPC6IntReplP6IntRep" \
+ "div\[(\]+(const IntRep|IntRep const) \[*\]+, long, IntRep \[*\]+\[)\]+"
+ gdb_test "maint dem div__FRC8RationalT0R8Rational" \
+ "div\[(\]+(const Rational|Rational const) &, (const Rational|Rational const) &, Rational &\[)\]+"
+ gdb_test "maint dem divide__FRC7IntegerT0R7IntegerT2" \
+ "divide\[(\]+(const Integer|Integer const) &, (const Integer|Integer const) &, Integer &, Integer &\[)\]+"
+ gdb_test "maint dem divide__FRC7IntegerlR7IntegerRl" \
+ "divide\[(\]+(const Integer|Integer const) &, long, Integer &, long &\[)\]+"
+ gdb_test "maint dem enable__14DocumentViewerPCcUi" \
+ "DocumentViewer::enable\[(\]+(const char|char const) \[*\]+, unsigned int\[)\]+"
+
+ gdb_test_exact "maint demangle foo__FiN30" "foo(int, int, int, int)"
+ gdb_test_exact "maint demangle foo__FiR3fooiT1iT1" "foo(int, foo &, int, foo &, int, foo &)"
+ gdb_test_exact "maint demangle foo___3barl" "bar::foo_(long)"
+ gdb_test_exact "maint demangle insert__15ivClippingStacklRP8_XRegion" "ivClippingStack::insert(long, _XRegion *&)"
+ gdb_test_exact "maint demangle insert__16ChooserInfo_ListlR11ChooserInfo" "ChooserInfo_List::insert(long, ChooserInfo &)"
+ gdb_test_exact "maint demangle insert__17FontFamilyRepListlRP15ivFontFamilyRep" "FontFamilyRepList::insert(long, ivFontFamilyRep *&)"
+ gdb_test_exact "maint demangle leaveok__FP7_win_stc" "leaveok(_win_st *, char)"
+ gdb_test_exact "maint demangle left_mover__C7ivMFKitP12ivAdjustableP7ivStyle" "ivMFKit::left_mover(ivAdjustable *, ivStyle *) const"
+ gdb_test "maint dem matches__C9BitStringRC10BitPatterni" \
+ "BitString::matches\[(\]+(const BitPattern|BitPattern const) &, int\[)\]+ const"
+ gdb_test "maint dem matches__C9SubStringRC5Regex" \
+ "SubString::matches\[(\]+(const Regex|Regex const) &\[)\]+ const"
+
+ gdb_test_exact "maint demangle overload1arg__FSc" "overload1arg(signed char)"
+ gdb_test_exact "maint demangle overload1arg__FUc" "overload1arg(unsigned char)"
+ gdb_test_exact "maint demangle overload1arg__FUi" "overload1arg(unsigned int)"
+ gdb_test_exact "maint demangle overload1arg__FUl" "overload1arg(unsigned long)"
+ gdb_test_exact "maint demangle overload1arg__FUs" "overload1arg(unsigned short)"
+ gdb_test_exact "maint demangle overload1arg__Fc" "overload1arg(char)"
+ gdb_test_exact "maint demangle overload1arg__Fd" "overload1arg(double)"
+ gdb_test_exact "maint demangle overload1arg__Ff" "overload1arg(float)"
+ gdb_test_exact "maint demangle overload1arg__Fi" "overload1arg(int)"
+ gdb_test_exact "maint demangle overload1arg__Fl" "overload1arg(long)"
+ gdb_test_exact "maint demangle overload1arg__Fs" "overload1arg(short)"
+ gdb_test_exact "maint demangle overload1arg__Fv" "overload1arg(void)"
+ gdb_test_exact "maint demangle overloadargs__Fi" "overloadargs(int)"
+ gdb_test_exact "maint demangle overloadargs__Fii" "overloadargs(int, int)"
+ gdb_test_exact "maint demangle overloadargs__Fiii" "overloadargs(int, int, int)"
+ gdb_test_exact "maint demangle overloadargs__Fiiii" "overloadargs(int, int, int, int)"
+
+ gdb_test_exact "maint demangle overloadargs__Fiiiii" "overloadargs(int, int, int, int, int)"
+ gdb_test_exact "maint demangle overloadargs__Fiiiiii" "overloadargs(int, int, int, int, int, int)"
+ gdb_test_exact "maint demangle overloadargs__Fiiiiiii" "overloadargs(int, int, int, int, int, int, int)"
+ gdb_test_exact "maint demangle overloadargs__Fiiiiiiii" "overloadargs(int, int, int, int, int, int, int, int)"
+ gdb_test_exact "maint demangle overloadargs__Fiiiiiiiii" "overloadargs(int, int, int, int, int, int, int, int, int)"
+ gdb_test_exact "maint demangle overloadargs__Fiiiiiiiiii" "overloadargs(int, int, int, int, int, int, int, int, int, int)"
+ gdb_test_exact "maint demangle overloadargs__Fiiiiiiiiiii" "overloadargs(int, int, int, int, int, int, int, int, int, int, int)"
+ gdb_test "maint dem pick__13ivCompositionP8ivCanvasRC12ivAllocationiR5ivHit" \
+ "ivComposition::pick\[(\]+ivCanvas \[*\]+, (const ivAllocation|ivAllocation const) &, int, ivHit &\[)\]+"
+ gdb_test "maint dem pointer__C11ivHScrollerRC7ivEventRC12ivAllocation" \
+ "ivHScroller::pointer\[(\]+(const ivEvent|ivEvent const) &, (const ivAllocation|ivAllocation const) &\[)\]+ const"
+ gdb_test_exact "maint demangle poke__8ivRasterUlUlffff" "ivRaster::poke(unsigned long, unsigned long, float, float, float, float)"
+ gdb_test_exact "maint demangle polar__Fdd" "polar(double, double)"
+ gdb_test "maint dem read__10osStdInputRPCc" \
+ "osStdInput::read\[(\]+(const char|char const) \[*\]+&\[)\]+"
+
+ gdb_test_exact "maint demangle scale__13ivTransformerff" "ivTransformer::scale(float, float)"
+ gdb_test "maint dem scanw__12CursesWindowPCce" \
+ "CursesWindow::scanw\[(\]+(const char|char const) \[*\]+,...\[)\]+"
+ gdb_test "maint dem scmp__FPCcT0" \
+ "scmp\[(\]+(const char|char const) \[*\]+, (const char|char const) \[*\]+\[)\]+"
+ gdb_test_exact "maint demangle sgetn__7filebufPci" "filebuf::sgetn(char *, int)"
+ gdb_test_exact "maint demangle shift__FP5_FrepiT0" "shift(_Frep *, int, _Frep *)"
+ gdb_test_exact "maint demangle test__C6BitSeti" "BitSet::test(int) const"
+ gdb_test_exact "maint demangle test__C6BitSetii" "BitSet::test(int, int) const"
+ gdb_test "maint dem testbit__FRC7Integerl" \
+ "testbit\[(\]+(const Integer|Integer const) &, long\[)\]+"
+ gdb_test_exact "maint demangle text_source__8Documentl" "Document::text_source(long)"
+ gdb_test_exact "maint demangle variance__6Erlangd" "Erlang::variance(double)"
+ gdb_test "maint dem vform__8iostreamPCcPc" \
+ "iostream::vform\[(\]+(const char|char const) \[*\]+, char \[*\]+\[)\]+"
+ gdb_test_exact "maint demangle view__14DocumentViewerP8ItemViewP11TabularItem" "DocumentViewer::view(ItemView *, TabularItem *)"
+ gdb_test_exact "maint demangle xy_extents__11ivExtensionffff" "ivExtension::xy_extents(float, float, float, float)"
+ gdb_test_exact "maint demangle zero__8osMemoryPvUi" "osMemory::zero(void *, unsigned int)"
+ gdb_test_exact "maint demangle _2T4\$N" "T4::N"
+ gdb_test_exact "maint demangle _Q22T42t1\$N" "T4::t1::N"
+ gdb_test_exact "maint demangle get__2T1" "T1::get(void)"
+ gdb_test_exact "maint demangle get__Q22T11a" "T1::a::get(void)"
+ gdb_test_exact "maint demangle get__Q32T11a1b" "T1::a::b::get(void)"
+ gdb_test_exact "maint demangle get__Q42T11a1b1c" "T1::a::b::c::get(void)"
+ gdb_test_exact "maint demangle get__Q52T11a1b1c1d" "T1::a::b::c::d::get(void)"
+ gdb_test_exact "maint demangle put__2T1i" "T1::put(int)"
+ gdb_test_exact "maint demangle put__Q22T11ai" "T1::a::put(int)"
+ gdb_test_exact "maint demangle put__Q32T11a1bi" "T1::a::b::put(int)"
+ gdb_test_exact "maint demangle put__Q42T11a1b1ci" "T1::a::b::c::put(int)"
+ gdb_test_exact "maint demangle put__Q52T11a1b1c1di" "T1::a::b::c::d::put(int)"
+
+ gdb_test_exact "maint demangle bar__3fooPv" "foo::bar(void *)"
+ gdb_test "maint dem bar__3fooPCv" \
+ "foo::bar\[(\]+(const void|void const) *\[*\]+\[)\]+"
+ gdb_test_exact "maint demangle bar__C3fooPv" "foo::bar(void *) const"
+ gdb_test "maint dem bar__C3fooPCv" \
+ "foo::bar\[(\]+(const void|void const) *\[*\]+\[)\]+ const"
+ gdb_test_exact "maint demangle __eq__3fooRT0" "foo::operator==(foo &)"
+ gdb_test "maint dem __eq__3fooRC3foo" \
+ "foo::operator==\[(\]+(const foo|foo const) &\[)\]+"
+ gdb_test_exact "maint demangle __eq__C3fooR3foo" "foo::operator==(foo &) const"
+ gdb_test "maint dem __eq__C3fooRT0" \
+ "foo::operator==\[(\]+(const foo|foo const) &\[)\]+ const"
+
+ gdb_test_exact "maint demangle elem__t6vector1Zdi" "vector<double>::elem(int)"
+ gdb_test_exact "maint demangle elem__t6vector1Zii" "vector<int>::elem(int)"
+ gdb_test_exact "maint demangle __t6vector1Zdi" "vector<double>::vector(int)"
+ gdb_test_exact "maint demangle __t6vector1Zii" "vector<int>::vector(int)"
+ gdb_test_exact "maint demangle _\$_t6vector1Zdi" "vector<double>::~vector(int)"
+ gdb_test_exact "maint demangle _\$_t6vector1Zii" "vector<int>::~vector(int)"
+
+ gdb_test_exact "maint demangle __nw__t2T11ZcUi" "T1<char>::operator new(unsigned int)"
+ gdb_test_exact "maint demangle __nw__t2T11Z1tUi" "T1<t>::operator new(unsigned int)"
+ gdb_test_exact "maint demangle __dl__t2T11ZcPv" "T1<char>::operator delete(void *)"
+ gdb_test_exact "maint demangle __dl__t2T11Z1tPv" "T1<t>::operator delete(void *)"
+ gdb_test_exact "maint demangle __t2T11Zci" "T1<char>::T1(int)"
+ gdb_test_exact "maint demangle __t2T11Zc" "T1<char>::T1(void)"
+ gdb_test_exact "maint demangle __t2T11Z1ti" "T1<t>::T1(int)"
+ gdb_test_exact "maint demangle __t2T11Z1t" "T1<t>::T1(void)"
+
+ gdb_test_exact "maint demangle __Q2t4List1Z10VHDLEntity3Pix" \
+ "List<VHDLEntity>::Pix::Pix(void)"
+
+ gdb_test_exact "maint demangle __Q2t4List1Z10VHDLEntity3PixPQ2t4List1Z10VHDLEntity7element" \
+ "List<VHDLEntity>::Pix::Pix(List<VHDLEntity>::element *)"
+
+ gdb_test_exact "maint demangle __Q2t4List1Z10VHDLEntity3PixRCQ2t4List1Z10VHDLEntity3Pix" \
+ "List<VHDLEntity>::Pix::Pix(List<VHDLEntity>::Pix const &)"
+
+ gdb_test_exact "maint demangle __Q2t4List1Z10VHDLEntity7elementRC10VHDLEntityPT0" \
+ "List<VHDLEntity>::element::element(VHDLEntity const &, List<VHDLEntity>::element *)"
+
+ gdb_test_exact "maint demangle __Q2t4List1Z10VHDLEntity7elementRCQ2t4List1Z10VHDLEntity7element" \
+ "List<VHDLEntity>::element::element(List<VHDLEntity>::element const &)"
+
+ gdb_test_exact "maint demangle __cl__C11VHDLLibraryGt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \
+ "VHDLLibrary::operator()(PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >) const"
+
+ gdb_test_exact "maint demangle __cl__Ct4List1Z10VHDLEntityRCQ2t4List1Z10VHDLEntity3Pix" \
+ "List<VHDLEntity>::operator()(List<VHDLEntity>::Pix const &) const"
+
+ gdb_test_exact "maint demangle __ne__FPvRCQ2t4List1Z10VHDLEntity3Pix" \
+ "operator!=(void *, List<VHDLEntity>::Pix const &)"
+
+ gdb_test_exact "maint demangle __ne__FPvRCt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \
+ "operator!=(void *, PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> > const &)"
+
+ gdb_test_exact "maint demangle __t4List1Z10VHDLEntityRCt4List1Z10VHDLEntity" \
+ "List<VHDLEntity>::List(List<VHDLEntity> const &)"
+
+ gdb_test_exact "maint demangle __t4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \
+ "PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >::PixX(void)"
+
+ gdb_test_exact "maint demangle __t4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntityP14VHDLLibraryRepGQ2t4List1Z10VHDLEntity3Pix" \
+ "PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >::PixX(VHDLLibraryRep *, List<VHDLEntity>::Pix)"
+
+ gdb_test_exact "maint demangle __t4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntityRCt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \
+ "PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >::PixX(PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> > const &)"
+
+ gdb_test_exact "maint demangle nextE__C11VHDLLibraryRt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity" \
+ "VHDLLibrary::nextE(PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> > &) const"
+
+ gdb_test_exact "maint demangle next__Ct4List1Z10VHDLEntityRQ2t4List1Z10VHDLEntity3Pix" \
+ "List<VHDLEntity>::next(List<VHDLEntity>::Pix &) const"
+
+ gdb_test_exact "maint demangle _GLOBAL_\$D\$set" "global destructors keyed to set"
+
+ gdb_test_exact "maint demangle _GLOBAL_\$I\$set" "global constructors keyed to set"
+
+ gdb_test_exact "maint demangle __as__t5ListS1ZUiRCt5ListS1ZUi" \
+ "ListS<unsigned int>::operator=(ListS<unsigned int> const &)"
+
+ gdb_test_exact "maint demangle __cl__Ct5ListS1ZUiRCQ2t5ListS1ZUi3Vix" \
+ "ListS<unsigned int>::operator()(ListS<unsigned int>::Vix const &) const"
+
+ gdb_test_exact "maint demangle __cl__Ct5SetLS1ZUiRCQ2t5SetLS1ZUi3Vix" \
+ "SetLS<unsigned int>::operator()(SetLS<unsigned int>::Vix const &) const"
+
+ gdb_test_exact "maint demangle __t10ListS_link1ZUiRCUiPT0" \
+ "ListS_link<unsigned int>::ListS_link(unsigned int const &, ListS_link<unsigned int> *)"
+
+ gdb_test_exact "maint demangle __t10ListS_link1ZUiRCt10ListS_link1ZUi" \
+ "ListS_link<unsigned int>::ListS_link(ListS_link<unsigned int> const &)"
+
+ gdb_test_exact "maint demangle __t5ListS1ZUiRCt5ListS1ZUi" \
+ "ListS<unsigned int>::ListS(ListS<unsigned int> const &)"
+
+ gdb_test_exact "maint demangle next__Ct5ListS1ZUiRQ2t5ListS1ZUi3Vix" \
+ "ListS<unsigned int>::next(ListS<unsigned int>::Vix &) const"
+
+ gdb_test_exact "maint demangle __ne__FPvRCQ2t5SetLS1ZUi3Vix" \
+ "operator!=(void *, SetLS<unsigned int>::Vix const &)"
+ gdb_test_exact "maint demangle __t8ListElem1Z5LabelRt4List1Z5Label" \
+ "ListElem<Label>::ListElem(List<Label> &)"
+ gdb_test_exact "maint demangle __t8BDDHookV1ZPcRCPc" \
+ "BDDHookV<char *>::BDDHookV(char *const &)"
+
+ gdb_test_exact "maint demangle _vt\$t8BDDHookV1ZPc" "BDDHookV<char *> virtual table"
+
+ gdb_test_exact "maint demangle __ne__FPvRCQ211BDDFunction4VixB" \
+ "operator!=(void *, BDDFunction::VixB const &)"
+ gdb_test_exact "maint demangle __eq__FPvRCQ211BDDFunction4VixB" \
+ "operator==(void *, BDDFunction::VixB const &)"
+
+ gdb_test_exact "maint demangle relativeId__CQ36T_phi210T_preserve8FPC_nextRCQ26T_phi210T_preserveRC10Parameters" \
+ "T_phi2::T_preserve::FPC_next::relativeId(T_phi2::T_preserve const &, Parameters const &) const"
+
+}
+
+#
+# Test lucid style name demangling
+#
+
+proc test_lucid_style_demangling {} {
+ global gdb_prompt
+
+ # Set the demangling style to "lucid" and then check to make sure
+ # it really got set. Return if the style failed to get set for
+ # some reason.
+
+ send_gdb "set demangle-style lucid\n"
+ gdb_expect {
+ -re "set demangle-style lucid\[\r\n\]+$gdb_prompt $" {}
+ -re ".*$gdb_prompt $" { fail "set demangle-style lucid failed" ; return }
+ timeout { fail "set demangle-style lucid failed (timeout)" ; return }
+ }
+
+ send_gdb "show demangle-style\n"
+ gdb_expect {
+ -re "The current C\[+\]+ demangling style is \"lucid\".\r\n$gdb_prompt $" {}
+ -re ".*$gdb_prompt $" { fail "demangling style not set to lucid" }
+ timeout { fail "show demangle-style timed out" }
+ }
+
+ gdb_test_exact "maint demangle WS__FR7istream" "WS(istream &)"
+ gdb_test_exact "maint demangle __aa__3fooFR3foo" "foo::operator&&(foo &)"
+ gdb_test_exact "maint demangle __aad__3fooFR3foo" "foo::operator&=(foo &)"
+ gdb_test_exact "maint demangle __ad__3fooFR3foo" "foo::operator&(foo &)"
+ gdb_test_exact "maint demangle __adv__3fooFR3foo" "foo::operator/=(foo &)"
+ gdb_test_exact "maint demangle __adv__7complexF7complex" "complex::operator/=(complex)"
+ gdb_test_exact "maint demangle __aer__3fooFR3foo" "foo::operator^=(foo &)"
+ gdb_test_exact "maint demangle __als__3fooFR3foo" "foo::operator<<=(foo &)"
+ gdb_test_exact "maint demangle __amd__3fooFR3foo" "foo::operator%=(foo &)"
+ gdb_test_exact "maint demangle __ami__3fooFR3foo" "foo::operator-=(foo &)"
+ gdb_test_exact "maint demangle __amu__3fooFR3foo" "foo::operator*=(foo &)"
+ gdb_test_exact "maint demangle __amu__7complexF7complex" "complex::operator*=(complex)"
+ gdb_test_exact "maint demangle __aor__3fooFR3foo" "foo::operator|=(foo &)"
+ gdb_test_exact "maint demangle __apl__3fooFR3foo" "foo::operator+=(foo &)"
+ gdb_test_exact "maint demangle __ars__3fooFR3foo" "foo::operator>>=(foo &)"
+ gdb_test_exact "maint demangle __as__18istream_withassignFP9streambuf" "istream_withassign::operator=(streambuf *)"
+ gdb_test_exact "maint demangle __as__18istream_withassignFR7istream" "istream_withassign::operator=(istream &)"
+ gdb_test_exact "maint demangle __as__3fooFR3foo" "foo::operator=(foo &)"
+ gdb_test_exact "maint demangle __as__3iosFR3ios" "ios::operator=(ios &)"
+ gdb_test_exact "maint demangle __cl__3fooFR3foo" "foo::operator()(foo &)"
+ gdb_test_exact "maint demangle __cm__3fooFR3foo" "foo::operator, (foo &)"
+
+ gdb_test_exact "maint demangle __co__3fooFv" "foo::operator~(void)"
+ gdb_test_exact "maint demangle __ct__10istrstreamFPc" "istrstream::istrstream(char *)"
+ gdb_test_exact "maint demangle __ct__10istrstreamFPci" "istrstream::istrstream(char *, int)"
+ gdb_test_exact "maint demangle __ct__10ostrstreamFPciT2" "ostrstream::ostrstream(char *, int, int)"
+ gdb_test_exact "maint demangle __ct__10ostrstreamFv" "ostrstream::ostrstream(void)"
+ gdb_test_exact "maint demangle __ct__10smanip_intFPFR3iosi_R3iosi" "smanip_int::smanip_int(ios &(*)(ios &, int), int)"
+ gdb_test "maint dem __ct__11c_exceptionFPcRC7complexT2" "c_exception::c_exception\[(\]+char \[*\]+, (const complex|complex const) &, (const complex|complex const) &\[)\]+"
+ gdb_test "maint dem __ct__11fstreambaseFPCciT2" "fstreambase::fstreambase\[(\]+(const char|char const) \[*\]+, int, int\[)\]+"
+ gdb_test_exact "maint demangle __ct__11fstreambaseFi" "fstreambase::fstreambase(int)"
+ gdb_test_exact "maint demangle __ct__11fstreambaseFiPcT1" "fstreambase::fstreambase(int, char *, int)"
+ gdb_test_exact "maint demangle __ct__11fstreambaseFv" "fstreambase::fstreambase(void)"
+ gdb_test_exact "maint demangle __ct__11smanip_longFPFR3iosl_R3iosl" "smanip_long::smanip_long(ios &(*)(ios &, long), long)"
+ gdb_test_exact "maint demangle __ct__11stdiostreamFP4FILE" "stdiostream::stdiostream(FILE *)"
+ gdb_test_exact "maint demangle __ct__12strstreambufFPFl_PvPFPv_v" "strstreambuf::strstreambuf(void *(*)(long), void (*)(void *))"
+ gdb_test_exact "maint demangle __ct__12strstreambufFPUciT1" "strstreambuf::strstreambuf(unsigned char *, int, unsigned char *)"
+ gdb_test_exact "maint demangle __ct__12strstreambufFPciT1" "strstreambuf::strstreambuf(char *, int, char *)"
+ gdb_test_exact "maint demangle __ct__12strstreambufFi" "strstreambuf::strstreambuf(int)"
+ gdb_test_exact "maint demangle __ct__12strstreambufFv" "strstreambuf::strstreambuf(void)"
+ gdb_test_exact "maint demangle __ct__13strstreambaseFPciT1" "strstreambase::strstreambase(char *, int, char *)"
+ gdb_test_exact "maint demangle __ct__3fooFR3foo" "foo::foo(foo &)"
+
+ gdb_test_exact "maint demangle __ct__3fooFi" "foo::foo(int)"
+ gdb_test_exact "maint demangle __ct__3fooFiN31" "foo::foo(int, int, int, int)"
+ gdb_test "maint dem __ct__3fooFiPCc" \
+ "foo::foo\[(\]+int, (const char|char const) \[*\]+\[)\]+"
+ gdb_test_exact "maint demangle __ct__3fooFiR3fooT1T2T1T2" "foo::foo(int, foo &, int, foo &, int, foo &)"
+ gdb_test_exact "maint demangle __ct__3iosFP9streambuf" "ios::ios(streambuf *)"
+ gdb_test_exact "maint demangle __ct__7filebufFiPcT1" "filebuf::filebuf(int, char *, int)"
+ gdb_test "maint dem __ct__7fstreamFPCciT2" \
+ "fstream::fstream\[(\]+(const char|char const) \[*\]+, int, int\[)\]+"
+ gdb_test_exact "maint demangle __ct__7fstreamFiPcT1" "fstream::fstream(int, char *, int)"
+ gdb_test_exact "maint demangle __ct__7istreamFP9streambuf" "istream::istream(streambuf *)"
+ gdb_test_exact "maint demangle __ct__7istreamFP9streambufiP7ostream" "istream::istream(streambuf *, int, ostream *)"
+ gdb_test_exact "maint demangle __ct__7istreamFiPcT1" "istream::istream(int, char *, int)"
+ gdb_test_exact "maint demangle __ct__7istreamFiT1P7ostream" "istream::istream(int, int, ostream *)"
+ gdb_test_exact "maint demangle __ct__7ostreamFP9streambuf" "ostream::ostream(streambuf *)"
+ gdb_test_exact "maint demangle __ct__7ostreamFiPc" "ostream::ostream(int, char *)"
+ gdb_test "maint dem __ct__8ifstreamFPCciT2" \
+ "ifstream::ifstream\[(\]+(const char|char const) \[*\]+, int, int\[)\]+"
+ gdb_test_exact "maint demangle __ct__8ifstreamFiPcT1" "ifstream::ifstream(int, char *, int)"
+
+ gdb_test_exact "maint demangle __ct__Q23foo3barFv" "foo::bar::bar(void)"
+ gdb_test_exact "maint demangle __ct__Q33foo3bar4bellFv" "foo::bar::bell::bell(void)"
+ gdb_test_exact "maint demangle __dl__3fooSFPv" "foo::operator delete(void *) static"
+ gdb_test_exact "maint demangle __dl__FPv" "operator delete(void *)"
+ gdb_test_exact "maint demangle __dt__10istrstreamFv" "istrstream::~istrstream(void)"
+
+ gdb_test_exact "maint demangle __dt__Q23foo3barFv" "foo::bar::~bar(void)"
+ gdb_test_exact "maint demangle __dt__Q33foo3bar4bellFv" "foo::bar::bell::~bell(void)"
+ gdb_test_exact "maint demangle __dv__3fooFR3foo" "foo::operator/(foo &)"
+ gdb_test_exact "maint demangle __dv__F7complexT1" "operator/(complex, complex)"
+ gdb_test_exact "maint demangle __eq__3fooFR3foo" "foo::operator==(foo &)"
+ gdb_test_exact "maint demangle __er__3fooFR3foo" "foo::operator^(foo &)"
+ gdb_test_exact "maint demangle __ge__3fooFR3foo" "foo::operator>=(foo &)"
+ gdb_test_exact "maint demangle __gt__3fooFR3foo" "foo::operator>(foo &)"
+ gdb_test_exact "maint demangle __le__3fooFR3foo" "foo::operator<=(foo &)"
+ gdb_test_exact "maint demangle __ls__3fooFR3foo" "foo::operator<<(foo &)"
+ gdb_test_exact "maint demangle __ls__7ostreamFP9streambuf" "ostream::operator<<(streambuf *)"
+
+ gdb_test "maint dem __ls__7ostreamFPCc" \
+ "ostream::operator<<\[(\]+(const char|char const) \[*\]+\[)\]+"
+ gdb_test_exact "maint demangle __ls__7ostreamFPFR3ios_R3ios" "ostream::operator<<(ios &(*)(ios &))"
+ gdb_test_exact "maint demangle __ls__7ostreamFPv" "ostream::operator<<(void *)"
+ gdb_test_exact "maint demangle __ls__7ostreamFUi" "ostream::operator<<(unsigned int)"
+ gdb_test_exact "maint demangle __ls__7ostreamFUl" "ostream::operator<<(unsigned long)"
+ gdb_test_exact "maint demangle __ls__7ostreamFd" "ostream::operator<<(double)"
+ gdb_test_exact "maint demangle __ls__7ostreamFf" "ostream::operator<<(float)"
+ gdb_test_exact "maint demangle __ls__7ostreamFi" "ostream::operator<<(int)"
+ gdb_test_exact "maint demangle __ls__7ostreamFl" "ostream::operator<<(long)"
+ gdb_test_exact "maint demangle __ls__FR7ostream7complex" "operator<<(ostream &, complex)"
+ gdb_test_exact "maint demangle __lt__3fooFR3foo" "foo::operator<(foo &)"
+ gdb_test_exact "maint demangle __md__3fooFR3foo" "foo::operator%(foo &)"
+ gdb_test_exact "maint demangle __mi__3fooFR3foo" "foo::operator-(foo &)"
+ gdb_test_exact "maint demangle __ml__3fooFR3foo" "foo::operator*(foo &)"
+ gdb_test_exact "maint demangle __ml__F7complexT1" "operator*(complex, complex)"
+ gdb_test_exact "maint demangle __mm__3fooFi" "foo::operator--(int)"
+ gdb_test_exact "maint demangle __ne__3fooFR3foo" "foo::operator!=(foo &)"
+ gdb_test_exact "maint demangle __nt__3fooFv" "foo::operator!(void)"
+ gdb_test_exact "maint demangle __nw__3fooSFi" "foo::operator new(int) static"
+ gdb_test_exact "maint demangle __nw__FUi" "operator new(unsigned int)"
+ gdb_test_exact "maint demangle __nw__FUiPv" "operator new(unsigned int, void *)"
+ gdb_test_exact "maint demangle __oo__3fooFR3foo" "foo::operator||(foo &)"
+ gdb_test_exact "maint demangle __opPc__3fooFv" "foo::operator char *(void)"
+ gdb_test_exact "maint demangle __opi__3fooFv" "foo::operator int(void)"
+ gdb_test_exact "maint demangle __or__3fooFR3foo" "foo::operator|(foo &)"
+
+ gdb_test_exact "maint demangle __pl__3fooFR3foo" "foo::operator+(foo &)"
+ gdb_test_exact "maint demangle __pp__3fooFi" "foo::operator++(int)"
+ gdb_test_exact "maint demangle __pt__3fooFv" "foo::operator->(void)"
+ gdb_test_exact "maint demangle __rm__3fooFR3foo" "foo::operator->*(foo &)"
+ gdb_test_exact "maint demangle __rs__3fooFR3foo" "foo::operator>>(foo &)"
+ gdb_test_exact "maint demangle __rs__7istreamFP9streambuf" "istream::operator>>(streambuf *)"
+ gdb_test_exact "maint demangle __rs__7istreamFPFR3ios_R3ios" "istream::operator>>(ios &(*)(ios &))"
+ gdb_test_exact "maint demangle __rs__7istreamFPFR7istream_R7istream" "istream::operator>>(istream &(*)(istream &))"
+ gdb_test_exact "maint demangle __rs__7istreamFPUc" "istream::operator>>(unsigned char *)"
+ gdb_test_exact "maint demangle __rs__7istreamFPc" "istream::operator>>(char *)"
+ gdb_test_exact "maint demangle __rs__7istreamFRUi" "istream::operator>>(unsigned int &)"
+ gdb_test_exact "maint demangle __rs__7istreamFRUl" "istream::operator>>(unsigned long &)"
+ gdb_test_exact "maint demangle __rs__7istreamFRUs" "istream::operator>>(unsigned short &)"
+ gdb_test_exact "maint demangle __rs__7istreamFRd" "istream::operator>>(double &)"
+ gdb_test_exact "maint demangle __rs__7istreamFRf" "istream::operator>>(float &)"
+ gdb_test_exact "maint demangle __rs__7istreamFRi" "istream::operator>>(int &)"
+ gdb_test_exact "maint demangle __rs__7istreamFRl" "istream::operator>>(long &)"
+ gdb_test_exact "maint demangle __rs__7istreamFRs" "istream::operator>>(short &)"
+ gdb_test_exact "maint demangle __rs__FR7istreamR7complex" "operator>>(istream &, complex &)"
+ gdb_test "maint dem __vc__3fooFR3foo" "foo::operator\\\[\\\]\\(foo &\\)"
+ gdb_test_exact "maint demangle __vtbl__10istrstream" "istrstream virtual table"
+ gdb_test_exact "maint demangle __vtbl__17ostream__iostream__19iostream_withassign" "iostream_withassign::ostream__iostream virtual table"
+
+ gdb_test_exact "maint demangle __vtbl__3ios" "ios virtual table"
+ gdb_test_exact "maint demangle __vtbl__3ios__13strstreambase" "strstreambase::ios virtual table"
+
+ # GDB 930414 demangles this as t_cc_main_ (obviously wrong).
+ # GDB 930701 gets into an infinite loop.
+ # GDB 930727 says "Can't demangle".
+ # What is the correct demangling? FIXME.
+ setup_xfail "*-*-*"
+ gdb_test_exact "maint demangle __vtbl__3foo__vt_cc_main_" ""
+
+ gdb_test_exact "maint demangle abs__F7complex" "abs(complex)"
+ gdb_test_exact "maint demangle allocate__9streambufFv" "streambuf::allocate(void)"
+ gdb_test_exact "maint demangle attach__11fstreambaseFi" "fstreambase::attach(int)"
+ gdb_test_exact "maint demangle bitalloc__3iosSFv" "ios::bitalloc(void) static"
+ gdb_test_exact "maint demangle chr__FiT1" "chr(int, int)"
+ gdb_test_exact "maint demangle complex_error__FR11c_exception" "complex_error(c_exception &)"
+ gdb_test_exact "maint demangle complexfunc2__FPFPc_i" "complexfunc2(int (*)(char *))"
+ gdb_test_exact "maint demangle complexfunc3__FPFPFPl_s_i" "complexfunc3(int (*)(short (*)(long *)))"
+
+ gdb_test_exact "maint demangle complexfunc4__FPFPFPc_s_i" "complexfunc4(int (*)(short (*)(char *)))"
+ gdb_test_exact "maint demangle complexfunc5__FPFPc_PFl_i" "complexfunc5(int (*(*)(char *))(long))"
+ gdb_test_exact "maint demangle complexfunc6__FPFPi_PFl_i" "complexfunc6(int (*(*)(int *))(long))"
+ gdb_test_exact "maint demangle complexfunc7__FPFPFPc_i_PFl_i" "complexfunc7(int (*(*)(int (*)(char *)))(long))"
+ gdb_test_exact "maint demangle complicated_put__7ostreamFc" "ostream::complicated_put(char)"
+ gdb_test_exact "maint demangle conv10__FlPc" "conv10(long, char *)"
+ gdb_test_exact "maint demangle conv16__FUlPc" "conv16(unsigned long, char *)"
+ gdb_test_exact "maint demangle dec__FR3ios" "dec(ios &)"
+ gdb_test_exact "maint demangle dec__Fli" "dec(long, int)"
+ gdb_test_exact "maint demangle dofield__FP7ostreamPciT2T3" "dofield(ostream *, char *, int, char *, int)"
+
+ gdb_test_exact "maint demangle flags__3iosFl" "ios::flags(long)"
+ gdb_test_exact "maint demangle flags__3iosFv" "ios::flags(void)"
+ gdb_test_exact "maint demangle foo__FiN31" "foo(int, int, int, int)"
+ gdb_test_exact "maint demangle foo__FiR3fooT1T2T1T2" "foo(int, foo &, int, foo &, int, foo &)"
+ gdb_test_exact "maint demangle foo___3barFl" "bar::foo_(long)"
+ gdb_test "maint dem form__FPCce" "form\[(\]+(const char|char const) \[*\]+,...\[)\]+"
+ gdb_test_exact "maint demangle get__7istreamFPcic" "istream::get(char *, int, char)"
+ gdb_test_exact "maint demangle get__7istreamFR9streambufc" "istream::get(streambuf &, char)"
+ gdb_test_exact "maint demangle get_complicated__7istreamFRUc" "istream::get_complicated(unsigned char &)"
+ gdb_test_exact "maint demangle get_complicated__7istreamFRc" "istream::get_complicated(char &)"
+ gdb_test_exact "maint demangle getline__7istreamFPUcic" "istream::getline(unsigned char *, int, char)"
+ gdb_test_exact "maint demangle getline__7istreamFPcic" "istream::getline(char *, int, char)"
+
+ gdb_test_exact "maint demangle ignore__7istreamFiT1" "istream::ignore(int, int)"
+ gdb_test_exact "maint demangle init__12strstreambufFPciT1" "strstreambuf::init(char *, int, char *)"
+ gdb_test_exact "maint demangle init__3iosFP9streambuf" "ios::init(streambuf *)"
+ gdb_test_exact "maint demangle initcount__13Iostream_init" "Iostream_init::initcount"
+ gdb_test_exact "maint demangle ipfx__7istreamFi" "istream::ipfx(int)"
+ gdb_test_exact "maint demangle ls_complicated__7ostreamFUc" "ostream::ls_complicated(unsigned char)"
+ gdb_test_exact "maint demangle ls_complicated__7ostreamFc" "ostream::ls_complicated(char)"
+ gdb_test "maint dem open__11fstreambaseFPCciT2" \
+ "fstreambase::open\[(\]+(const char|char const) \[*\]+, int, int\[)\]+"
+ gdb_test "maint dem open__7filebufFPCciT2" \
+ "filebuf::open\[(\]+(const char|char const) \[*\]+, int, int\[)\]+"
+
+ gdb_test_exact "maint demangle overload1arg__FSc" "overload1arg(signed char)"
+ gdb_test_exact "maint demangle overload1arg__FUc" "overload1arg(unsigned char)"
+ gdb_test_exact "maint demangle overload1arg__FUi" "overload1arg(unsigned int)"
+ gdb_test_exact "maint demangle overload1arg__FUl" "overload1arg(unsigned long)"
+ gdb_test_exact "maint demangle overload1arg__FUs" "overload1arg(unsigned short)"
+ gdb_test_exact "maint demangle overload1arg__Fc" "overload1arg(char)"
+ gdb_test_exact "maint demangle overload1arg__Fd" "overload1arg(double)"
+ gdb_test_exact "maint demangle overload1arg__Ff" "overload1arg(float)"
+ gdb_test_exact "maint demangle overload1arg__Fi" "overload1arg(int)"
+ gdb_test_exact "maint demangle overload1arg__Fl" "overload1arg(long)"
+ gdb_test_exact "maint demangle overload1arg__Fs" "overload1arg(short)"
+ gdb_test_exact "maint demangle overload1arg__Fv" "overload1arg(void)"
+ gdb_test_exact "maint demangle overloadargs__FiN21" "overloadargs(int, int, int)"
+ gdb_test_exact "maint demangle overloadargs__FiN31" "overloadargs(int, int, int, int)"
+ gdb_test_exact "maint demangle overloadargs__FiN41" "overloadargs(int, int, int, int, int)"
+ gdb_test_exact "maint demangle overloadargs__FiN51" "overloadargs(int, int, int, int, int, int)"
+ gdb_test_exact "maint demangle overloadargs__FiN61" "overloadargs(int, int, int, int, int, int, int)"
+
+ gdb_test_exact "maint demangle overloadargs__FiN71" "overloadargs(int, int, int, int, int, int, int, int)"
+ gdb_test_exact "maint demangle overloadargs__FiN81" "overloadargs(int, int, int, int, int, int, int, int, int)"
+ gdb_test_exact "maint demangle overloadargs__FiN91" "overloadargs(int, int, int, int, int, int, int, int, int, int)"
+ gdb_test_exact "maint demangle overloadargs__FiN91N11" "overloadargs(int, int, int, int, int, int, int, int, int, int, int)"
+ gdb_test_exact "maint demangle overloadargs__FiT1" "overloadargs(int, int)"
+ gdb_test_exact "maint demangle polar__FdT1" "polar(double, double)"
+ gdb_test_exact "maint demangle pow__F7complexT1" "pow(complex, complex)"
+ gdb_test_exact "maint demangle pow__F7complexd" "pow(complex, double)"
+ gdb_test_exact "maint demangle pow__F7complexi" "pow(complex, int)"
+ gdb_test_exact "maint demangle pow__Fd7complex" "pow(double, complex)"
+ gdb_test_exact "maint demangle pstart__FPciT2" "pstart(char *, int, int)"
+ gdb_test_exact "maint demangle put__7ostreamFc" "ostream::put(char)"
+
+ gdb_test_exact "maint demangle read__7istreamFPci" "istream::read(char *, int)"
+ gdb_test_exact "maint demangle resetiosflags__FR3iosl" "resetiosflags(ios &, long)"
+ gdb_test_exact "maint demangle restore_errno__FRi" "restore_errno(int &)"
+ gdb_test_exact "maint demangle rs_complicated__7istreamFRUc" "istream::rs_complicated(unsigned char &)"
+ gdb_test_exact "maint demangle rs_complicated__7istreamFRc" "istream::rs_complicated(char &)"
+ gdb_test_exact "maint demangle seekg__7istreamFl8seek_dir" "istream::seekg(long, seek_dir)"
+ gdb_test_exact "maint demangle seekoff__12strstreambufFl8seek_diri" "strstreambuf::seekoff(long, seek_dir, int)"
+ gdb_test_exact "maint demangle seekoff__9streambufFlQ2_3ios12ios_seek_diri" "streambuf::seekoff(long, ios::ios_seek_dir, int)"
+ gdb_test_exact "maint demangle seekpos__9streambufFli" "streambuf::seekpos(long, int)"
+ gdb_test_exact "maint demangle set_new_handler__FPFv_v" "set_new_handler(void (*)(void))"
+ gdb_test_exact "maint demangle setb__9streambufFPcT1i" "streambuf::setb(char *, char *, int)"
+
+ gdb_test_exact "maint demangle setb__FR3iosi" "setb(ios &, int)"
+ gdb_test_exact "maint demangle setbuf__11fstreambaseFPci" "fstreambase::setbuf(char *, int)"
+ gdb_test_exact "maint demangle setbuf__9streambufFPUci" "streambuf::setbuf(unsigned char *, int)"
+ gdb_test_exact "maint demangle setbuf__9streambufFPciT2" "streambuf::setbuf(char *, int, int)"
+ gdb_test_exact "maint demangle setf__3iosFlT1" "ios::setf(long, long)"
+ gdb_test_exact "maint demangle setfill__FR3iosi" "setfill(ios &, int)"
+ gdb_test_exact "maint demangle setg__9streambufFPcN21" "streambuf::setg(char *, char *, char *)"
+ gdb_test_exact "maint demangle setp__9streambufFPcT1" "streambuf::setp(char *, char *)"
+
+ gdb_test "maint dem sputn__9streambufFPCci" \
+ "streambuf::sputn\[(\]+(const char|char const) \[*\]+, int\[)\]+"
+ gdb_test "maint dem str__FPCci" \
+ "str\[(\]+(const char|char const) \[*\]+, int\[)\]+"
+ gdb_test_exact "maint demangle tie__3iosFP7ostream" "ios::tie(ostream *)"
+ gdb_test_exact "maint demangle uconv10__FUlPc" "uconv10(unsigned long, char *)"
+
+ gdb_test "maint dem write__7ostreamFPCci" \
+ "ostream::write\[(\]+(const char|char const) \[*\]+, int\[)\]+"
+ gdb_test_exact "maint demangle xget__7istreamFPc" "istream::xget(char *)"
+ gdb_test_exact "maint demangle xsgetn__9streambufFPci" "streambuf::xsgetn(char *, int)"
+ gdb_test "maint dem xsputn__9streambufFPCci" \
+ "streambuf::xsputn\[(\]+(const char|char const) \[*\]+, int\[)\]+"
+}
+
+#
+# Test arm style name demangling
+#
+
+proc test_arm_style_demangling {} {
+ global gdb_prompt
+
+ # Set the demangling style to "arm" and then check to make sure
+ # it really got set. Return if the style failed to get set for
+ # some reason.
+
+ send_gdb "set demangle-style arm\n"
+ gdb_expect {
+ -re "set demangle-style arm\[\r\n\]+$gdb_prompt $" {}
+ -re ".*$gdb_prompt $" { fail "set demangle-style arm failed" ; return }
+ timeout { fail "set demangle-style arm failed (timeout)" ; return }
+ }
+
+ send_gdb "show demangle-style\n"
+ gdb_expect {
+ -re "The current C\[+\]+ demangling style is \"arm\".\r\n$gdb_prompt $" {}
+ -re ".*$gdb_prompt $" { fail "demangling style not set to arm" }
+ timeout { fail "show demangle-style timed out" }
+ }
+
+ gdb_test_exact "maint demangle __dt__21T5__pt__11_PFiPPdPv_iFv" "T5<int (*)(int, double **, void *)>::~T5(void)"
+
+ gdb_test_exact "maint demangle __ct__1cFi" "c::c(int)"
+
+ gdb_test_exact "maint demangle __dt__11T5__pt__2_iFv" "T5<int>::~T5(void)"
+
+ gdb_test_exact "maint demangle __dt__11T5__pt__2_cFv" "T5<char>::~T5(void)"
+
+ gdb_test_exact "maint demangle __ct__2T2Fi" "T2::T2(int)"
+ gdb_test_exact "maint demangle __dt__2T1Fv" "T1::~T1(void)"
+
+ gdb_test_exact "maint demangle __dt__12T5__pt__3_1xFv" "T5<x>::~T5(void)"
+
+ gdb_test_exact "maint demangle __dt__17T5__pt__8_PFcPv_iFv" "T5<int (*)(char, void *)>::~T5(void)"
+
+ gdb_test "maint dem g__FP1cPC1cT1" \
+ "g\[(\]+c *\[*\]+, (const c|c const) *\[*\]+, c *\[*\]+\[)\]+"
+ gdb_test "maint dem g__FPUlPCUlT1" \
+ "g\[(\]+unsigned long \[*\]+, (const unsigned long|unsigned long const) \[*\]+, unsigned long \[*\]+\[)\]+"
+ gdb_test "maint dem g__FPUiPCUiT1" \
+ "g\[(\]+unsigned int \[*\]+, (const unsigned int|unsigned int const) \[*\]+, unsigned int \[*\]+\[)\]+"
+ gdb_test "maint dem g__FPUsPCUsT1" \
+ "g\[(\]+unsigned short \[*\]+, (const unsigned short|unsigned short const) \[*\]+, unsigned short \[*\]+\[)\]+"
+ gdb_test "maint dem g__FPUcPCUcT1" \
+ "g\[(\]+unsigned char \[*\]+, (const unsigned char|unsigned char const) \[*\]+, unsigned char \[*\]+\[)\]+"
+ gdb_test "maint dem g__F1TPlPClT2" \
+ "g\[(\]+T, long \[*\]+, (const long|long const) \[*\]+, long \[*\]+\[)\]+"
+ gdb_test "maint dem g__F1RRlRClT2" \
+ "g\[(\]+R, long &, (const long|long const) &, long &\[)\]+"
+ gdb_test "maint dem g__F1TPiPCiT2" \
+ "g\[(\]+T, int \[*\]+, (const int|int const) \[*\]+, int \[*\]+\[)\]+"
+ gdb_test "maint dem g__F1RRiRCiT2" \
+ "g\[(\]+R, int &, (const int|int const) &, int &\[)\]+"
+ gdb_test "maint dem g__F1TPsPCsT2" \
+ "g\[(\]+T, short \[*\]+, (const short|short const) \[*\]+, short \[*\]+\[)\]+"
+ gdb_test "maint dem g__F1RRsRCsT2" \
+ "g\[(\]+R, short &, (const short|short const) &, short &\[)\]+"
+ gdb_test "maint dem g__F1TPcPCcT2" \
+ "g\[(\]+T, char \[*\]+, (const char|char const) \[*\]+, char \[*\]+\[)\]+"
+ gdb_test "maint dem g__F1RRcRCcT2" \
+ "g\[(\]+R, char &, (const char|char const) &, char &\[)\]+"
+
+ gdb_test_exact "maint demangle __ct__21T5__pt__11_PFiPPdPv_iFi" "T5<int (*)(int, double **, void *)>::T5(int)"
+
+ gdb_test "maint dem __gt__FRC2T2c" \
+ "operator>\[(\]+(const T2|T2 const) &, char\[)\]+"
+ gdb_test "maint dem __ge__FRC2T2c" \
+ "operator>=\[(\]+(const T2|T2 const) &, char\[)\]+"
+ gdb_test "maint dem __lt__FRC2T2c" \
+ "operator<\[(\]+(const T2|T2 const) &, char\[)\]+"
+
+ gdb_test "maint dem __le__FRC2T2c" \
+ "operator<=\[(\]+(const T2|T2 const) &, char\[)\]+"
+ gdb_test "maint dem __ne__FRC2T2c" \
+ "operator!=\[(\]+(const T2|T2 const) &, char\[)\]+"
+ gdb_test "maint dem __eq__FRC2T2c" \
+ "operator==\[(\]+(const T2|T2 const) &, char\[)\]+"
+ gdb_test_exact "maint demangle __amd__FR2T2i" "operator%=(T2 &, int)"
+ gdb_test_exact "maint demangle __adv__FR2T2i" "operator/=(T2 &, int)"
+ gdb_test_exact "maint demangle __amu__FR2T2i" "operator*=(T2 &, int)"
+ gdb_test_exact "maint demangle __ami__FR2T2i" "operator-=(T2 &, int)"
+ gdb_test_exact "maint demangle __apl__FR2T2i" "operator+=(T2 &, int)"
+ gdb_test_exact "maint demangle __nw__2T1SFUi" "T1::operator new(unsigned int) static"
+ gdb_test_exact "maint demangle __dl__2T1SFPv" "T1::operator delete(void *) static"
+ gdb_test_exact "maint demangle put__2T7SFi" "T7::put(int) static"
+
+ gdb_test_exact "maint demangle __dl__12T5__pt__3_1xSFPv" "T5<x>::operator delete(void *) static"
+
+ gdb_test_exact "maint demangle h__FUc" "h(unsigned char)"
+ gdb_test_exact "maint demangle f__Fic" "f(int, char)"
+ gdb_test_exact "maint demangle h__FUi" "h(unsigned int)"
+ gdb_test_exact "maint demangle h__Fci" "h(char, int)"
+ gdb_test_exact "maint demangle h__FUl" "h(unsigned long)"
+ gdb_test_exact "maint demangle h__Fcl" "h(char, long)"
+ gdb_test_exact "maint demangle h__FUs" "h(unsigned short)"
+ gdb_test_exact "maint demangle h__Fcs" "h(char, short)"
+ gdb_test "maint dem __amd__FR2T2RC2T2" \
+ "operator%=\[(\]+T2 &, (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __adv__FR2T2RC2T2" \
+ "operator/=\[(\]+T2 &, (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __amu__FR2T2RC2T2" \
+ "operator\[*\]+=\[(\]+T2 &, (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __ami__FR2T2RC2T2" \
+ "operator-=\[(\]+T2 &, (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __apl__FR2T2RC2T2" \
+ "operator\[+\]+=\[(\]+T2 &, (const T2|T2 const) &\[)\]+"
+
+ gdb_test "maint dem g__F1SRPUlRPCUlT2" \
+ "g\[(\]+S, unsigned long \[*\]+&, (const unsigned long|unsigned long const) \[*\]+&, unsigned long \[*\]+&\[)\]+"
+ gdb_test "maint dem g__F1SRPUiRPCUiT2" \
+ "g\[(\]+S, unsigned int \[*\]+&, (const unsigned int|unsigned int const) \[*\]+&, unsigned int \[*\]+&\[)\]+"
+ gdb_test "maint dem g__F1SRPUsRPCUsT2" \
+ "g\[(\]+S, unsigned short \[*\]+&, (const unsigned short|unsigned short const) \[*\]+&, unsigned short \[*\]+&\[)\]+"
+ gdb_test "maint dem g__F1SRPUcRPCUcT2" \
+ "g\[(\]+S, unsigned char \[*\]+&, (const unsigned char|unsigned char const) \[*\]+&, unsigned char \[*\]+&\[)\]+"
+ gdb_test "maint dem g__F1T1SRPlRPClT3" \
+ "g\[(\]+T, S, long \[*\]+&, (const long|long const) \[*\]+&, long \[*\]+&\[)\]+"
+ gdb_test "maint dem g__F1T1SRPiRPCiT3" \
+ "g\[(\]+T, S, int \[*\]+&, (const int|int const) \[*\]+&, int \[*\]+&\[)\]+"
+ gdb_test "maint dem g__F1T1SRPcRPCcT3" \
+ "g\[(\]+T, S, char \[*\]+&, (const char|char const) \[*\]+&, char \[*\]+&\[)\]+"
+
+ gdb_test_exact "maint demangle X__12T5__pt__3_1x" "T5<x>::X"
+
+ gdb_test_exact "maint demangle __ct__11T5__pt__2_iFi" "T5<int>::T5(int)"
+
+ gdb_test_exact "maint demangle __ct__11T5__pt__2_cFi" "T5<char>::T5(int)"
+
+ gdb_test "maint dem __gt__FRC2T2T1" \
+ "operator>\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __ge__FRC2T2T1" \
+ "operator>=\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __lt__FRC2T2T1" \
+ "operator<\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __le__FRC2T2T1" \
+ "operator<=\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __ne__FRC2T2T1" \
+ "operator!=\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __eq__FRC2T2T1" \
+ "operator==\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem g__FcR1cRC1cT2" \
+ "g\[(\]+char, c &, (const c|c const) &, c &\[)\]+"
+ gdb_test "maint dem g__FcRPdRPCdT2" \
+ "g\[(\]+char, double *\[*\]+&, (const double|double const) *\[*\]+&, double *\[*\]+&\[)\]+"
+ gdb_test "maint dem g__FcRPfRPCfT2" \
+ "g\[(\]+char, float *\[*\]+&, (const float|float const) *\[*\]+&, float *\[*\]+&\[)\]+"
+ gdb_test_exact "maint demangle h__FcT1" "h(char, char)"
+ gdb_test_exact "maint demangle f__Ficd" "f(int, char, double)"
+ gdb_test "maint dem g__F1T1SdRPsRPCsT4" \
+ "g\[(\]+T, S, double, short \[*\]+&, (const short|short const) \[*\]+&, short \[*\]+&\[)\]+"
+ gdb_test "maint dem g__F1cC1cT1" \
+ "g\[(\]+c, (const c|c const), c\[)\]+"
+ gdb_test "maint dem g__FPdPCdT1" \
+ "g\[(\]+double *\[*\]+, (const double|double const) *\[*\]+, double *\[*\]+\[)\]+"
+ gdb_test "maint dem g__FPfPCfT1" \
+ "g\[(\]+float *\[*\]+, (const float|float const) *\[*\]+, float *\[*\]+\[)\]+"
+
+ gdb_test "maint dem g__FUlCUlT1" \
+ "g\[(\]+unsigned long, (const unsigned long|unsigned long const), unsigned long\[)\]+"
+ gdb_test "maint dem g__FPlPClT1" \
+ "g\[(\]+long \[*\]+, (const long|long const) \[*\]+, long \[*\]+\[)\]+"
+ gdb_test "maint dem g__FUiCUiT1" \
+ "g\[(\]+unsigned int, (const unsigned int|unsigned int const), unsigned int\[)\]+"
+ gdb_test "maint dem g__FPiPCiT1" \
+ "g\[(\]+int \[*\]+, (const int|int const) \[*\]+, int \[*\]+\[)\]+"
+ gdb_test "maint dem g__FUsCUsT1" \
+ "g\[(\]+unsigned short, (const unsigned short|unsigned short const), unsigned short\[)\]+"
+ gdb_test "maint dem g__FPsPCsT1" \
+ "g\[(\]+short \[*\]+, (const short|short const) \[*\]+, short \[*\]+\[)\]+"
+ gdb_test "maint dem g__FUcCUcT1" \
+ "g\[(\]+unsigned char, (const unsigned char|unsigned char const), unsigned char\[)\]+"
+ gdb_test "maint dem g__FPcPCcT1" \
+ "g\[(\]+char \[*\]+, (const char|char const) \[*\]+, char \[*\]+\[)\]+"
+ gdb_test "maint dem g__F1TlClT2" \
+ "g\[(\]+T, long, (const long|long const), long\[)\]+"
+ gdb_test "maint dem g__F1TiCiT2" \
+ "g\[(\]+T, int, (const int|int const), int\[)\]+"
+ gdb_test "maint dem g__F1TsCsT2" \
+ "g\[(\]+T, short, (const short|short const), short\[)\]+"
+ gdb_test "maint dem g__F1TcCcT2" \
+ "g\[(\]+T, char, (const char|char const), char\[)\]+"
+
+ gdb_test_exact "maint demangle __dl__17T5__pt__8_PFcPv_iSFPv" "T5<int (*)(char, void *)>::operator delete(void *) static"
+
+ gdb_test "maint dem printf__FPCce" \
+ "printf\[(\]+(const char|char const) \[*\]+,...\[)\]+"
+
+ gdb_test_exact "maint demangle X__17T5__pt__8_PFcPv_i" "T5<int (*)(char, void *)>::X"
+
+ gdb_test_exact "maint demangle __ct__12T5__pt__3_1xFi" "T5<x>::T5(int)"
+
+ gdb_test "maint dem g__F1SRUlRCUlT2" \
+ "g\[(\]+S, unsigned long &, (const unsigned long|unsigned long const) &, unsigned long &\[)\]+"
+ gdb_test "maint dem g__F1SRPlRPClT2" \
+ "g\[(\]+S, long \[*\]+&, (const long|long const) \[*\]+&, long \[*\]+&\[)\]+"
+ gdb_test "maint dem g__F1RRUiRCUiT2" \
+ "g\[(\]+R, unsigned int &, (const unsigned int|unsigned int const) &, unsigned int &\[)\]+"
+ gdb_test "maint dem g__F1SRPiRPCiT2" \
+ "g\[(\]+S, int \[*\]+&, (const int|int const) \[*\]+&, int \[*\]+&\[)\]+"
+ gdb_test "maint dem g__F1RRUsRCUsT2" \
+ "g\[(\]+R, unsigned short &, (const unsigned short|unsigned short const) &, unsigned short &\[)\]+"
+ gdb_test "maint dem g__F1SRPsRPCsT2" \
+ "g\[(\]+S, short \[*\]+&, (const short|short const) \[*\]+&, short \[*\]+&\[)\]+"
+ gdb_test "maint dem g__F1RRUcRCUcT2" \
+ "g\[(\]+R, unsigned char &, (const unsigned char|unsigned char const) &, unsigned char &\[)\]+"
+ gdb_test "maint dem g__F1SRPcRPCcT2" \
+ "g\[(\]+S, char \[*\]+&, (const char|char const) \[*\]+&, char \[*\]+&\[)\]+"
+ gdb_test "maint dem g__F1T1RRlRClT3" \
+ "g\[(\]+T, R, long &, (const long|long const) &, long &\[)\]+"
+ gdb_test "maint dem g__F1T1RRiRCiT3" \
+ "g\[(\]+T, R, int &, (const int|int const) &, int &\[)\]+"
+ gdb_test "maint dem g__F1T1RRsRCsT3" \
+ "g\[(\]+T, R, short &, (const short|short const) &, short &\[)\]+"
+ gdb_test "maint dem g__F1T1RRcRCcT3" \
+ "g\[(\]+T, R, char &, (const char|char const) &, char &\[)\]+"
+
+ gdb_test_exact "maint demangle __dl__21T5__pt__11_PFiPPdPv_iSFPv" "T5<int (*)(int, double **, void *)>::operator delete(void *) static"
+
+ gdb_test_exact "maint demangle __std__foo" "global destructors keyed to foo"
+
+ gdb_test_exact "maint demangle __sti__bar" "global constructors keyed to bar"
+
+ gdb_test_exact "maint demangle f__FicdPcPFci_v" "f(int, char, double, char *, void (*)(char, int))"
+ gdb_test_exact "maint demangle f__FicdPcPFic_v" "f(int, char, double, char *, void (*)(int, char))"
+ gdb_test_exact "maint demangle get__2T7SFv" "T7::get(void) static"
+
+ gdb_test_exact "maint demangle X__21T5__pt__11_PFiPPdPv_i" "T5<int (*)(int, double **, void *)>::X"
+
+ gdb_test "maint dem g__FcRdRCdT2" \
+ "g\[(\]+char, double &, (const double|double const) &, double &\[)\]+"
+ gdb_test "maint dem g__FcRfRCfT2" \
+ "g\[(\]+char, float &, (const float|float const) &, float &\[)\]+"
+ gdb_test "maint dem __md__FC2T2i" \
+ "operator%\[(\]+(const T2|T2 const), int\[)\]+"
+ gdb_test "maint dem __dv__FC2T2i" \
+ "operator/\[(\]+(const T2|T2 const), int\[)\]+"
+ gdb_test "maint dem __ml__FC2T2i" \
+ "operator\[*\]+\[(\]+(const T2|T2 const), int\[)\]+"
+ gdb_test "maint dem __mi__FC2T2i" \
+ "operator-\[(\]+(const T2|T2 const), int\[)\]+"
+ gdb_test "maint dem __pl__FC2T2i" \
+ "operator\[+\]+\[(\]+(const T2|T2 const), int\[)\]+"
+
+ gdb_test_exact "maint demangle __dl__11T5__pt__2_iSFPv" "T5<int>::operator delete(void *) static"
+
+ gdb_test_exact "maint demangle __dl__11T5__pt__2_cSFPv" "T5<char>::operator delete(void *) static"
+
+ gdb_test_exact "maint demangle h__Fc" "h(char)"
+ gdb_test_exact "maint demangle h__Fd" "h(double)"
+ gdb_test_exact "maint demangle h__Ff" "h(float)"
+ gdb_test_exact "maint demangle h__Fi" "h(int)"
+ gdb_test_exact "maint demangle f__Fi" "f(int)"
+ gdb_test_exact "maint demangle h__Fl" "h(long)"
+
+ gdb_test_exact "maint demangle h__Fs" "h(short)"
+ gdb_test "maint dem __md__FC2T2RC2T2" \
+ "operator%\[(\]+(const T2|T2 const), (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __dv__FC2T2RC2T2" \
+ "operator/\[(\]+(const T2|T2 const), (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __ml__FC2T2RC2T2" \
+ "operator\[*\]+\[(\]+(const T2|T2 const), (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __mi__FC2T2RC2T2" \
+ "operator-\[(\]+(const T2|T2 const), (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __pl__FC2T2RC2T2" \
+ "operator\[+\]+\[(\]+(const T2|T2 const), (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem g__FcRP1cRPC1cT2" \
+ "g\[(\]+char, c *\[*\]+&, (const c|c const) *\[*\]+&, c *\[*\]+&\[)\]+"
+
+ gdb_test_exact "maint demangle X__11T5__pt__2_c" "T5<char>::X"
+
+ gdb_test_exact "maint demangle X__11T5__pt__2_i" "T5<int>::X"
+
+ gdb_test "maint dem g__FdCdT1" \
+ "g\[(\]+double, (const double|double const), double\[)\]+"
+ gdb_test "maint dem g__FfCfT1" \
+ "g\[(\]+float, (const float|float const), float\[)\]+"
+ gdb_test "maint dem g__FlClT1" \
+ "g\[(\]+long, (const long|long const), long\[)\]+"
+ gdb_test "maint dem g__FiCiT1" \
+ "g\[(\]+int, (const int|int const), int\[)\]+"
+ gdb_test "maint dem g__FsCsT1" \
+ "g\[(\]+short, (const short|short const), short\[)\]+"
+ gdb_test "maint dem g__FcCcT1" \
+ "g\[(\]+char, (const char|char const), char\[)\]+"
+
+ gdb_test_exact "maint demangle __ct__17T5__pt__8_PFcPv_iFi" "T5<int (*)(char, void *)>::T5(int)"
+
+ gdb_test_exact "maint demangle f__FicdPc" "f(int, char, double, char *)"
+ gdb_test_exact "maint demangle __nw__FUi" "operator new(unsigned int)"
+ gdb_test_exact "maint demangle __ct__Q3_2T11a1bSFi" "T1::a::b::b(int) static"
+ gdb_test_exact "maint demangle __dt__Q3_2T11a1bSFi" "T1::a::b::~b(int) static"
+ gdb_test_exact "maint demangle put__Q3_2T11a1bSFi" "T1::a::b::put(int) static"
+ gdb_test_exact "maint demangle get__Q2_2T11aSFv" "T1::a::get(void) static"
+ gdb_test_exact "maint demangle put__2T1SFi" "T1::put(int) static"
+ gdb_test_exact "maint demangle put__Q5_2T11a1b1c1dSFi" "T1::a::b::c::d::put(int) static"
+ gdb_test_exact "maint demangle get__Q4_2T11a1b1cSFv" "T1::a::b::c::get(void) static"
+ gdb_test_exact "maint demangle put__Q2_2T11aSFi" "T1::a::put(int) static"
+ gdb_test_exact "maint demangle put__Q4_2T11a1b1cSFi" "T1::a::b::c::put(int) static"
+ gdb_test_exact "maint demangle get__Q3_2T11a1bSFv" "T1::a::b::get(void) static"
+ gdb_test_exact "maint demangle get__2T1SFv" "T1::get(void) static"
+ gdb_test_exact "maint demangle get__Q5_2T11a1b1c1dSFv" "T1::a::b::c::d::get(void) static"
+
+ gdb_test_exact "maint demangle __dt__11T1__pt__2_cFv" "T1<char>::~T1(void)"
+
+ gdb_test_exact "maint demangle __dt__12T1__pt__3_1tFv" "T1<t>::~T1(void)"
+
+ gdb_test_exact "maint demangle __dl__12T1__pt__3_1tSFPv" "T1<t>::operator delete(void *) static"
+
+ gdb_test_exact "maint demangle __ct__11T1__pt__2_cFi" "T1<char>::T1(int)"
+
+ gdb_test_exact "maint demangle __ct__11T1__pt__2_cFv" "T1<char>::T1(void)"
+
+ gdb_test_exact "maint demangle __ct__12T1__pt__3_1tFi" "T1<t>::T1(int)"
+
+ gdb_test_exact "maint demangle __ct__12T1__pt__3_1tFv" "T1<t>::T1(void)"
+
+ gdb_test_exact "maint demangle __dl__11T1__pt__2_cSFPv" "T1<char>::operator delete(void *) static"
+
+ gdb_test_exact "maint demangle bar__3fooFPv" "foo::bar(void *)"
+ gdb_test "maint dem bar__3fooFPCv" \
+ "foo::bar\[(\]+(const void|void const) *\[*\]+\[)\]+"
+ gdb_test_exact "maint demangle bar__3fooCFPv" "foo::bar(void *) const"
+ gdb_test "maint dem bar__3fooCFPCv" \
+ "foo::bar\[(\]+(const void|void const) *\[*\]+\[)\]+ const"
+ gdb_test_exact "maint demangle __eq__3fooFR3foo" "foo::operator==(foo &)"
+ gdb_test "maint dem __eq__3fooFRC3foo" \
+ "foo::operator==\[(\]+(const foo|foo const) &\[)\]+"
+ gdb_test_exact "maint demangle __eq__3fooCFR3foo" "foo::operator==(foo &) const"
+ gdb_test "maint dem __eq__3fooCFRC3foo" \
+ "foo::operator==\[(\]+(const foo|foo const) &\[)\]+ const"
+
+ gdb_test_exact "maint demangle elem__15vector__pt__2_dFi" "vector<double>::elem(int)"
+
+ gdb_test_exact "maint demangle elem__15vector__pt__2_iFi" "vector<int>::elem(int)"
+
+ gdb_test_exact "maint demangle __ct__15vector__pt__2_dFi" "vector<double>::vector(int)"
+
+ gdb_test_exact "maint demangle __ct__15vector__pt__2_iFi" "vector<int>::vector(int)"
+
+ gdb_test_exact "maint demangle __ct__25DListNode__pt__9_R6RLabelFR6RLabelP25DListNode__pt__9_R6RLabelT2" \
+ "DListNode<RLabel &>::DListNode(RLabel &, DListNode<RLabel &> *, DListNode<RLabel &> *)"
+
+ gdb_test_exact "maint demangle bar__3fooFiT16FooBar" "foo::bar(int, int, FooBar)"
+
+ gdb_test_exact "maint demangle bar__3fooFPiN51PdN37PcN211T1iN215" \
+ "foo::bar(int *, int *, int *, int *, int *, int *, double *, double *, double *, double *, char *, char *, char *, int *, int, int, int)"
+
+}
+
+proc test_hp_style_demangling {} {
+ global gdb_prompt
+
+ # Set the demangling style to "hp" and then check to make sure
+ # it really got set. Return if the style failed to get set for
+ # some reason.
+
+ send_gdb "set demangle-style hp\n"
+ gdb_expect {
+ -re "set demangle-style hp\[\r\n\]+$gdb_prompt $" {}
+ -re ".*$gdb_prompt $" { fail "set demangle-style hp failed" ; return }
+ timeout { fail "set demangle-style hp failed (timeout)" ; return }
+ }
+
+ send_gdb "show demangle-style\n"
+ gdb_expect {
+ -re "The current C\[+\]+ demangling style is \"hp\".\r\n$gdb_prompt $" {}
+ -re ".*$gdb_prompt $" { fail "demangling style not set to hp" }
+ timeout { fail "show demangle-style timed out (HP)" }
+ }
+
+ # HP aCC mangling style is based on ARM for all the basic stuff,
+ # so first we use some of the ARM tests here. Later we have HP-specific
+ # tests.
+
+ gdb_test "maint dem g__FP1cPC1cT1" \
+ "g\[(\]+c *\[*\]+, (const c|c const) *\[*\]+, c *\[*\]+\[)\]+"
+ gdb_test "maint dem g__FPUlPCUlT1" \
+ "g\[(\]+unsigned long \[*\]+, (const unsigned long|unsigned long const) \[*\]+, unsigned long \[*\]+\[)\]+"
+ gdb_test "maint dem g__FPUiPCUiT1" \
+ "g\[(\]+unsigned int \[*\]+, (const unsigned int|unsigned int const) \[*\]+, unsigned int \[*\]+\[)\]+"
+ gdb_test "maint dem g__FPUsPCUsT1" \
+ "g\[(\]+unsigned short \[*\]+, (const unsigned short|unsigned short const) \[*\]+, unsigned short \[*\]+\[)\]+"
+ gdb_test "maint dem g__FPUcPCUcT1" \
+ "g\[(\]+unsigned char \[*\]+, (const unsigned char|unsigned char const) \[*\]+, unsigned char \[*\]+\[)\]+"
+ gdb_test "maint dem g__F1TPlPClT2" \
+ "g\[(\]+T, long \[*\]+, (const long|long const) \[*\]+, long \[*\]+\[)\]+"
+ gdb_test "maint dem g__F1RRlRClT2" \
+ "g\[(\]+R, long &, (const long|long const) &, long &\[)\]+"
+ gdb_test "maint dem g__F1TPiPCiT2" \
+ "g\[(\]+T, int \[*\]+, (const int|int const) \[*\]+, int \[*\]+\[)\]+"
+ gdb_test "maint dem g__F1RRiRCiT2" \
+ "g\[(\]+R, int &, (const int|int const) &, int &\[)\]+"
+ gdb_test "maint dem g__F1TPsPCsT2" \
+ "g\[(\]+T, short \[*\]+, (const short|short const) \[*\]+, short \[*\]+\[)\]+"
+ gdb_test "maint dem g__F1RRsRCsT2" \
+ "g\[(\]+R, short &, (const short|short const) &, short &\[)\]+"
+ gdb_test "maint dem g__F1TPcPCcT2" \
+ "g\[(\]+T, char \[*\]+, (const char|char const) \[*\]+, char \[*\]+\[)\]+"
+ gdb_test "maint dem g__F1RRcRCcT2" \
+ "g\[(\]+R, char &, (const char|char const) &, char &\[)\]+"
+
+ gdb_test "maint dem __gt__FRC2T2c" \
+ "operator>\[(\]+(const T2|T2 const) &, char\[)\]+"
+ gdb_test "maint dem __ge__FRC2T2c" \
+ "operator>=\[(\]+(const T2|T2 const) &, char\[)\]+"
+ gdb_test "maint dem __lt__FRC2T2c" \
+ "operator<\[(\]+(const T2|T2 const) &, char\[)\]+"
+
+ gdb_test "maint dem __le__FRC2T2c" \
+ "operator<=\[(\]+(const T2|T2 const) &, char\[)\]+"
+ gdb_test "maint dem __ne__FRC2T2c" \
+ "operator!=\[(\]+(const T2|T2 const) &, char\[)\]+"
+ gdb_test "maint dem __eq__FRC2T2c" \
+ "operator==\[(\]+(const T2|T2 const) &, char\[)\]+"
+ gdb_test_exact "maint demangle __amd__FR2T2i" "operator%=(T2 &, int)"
+ gdb_test_exact "maint demangle __adv__FR2T2i" "operator/=(T2 &, int)"
+ gdb_test_exact "maint demangle __amu__FR2T2i" "operator*=(T2 &, int)"
+ gdb_test_exact "maint demangle __ami__FR2T2i" "operator-=(T2 &, int)"
+ gdb_test_exact "maint demangle __apl__FR2T2i" "operator+=(T2 &, int)"
+ gdb_test_exact "maint demangle __nw__2T1SFUi" "T1::operator new(unsigned int) static"
+ gdb_test_exact "maint demangle __dl__2T1SFPv" "T1::operator delete(void *) static"
+ gdb_test_exact "maint demangle put__2T7SFi" "T7::put(int) static"
+
+ gdb_test_exact "maint demangle h__FUc" "h(unsigned char)"
+ gdb_test_exact "maint demangle f__Fic" "f(int, char)"
+ gdb_test_exact "maint demangle h__FUi" "h(unsigned int)"
+ gdb_test_exact "maint demangle h__Fci" "h(char, int)"
+ gdb_test_exact "maint demangle h__FUl" "h(unsigned long)"
+ gdb_test_exact "maint demangle h__Fcl" "h(char, long)"
+ gdb_test_exact "maint demangle h__FUs" "h(unsigned short)"
+ gdb_test_exact "maint demangle h__Fcs" "h(char, short)"
+ gdb_test "maint dem __amd__FR2T2RC2T2" \
+ "operator%=\[(\]+T2 &, (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __adv__FR2T2RC2T2" \
+ "operator/=\[(\]+T2 &, (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __amu__FR2T2RC2T2" \
+ "operator\[*\]+=\[(\]+T2 &, (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __ami__FR2T2RC2T2" \
+ "operator-=\[(\]+T2 &, (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __apl__FR2T2RC2T2" \
+ "operator\[+\]+=\[(\]+T2 &, (const T2|T2 const) &\[)\]+"
+
+ gdb_test "maint dem g__F1SRPUlRPCUlT2" \
+ "g\[(\]+S, unsigned long \[*\]+&, (const unsigned long|unsigned long const) \[*\]+&, unsigned long \[*\]+&\[)\]+"
+ gdb_test "maint dem g__F1SRPUiRPCUiT2" \
+ "g\[(\]+S, unsigned int \[*\]+&, (const unsigned int|unsigned int const) \[*\]+&, unsigned int \[*\]+&\[)\]+"
+ gdb_test "maint dem g__F1SRPUsRPCUsT2" \
+ "g\[(\]+S, unsigned short \[*\]+&, (const unsigned short|unsigned short const) \[*\]+&, unsigned short \[*\]+&\[)\]+"
+ gdb_test "maint dem g__F1SRPUcRPCUcT2" \
+ "g\[(\]+S, unsigned char \[*\]+&, (const unsigned char|unsigned char const) \[*\]+&, unsigned char \[*\]+&\[)\]+"
+ gdb_test "maint dem g__F1T1SRPlRPClT3" \
+ "g\[(\]+T, S, long \[*\]+&, (const long|long const) \[*\]+&, long \[*\]+&\[)\]+"
+ gdb_test "maint dem g__F1T1SRPiRPCiT3" \
+ "g\[(\]+T, S, int \[*\]+&, (const int|int const) \[*\]+&, int \[*\]+&\[)\]+"
+ gdb_test "maint dem g__F1T1SRPcRPCcT3" \
+ "g\[(\]+T, S, char \[*\]+&, (const char|char const) \[*\]+&, char \[*\]+&\[)\]+"
+
+
+ gdb_test "maint dem __gt__FRC2T2T1" \
+ "operator>\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __ge__FRC2T2T1" \
+ "operator>=\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __lt__FRC2T2T1" \
+ "operator<\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __le__FRC2T2T1" \
+ "operator<=\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __ne__FRC2T2T1" \
+ "operator!=\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __eq__FRC2T2T1" \
+ "operator==\[(\]+(const T2|T2 const) &, (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem g__FcR1cRC1cT2" \
+ "g\[(\]+char, c &, (const c|c const) &, c &\[)\]+"
+ gdb_test "maint dem g__FcRPdRPCdT2" \
+ "g\[(\]+char, double *\[*\]+&, (const double|double const) *\[*\]+&, double *\[*\]+&\[)\]+"
+ gdb_test "maint dem g__FcRPfRPCfT2" \
+ "g\[(\]+char, float *\[*\]+&, (const float|float const) *\[*\]+&, float *\[*\]+&\[)\]+"
+ gdb_test_exact "maint demangle h__FcT1" "h(char, char)"
+ gdb_test_exact "maint demangle f__Ficd" "f(int, char, double)"
+ gdb_test "maint dem g__F1T1SdRPsRPCsT4" \
+ "g\[(\]+T, S, double, short \[*\]+&, (const short|short const) \[*\]+&, short \[*\]+&\[)\]+"
+ gdb_test "maint dem g__F1cC1cT1" \
+ "g\[(\]+c, (const c|c const), c\[)\]+"
+ gdb_test "maint dem g__FPdPCdT1" \
+ "g\[(\]+double *\[*\]+, (const double|double const) *\[*\]+, double *\[*\]+\[)\]+"
+ gdb_test "maint dem g__FPfPCfT1" \
+ "g\[(\]+float *\[*\]+, (const float|float const) *\[*\]+, float *\[*\]+\[)\]+"
+
+ gdb_test "maint dem g__FUlCUlT1" \
+ "g\[(\]+unsigned long, (const unsigned long|unsigned long const), unsigned long\[)\]+"
+ gdb_test "maint dem g__FPlPClT1" \
+ "g\[(\]+long \[*\]+, (const long|long const) \[*\]+, long \[*\]+\[)\]+"
+ gdb_test "maint dem g__FUiCUiT1" \
+ "g\[(\]+unsigned int, (const unsigned int|unsigned int const), unsigned int\[)\]+"
+ gdb_test "maint dem g__FPiPCiT1" \
+ "g\[(\]+int \[*\]+, (const int|int const) \[*\]+, int \[*\]+\[)\]+"
+ gdb_test "maint dem g__FUsCUsT1" \
+ "g\[(\]+unsigned short, (const unsigned short|unsigned short const), unsigned short\[)\]+"
+ gdb_test "maint dem g__FPsPCsT1" \
+ "g\[(\]+short \[*\]+, (const short|short const) \[*\]+, short \[*\]+\[)\]+"
+ gdb_test "maint dem g__FUcCUcT1" \
+ "g\[(\]+unsigned char, (const unsigned char|unsigned char const), unsigned char\[)\]+"
+ gdb_test "maint dem g__FPcPCcT1" \
+ "g\[(\]+char \[*\]+, (const char|char const) \[*\]+, char \[*\]+\[)\]+"
+ gdb_test "maint dem g__F1TlClT2" \
+ "g\[(\]+T, long, (const long|long const), long\[)\]+"
+ gdb_test "maint dem g__F1TiCiT2" \
+ "g\[(\]+T, int, (const int|int const), int\[)\]+"
+ gdb_test "maint dem g__F1TsCsT2" \
+ "g\[(\]+T, short, (const short|short const), short\[)\]+"
+ gdb_test "maint dem g__F1TcCcT2" \
+ "g\[(\]+T, char, (const char|char const), char\[)\]+"
+
+ gdb_test "maint dem printf__FPCce" \
+ "printf\[(\]+(const char|char const) \[*\]+,...\[)\]+"
+
+
+ gdb_test "maint dem g__F1SRUlRCUlT2" \
+ "g\[(\]+S, unsigned long &, (const unsigned long|unsigned long const) &, unsigned long &\[)\]+"
+ gdb_test "maint dem g__F1SRPlRPClT2" \
+ "g\[(\]+S, long \[*\]+&, (const long|long const) \[*\]+&, long \[*\]+&\[)\]+"
+ gdb_test "maint dem g__F1RRUiRCUiT2" \
+ "g\[(\]+R, unsigned int &, (const unsigned int|unsigned int const) &, unsigned int &\[)\]+"
+ gdb_test "maint dem g__F1SRPiRPCiT2" \
+ "g\[(\]+S, int \[*\]+&, (const int|int const) \[*\]+&, int \[*\]+&\[)\]+"
+ gdb_test "maint dem g__F1RRUsRCUsT2" \
+ "g\[(\]+R, unsigned short &, (const unsigned short|unsigned short const) &, unsigned short &\[)\]+"
+ gdb_test "maint dem g__F1SRPsRPCsT2" \
+ "g\[(\]+S, short \[*\]+&, (const short|short const) \[*\]+&, short \[*\]+&\[)\]+"
+ gdb_test "maint dem g__F1RRUcRCUcT2" \
+ "g\[(\]+R, unsigned char &, (const unsigned char|unsigned char const) &, unsigned char &\[)\]+"
+ gdb_test "maint dem g__F1SRPcRPCcT2" \
+ "g\[(\]+S, char \[*\]+&, (const char|char const) \[*\]+&, char \[*\]+&\[)\]+"
+ gdb_test "maint dem g__F1T1RRlRClT3" \
+ "g\[(\]+T, R, long &, (const long|long const) &, long &\[)\]+"
+ gdb_test "maint dem g__F1T1RRiRCiT3" \
+ "g\[(\]+T, R, int &, (const int|int const) &, int &\[)\]+"
+ gdb_test "maint dem g__F1T1RRsRCsT3" \
+ "g\[(\]+T, R, short &, (const short|short const) &, short &\[)\]+"
+ gdb_test "maint dem g__F1T1RRcRCcT3" \
+ "g\[(\]+T, R, char &, (const char|char const) &, char &\[)\]+"
+
+
+ gdb_test_exact "maint demangle f__FicdPcPFci_v" "f(int, char, double, char *, void (*)(char, int))"
+ gdb_test_exact "maint demangle f__FicdPcPFic_v" "f(int, char, double, char *, void (*)(int, char))"
+ gdb_test_exact "maint demangle get__2T7SFv" "T7::get(void) static"
+
+
+ gdb_test "maint dem g__FcRdRCdT2" \
+ "g\[(\]+char, double &, (const double|double const) &, double &\[)\]+"
+ gdb_test "maint dem g__FcRfRCfT2" \
+ "g\[(\]+char, float &, (const float|float const) &, float &\[)\]+"
+ gdb_test "maint dem __md__FC2T2i" \
+ "operator%\[(\]+(const T2|T2 const), int\[)\]+"
+ gdb_test "maint dem __dv__FC2T2i" \
+ "operator/\[(\]+(const T2|T2 const), int\[)\]+"
+ gdb_test "maint dem __ml__FC2T2i" \
+ "operator\[*\]+\[(\]+(const T2|T2 const), int\[)\]+"
+ gdb_test "maint dem __mi__FC2T2i" \
+ "operator-\[(\]+(const T2|T2 const), int\[)\]+"
+ gdb_test "maint dem __pl__FC2T2i" \
+ "operator\[+\]+\[(\]+(const T2|T2 const), int\[)\]+"
+
+
+ gdb_test_exact "maint demangle h__Fc" "h(char)"
+ gdb_test_exact "maint demangle h__Fd" "h(double)"
+ gdb_test_exact "maint demangle h__Ff" "h(float)"
+ gdb_test_exact "maint demangle h__Fi" "h(int)"
+ gdb_test_exact "maint demangle f__Fi" "f(int)"
+ gdb_test_exact "maint demangle h__Fl" "h(long)"
+
+ gdb_test_exact "maint demangle h__Fs" "h(short)"
+ gdb_test "maint dem __md__FC2T2RC2T2" \
+ "operator%\[(\]+(const T2|T2 const), (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __dv__FC2T2RC2T2" \
+ "operator/\[(\]+(const T2|T2 const), (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __ml__FC2T2RC2T2" \
+ "operator\[*\]+\[(\]+(const T2|T2 const), (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __mi__FC2T2RC2T2" \
+ "operator-\[(\]+(const T2|T2 const), (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem __pl__FC2T2RC2T2" \
+ "operator\[+\]+\[(\]+(const T2|T2 const), (const T2|T2 const) &\[)\]+"
+ gdb_test "maint dem g__FcRP1cRPC1cT2" \
+ "g\[(\]+char, c *\[*\]+&, (const c|c const) *\[*\]+&, c *\[*\]+&\[)\]+"
+
+
+ gdb_test "maint dem g__FdCdT1" \
+ "g\[(\]+double, (const double|double const), double\[)\]+"
+ gdb_test "maint dem g__FfCfT1" \
+ "g\[(\]+float, (const float|float const), float\[)\]+"
+ gdb_test "maint dem g__FlClT1" \
+ "g\[(\]+long, (const long|long const), long\[)\]+"
+ gdb_test "maint dem g__FiCiT1" \
+ "g\[(\]+int, (const int|int const), int\[)\]+"
+ gdb_test "maint dem g__FsCsT1" \
+ "g\[(\]+short, (const short|short const), short\[)\]+"
+ gdb_test "maint dem g__FcCcT1" \
+ "g\[(\]+char, (const char|char const), char\[)\]+"
+
+
+ gdb_test_exact "maint demangle f__FicdPc" "f(int, char, double, char *)"
+ gdb_test_exact "maint demangle __nw__FUi" "operator new(unsigned int)"
+ gdb_test_exact "maint demangle __ct__Q3_2T11a1bSFi" "T1::a::b::b(int) static"
+ gdb_test_exact "maint demangle __dt__Q3_2T11a1bSFi" "T1::a::b::~b(int) static"
+ gdb_test_exact "maint demangle put__Q3_2T11a1bSFi" "T1::a::b::put(int) static"
+ gdb_test_exact "maint demangle get__Q2_2T11aSFv" "T1::a::get(void) static"
+ gdb_test_exact "maint demangle put__2T1SFi" "T1::put(int) static"
+ gdb_test_exact "maint demangle put__Q5_2T11a1b1c1dSFi" "T1::a::b::c::d::put(int) static"
+ gdb_test_exact "maint demangle get__Q4_2T11a1b1cSFv" "T1::a::b::c::get(void) static"
+ gdb_test_exact "maint demangle put__Q2_2T11aSFi" "T1::a::put(int) static"
+ gdb_test_exact "maint demangle put__Q4_2T11a1b1cSFi" "T1::a::b::c::put(int) static"
+ gdb_test_exact "maint demangle get__Q3_2T11a1bSFv" "T1::a::b::get(void) static"
+ gdb_test_exact "maint demangle get__2T1SFv" "T1::get(void) static"
+ gdb_test_exact "maint demangle get__Q5_2T11a1b1c1dSFv" "T1::a::b::c::d::get(void) static"
+
+
+ gdb_test_exact "maint demangle bar__3fooFPv" "foo::bar(void *)"
+ gdb_test "maint dem bar__3fooFPCv" \
+ "foo::bar\[(\]+(const void|void const) *\[*\]+\[)\]+"
+ gdb_test_exact "maint demangle bar__3fooCFPv" "foo::bar(void *) const"
+ gdb_test "maint dem bar__3fooCFPCv" \
+ "foo::bar\[(\]+(const void|void const) *\[*\]+\[)\]+ const"
+ gdb_test_exact "maint demangle __eq__3fooFR3foo" "foo::operator==(foo &)"
+ gdb_test "maint dem __eq__3fooFRC3foo" \
+ "foo::operator==\[(\]+(const foo|foo const) &\[)\]+"
+ gdb_test_exact "maint demangle __eq__3fooCFR3foo" "foo::operator==(foo &) const"
+ gdb_test "maint dem __eq__3fooCFRC3foo" \
+ "foo::operator==\[(\]+(const foo|foo const) &\[)\]+ const"
+
+ gdb_test_exact "maint demangle bar__3fooFiT16FooBar" "foo::bar(int, int, FooBar)"
+
+ gdb_test_exact "maint demangle bar__3fooFPiN51PdN37PcN211T1iN215" \
+ "foo::bar(int *, int *, int *, int *, int *, int *, double *, double *, double *, double *, char *, char *, char *, int *, int, int, int)"
+
+
+ # HP aCC specific tests. HP aCC demangling does not use __pt__ for
+ # template specifications. There are other differences as well.
+
+ gdb_test_exact "maint demangle __dt__2T5XTPFiPPdPv_i__Fv" "T5<int (*)(int, double **, void *)>::~T5(void)"
+
+ gdb_test_exact "maint demangle __ct__1cFi" "c::c(int)"
+
+ gdb_test_exact "maint demangle __dt__2T5XTi__Fv" "T5<int>::~T5(void)"
+
+ gdb_test_exact "maint demangle __dt__2T5XTc__Fv" "T5<char>::~T5(void)"
+
+ gdb_test_exact "maint demangle __ct__2T2Fi" "T2::T2(int)"
+ gdb_test_exact "maint demangle __dt__2T1Fv" "T1::~T1(void)"
+
+ gdb_test_exact "maint demangle __dt__2T5XT1x__Fv" "T5<x>::~T5(void)"
+
+ gdb_test_exact "maint demangle __dt__2T5XTPFcPv_i__Fv" "T5<int (*)(char, void *)>::~T5(void)"
+
+ gdb_test_exact "maint demangle __ct__2T5XTPFiPPdPv_i__Fi" "T5<int (*)(int, double **, void *)>::T5(int)"
+
+ gdb_test_exact "maint demangle __dl__2T5XT1x__SFPv" "T5<x>::operator delete(void *) static"
+
+ gdb_test_exact "maint demangle X__2T5XT1x" "T5<x>::X"
+
+ gdb_test_exact "maint demangle __ct__2T5XTi__Fi" "T5<int>::T5(int)"
+
+ gdb_test_exact "maint demangle __ct__2T5XTc__Fi" "T5<char>::T5(int)"
+
+ gdb_test_exact "maint demangle __dl__2T5XTPFcPv_i__SFPv" "T5<int (*)(char, void *)>::operator delete(void *) static"
+
+ gdb_test_exact "maint demangle X__2T5XTPFcPv_i" "T5<int (*)(char, void *)>::X"
+
+ gdb_test_exact "maint demangle __ct__2T5XT1x__Fi" "T5<x>::T5(int)"
+
+ gdb_test_exact "maint demangle __dl__2T5XTPFiPPdPv_i__SFPv" "T5<int (*)(int, double **, void *)>::operator delete(void *) static"
+ gdb_test_exact "maint demangle X__2T5XTPFiPPdPv_i" "T5<int (*)(int, double **, void *)>::X"
+
+ gdb_test_exact "maint demangle __dl__2T5XTi__SFPv" "T5<int>::operator delete(void *) static"
+
+ gdb_test_exact "maint demangle __dl__2T5XTc__SFPv" "T5<char>::operator delete(void *) static"
+
+ gdb_test_exact "maint demangle X__2T5XTc" "T5<char>::X"
+
+ gdb_test_exact "maint demangle X__2T5XTi" "T5<int>::X"
+
+ gdb_test_exact "maint demangle __ct__2T5XTPFcPv_i__Fi" "T5<int (*)(char, void *)>::T5(int)"
+
+ gdb_test_exact "maint demangle __dt__2T1XTc__Fv" "T1<char>::~T1(void)"
+
+ gdb_test_exact "maint demangle __dt__2T1XT1t__Fv" "T1<t>::~T1(void)"
+
+ gdb_test_exact "maint demangle __dl__2T1XT1t__SFPv" "T1<t>::operator delete(void *) static"
+
+ gdb_test_exact "maint demangle __ct__2T1XTc__Fi" "T1<char>::T1(int)"
+
+ gdb_test_exact "maint demangle __ct__2T1XTc__Fv" "T1<char>::T1(void)"
+
+ gdb_test_exact "maint demangle __ct__2T1XT1t__Fi" "T1<t>::T1(int)"
+
+ gdb_test_exact "maint demangle __ct__2T1XT1t__Fv" "T1<t>::T1(void)"
+
+ gdb_test_exact "maint demangle __dl__2T1XTc__SFPv" "T1<char>::operator delete(void *) static"
+
+ gdb_test_exact "maint demangle elem__6vectorXTd__Fi" "vector<double>::elem(int)"
+
+ gdb_test_exact "maint demangle elem__6vectorXTi__Fi" "vector<int>::elem(int)"
+
+ gdb_test_exact "maint demangle __ct__6vectorXTd__Fi" "vector<double>::vector(int)"
+
+ gdb_test_exact "maint demangle __ct__6vectorXTi__Fi" "vector<int>::vector(int)"
+
+ gdb_test_exact "maint demangle __ct__9DListNodeXTR6RLabel__FR6RLabelP9DListNodeXTR6RLabel_T2" \
+ "DListNode<RLabel &>::DListNode(RLabel &, DListNode<RLabel &> *, DListNode<RLabel &> *)"
+
+
+ # Absolute integer constants in template args
+
+ gdb_test_exact "maint demangle elem__6vectorXTiUP34__Fi" "vector<int,34U>::elem(int)"
+ gdb_test_exact "maint demangle elem__6vectorXUP2701Td__Fi" "vector<2701U,double>::elem(int)"
+ gdb_test_exact "maint demangle elem__6vectorXTiSP334__Fi" "vector<int,334>::elem(int)"
+ gdb_test_exact "maint demangle elem__6vectorXTiSN67__Fi" "vector<int,-67>::elem(int)"
+ gdb_test_exact "maint demangle elem__6vectorXTiSM__SCFPPd" "vector<int,-2147483648>::elem(double **) static const"
+ gdb_test_exact "maint demangle elem__6vectorXTiSN67UP4000TRs__Fi" "vector<int,-67,4000U,short &>::elem(int)"
+ gdb_test_exact "maint demangle elem__6vectorXTiSN67TRdTFPv_i__Fi" "vector<int,-67,double &,int (void *)>::elem(int)"
+ gdb_test_exact "maint demangle X__6vectorXTiSN67TdTPvUP5TRs" "vector<int,-67,double,void *,5U,short &>::X"
+
+ # Named constants in template args
+
+ gdb_test_exact "maint demangle elem__6vectorXTiA3foo__Fi" "vector<int,&foo>::elem(int)"
+ gdb_test_exact "maint demangle elem__6vectorXTiA3fooTPvA5Label__FiPPvT2" "vector<int,&foo,void *,&Label>::elem(int, void **, void **)"
+ gdb_test_exact "maint demangle elem__6vectorXTiSN42A3foo__Fi" "vector<int,-42,&foo>::elem(int)"
+
+ # Alternate entry points for functions
+
+ gdb_test_exact "maint demangle __ct__2T5XTPFcPv_i__Fi_2" "T5<int (*)(char, void *)>::T5(int)"
+ gdb_test_exact "maint demangle __ct__2T5XTPFcPv_i__Fi_19" "T5<int (*)(char, void *)>::T5(int)"
+ gdb_test_exact "maint demangle f__FicdPcPFci_v_34" "f(int, char, double, char *, void (*)(char, int))"
+
+
+ # Template partial specializations
+
+# FIXME! The # characters don't go through expect, and backslashes don't seem to work.
+# gdb_test_exact "maint demangle spec__13Spec<#1,#1.*>XTiTPi_FPi" "Spec<int,int *>::spec(int *)"
+# gdb_test_exact "maint demangle spec__16Spec<#1,#1.&,#1>XTiTRiTi_FPi" "Spec<int,int &, int>::spec(int *)"
+# Fake test -- replace # with %
+ gdb_test_exact "maint demangle spec__13Spec<%1,%1.*>XTiTPi_FPi" "Spec<int,int *>::spec(int *)"
+ gdb_test_exact "maint demangle spec__16Spec<%1,%1.&,%1>XTiTRiTi_FPi" "Spec<int,int &,int>::spec(int *)"
+
+ # Global template functions
+
+ gdb_test_exact "maint demangle add__XTc_FcT1" "add<char>(char, char)"
+ gdb_test_exact "maint demangle add__XTcSP9A5label_FcPPlT1" "add<char,9,&label>(char, long **, char)"
+ gdb_test_exact "maint demangle add__XTPfTFPd_f_FcT1" "add<float *,float (double *)>(char, char)"
+
+ # Template for template arg
+
+ gdb_test_exact "maint demangle unLink__12basic_stringXTcT18string_char_traitsXTc_T9allocator_Fv" "basic_string<char,string_char_traits<char>,allocator>::unLink(void)"
+
+}
+# Test support for different demangling styles. Note that this does
+# not depend upon running the test program and does not depend upon
+# gdb being able to lookup any C++ symbols. It simply calls the
+# internal demangler with synthesized strings and tests the results.
+
+proc do_tests {} {
+ global prms_id
+ global bug_id
+ global subdir
+ global gdb_prompt
+
+ set prms_id 0
+ set bug_id 0
+
+ # Start with a fresh gdb.
+
+ gdb_exit
+ gdb_start
+
+ send_gdb "set language c++\n"
+ gdb_expect -re "$gdb_prompt $"
+ send_gdb "set width 0\n"
+ gdb_expect -re "$gdb_prompt $"
+
+ test_lucid_style_demangling
+ test_gnu_style_demangling
+ test_arm_style_demangling
+ test_hp_style_demangling
+}
+
+do_tests
diff --git a/gdb/testsuite/gdb.c++/derivation.cc b/gdb/testsuite/gdb.c++/derivation.cc
new file mode 100644
index 00000000000..99efa7605a4
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/derivation.cc
@@ -0,0 +1,240 @@
+class A {
+public:
+ int a;
+ int aa;
+
+ A()
+ {
+ a=1;
+ aa=2;
+ }
+ int afoo();
+ int foo();
+
+};
+
+
+
+class B {
+public:
+ int b;
+ int bb;
+
+ B()
+ {
+ b=3;
+ bb=4;
+ }
+ int bfoo();
+ int foo();
+
+};
+
+
+
+class C {
+public:
+ int c;
+ int cc;
+
+ C()
+ {
+ c=5;
+ cc=6;
+ }
+ int cfoo();
+ int foo();
+
+};
+
+
+
+class D : private A, public B, protected C {
+public:
+ int d;
+ int dd;
+
+ D()
+ {
+ d =7;
+ dd=8;
+ }
+ int dfoo();
+ int foo();
+
+};
+
+
+class E : public A, B, protected C {
+public:
+ int e;
+ int ee;
+
+ E()
+ {
+ e =9;
+ ee=10;
+ }
+ int efoo();
+ int foo();
+
+};
+
+
+class F : A, public B, C {
+public:
+ int f;
+ int ff;
+
+ F()
+ {
+ f =11;
+ ff=12;
+ }
+ int ffoo();
+ int foo();
+
+};
+
+class G : private A, public B, protected C {
+public:
+ int g;
+ int gg;
+ int a;
+ int b;
+ int c;
+
+ G()
+ {
+ g =13;
+ gg =14;
+ a=15;
+ b=16;
+ c=17;
+
+ }
+ int gfoo();
+ int foo();
+
+};
+
+
+
+
+int A::afoo() {
+ return 1;
+}
+
+int B::bfoo() {
+ return 2;
+}
+
+int C::cfoo() {
+ return 3;
+}
+
+int D::dfoo() {
+ return 4;
+}
+
+int E::efoo() {
+ return 5;
+}
+
+int F::ffoo() {
+ return 6;
+}
+
+int G::gfoo() {
+ return 77;
+}
+
+int A::foo()
+{
+ return 7;
+
+}
+
+int B::foo()
+{
+ return 8;
+
+}
+
+int C::foo()
+{
+ return 9;
+
+}
+
+int D::foo()
+{
+ return 10;
+
+}
+
+int E::foo()
+{
+ return 11;
+
+}
+
+int F::foo()
+{
+ return 12;
+
+}
+
+int G::foo()
+{
+ return 13;
+
+}
+
+
+void marker1()
+{
+}
+
+
+int main(void)
+{
+
+ A a_instance;
+ B b_instance;
+ C c_instance;
+ D d_instance;
+ E e_instance;
+ F f_instance;
+ G g_instance;
+
+ #ifdef usestubs
+ set_debug_traps();
+ breakpoint();
+ #endif
+
+
+ marker1();
+
+ a_instance.a = 20;
+ a_instance.aa = 21;
+ b_instance.b = 22;
+ b_instance.bb = 23;
+ c_instance.c = 24;
+ c_instance.cc = 25;
+ d_instance.d = 26;
+ d_instance.dd = 27;
+ e_instance.e = 28;
+ e_instance.ee =29;
+ f_instance.f =30;
+ f_instance.ff =31;
+
+
+
+
+ return 0;
+
+}
+
+
+
diff --git a/gdb/testsuite/gdb.c++/derivation.exp b/gdb/testsuite/gdb.c++/derivation.exp
new file mode 100644
index 00000000000..ed3cc2cfbcc
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/derivation.exp
@@ -0,0 +1,316 @@
+# Copyright (C) 1998 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
+# (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
+
+# This file was written by Elena Zannoni (ezannoni@cygnus.com)
+
+# This file is part of the gdb testsuite
+#
+
+#
+# tests for inheritance, with several derivations types combinations (private,
+# public, protected)
+# classes have simple members and member functions.
+#
+
+
+if $tracelevel then {
+ strace $tracelevel
+ }
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+set testfile "derivation"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+
+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."
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+remote_file build delete ${binfile}.ci
+ if {![istarget "hppa*-*-hpux*"]} {
+ if { [gdb_compile "${srcdir}/${subdir}/compiler.cc" "${binfile}.ci" preprocess ""] != ""
+} {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will auto
+matically fail."
+ }
+ } else {
+ if { [gdb_preprocess "${srcdir}/${subdir}/compiler.cc" "${binfile}.ci" "c++"] != "" } {
+ perror "Couldn't make ${binfile}.ci file"
+ return 1;
+ }
+ }
+
+source ${binfile}.ci
+
+#
+# set it up at a breakpoint so we can play with the variable values
+#
+if ![runto_main] then {
+ perror "couldn't run to breakpoint"
+ continue
+}
+
+send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
+
+ send_gdb "cont\n"
+ gdb_expect {
+ -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
+ send_gdb "up\n"
+ gdb_expect {
+ -re ".*$gdb_prompt $" {}
+ timeout { fail "up from marker1" }
+ }
+ }
+ -re "$gdb_prompt $" { fail "continue to marker1" }
+ timeout { fail "(timeout) continue to marker1" }
+ }
+
+
+
+send_gdb "print a_instance\n"
+gdb_expect {
+ -re ".\[0-9\]* = \{a = 1, aa = 2\}\r\n$gdb_prompt $" {
+ pass "print value of a_instance"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of a_instance" }
+ timeout { fail "(timeout) print value of a_instance" }
+ }
+
+
+send_gdb "ptype a_instance\n"
+gdb_expect {
+ -re "type = class A \{\r\n\[\t \]*public:\r\n\[\t \]*int a;\r\n\[\t \]*int aa;\[\r\n\t \]+A\\(void\\);\r\n\[\t \]*int afoo\\(void\\);\r\n\[\t \]*int foo\\(void\\);\r\n\}.*$gdb_prompt $" { pass "ptype a_instance" }
+ -re ".*$gdb_prompt $" { fail "ptype a_instance" }
+ timeout { fail "(timeout) ptype a_instance" }
+}
+
+
+send_gdb "print d_instance\n"
+gdb_expect {
+ -re ".\[0-9\]* = \{<A> = \{a = 1, aa = 2\}, <B> = \{b = 3, bb = 4\}, <C> = \{c = 5, cc = 6\}, d = 7, dd = 8\}\r\n$gdb_prompt $" {
+ pass "print value of d_instance"
+ }
+ -re ".\[0-9\]* = \{<class A> = \{a = 1, aa = 2\}, <class B> = \{b = 3, bb = 4\}, <class C> = \{c = 5, cc = 6\}, d = 7, dd = 8\}\r\n$gdb_prompt $" {
+ pass "print value of d_instance"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of d_instance" }
+ timeout { fail "(timeout) print value of d_instance" }
+ }
+
+ if {$gcc_compiled} then {
+ send_gdb "ptype d_instance\n"
+ gdb_expect {
+ -re "type = class D : private A, public B, private C \{\r\n\[\t \]*public:\r\n\[\t \]*int d;\r\n\[\t \]*int dd;\[\r\n\t \]+D\\(void\\);\r\n\[\t \]*int dfoo\\(void\\);\r\n\[\t \]*int foo\\(void\\);\r\n\}.*$gdb_prompt $" { pass "ptype d_instance" }
+ -re ".*$gdb_prompt $" { fail "ptype d_instance" }
+ timeout { fail "(timeout) ptype d_instance" }
+ }
+ } else {
+ send_gdb "ptype d_instance\n"
+ gdb_expect {
+ -re "type = class D : private A, public B, protected C \{\r\n\[\t \]*public:\r\n\[\t \]*int d;\r\n\[\t \]*int dd;\[\r\n\t \]+D\\(void\\);\r\n\[\t \]*int dfoo\\(void\\);\r\n\[\t \]*int foo\\(void\\);\r\n\}.*$gdb_prompt $" { pass "ptype d_instance" }
+ -re ".*$gdb_prompt $" { fail "ptype d_instance" }
+ timeout { fail "(timeout) ptype d_instance" }
+ }
+ }
+
+
+send_gdb "print e_instance\n"
+gdb_expect {
+ -re ".\[0-9\]* = \{<A> = \{a = 1, aa = 2\}, <B> = \{b = 3, bb = 4\}, <C> = \{c = 5, cc = 6\}, e = 9, ee = 10\}\r\n$gdb_prompt $" {
+ pass "print value of e_instance"
+ }
+ -re ".\[0-9\]* = \{<class A> = \{a = 1, aa = 2\}, <class B> = \{b = 3, bb = 4\}, <class C> = \{c = 5, cc = 6\}, e = 9, ee = 10\}\r\n$gdb_prompt $" {
+ pass "print value of e_instance"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of e_instance" }
+ timeout { fail "(timeout) print value of e_instance" }
+ }
+
+ if {$gcc_compiled} {
+ send_gdb "ptype e_instance\n"
+ gdb_expect {
+ -re "type = class E : public A, private B, private C \{\r\n\[\t \]*public:\r\n\[\t \]*int e;\r\n\[\t \]*int ee;\[\r\n\t \]+E\\(void\\);\r\n\[\t \]*int efoo\\(void\\);\r\n\[\t \]*int foo\\(void\\);\r\n\}.*$gdb_prompt $" { pass "ptype e_instance" }
+ -re ".*$gdb_prompt $" { fail "ptype e_instance" }
+ timeout { fail "(timeout) ptype e_instance" }
+ }
+ } else {
+ send_gdb "ptype e_instance\n"
+ gdb_expect {
+ -re "type = class E : public A, private B, protected C \{\r\n\[\t \]*public:\r\n\[\t \]*int e;\r\n\[\t \]*int ee;\[\r\n\t \]+E\\(void\\);\r\n\[\t \]*int efoo\\(void\\);\r\n\[\t \]*int foo\\(void\\);\r\n\}.*$gdb_prompt $" { pass "ptype e_instance" }
+ -re ".*$gdb_prompt $" { fail "ptype e_instance" }
+ timeout { fail "(timeout) ptype e_instance" }
+ }
+ }
+
+
+send_gdb "print f_instance\n"
+gdb_expect {
+ -re ".\[0-9\]* = \{<A> = \{a = 1, aa = 2\}, <B> = \{b = 3, bb = 4\}, <C> = \{c = 5, cc = 6\}, f = 11, ff = 12\}\r\n$gdb_prompt $" {
+ pass "print value of f_instance"
+ }
+ -re ".\[0-9\]* = \{<class A> = \{a = 1, aa = 2\}, <class B> = \{b = 3, bb = 4\}, <class C> = \{c = 5, cc = 6\}, f = 11, ff = 12\}\r\n$gdb_prompt $" {
+ pass "print value of f_instance"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of f_instance" }
+ timeout { fail "(timeout) print value of f_instance" }
+ }
+
+send_gdb "ptype f_instance\n"
+gdb_expect {
+ -re "type = class F : private A, public B, private C \{\r\n\[\t \]*public:\r\n\[\t \]*int f;\r\n\[\t \]*int ff;\[\r\n\t \]+F\\(void\\);\r\n\[\t \]*int ffoo\\(void\\);\r\n\[\t \]*int foo\\(void\\);\r\n\}.*$gdb_prompt $" { pass "ptype f_instance" }
+ -re ".*$gdb_prompt $" { fail "ptype f_instance" }
+ timeout { fail "(timeout) ptype f_instance" }
+}
+
+
+
+send_gdb "print d_instance.a\n"
+gdb_expect {
+ -re ".\[0-9\]* = 1.*$gdb_prompt $" {
+ pass "print value of d_instance.a"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of d_instance.a" }
+ timeout { fail "(timeout) print value of d_instance.a" }
+ }
+
+send_gdb "print d_instance.aa\n"
+gdb_expect {
+ -re ".\[0-9\]* = 2.*$gdb_prompt $" {
+ pass "print value of d_instance.aa"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of d_instance.aa" }
+ timeout { fail "(timeout) print value of d_instance.aa" }
+ }
+
+send_gdb "print d_instance.b\n"
+gdb_expect {
+ -re ".\[0-9\]* = 3.*$gdb_prompt $" {
+ pass "print value of d_instance.b"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of d_instance.b" }
+ timeout { fail "(timeout) print value of d_instance.b" }
+ }
+
+send_gdb "print d_instance.bb\n"
+gdb_expect {
+ -re ".\[0-9\]* = 4.*$gdb_prompt $" {
+ pass "print value of d_instance.bb"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of d_instance.bb" }
+ timeout { fail "(timeout) print value of d_instance.bb" }
+ }
+
+send_gdb "print d_instance.c\n"
+gdb_expect {
+ -re ".\[0-9\]* = 5.*$gdb_prompt $" {
+ pass "print value of d_instance.c"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of d_instance.c" }
+ timeout { fail "(timeout) print value of d_instance.c" }
+ }
+
+send_gdb "print d_instance.cc\n"
+gdb_expect {
+ -re ".\[0-9\]* = 6.*$gdb_prompt $" {
+ pass "print value of d_instance.cc"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of d_instance.cc" }
+ timeout { fail "(timeout) print value of d_instance.cc" }
+ }
+
+send_gdb "print d_instance.d\n"
+gdb_expect {
+ -re ".\[0-9\]* = 7.*$gdb_prompt $" {
+ pass "print value of d_instance.d"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of d_instance.d" }
+ timeout { fail "(timeout) print value of d_instance.d" }
+ }
+
+send_gdb "print d_instance.dd\n"
+gdb_expect {
+ -re ".\[0-9\]* = 8.*$gdb_prompt $" {
+ pass "print value of d_instance.dd"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of d_instance.dd" }
+ timeout { fail "(timeout) print value of d_instance.dd" }
+ }
+
+send_gdb "print g_instance.a\n"
+gdb_expect {
+ -re ".\[0-9\]* = 15.*$gdb_prompt $" {
+ pass "print value of g_instance.a"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of g_instance.a" }
+ timeout { fail "(timeout) print value of g_instance.a" }
+ }
+
+send_gdb "print g_instance.b\n"
+gdb_expect {
+ -re ".\[0-9\]* = 16.*$gdb_prompt $" {
+ pass "print value of g_instance.b"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of g_instance.b" }
+ timeout { fail "(timeout) print value of g_instance.b" }
+ }
+
+send_gdb "print g_instance.c\n"
+gdb_expect {
+ -re ".\[0-9\]* = 17.*$gdb_prompt $" {
+ pass "print value of g_instance.c"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of g_instance.c" }
+ timeout { fail "(timeout) print value of g_instance.c" }
+ }
+
+send_gdb "print g_instance.afoo()\n"
+gdb_expect {
+ -re ".\[0-9\]* = 1.*$gdb_prompt $" {
+ pass "print value of g_instance.afoo()"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of g_instance.afoo()" }
+ timeout { fail "(timeout) print value of g_instance.afoo()" }
+ }
+
+send_gdb "print g_instance.bfoo()\n"
+gdb_expect {
+ -re ".\[0-9\]* = 2.*$gdb_prompt $" {
+ pass "print value of g_instance.bfoo()"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of g_instance.bfoo()" }
+ timeout { fail "(timeout) print value of g_instance.bfoo()" }
+ }
+
+send_gdb "print g_instance.cfoo()\n"
+gdb_expect {
+ -re ".\[0-9\]* = 3.*$gdb_prompt $" {
+ pass "print value of g_instance.cfoo()"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of g_instance.cfoo()" }
+ timeout { fail "(timeout) print value of g_instance.cfoo()" }
+ }
diff --git a/gdb/testsuite/gdb.c++/inherit.exp b/gdb/testsuite/gdb.c++/inherit.exp
new file mode 100644
index 00000000000..8c7a90c9153
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/inherit.exp
@@ -0,0 +1,859 @@
+# Copyright (C) 1992, 1993, 1994, 1997 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
+# (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
+
+# This file was written by Fred Fish. (fnf@cygnus.com)
+
+set ws "\[\r\n\t \]+"
+set nl "\[\r\n\]+"
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# Check to see if we have an executable to test. If not, then either we
+# haven't tried to compile one, or the compilation failed for some reason.
+# In either case, just notify the user and skip the tests in this file.
+# Note - create separate "inherit" executable from misc.cc
+
+set testfile "inherit"
+set srcfile misc.cc
+set binfile ${objdir}/${subdir}/${testfile}
+
+
+# Create and source the file that provides information about the compiler
+# used to compile the test case.
+
+if [get_compiler_info ${binfile} "c++"] {
+ return -1
+}
+
+# if we are on HPUX and we are not compiled with gcc, then skip these tests.
+
+if [istarget hppa*-*-hpux*] {
+ if {!$gcc_compiled} {
+ continue
+ }
+}
+
+
+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."
+}
+
+#
+# Single inheritance, print individual members.
+#
+
+proc test_print_si_members {} {
+ # Print all members of g_A using fully qualified form.
+
+ gdb_test "print g_A.A::a" ".* = 1" "print g_A.A::a"
+
+ gdb_test "print g_A.A::x" ".* = 2" "print g_A.A::x"
+
+ # Print members of g_A using nonambiguous compact form.
+
+ gdb_test "print g_A.a" ".* = 1" "print g_A.a"
+
+ gdb_test "print g_A.x" ".* = 2" "print g_A.x"
+
+ # Print all members of g_B using fully qualified form.
+
+ gdb_test "print g_B.A::a" ".* = 3" "print g_B.A::a"
+
+ gdb_test "print g_B.A::x" ".* = 4" "print g_B.A::x"
+
+ gdb_test "print g_B.B::b" ".* = 5" "print g_B.B::b"
+
+ gdb_test "print g_B.B::x" ".* = 6" "print g_B.B::x"
+
+ # Print members of g_B using nonambiguous compact form.
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_B.a" ".* = 3" "print g_B.a"
+
+ gdb_test "print g_B.b" ".* = 5" "print g_B.b"
+
+ gdb_test "print g_B.x" ".* = 6" "print g_B.x"
+
+ # Print all members of g_C using fully qualified form.
+
+ gdb_test "print g_C.A::a" ".* = 7" "print g_C.A::a"
+
+ gdb_test "print g_C.A::x" ".* = 8" "print g_C.A::x"
+
+ gdb_test "print g_C.C::c" ".* = 9" "print g_C.C::c"
+
+ gdb_test "print g_C.C::x" ".* = 10" "print g_C.C::x"
+
+ # Print members of g_C using nonambiguous compact form.
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_C.a" ".* = 7" "print g_C.a"
+
+ gdb_test "print g_C.c" ".* = 9" "print g_C.c"
+
+ gdb_test "print g_C.x" ".* = 10" "print g_C.x"
+}
+
+#
+# Single inheritance, print type definitions.
+#
+
+proc test_ptype_si {} {
+ global gdb_prompt
+ global ws
+ global nl
+
+ # Print class A as a type.
+
+ send_gdb "ptype A\n"
+ gdb_expect {
+ -re "type = class A \{$nl.*\[ \]*int a;$nl\[ \]*int x;$nl.*\[ \]*\}$nl$gdb_prompt $" {
+ pass "ptype A (FIXME)"
+ }
+ -re "type = struct A \{$nl\[ \]*int a;$nl\[ \]*int x;$nl\[ \]*\}$nl$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "ptype A (FIXME)"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype A" }
+ timeout { fail "ptype A (timeout)" ; return }
+ }
+
+ # Print class A as an explicit class.
+
+ send_gdb "ptype class A\n"
+ gdb_expect {
+ -re "type = class A \{$nl.*\[ \]*int a;$nl\[ \]*int x;$nl.*\[ \]*\}$nl$gdb_prompt $" {
+ pass "ptype class A (FIXME)"
+ }
+ -re "type = struct A \{$nl\[ \]*int a;$nl\[ \]*int x;$nl\[ \]*\}$nl$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "ptype class A (FIXME)"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype class A" }
+ timeout { fail "ptype class A (timeout)" ; return }
+ }
+
+ # Print type of an object of type A.
+
+ send_gdb "ptype g_A\n"
+ gdb_expect {
+ -re "type = class A \{$nl.*\[ \]*int a;$nl\[ \]*int x;$nl.*\[ \]*\}$nl$gdb_prompt $" {
+ pass "ptype g_A (FIXME)"
+ }
+ -re "type = struct A \{$nl\[ \]*int a;$nl\[ \]*int x;$nl\[ \]*\}$nl$gdb_prompt $" {
+ setup_xfail "*-*-*"
+ fail "ptype g_A (FIXME)"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype g_A" }
+ timeout { fail "ptype g_A (timeout)" ; return }
+ }
+
+ # Print class B as a type.
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype B" "type = class B : public A \{$nl\[ \]*public:$nl\[ \]*int b;$nl\[ \]*int x;$nl.*\}" "ptype B"
+
+ # Print class B as an explicit class.
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype class B" "type = class B : public A \{$nl\[ \]*public:$nl\[ \]*int b;$nl\[ \]*int x;$nl.*\}" "ptype class B"
+
+ # Print type of an object of type B.
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype g_B" "type = class B : public A \{$nl\[ \]*public:$nl\[ \]*int b;$nl\[ \]*int x;$nl.*\}" "ptype g_B"
+
+ # Print class C as a type.
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype C" "type = class C : public A \{$nl\[ \]*public:$nl\[ \]*int c;$nl\[ \]*int x;$nl.*\}" "ptype C"
+
+ # Print class C as an explicit class.
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype class C" "type = class C : public A \{$nl\[ \]*public:$nl\[ \]*int c;$nl\[ \]*int x;$nl.*\}" "ptype class C"
+
+ # Print type of an object of type g_C.
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype g_C" "type = class C : public A \{$nl\[ \]*public:$nl\[ \]*int c;$nl\[ \]*int x;$nl.*\}" "ptype g_C"
+
+ # gcc cygnus-2.3.3 (Q1) has this bug, but it was fixed as of
+ # cygnus-2.3.3-930417. PR 2819.
+ send_gdb "ptype tagless_struct\n"
+ gdb_expect {
+ -re "type = class \{${ws}public:${ws}int one;${ws}int two;${ws}tagless_struct & operator=\\(tagless_struct &\\);${ws}\\\$_1 \\(tagless_struct &\\);${ws}\\\$_1 \\(\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype tagless struct"
+ }
+ -re "type = (struct|class).*\{.*int one;.*int two;.*\}$nl$gdb_prompt $" {
+ pass "ptype tagless struct (obsolete gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype tagless struct"
+ }
+ timeout {
+ fail "ptype tagless struct (timeout)"
+ }
+ }
+
+ send_gdb "ptype v_tagless\n"
+ gdb_expect {
+ -re "type = class \{${ws}public:${ws}int one;${ws}int two;${ws}tagless_struct & operator=\\(tagless_struct &\\);${ws}\\\$_1 \\(tagless_struct &\\);${ws}\\\$_1 \\(\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype variable of type tagless struct"
+ }
+ -re "type = (struct|class).*\{.*int one;.*int two;.*\}$nl$gdb_prompt $" {
+ pass "ptype variable of type tagless struct (obsolete gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype variable of type tagless struct"
+ }
+ timeout {
+ fail "ptype variable of type tagless struct (timeout)"
+ }
+ }
+}
+
+#
+# Single inheritance, print complete classes.
+#
+
+proc test_print_si_classes {} {
+ # Print all members of g_A.
+
+ gdb_test "print g_A" ".* = \{a = 1, x = 2\}" "print g_A"
+
+ # Print all members of g_B.
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_B" ".* = \{\<A\> = \{a = 3, x = 4\}, b = 5, x = 6\}" "print g_B"
+
+ # Print all members of g_C.
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_C" ".* = \{\<A\> = \{a = 7, x = 8\}, c = 9, x = 10\}" "print g_C"
+}
+
+#
+# Single inheritance, print anonymous unions.
+# GDB versions prior to 4.14 entered an infinite loop when printing
+# the type of a class containing an anonymous union, and they were also
+# incapable of printing the member of an anonymous union.
+# We test the printing of the member first, and perform the other tests
+# only if the test succeeds, to avoid the infinite loop.
+#
+
+proc test_print_anon_union {} {
+ global gdb_prompt
+ global ws
+ global nl
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_anon_union.a" ".* = 2" "print anonymous union member"
+ setup_xfail_format "DWARF 1"
+ send_gdb "print g_anon_union\n"
+ gdb_expect {
+ -re ".* = \{one = 1, = \{a = 2, b = 2\}\}$nl$gdb_prompt $" {
+ pass "print variable of type anonymous union"
+ }
+ -re ".* = .*\{one = 1, = \{a = 2, b = .*\}\}$nl$gdb_prompt $" {
+ pass "print variable of type anonymous union (obsolete gcc or gdb)"
+ }
+ -re ".*$nl$gdb_prompt $" {
+ fail "print variable of type anonymous union"
+ }
+ timeout {
+ fail "print variableof type anonymous union (timeout)"
+ }
+ }
+ setup_xfail_format "DWARF 1"
+ send_gdb "ptype g_anon_union\n"
+ gdb_expect {
+ -re "type = class class_with_anon_union \{${ws}public:${ws}int one;${ws}union \{${ws}public:${ws}int a;${ws}long int b;${ws}union \{\.\.\.\} & operator=\\(union \{\.\.\.\} &\\);${ws}\\\$_0 \\(union \{\.\.\.\} &\\);${ws}\\\$_0 \\(\\);${ws}\};${ws}class_with_anon_union & operator=\\(class_with_anon_union const &\\);${ws}class_with_anon_union\\(class_with_anon_union const &\\);${ws}class_with_anon_union\\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "print type of anonymous union"
+ }
+ -re "type = (struct|class).*\{.*int one;.*union \{.*int a;.*(long|long int|int) b;.*\};.*\}$nl$gdb_prompt $" {
+ pass "print type of anonymous union (obsolete gcc or gdb)"
+ }
+ -re ".*$nl$gdb_prompt $" {
+ fail "print type of anonymous union"
+ }
+ timeout {
+ fail "print type of anonymous union (timeout)"
+ }
+ }
+}
+
+#
+# Multiple inheritance, print individual members.
+#
+
+proc test_print_mi_members {} {
+ global gdb_prompt
+ global nl
+
+ # Print all members of g_A.
+
+ gdb_test "print g_A.A::a" ".* = 1" "print g_A.A::a"
+
+ gdb_test "print g_A.A::x" ".* = 2" "print g_A.A::x"
+
+ # Print all members of g_B.
+
+ gdb_test "print g_B.A::a" ".* = 3" "print g_B.A::a"
+
+ gdb_test "print g_B.A::x" ".* = 4" "print g_B.A::x"
+
+ gdb_test "print g_B.B::b" ".* = 5" "print g_B.B::b"
+
+ gdb_test "print g_B.B::x" ".* = 6" "print g_B.B::x"
+
+ # Print all members of g_C.
+
+ gdb_test "print g_C.A::a" ".* = 7" "print g_C.A::a"
+
+ gdb_test "print g_C.A::x" ".* = 8" "print g_C.A::x"
+
+ gdb_test "print g_C.C::c" ".* = 9" "print g_C.C::c"
+
+ gdb_test "print g_C.C::x" ".* = 10" "print g_C.C::x"
+
+ # Print all members of g_D.
+
+ # The following is ambiguous, and gdb should detect this.
+ # For now, accept gdb's behavior as an expected failure if it
+ # simply prints either member correctly.
+
+ setup_xfail "*-*-*"
+ send_gdb "print g_D.A::a\n"
+ gdb_expect {
+ -re ".* = 11$nl$gdb_prompt $" {
+ fail "print g_D.A::a (FIXME)"
+ }
+ -re ".* = 15$nl$gdb_prompt $" {
+ fail "print g_D.A::a (FIXME)"
+ }
+ -re ".*$gdb_prompt $" { fail "print g_D.A::a" }
+ timeout { fail "print g_D.A::a (timeout)" ; return }
+ }
+
+ # The following is ambiguous, and gdb should detect this.
+ # For now, accept gdb's behavior as an expected failure if it
+ # simply prints either member correctly.
+
+ setup_xfail "*-*-*"
+ send_gdb "print g_D.A::x\n"
+ gdb_expect {
+ -re ".* = 12$nl$gdb_prompt $" {
+ fail "print g_D.A::x (FIXME)"
+ }
+ -re ".* = 16$nl$gdb_prompt $" {
+ fail "print g_D.A::x (FIXME)"
+ }
+ -re ".*$gdb_prompt $" { fail "print g_D.A::x" }
+ timeout { fail "print g_D.A::x (timeout)" ; return }
+ }
+
+ gdb_test "print g_D.B::b" ".* = 13" "print g_D.B::b"
+
+ gdb_test "print g_D.B::x" ".* = 14" "print g_D.B::x"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_D.C::c" ".* = 17" "print g_D.C::c"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_D.C::x" ".* = 18" "print g_D.C::x"
+
+ gdb_test "print g_D.D::d" ".* = 19" "print g_D.D::d"
+
+ gdb_test "print g_D.D::x" ".* = 20" "print g_D.D::x"
+
+ # Print all members of g_E.
+
+ # The following is ambiguous, and gdb should detect this.
+ # For now, accept gdb's behavior as an expected failure if it
+ # simply prints either member correctly.
+
+ setup_xfail "*-*-*"
+ send_gdb "print g_E.A::a\n"
+ gdb_expect {
+ -re ".* = 21$nl$gdb_prompt $" {
+ fail "print g_E.A::a (FIXME)"
+ }
+ -re ".* = 25$nl$gdb_prompt $" {
+ fail "print g_E.A::a (FIXME)"
+ }
+ -re ".*$gdb_prompt $" { fail "print g_E.A::a" }
+ timeout { fail "print g_E.A::a (timeout)" ; return }
+ }
+
+ # The following is ambiguous, and gdb should detect this.
+ # For now, accept gdb's behavior as an expected failure if it
+ # simply prints either member correctly.
+
+ setup_xfail "*-*-*"
+ send_gdb "print g_E.A::x\n"
+ gdb_expect {
+ -re ".* = 22$nl$gdb_prompt $" {
+ fail "print g_E.A::x (FIXME)"
+ }
+ -re ".* = 26$nl$gdb_prompt $" {
+ fail "print g_E.A::x (FIXME)"
+ }
+ -re ".*$gdb_prompt $" { fail "print g_E.A::x" }
+ timeout { fail "print g_E.A::x (timeout)" ; return }
+ }
+
+ gdb_test "print g_E.B::b" ".* = 23" "print g_E.B::b"
+
+ gdb_test "print g_E.B::x" ".* = 24" "print g_E.B::x"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_E.C::c" ".* = 27" "print g_E.C::c"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_E.C::x" ".* = 28" "print g_E.C::x"
+
+ gdb_test "print g_E.D::d" ".* = 29" "print g_E.D::d"
+
+ gdb_test "print g_E.D::x" ".* = 30" "print g_E.D::x"
+
+ gdb_test "print g_E.E::e" ".* = 31" "print g_E.E::e"
+
+ gdb_test "print g_E.E::x" ".* = 32" "print g_E.E::x"
+}
+
+#
+# Multiple inheritance, print type definitions.
+#
+
+proc test_ptype_mi {} {
+ global nl
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype D"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype class D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype class D"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype g_D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype g_D"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype E"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype class E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype class E"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype g_E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype g_E"
+}
+
+#
+# Multiple inheritance, print complete classes.
+#
+
+proc test_print_mi_classes {} {
+ # Print all members of g_D.
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_D" ".* = \{\<B\> = \{\<A\> = \{a = 11, x = 12\}, b = 13, x = 14\}, \<C\> = \{\<A\> = \{a = 15, x = 16\}, c = 17, x = 18\}, d = 19, x = 20\}" "print g_D"
+
+ # Print all members of g_E.
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_E" ".* = \{\<D\> = \{\<B\> = \{\<A\> = \{a = 21, x = 22\}, b = 23, x = 24\}, \<C\> = \{\<A\> = \{a = 25, x = 26\}, c = 27, x = 28\}, d = 29, x = 30\}, e = 31, x = 32\}" "print g_E"
+}
+
+#
+# Single virtual inheritance, print individual members.
+#
+
+proc test_print_svi_members {} {
+ global gdb_prompt
+ global decimal
+ global nl
+
+ # Print all members of g_vA.
+
+ gdb_test "print g_vA.vA::va" ".* = 1" "print g_vA.vA::va"
+
+ gdb_test "print g_vA.vA::vx" ".* = 2" "print g_vA.vA::vx"
+
+ # Print members of g_vA using compact form.
+
+ gdb_test "print g_vA.va" ".* = 1" "print g_vA.va"
+
+ gdb_test "print g_vA.vx" ".* = 2" "print g_vA.vx"
+
+ # Print all members of g_vB.
+
+ setup_xfail_format "DWARF 1"
+ send_gdb "print g_vB.vA::va\n"
+ gdb_expect {
+ -re ".* = 3$nl$gdb_prompt $" { pass "print g_vB.vA::va" }
+ -re ".*virtual baseclass botch.*$gdb_prompt $" {
+ # Does not happen with gcc cygnus-2.4.5-930828
+ fail "print g_vB.vA::va (known bug with gcc cygnus-2.4.5-930417)"
+ # Many of the rest of these tests have the same problem.
+ return 0
+ }
+ -re ".*$gdb_prompt $" { fail "print g_vB.vA::va" }
+ timeout { fail "print g_vB.vA::va (timeout)" ; return }
+ }
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_vB.vA::vx" ".* = 4" "print g_vB.vA::vx"
+
+ gdb_test "print g_vB.vB::vb" ".* = 5" "print g_vB.vB::vb"
+
+ gdb_test "print g_vB.vB::vx" ".* = 6" "print g_vB.vB::vx"
+
+ # Print members of g_vB using compact form.
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_vB.va" ".* = 3" "print g_vB.va"
+
+ gdb_test "print g_vB.vb" ".* = 5" "print g_vB.vb"
+
+ gdb_test "print g_vB.vx" ".* = 6" "print g_vB.vx"
+
+ # Print all members of g_vC.
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_vC.vA::va" ".* = 7" "print g_vC.vA::va"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_vC.vA::vx" ".* = 8" "print g_vC.vA::vx"
+
+ gdb_test "print g_vC.vC::vc" ".* = 9" "print g_vC.vC::vc"
+
+ gdb_test "print g_vC.vC::vx" ".* = 10" "print g_vC.vC::vx"
+
+ # Print members of g_vC using compact form.
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_vC.va" ".* = 7" "print g_vC.va"
+
+ gdb_test "print g_vC.vc" ".* = 9" "print g_vC.vc"
+
+ gdb_test "print g_vC.vx" ".* = 10" "print g_vC.vx"
+}
+
+#
+# Single virtual inheritance, print type definitions.
+#
+
+proc test_ptype_vi {} {
+ global gdb_prompt
+ global nl
+
+ # This class does not use any C++-specific features, so it's fine for
+ # it to print as "struct".
+ send_gdb "ptype vA\n"
+ gdb_expect {
+ -re "type = class vA \{$nl\[ \]*public:$nl\[ \]*int va;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
+ pass "ptype vA"
+ }
+ -re "type = struct vA \{$nl\[ \]*int va;$nl\[ \]*int vx;$nl\}$nl$gdb_prompt $" {
+ pass "ptype vA"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype vA" }
+ timeout { fail "ptype vA (timeout)" ; return }
+ }
+
+ # This class does not use any C++-specific features, so it's fine for
+ # it to print as "struct".
+ send_gdb "ptype class vA\n"
+ gdb_expect {
+ -re "type = class vA \{$nl\[ \]*public:$nl\[ \]*int va;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
+ pass "ptype class vA"
+ }
+ -re "type = struct vA \{$nl\[ \]*int va;$nl\[ \]*int vx;$nl\}$nl$gdb_prompt $" {
+ pass "ptype class vA"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype class vA" }
+ timeout { fail "ptype class vA (timeout)" ; return }
+ }
+
+ # This class does not use any C++-specific features, so it's fine for
+ # it to print as "struct".
+ send_gdb "ptype g_vA\n"
+ gdb_expect {
+ -re "type = class vA \{$nl\[ \]*public:$nl\[ \]*int va;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
+ pass "ptype g_vA"
+ }
+ -re "type = struct vA \{$nl\[ \]*int va;$nl\[ \]*int vx;$nl\}$nl$gdb_prompt $" {
+ pass "ptype g_vA"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype g_vA" }
+ timeout { fail "ptype g_vA (timeout)" ; return }
+ }
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype vB" "ptype vB\[\r\n\]+type = class vB : public virtual vA \{$nl private:$nl\[ \]+vA \[*\]+_vb\[\\\$\.\]+vA;$nl public:$nl\[ \]+int vb;$nl\[ \]+int vx;$nl.*\}" "ptype vB"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype class vB" "type = class vB : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}" "ptype class vB"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype g_vB" "type = class vB : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}" "ptype g_vB"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype vC" "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}" "ptype vC"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype class vC" "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}" "ptype class vC"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype g_vC" "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}" "ptype g_vC"
+}
+
+#
+# Single virtual inheritance, print complete classes.
+#
+
+proc test_print_svi_classes {} {
+ global gdb_prompt
+ global hex
+ global decimal
+ global nl
+
+ # Print all members of g_vA.
+
+ gdb_test "print g_vA" ".* = \{va = 1, vx = 2\}" "print g_vA"
+
+ # Print all members of g_vB.
+
+ setup_xfail_format "DWARF 1"
+ send_gdb "print g_vB\n"
+ gdb_expect {
+ -re ".* = \{\<vA\> = \{va = 3, vx = 4\}, _vb\[\\\$\.\]vA = $hex, vb = 5, vx = 6\}$nl$gdb_prompt $" {
+ pass "print g_vB"
+ }
+ -re ".*invalid address 0x0.*$gdb_prompt $" {
+ # Does not happen with gcc cygnus-2.4.5-930828
+ fail "print g_vB (known bug with gcc cygnus-2.4.5-930417)"
+ # Many of the rest of these tests have the same problem.
+ return 0
+ }
+ -re ".*$gdb_prompt $" { fail "print g_vB" }
+ timeout { fail "print g_vB (timeout)" ; return }
+ }
+
+ # Print all members of g_vC.
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_vC" ".* = \{\<vA\> = \{va = 7, vx = 8\}, _vb\[\\\$\.\]vA = $hex, vc = 9, vx = 10\}" "print g_vC"
+}
+
+#
+# Multiple virtual inheritance, print individual members.
+#
+
+proc test_print_mvi_members {} {
+ global gdb_prompt
+ global decimal
+ global nl
+
+ # Print all members of g_vD.
+
+ setup_xfail_format "DWARF 1"
+ send_gdb "print g_vD.vA::va\n"
+ gdb_expect {
+ -re ".* = 19$nl$gdb_prompt $" { pass "print g_vD.vA::va" }
+ -re ".*virtual baseclass botch.*$gdb_prompt $" {
+ # Does not happen with gcc cygnus-2.4.5-930828
+ fail "print g_vD.vA::va (known bug with gcc cygnus-2.4.5-930417)"
+ # Many of the rest of these tests have the same problem.
+ return 0
+ }
+ -re ".*$gdb_prompt $" { fail "print g_vD.vA::va" }
+ timeout { fail "print g_vD.vA::va (timeout)" ; return }
+ }
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_vD.vA::vx" ".* = 20" "print g_vD.vA::vx"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_vD.vB::vb" ".* = 21" "print g_vD.vB::vb"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_vD.vB::vx" ".* = 22" "print g_vD.vB::vx"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_vD.vC::vc" ".* = 23" "print g_vD.vC::vc"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_vD.vC::vx" ".* = 24" "print g_vD.vC::vx"
+
+ gdb_test "print g_vD.vD::vd" ".* = 25" "print g_vD.vD::vd"
+
+ gdb_test "print g_vD.vD::vx" ".* = 26" "print g_vD.vD::vx"
+
+ # Print all members of g_vE.
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_vE.vA::va" ".* = 0" "print g_vE.vA::va"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_vE.vA::vx" ".* = 0" "print g_vE.vA::vx"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_vE.vB::vb" ".* = 0" "print g_vE.vB::vb"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_vE.vB::vx" ".* = 0" "print g_vE.vB::vx"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_vE.vC::vc" ".* = 0" "print g_vE.vC::vc"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_vE.vC::vx" ".* = 0" "print g_vE.vC::vx"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_vE.vD::vd" ".* = 0" "print g_vE.vD::vd"
+
+ gdb_test "print g_vE.vD::vx" ".* = 0" "print g_vE.vD::vx"
+
+ gdb_test "print g_vE.vE::ve" ".* = 27" "print g_vE.vE::ve"
+
+ gdb_test "print g_vE.vE::vx" ".* = 28" "print g_vE.vE::vx"
+}
+
+#
+# Multiple virtual inheritance, print type definitions.
+#
+
+proc test_ptype_mvi {} {
+ global nl
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype vD" "type = class vD : public virtual vB, public virtual vC \{$nl\[ \]*private:$nl\[ \]*vC \[*\]+_vb\[\\\$\.\]vC;$nl\[ \]*vB \[*\]+_vb\[\\\$\.\]vB;$nl\[ \]*public:$nl\[ \]*int vd;$nl\[ \]*int vx;$nl.*\}" "ptype vD"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype class vD" "type = class vD : public virtual vB, public virtual vC \{$nl\[ \]*private:$nl\[ \]*vC \[*\]+_vb\[\\\$\.\]vC;$nl\[ \]*vB \[*\]+_vb\[\\\$\.\]vB;$nl\[ \]*public:$nl\[ \]*int vd;$nl\[ \]*int vx;$nl.*\}" "ptype class vD"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype g_vD" "type = class vD : public virtual vB, public virtual vC \{$nl\[ \]*private:$nl\[ \]*vC \[*\]+_vb\[\\\$\.\]vC;$nl\[ \]*vB \[*\]+_vb\[\\\$\.\]vB;$nl\[ \]*public:$nl\[ \]*int vd;$nl\[ \]*int vx;$nl.*\}" "ptype g_vD"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype vE" "type = class vE : public virtual vD \{$nl\[ \]*private:$nl\[ \]*vD \[*\]+_vb\[\\\$\.\]vD;$nl\[ \]*public:$nl\[ \]*int ve;$nl\[ \]*int vx;$nl.*\}" "ptype vE"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype class vE" "type = class vE : public virtual vD \{$nl\[ \]*private:$nl\[ \]*vD \[*\]+_vb\[\\\$\.\]vD;$nl\[ \]*public:$nl\[ \]*int ve;$nl\[ \]*int vx;$nl.*\}" "ptype class vE"
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "ptype g_vE" "type = class vE : public virtual vD \{$nl\[ \]*private:$nl\[ \]*vD \[*\]+_vb\[\\\$\.\]vD;$nl\[ \]*public:$nl\[ \]*int ve;$nl\[ \]*int vx;$nl.*\}" "ptype g_vE"
+}
+
+#
+# Multiple virtual inheritance, print complete classes.
+#
+
+proc test_print_mvi_classes {} {
+ global gdb_prompt
+ global hex
+ global decimal
+ global nl
+
+ # Print all members of g_vD.
+
+ setup_xfail_format "DWARF 1"
+ send_gdb "print g_vD\n"
+ gdb_expect {
+ -re ".* = \{\<vB\> = \{\<vA\> = \{va = 19, vx = 20\}, _vb\[\\\$\.\]vA = $hex, vb = 21, vx = 22\}, \<vC\> = \{_vb\[\\\$\.\]vA = $hex, vc = 23, vx = 24\}, _vb\[\\\$\.\]vC = $hex, _vb\[\\\$\.\]vB = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" {
+ pass "print g_vD"
+ }
+ -re ".*invalid address 0x0.*$gdb_prompt $" {
+ # Does not happen with gcc cygnus-2.4.5-930828
+ fail "print g_vD (known bug with gcc cygnus-2.4.5-930417)"
+ # Many of the rest of these tests have the same problem.
+ return 0
+ }
+ -re ".*$gdb_prompt $" { fail "print g_vD" }
+ timeout { fail "print g_vD (timeout)" ; return }
+ }
+
+ # Print all members of g_vE.
+
+ setup_xfail_format "DWARF 1"
+ gdb_test "print g_vE" ".* = \{\<vD\> = \{\<vB\> = \{\<vA\> = \{va = 0, vx = 0\}, _vb\[\\\$\.\]vA = $hex, vb = 0, vx = 0\}, \<vC\> = \{_vb\[\\\$\.\]vA = $hex, vc = 0, vx = 0\}, _vb\[\\\$\.\]vC = $hex, _vb\[\\\$\.\]vB = $hex, vd = 0, vx = 0\}, _vb\[\\\$\.\]vD = $hex, ve = 27, vx = 28\}" "print g_vE"
+}
+
+proc do_tests {} {
+ global prms_id
+ global bug_id
+ global subdir
+ global objdir
+ global srcdir
+ global binfile
+
+ set prms_id 0
+ set bug_id 0
+
+ # Start with a fresh gdb.
+
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load $binfile
+
+ gdb_test "set language c++" ""
+ gdb_test "set width 0" ""
+
+ # Get the debug format for the compiled test case.
+
+ if { ![ runto_main] } {
+ gdb_suppress_tests;
+ } else {
+ get_debug_format
+ }
+
+ test_ptype_si
+ test_ptype_mi
+ test_ptype_vi
+ test_ptype_mvi
+
+ gdb_stop_suppressing_tests;
+
+ if { ![ runto 'inheritance2(void)' ] } {
+ gdb_suppress_tests;
+ }
+
+ test_print_si_members
+ test_print_si_classes
+ test_print_mi_members
+ test_print_mi_classes
+ test_print_anon_union
+
+ gdb_stop_suppressing_tests;
+
+ if { ![ runto 'inheritance4(void)' ] } {
+ gdb_suppress_tests;
+ }
+
+ test_print_svi_members
+ test_print_svi_classes
+ test_print_mvi_members
+ test_print_mvi_classes
+}
+
+do_tests
diff --git a/gdb/testsuite/gdb.c++/local.cc b/gdb/testsuite/gdb.c++/local.cc
new file mode 100644
index 00000000000..c811debdf97
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/local.cc
@@ -0,0 +1,67 @@
+// Tests for local types
+
+void marker1 (void)
+{
+}
+
+
+int foobar (int x)
+{
+ class Local {
+ public:
+ int loc1;
+ char loc_foo (char c)
+ {
+ return c + 3;
+ }
+ };
+
+ Local l;
+ static Local l1;
+ char c;
+
+ l.loc1 = 23;
+
+ c = l.loc_foo('x');
+ return c + 2;
+}
+
+int main()
+{
+ int c;
+
+ c = foobar (31);
+
+ { // inner block
+ class InnerLocal {
+ public:
+ char ilc;
+ int * ip;
+ int il_foo (unsigned const char & uccr)
+ {
+ return uccr + 333;
+ }
+ class NestedInnerLocal {
+ public:
+ int nil;
+ int nil_foo (int i)
+ {
+ return i * 27;
+ }
+ };
+ NestedInnerLocal nest1;
+ };
+
+ InnerLocal il;
+
+ il.ilc = 'b';
+ il.ip = &c;
+ }
+ marker1();
+}
+
+
+
+
+
+
diff --git a/gdb/testsuite/gdb.c++/local.exp b/gdb/testsuite/gdb.c++/local.exp
new file mode 100644
index 00000000000..0aa84683d80
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/local.exp
@@ -0,0 +1,110 @@
+# Copyright (C) 1998 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
+# (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
+
+# tests for local variables
+# Written by Satish Pai <pai@apollo.hp.com> 1997-07-08
+
+
+# This file is part of the gdb testsuite
+
+if $tracelevel then {
+ strace $tracelevel
+ }
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+set testfile "local"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+
+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."
+}
+
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+
+#
+# set it up at a breakpoint so we can play with the variable values
+#
+if ![runto_main] then {
+ perror "couldn't run to breakpoint"
+ continue
+}
+
+send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
+
+ send_gdb "cont\n"
+ gdb_expect {
+ -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
+ send_gdb "up\n"
+ gdb_expect {
+ -re ".*$gdb_prompt $" {}
+ timeout { fail "up from marker1" }
+ }
+ }
+ -re "$gdb_prompt $" { fail "continue to marker1" }
+ timeout { fail "(timeout) continue to marker1" }
+ }
+
+send_gdb "ptype Local\n"
+gdb_expect {
+ -re "type = class Local \{\r\n\[\t \]*public:\r\n\[\t \]*int loc1;\r\n\r\n\[\t \]*.char loc_foo\\(char\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.C:10\\).*$gdb_prompt $" { pass "ptype Local" }
+ -re "type = class Local \{\r\n\[\t \]*public:\r\n\[\t \]*int loc1;\r\n\r\n\[\t \]*.char loc_foo\\(char\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.C:\[0-9\]*\\).*$gdb_prompt $" { pass "ptype Local (incorrect line number?)" }
+ -re ".*$gdb_prompt $" { fail "ptype Local" }
+ timeout { fail "(timeout) ptype Local" }
+}
+
+send_gdb "ptype InnerLocal\n"
+gdb_expect {
+ -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(const unsigned char &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.C:36\\).*$gdb_prompt $" { pass "ptype InnerLocal" }
+ -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*class InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(const unsigned char &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.C:36\\).*$gdb_prompt $" { pass "ptype InnerLocal" }
+ -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(const unsigned char &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.C:\[0-9\]*\\).*$gdb_prompt $" { pass "ptype InnerLocal (incorrect line number?" }
+ -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*class InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(const unsigned char &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.C:\[0-9\]*\\).*$gdb_prompt $" { pass "ptype InnerLocal (incorrect line number?" }
+ -re ".*$gdb_prompt $" { fail "ptype InnerLocal" }
+ timeout { fail "(timeout) ptype InnerLocal" }
+}
+
+
+send_gdb "ptype NestedInnerLocal\n"
+gdb_expect {
+ -re "type = class InnerLocal::NestedInnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*int nil;\r\n\r\n\[\t \]*.int nil_foo\\(int\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.C:44\\).*$gdb_prompt $" { pass "ptype NestedInnerLocal" }
+ -re "type = class InnerLocal::NestedInnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*int nil;\r\n\r\n\[\t \]*.int nil_foo\\(int\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.C:\[0-9\]*\\).*$gdb_prompt $" { pass "ptype NestedInnerLocal (incorrect line number?)" }
+ -re "No symbol.*in current context.*$gdb_prompt $" { pass "ptype NestedInnerLocal (known aCC limitation)" }
+ -re ".*$gdb_prompt $" { fail "ptype NestedInnerLocal" }
+ timeout { fail "(timeout) ptype NestedInnerLocal" }
+}
+
+send_gdb "ptype InnerLocal::NestedInnerLocal\n"
+gdb_expect {
+ -re "type = class InnerLocal::NestedInnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*int nil;\r\n\r\n\[\t \]*.int nil_foo\\(int\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.C:44\\).*$gdb_prompt $" { pass "ptype InnerLocal::NestedInnerLocal" }
+ -re "type = class InnerLocal::NestedInnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*int nil;\r\n\r\n\[\t \]*.int nil_foo\\(int\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.C:\[0-9\]*\\).*$gdb_prompt $" { pass "ptype InnerLocal::NestedInnerLocal (incorrect line number?)" }
+ -re ".*$gdb_prompt $" { fail "ptype InnerLocal::NestedInnerLocal" }
+ timeout { fail "(timeout) ptype InnerLocal::NestedInnerLocal" }
+}
+
+
diff --git a/gdb/testsuite/gdb.c++/member-ptr.cc b/gdb/testsuite/gdb.c++/member-ptr.cc
new file mode 100644
index 00000000000..4beb92616d4
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/member-ptr.cc
@@ -0,0 +1,106 @@
+extern "C" {
+#include <stdio.h>
+}
+
+
+class A {
+public:
+ A();
+ int foo (int x);
+ int bar (int y);
+ virtual int baz (int z);
+ char c;
+ int j;
+ int jj;
+ static int s;
+};
+
+class B {
+public:
+ static int s;
+};
+
+int A::s = 10;
+int B::s = 20;
+
+A::A()
+{
+ c = 'x';
+ j = 5;
+}
+
+int A::foo (int dummy)
+{
+ j += 3;
+ return j + dummy;
+}
+
+int A::bar (int dummy)
+{
+ int r;
+ j += 13;
+ r = this->foo(15);
+ return r + j + 2 * dummy;
+}
+
+int A::baz (int dummy)
+{
+ int r;
+ j += 15;
+ r = this->foo(15);
+ return r + j + 12 * dummy;
+}
+
+int fum (int dummy)
+{
+ return 2 + 13 * dummy;
+}
+
+typedef int (A::*PMF)(int);
+
+typedef int A::*PMI;
+
+int main ()
+{
+ A a;
+ A * a_p;
+ PMF pmf;
+
+ PMF * pmf_p;
+ PMI pmi;
+
+ a.j = 121;
+ a.jj = 1331;
+
+ int k;
+
+ a_p = &a;
+
+ pmi = &A::j;
+ pmf = &A::bar;
+ pmf_p = &pmf;
+
+ pmi = NULL;
+
+ k = (a.*pmf)(3);
+
+ pmi = &A::jj;
+ pmf = &A::foo;
+ pmf_p = &pmf;
+
+ k = (a.*pmf)(4);
+
+ k = (a.**pmf_p)(5);
+
+ k = a.*pmi;
+
+
+ k = a.bar(2);
+
+ k += fum (4);
+
+ B b;
+
+ k += b.s;
+
+}
diff --git a/gdb/testsuite/gdb.c++/member-ptr.exp b/gdb/testsuite/gdb.c++/member-ptr.exp
new file mode 100644
index 00000000000..7b4dd7c1bf1
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/member-ptr.exp
@@ -0,0 +1,510 @@
+# Copyright (C) 1998 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
+# (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
+# Tests for pointer-to-member support
+# Written by Satish Pai <pai@apollo.hp.com> 1997-08-19
+
+# This file is part of the gdb testsuite
+
+
+if $tracelevel then {
+ strace $tracelevel
+ }
+
+#
+# test running programs
+#
+
+# Start with a fresh gdb
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+
+set prms_id 0
+set bug_id 0
+
+set testfile "member-ptr"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+
+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."
+}
+
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+
+if ![runto_main] then {
+ perror "couldn't run to breakpoint"
+ continue
+}
+
+send_gdb "break 83\n"
+gdb_expect {
+ -re "Breakpoint \[0-9\]*.*line 83\\.\r\n$gdb_prompt $" {
+ pass "set break at 83"
+ }
+ -re ".*$gdb_prompt $" { fail "set break at 83" }
+ timeout { fail "(timeout) set break at 83" }
+}
+
+send_gdb "continue\n"
+gdb_expect {
+ -re "Continuing\\.\r\n\r\nBreakpoint.*at.*member-ptr\\.cc:83\r\n83\[ \t]*pmi = NULL;\r\n$gdb_prompt $" {
+ pass "continue to 83"
+ }
+ -re ".*$gdb_prompt $" { fail "continue to 83" }
+ timeout { fail "(timeout) continue to 83" }
+}
+
+# ptype on pointer to data member
+
+send_gdb "ptype pmi\n"
+gdb_expect {
+ -re "type = int \\( A::\\*\\)\r\n$gdb_prompt $" {
+ pass "ptype pmi"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype pmi" }
+ timeout { fail "(timeout) ptype pmi" }
+}
+
+# print pointer to data member
+
+send_gdb "print pmi\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \\(int \\( A::\\*\\)\\) &A::j\r\n$gdb_prompt $" {
+ pass "print pmi"
+ }
+ -re ".*$gdb_prompt $" { fail "print pmi" }
+ timeout { fail "(timeout) print pmi" }
+}
+
+
+# print dereferenced pointer to data member
+
+send_gdb "print a.*pmi\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = 121\r\n$gdb_prompt $" {
+ pass "print a.*pmi"
+ }
+ -re ".*$gdb_prompt $" { fail "print a.*pmi" }
+ timeout { fail "(timeout) print a.*pmi" }
+}
+
+# print dereferenced pointer to data member
+# this time, dereferenced through a pointer
+
+send_gdb "print a_p->*pmi\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = 121\r\n$gdb_prompt $" {
+ pass "print a->*pmi"
+ }
+ -re ".*$gdb_prompt $" { fail "print a->*pmi" }
+ timeout { fail "(timeout) print a->*pmi" }
+}
+
+
+# set the pointer to data member
+
+send_gdb "set var pmi = &A::jj\n"
+gdb_expect {
+ -re "$gdb_prompt $" {
+ pass "set var (not really a pass)"
+ }
+ timeout { fail "(timeout) " }
+}
+
+# Now print the pointer again
+
+send_gdb "print pmi\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \\(int \\( A::\\*\\)\\) &A::jj\r\n$gdb_prompt $" {
+ pass "print pmi after setting"
+ }
+ -re ".*$gdb_prompt $" { fail "print pmi after setting" }
+ timeout { fail "(timeout) print pmi after setting" }
+}
+
+# print dereferenced pointer to data member again
+
+send_gdb "print a.*pmi\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = 1331\r\n$gdb_prompt $" {
+ pass "print a.*pmi after setting"
+ }
+ -re ".*$gdb_prompt $" { fail "print a.*pmi after setting" }
+ timeout { fail "(timeout) print a.*pmi after setting" }
+}
+
+# set the pointer to data member back to A::j
+
+send_gdb "set var pmi = &A::j\n"
+gdb_expect {
+ -re "$gdb_prompt $" {
+ pass "set var back to A::j (not really a pass)"
+ }
+ timeout { fail "(timeout) set var pmi" }
+}
+
+# print dereferenced pointer to data member yet again (extra check, why not)
+
+send_gdb "print a.*pmi\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = 121\r\n$gdb_prompt $" {
+ pass "print a.*pmi after resetting"
+ }
+ -re ".*$gdb_prompt $" { fail "print a.*pmi after resetting" }
+ timeout { fail "(timeout) print a.*pmi after resetting" }
+}
+
+# Set the data member pointed to.
+
+send_gdb "print a.*pmi = 33\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = 33\r\n$gdb_prompt $" {
+ pass "print command to set"
+ }
+ -re ".*$gdb_prompt $" { fail "print command to set" }
+ timeout { fail "(timeout) print command to set" }
+}
+
+# Now check that the data really was changed
+send_gdb "print a.*pmi\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = 33\r\n$gdb_prompt $" {
+ pass "print a.*pmi after setting member pointed to"
+ }
+ -re ".*$gdb_prompt $" { fail "print a.*pmi after setting member pointed to" }
+ timeout { fail "(timeout) print a.*pmi after setting member pointed to" }
+}
+
+# Double-check by printing a.
+send_gdb "print a\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \{c = 120 'x', j = 33, jj = 1331, static s = 10, Virtual table at $hex\}\r\n$gdb_prompt $" {
+ pass "print a after setting member pointed to by pmi"
+ }
+ -re ".*$gdb_prompt $" { fail "print a after setting member pointed to by pmi" }
+ timeout { fail "(timeout) print a after setting member pointed to by pmi" }
+}
+
+
+# Set the data member pointed to, using ->*
+
+send_gdb "print a_p->*pmi = 44\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = 44\r\n$gdb_prompt $" {
+ pass "print command to set (->)"
+ }
+ -re ".*$gdb_prompt $" { fail "print command to set (->)" }
+ timeout { fail "(timeout) print command to set (->)" }
+}
+
+# Now check that the data really was changed
+send_gdb "print a_p->*pmi\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = 44\r\n$gdb_prompt $" {
+ pass "print a_p->*pmi after setting member pointed to"
+ }
+ -re ".*$gdb_prompt $" { fail "print a_p->*pmi after setting member pointed to" }
+ timeout { fail "(timeout) print a_p->*pmi after setting member pointed to" }
+}
+
+# Double-check by printing a.
+send_gdb "print a\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \{c = 120 'x', j = 44, jj = 1331, static s = 10, Virtual table at $hex\}\r\n$gdb_prompt $" {
+ pass "print a after setting member pointed to by pmi (->) "
+ }
+ -re ".*$gdb_prompt $" { fail "print a after setting member pointed to by pmi (->) " }
+ timeout { fail "(timeout) print a after setting member pointed to by pmi (->) " }
+}
+
+
+# Do a ptype on the dereferenced pointer to member
+# pai/1997-08-20 Doesn't work
+
+# send_gdb "ptype a.*pmi\n"
+# gdb_expect {
+# -re "type = int\r\n$gdb_prompt $" {
+# pass "ptype a.*pmi"
+# }
+# -re ".*$gdb_prompt $" { fail "ptype a.*pmi" }
+# timeout { fail "(timeout) ptype a.*pmi" }
+#}
+
+# Try to dereference the pointer to data member without any object
+
+send_gdb "print *pmi\n"
+gdb_expect {
+ -re "Attempt to dereference pointer to member without an object\r\n$gdb_prompt $" {
+ pass "attempt to print ptr to member without object"
+ }
+ -re ".*$gdb_prompt $" { fail "attempt to print ptr to member without object" }
+ timeout { fail "(timeout) attempt to print ptr to member without object" }
+}
+
+# Try to ptype a dereference of the pointer to data member without any object
+
+send_gdb "ptype *pmi\n"
+gdb_expect {
+ -re "Attempt to dereference pointer to member without an object\r\n$gdb_prompt $" {
+ pass "attempt to ptype ptr to member without object"
+ }
+ -re ".*$gdb_prompt $" { fail "attempt to ptype ptr to member without object" }
+ timeout { fail "(timeout) attempt to ptype ptr to member without object" }
+}
+
+# Ptype a pointer to a method.
+
+send_gdb "ptype pmf\n"
+gdb_expect {
+ -re "type = int \\( A::\\*\\)\\(\\.\\.\\.\\)\r\n$gdb_prompt $" {
+ pass "ptype pmf"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype pmf" }
+ timeout { fail "(timeout) ptype pmf" }
+}
+
+# print a pointer to a method
+
+send_gdb "print pmf\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \\(int \\( A::\\*\\)\\(\\.\\.\\.\\)\\) \\?\\? <not supported with HP aCC>\r\n$gdb_prompt $" {
+ pass "print pmf"
+ }
+ -re ".*$gdb_prompt $" { fail "print pmf" }
+ timeout { fail "(timeout) print pmf" }
+}
+
+
+# Ptype a pointer to a pointer to a method
+
+send_gdb "ptype pmf_p\n"
+gdb_expect {
+ -re "type = int \\( A::\\*\\*\\)\\(\\.\\.\\.\\)\r\n$gdb_prompt $" {
+ pass "ptype pmf_p"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype pmf_p" }
+ timeout { fail "(timeout) ptype pmf_p" }
+}
+
+# print a pointer to a pointer to a method
+
+send_gdb "print pmf_p\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \\(int \\( A::\\*\\*\\)\\(\\.\\.\\.\\)\\) $hex\r\n$gdb_prompt $" {
+ pass "print pmf_p"
+ }
+ -re ".*$gdb_prompt $" { fail "print pmf_p" }
+ timeout { fail "(timeout) print pmf_p" }
+}
+
+# print dereferenced pointer to method
+
+send_gdb "print a.*pmf\n"
+gdb_expect {
+ -re "Pointers to methods not supported with HP aCC\r\n$gdb_prompt $" {
+ pass "print a.*pmf (known aCC limitation)"
+ }
+ -re ".*$gdb_prompt $" { fail "print a.*pmf -- ??" }
+ timeout { fail "(timeout) print a.*pmf" }
+}
+
+# print dereferenced pointer to method, using ->*
+
+send_gdb "print a_p->*pmf\n"
+gdb_expect {
+ -re "Pointers to methods not supported with HP aCC\r\n$gdb_prompt $" {
+ pass "print a_p->*pmf (known aCC limitation)"
+ }
+ -re ".*$gdb_prompt $" { fail "print a_p->*pmf -- ??" }
+ timeout { fail "(timeout) print a_p->*pmf" }
+}
+
+# set the pointer to data member
+
+send_gdb "set var pmf = &A::foo\n"
+gdb_expect {
+ -re "Assignment to pointers to methods not implemented with HP aCC\r\n$gdb_prompt $" {
+ pass "set var pmf (known aCC limitation)"
+ }
+ -re ".*$gdb_prompt $" { fail "set var pmf -- ??" }
+ timeout { fail "(timeout) set var pmf" }
+}
+
+# Try to dereference the pointer to method without any object
+
+send_gdb "print *pmf\n"
+gdb_expect {
+ -re "Attempt to dereference pointer to member without an object\r\n$gdb_prompt $" {
+ pass "attempt to print ptr to method without object"
+ }
+ -re ".*$gdb_prompt $" { fail "attempt to print ptr to method without object" }
+ timeout { fail "(timeout) attempt to print ptr to method without object" }
+}
+
+# Try to ptype a dereference of the pointer to method without any object
+
+send_gdb "ptype *pmi\n"
+gdb_expect {
+ -re "Attempt to dereference pointer to member without an object\r\n$gdb_prompt $" {
+ pass "attempt to ptype ptr to member without object"
+ }
+ -re ".*$gdb_prompt $" { fail "attempt to ptype ptr to member without object" }
+ timeout { fail "(timeout) attempt to ptype ptr to member without object" }
+}
+
+# Check cast of pointer to member to integer
+send_gdb "print (int) pmi\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = 8\r\n$gdb_prompt $" {
+ pass "casting pmi to int"
+ }
+ -re ".*$gdb_prompt $" { fail "casting pmi to int" }
+ timeout { fail "(timeout) casting pmi to int" }
+}
+
+# Check cast of pointer to method to integer
+send_gdb "print (int) pmf\n"
+gdb_expect {
+ -re "Pointers to methods not supported with HP aCC\r\n$gdb_prompt $" {
+ pass "casting pmf to int (known aCC limitation)"
+ }
+ -re ".*$gdb_prompt $" { fail "casting pmf to int -- ??" }
+ timeout { fail "(timeout) casting pmf to int" }
+}
+
+# Try to invoke a function through a pointer to data member
+send_gdb "print (a.*pmi)(3)\n"
+gdb_expect {
+ -re "Not implemented: function invocation through pointer to method with HP aCC\r\n$gdb_prompt $" {
+ pass "print (a.*pmi)(3) -- error message should be different"
+ }
+ -re ".*$gdb_prompt $" { fail "print (a.*pmi)(3) -- ???" }
+ timeout { fail "(timeout) print (a.*pmi)(3)" }
+}
+
+# Try to invoke a function through a pointer to a method
+send_gdb "print (a.*pmf)(3)\n"
+gdb_expect {
+ -re "Not implemented: function invocation through pointer to method with HP aCC\r\n$gdb_prompt $" {
+ pass "print (a.*pmi)(3) -- known aCC limitation"
+ }
+ -re ".*$gdb_prompt $" { fail "print (a.*pmf)(3) -- ???" }
+ timeout { fail "(timeout) print (a.*pmf)(3)" }
+}
+
+
+# Go past assignment of NULL to pmi
+send_gdb "next\n"
+gdb_expect {
+ -re "\r\n85\[ \t\]*k = \\(a.\\*pmf\\)\\(3\\);\r\n$gdb_prompt $" {
+ pass "next past 83"
+ }
+ -re ".*$gdb_prompt $" { fail "next past 83" }
+ timeout { fail "(timeout) next past 83" }
+}
+
+#send_gdb "print pmi\n"
+#gdb_expect {
+# -re "Attempted dereference of null pointer-to-member\r\n$gdb_prompt $" {
+# pass ""
+# }
+# -re ".*$gdb_prompt $" { fail "" }
+# timeout { fail "(timeout) " }
+#}
+
+# Dereference the null pointer to member
+send_gdb "print a.*pmi\n"
+gdb_expect {
+ -re "Attempted dereference of null pointer-to-member\r\n$gdb_prompt $" {
+ pass "print a.*NULL"
+ }
+ -re ".*$gdb_prompt $" { fail "print a.*NULL" }
+ timeout { fail "(timeout) print a.*NULL" }
+}
+
+
+# Go to another part of the program
+send_gdb "break 91\n"
+gdb_expect {
+ -re "Breakpoint \[0-9\]*.*line 91\\.\r\n$gdb_prompt $" {
+ pass "set break at 91"
+ }
+ -re ".*$gdb_prompt $" { fail "set break at 91" }
+ timeout { fail "(timeout) set break at 91" }
+}
+
+send_gdb "continue\n"
+gdb_expect {
+ -re "Continuing\\.\r\n\r\nBreakpoint.*at.*member-ptr\\.cc:91\r\n91\[ \t]*k = \\(a.\\*pmf\\)\\(4\\);\r\n$gdb_prompt $" {
+ pass "continue to 91"
+ }
+ -re ".*$gdb_prompt $" { fail "continue to 91" }
+ timeout { fail "(timeout) continue to 91" }
+}
+
+
+# Now check again that pmi works even when not set to
+# something that's at the beginning of the object
+
+send_gdb "print pmi\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \\(int \\( A::\\*\\)\\) &A::jj\r\n$gdb_prompt $" {
+ pass "print pmi (2)"
+ }
+ -re ".*$gdb_prompt $" { fail "print pmi (2)" }
+ timeout { fail "(timeout) print pmi (2)" }
+}
+
+
+# print dereferenced pointer to data member
+
+send_gdb "print a.*pmi\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = 1331\r\n$gdb_prompt $" {
+ pass "print a.*pmi (2)"
+ }
+ -re ".*$gdb_prompt $" { fail "print a.*pmi (2)" }
+ timeout { fail "(timeout) print a.*pmi (2)" }
+}
+
+# print dereferenced pointer to data member
+# this time, dereferenced through a pointer
+
+send_gdb "print a_p->*pmi\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = 1331\r\n$gdb_prompt $" {
+ pass "print a->*pmi"
+ }
+ -re ".*$gdb_prompt $" { fail "print a->*pmi (2)" }
+ timeout { fail "(timeout) print a->*pmi (2)" }
+}
+
+
+# p a.*pmf - fail
+
+# p pmi
+
+# p a.*pmi
+
diff --git a/gdb/testsuite/gdb.c++/method.cc b/gdb/testsuite/gdb.c++/method.cc
new file mode 100644
index 00000000000..949b027a02e
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/method.cc
@@ -0,0 +1,80 @@
+// Class funk has a constructor and an ordinary method
+// Test for CHFts23426
+
+class funk
+{
+public:
+ funk();
+ void getFunky(int a, int b);
+ int data_;
+};
+
+funk::funk()
+ : data_(33)
+{
+}
+
+void funk::getFunky(int a, int b)
+{
+ int res;
+ res = a + b - data_;
+ data_ = res;
+}
+
+// Class A has const and volatile methods
+
+class A {
+public:
+ int x;
+ int y;
+ int foo (int arg);
+ int bar (int arg) const;
+ int baz (int arg, char c) volatile;
+ int qux (int arg, float f) const volatile;
+};
+
+int A::foo (int arg)
+{
+ x += arg;
+ return arg *2;
+}
+
+int A::bar (int arg) const
+{
+ return arg + 2 * x;
+}
+
+int A::baz (int arg, char c) volatile
+{
+ return arg - 2 * x + c;
+}
+
+int A::qux (int arg, float f) const volatile
+{
+ if (f > 0)
+ return 2 * arg - x;
+ else
+ return 2 * arg + x;
+}
+
+
+int main()
+{
+ A a;
+ int k;
+
+ k = 10;
+ a.x = k * 2;
+
+ k = a.foo(13);
+
+ k += a.bar(15);
+
+ // Test for CHFts23426 follows
+ funk f;
+ f.getFunky(1, 2);
+ return 0;
+}
+
+
+
diff --git a/gdb/testsuite/gdb.c++/method.exp b/gdb/testsuite/gdb.c++/method.exp
new file mode 100644
index 00000000000..a3939dc0582
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/method.exp
@@ -0,0 +1,233 @@
+# Copyright (C) 1998 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
+# (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
+
+# tests for misc. C++ method stuff
+# Written by Satish Pai <pai@apollo.hp.com> 1997-07-08
+
+# This file is part of the gdb testsuite
+
+# This tests:
+# 0. method arguments are correct
+# 1. access to class data members inside method scopes
+# 2. correct param types for methods in ptype.
+# 3. const and volatile methods
+
+# (#0 and #1 above relate to an HP specific problem -- GDB must correctly
+# integrate FPARAM symbols in HP debug info into the local var list
+# for the function or method's block.)
+
+if $tracelevel then {
+ strace $tracelevel
+ }
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+set testfile "method"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+
+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."
+}
+
+
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+
+#
+# set it up at a breakpoint so we can play with the variable values
+#
+if ![runto_main] then {
+ perror "couldn't run to breakpoint"
+ continue
+}
+
+send_gdb "break A::foo\n"
+gdb_expect {
+ -re "Breakpoint \[0-9\]* at $hex.*file .*method.cc, line 38*\\.\r\n$gdb_prompt $" {
+ pass "set breakpoint on A::foo"
+ }
+ -re ".*$gdb_prompt $" { fail "set breakpoint on A::foo" }
+ timeout { fail "(timeout) set breakpoint on A::foo" }
+}
+
+send_gdb "continue\n"
+gdb_expect {
+ -re "Continuing\\.\r\n\r\nBreakpoint \[0-9\]*, A::foo \\(this=$hex, arg=13\\) at .*method\\.cc:38\r\n38\[\t \]*x \\+= arg;\r\n$gdb_prompt $" {
+ pass "continued and got breakpoint in A::foo"
+ }
+ -re ".*$gdb_prompt $" { fail "continuing and breaking in A::foo" }
+ timeout { fail "(timeout) continue" }
+}
+
+# Check ability to access this-relative stuff.
+
+send_gdb "print x\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = 20\r\n$gdb_prompt $" {
+ pass "access this-relative x (in foo)"
+ }
+ -re ".*$gdb_prompt $" { fail "print x (in foo)" }
+ timeout { fail "(timeout) print x (in foo)" }
+}
+
+# Check access to this pointer
+
+send_gdb "print this\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \\(A \\*\\) $hex\r\n$gdb_prompt $" {
+ pass "print this (in foo)"
+ }
+ -re ".*$gdb_prompt $" { fail "print this (in foo)" }
+ timeout { fail "(timeout) print this (in foo)" }
+}
+
+# Now do everything over again for A::bar, because sometimes processing one method
+# (the first one) is fine, but the second one's debug info gets munged beyond recognition.
+
+send_gdb "break A::bar\n"
+gdb_expect {
+ -re "Breakpoint \[0-9\]* at $hex.*file .*method.cc, line 44\\.\r\n$gdb_prompt $" {
+ pass "set breakpoint on A::bar"
+ }
+ -re ".*$gdb_prompt $" { fail "set breakpoint on A::bar" }
+ timeout { fail "(timeout) set breakpoint on A::bar" }
+}
+
+send_gdb "continue\n"
+gdb_expect {
+ -re "Continuing\\.\r\n\r\nBreakpoint \[0-9\]*, A::bar \\(this=$hex, arg=15\\) at .*method\\.cc:44\r\n44\[\t \]*return arg \\+ 2 \\* x;\r\n$gdb_prompt $" {
+ pass "continued and got breakpoint in A::bar"
+ }
+ -re ".*$gdb_prompt $" { fail "continuing and breaking in A::bar" }
+ timeout { fail "(timeout) continue" }
+}
+
+# Check ability to access this-relative stuff.
+
+send_gdb "print x\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = 33\r\n$gdb_prompt $" {
+ pass "access this-relative x (in bar)"
+ }
+ -re ".*$gdb_prompt $" { fail "print x (in bar)" }
+ timeout { fail "(timeout) print x (in bar)" }
+}
+
+# Check access to this pointer
+
+send_gdb "print this\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \\(const class A \\*\\) $hex\r\n$gdb_prompt $" {
+ pass "print this (in bar)"
+ }
+ -re ".*$gdb_prompt $" { fail "print this (in bar)" }
+ timeout { fail "(timeout) print this (in bar)" }
+}
+
+# Check again with funk::getFunky (this is the original test case
+# for CHFts23426); sometimes having a constructor with no arguments
+# will nuke the debug info read in for other methods in the class.
+
+send_gdb "break funk::getFunky\n"
+gdb_expect {
+ -re "Breakpoint \[0-9\]* at $hex.*file .*method.cc, line 20\\.\r\n$gdb_prompt $" {
+ pass "set breakpoint on funk::getFunky"
+ }
+ -re ".*$gdb_prompt $" { fail "set breakpoint on funk::getfunky" }
+ timeout { fail "(timeout) set breakpoint on funk::getfunky" }
+}
+
+send_gdb "continue\n"
+gdb_expect {
+ -re "Continuing\\.\r\n\r\nBreakpoint \[0-9\]*, funk::getFunky \\(this=$hex, a=1, b=2\\) at .*method\\.cc:20\r\n20\[\t \]*res = a \\+ b - data_;\r\n$gdb_prompt $" {
+ pass "continued and got breakpoint in funk::getfunky"
+ }
+ -re ".*$gdb_prompt $" { fail "continuing and breaking in funk::getfunky" }
+ timeout { fail "(timeout) continue" }
+}
+
+# Check ability to access this-relative stuff.
+
+send_gdb "print data_\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = 33\r\n$gdb_prompt $" {
+ pass "access this-relative data_ in getFunky"
+ }
+ -re ".*$gdb_prompt $" { fail "print data_ in getFunky" }
+ timeout { fail "(timeout) print data_ in getFunky" }
+}
+
+# Check access to this pointer
+
+send_gdb "print this\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \\(funk \\*\\) $hex\r\n$gdb_prompt $" {
+ pass "print this in getFunky"
+ }
+ -re ".*$gdb_prompt $" { fail "print this in getfunky" }
+ timeout { fail "(timeout) print this in getfunky" }
+}
+
+# Check access to local variable
+
+send_gdb "print res\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \[0-9\]*\r\n$gdb_prompt $" {
+ pass "print res in getFunky"
+ }
+ -re ".*$gdb_prompt $" { fail "print res in getfunky" }
+ timeout { fail "(timeout) print res in getfunky" }
+}
+
+
+# Check ptype of class -- should show const/volatile methods
+
+send_gdb "ptype A\n"
+gdb_expect {
+ -re "type = class A \{\r\n\[ \]*public:\r\n\[ \]*int x;\r\n\[ \]*int y;\r\n\r\n\\[ \]*A & operator=\\(A const &\\);\r\n\[ \]*A\\(A const &\\)\r\n\[ \]*A\\(void\\)\r\n[ \]*int foo\\(int\\);\r\n\[ \]*int bar\\(int\\) const;\r\n\[ \]*int baz\\(int, char\\) volatile;\r\n\[ \]*int qux\\(int, float\\) const volatile;\r\n\}\r\n$gdb_prompt $" {
+ pass "ptype A"
+ }
+ -re "type = class A \{\r\n\[ \]*public:\r\n\[ \]*int x;\r\n\[ \]*int y;\r\n\r\n\[ \]*int foo\\(int\\);\r\n\[ \]*int bar\\(int\\) const;\r\n\[ \]*int baz\\(int, char\\);\r\n\[ \]*int qux\\(int, float\\) const;\r\n\}\r\n$gdb_prompt $" {
+ pass "ptype A (HP aCC bug -- volatile not indicated)"
+ }
+ -re "type = class A \{\r\n\[ \]*public:\r\n\[ \]*int x;\r\n\[ \]*int y;\r\n\r\n\[ \]*int foo\\(int\\);\r\n\[ \]*int bar\\(int\\) const;\r\n\[ \]*int baz\\(int, char\\) volatile;\r\n\[ \]*int qux\\(int, float\\) const volatile;\r\n\}\r\n$gdb_prompt $" {
+ pass "ptype A"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype A" }
+ timeout { fail "(timeout) ptype A" }
+}
+
+send_gdb "cont\n"
+gdb_expect {
+ -re "Continuing.\r\n\r\nProgram exited normally.\r\n$gdb_prompt $" {
+ pass "finish program"
+ }
+ -re "$gdb_prompt $" { fail "finish program" }
+ timeout { fail "(timeout) finish program" }
+}
+
diff --git a/gdb/testsuite/gdb.c++/misc.cc b/gdb/testsuite/gdb.c++/misc.cc
new file mode 100644
index 00000000000..ffeb73962fd
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/misc.cc
@@ -0,0 +1,517 @@
+// Test various -*- C++ -*- things.
+
+typedef struct fleep fleep;
+struct fleep { int a; } s;
+
+// ====================== simple class structures =======================
+
+struct default_public_struct {
+ // defaults to public:
+ int a;
+ int b;
+};
+
+struct explicit_public_struct {
+ public:
+ int a;
+ int b;
+};
+
+struct protected_struct {
+ protected:
+ int a;
+ int b;
+};
+
+struct private_struct {
+ private:
+ int a;
+ int b;
+};
+
+struct mixed_protection_struct {
+ public:
+ int a;
+ int b;
+ private:
+ int c;
+ int d;
+ protected:
+ int e;
+ int f;
+ public:
+ int g;
+ private:
+ int h;
+ protected:
+ int i;
+};
+
+class public_class {
+ public:
+ int a;
+ int b;
+};
+
+class protected_class {
+ protected:
+ int a;
+ int b;
+};
+
+class default_private_class {
+ // defaults to private:
+ int a;
+ int b;
+};
+
+class explicit_private_class {
+ private:
+ int a;
+ int b;
+};
+
+class mixed_protection_class {
+ public:
+ int a;
+ int b;
+ private:
+ int c;
+ int d;
+ protected:
+ int e;
+ int f;
+ public:
+ int g;
+ private:
+ int h;
+ protected:
+ int i;
+};
+
+class const_vol_method_class {
+public:
+ int a;
+ int b;
+ int foo (int &) const;
+ int bar (int &) volatile;
+ int baz (int &) const volatile;
+};
+
+int const_vol_method_class::foo (int & ir) const
+{
+ return ir + 3;
+}
+int const_vol_method_class::bar (int & ir) volatile
+{
+ return ir + 4;
+}
+int const_vol_method_class::baz (int & ir) const volatile
+{
+ return ir + 5;
+}
+
+// ========================= simple inheritance ==========================
+
+class A {
+ public:
+ int a;
+ int x;
+};
+
+A g_A;
+
+class B : public A {
+ public:
+ int b;
+ int x;
+};
+
+B g_B;
+
+class C : public A {
+ public:
+ int c;
+ int x;
+};
+
+C g_C;
+
+class D : public B, public C {
+ public:
+ int d;
+ int x;
+};
+
+D g_D;
+
+class E : public D {
+ public:
+ int e;
+ int x;
+};
+
+E g_E;
+
+class class_with_anon_union
+{
+ public:
+ int one;
+ union
+ {
+ int a;
+ long b;
+ };
+};
+
+class_with_anon_union g_anon_union;
+
+void inheritance2 (void)
+{
+}
+
+void inheritance1 (void)
+{
+ int ival;
+ int *intp;
+
+ // {A::a, A::x}
+
+ g_A.A::a = 1;
+ g_A.A::x = 2;
+
+ // {{A::a,A::x},B::b,B::x}
+
+ g_B.A::a = 3;
+ g_B.A::x = 4;
+ g_B.B::b = 5;
+ g_B.B::x = 6;
+
+ // {{A::a,A::x},C::c,C::x}
+
+ g_C.A::a = 7;
+ g_C.A::x = 8;
+ g_C.C::c = 9;
+ g_C.C::x = 10;
+
+ // {{{A::a,A::x},B::b,B::x},{{A::a,A::x},C::c,C::x},D::d,D::x}
+
+ // The following initialization code is non-portable, but allows us
+ // to initialize all members of g_D until we can fill in the missing
+ // initialization code with legal C++ code.
+
+ for (intp = (int *) &g_D, ival = 11;
+ intp < ((int *) &g_D + sizeof (g_D) / sizeof (int));
+ intp++, ival++)
+ {
+ *intp = ival;
+ }
+
+ // Overlay the nonportable initialization with legal initialization.
+
+ // ????? = 11; (g_D.A::a = 11; is ambiguous)
+ // ????? = 12; (g_D.A::x = 12; is ambiguous)
+ g_D.B::b = 13;
+ g_D.B::x = 14;
+ // ????? = 15;
+ // ????? = 16;
+ g_D.C::c = 17;
+ g_D.C::x = 18;
+ g_D.D::d = 19;
+ g_D.D::x = 20;
+
+
+ // {{{{A::a,A::x},B::b,B::x},{{A::a,A::x},C::c,C::x},D::d,D::x}},E::e,E::x}
+
+ // The following initialization code is non-portable, but allows us
+ // to initialize all members of g_D until we can fill in the missing
+ // initialization code with legal C++ code.
+
+ for (intp = (int *) &g_E, ival = 21;
+ intp < ((int *) &g_E + sizeof (g_E) / sizeof (int));
+ intp++, ival++)
+ {
+ *intp = ival;
+ }
+
+ // Overlay the nonportable initialization with legal initialization.
+
+ // ????? = 21; (g_E.A::a = 21; is ambiguous)
+ // ????? = 22; (g_E.A::x = 22; is ambiguous)
+ g_E.B::b = 23;
+ g_E.B::x = 24;
+ // ????? = 25;
+ // ????? = 26;
+ g_E.C::c = 27;
+ g_E.C::x = 28;
+ g_E.D::d = 29;
+ g_E.D::x = 30;
+ g_E.E::e = 31;
+ g_E.E::x = 32;
+
+ g_anon_union.one = 1;
+ g_anon_union.a = 2;
+
+ inheritance2 ();
+}
+
+// ======================== virtual base classes=========================
+
+class vA {
+ public:
+ int va;
+ int vx;
+};
+
+vA g_vA;
+
+class vB : public virtual vA {
+ public:
+ int vb;
+ int vx;
+};
+
+vB g_vB;
+
+class vC : public virtual vA {
+ public:
+ int vc;
+ int vx;
+};
+
+vC g_vC;
+
+class vD : public virtual vB, public virtual vC {
+ public:
+ int vd;
+ int vx;
+};
+
+vD g_vD;
+
+class vE : public virtual vD {
+ public:
+ int ve;
+ int vx;
+};
+
+vE g_vE;
+
+void inheritance4 (void)
+{
+}
+
+void inheritance3 (void)
+{
+ int ival;
+ int *intp;
+
+ // {vA::va, vA::vx}
+
+ g_vA.vA::va = 1;
+ g_vA.vA::vx = 2;
+
+ // {{vA::va, vA::vx}, vB::vb, vB::vx}
+
+ g_vB.vA::va = 3;
+ g_vB.vA::vx = 4;
+ g_vB.vB::vb = 5;
+ g_vB.vB::vx = 6;
+
+ // {{vA::va, vA::vx}, vC::vc, vC::vx}
+
+ g_vC.vA::va = 7;
+ g_vC.vA::vx = 8;
+ g_vC.vC::vc = 9;
+ g_vC.vC::vx = 10;
+
+ // {{{{vA::va, vA::vx}, vB::vb, vB::vx}, vC::vc, vC::vx}, vD::vd,vD::vx}
+
+ g_vD.vA::va = 11;
+ g_vD.vA::vx = 12;
+ g_vD.vB::vb = 13;
+ g_vD.vB::vx = 14;
+ g_vD.vC::vc = 15;
+ g_vD.vC::vx = 16;
+ g_vD.vD::vd = 17;
+ g_vD.vD::vx = 18;
+
+
+ // {{{{{vA::va,vA::vx},vB::vb,vB::vx},vC::vc,vC::vx},vD::vd,vD::vx},vE::ve,vE::vx}
+
+ g_vD.vA::va = 19;
+ g_vD.vA::vx = 20;
+ g_vD.vB::vb = 21;
+ g_vD.vB::vx = 22;
+ g_vD.vC::vc = 23;
+ g_vD.vC::vx = 24;
+ g_vD.vD::vd = 25;
+ g_vD.vD::vx = 26;
+ g_vE.vE::ve = 27;
+ g_vE.vE::vx = 28;
+
+ inheritance4 ();
+}
+
+// ======================================================================
+
+class Base1 {
+ public:
+ int x;
+ Base1(int i) { x = i; }
+};
+
+class Foo
+{
+ public:
+ int x;
+ int y;
+ static int st;
+ Foo (int i, int j) { x = i; y = j; }
+ int operator! ();
+ operator int ();
+ int times (int y);
+};
+
+class Bar : public Base1, public Foo {
+ public:
+ int z;
+ Bar (int i, int j, int k) : Base1 (10*k), Foo (i, j) { z = k; }
+};
+
+class ClassWithEnum {
+public:
+ enum PrivEnum { red, green, blue, yellow = 42 };
+ PrivEnum priv_enum;
+ int x;
+};
+
+int Foo::operator! () { return !x; }
+
+int Foo::times (int y) { return x * y; }
+
+int Foo::st = 100;
+
+Foo::operator int() { return x; }
+
+Foo foo(10, 11);
+Bar bar(20, 21, 22);
+
+class Contains_static_instance
+{
+ public:
+ int x;
+ int y;
+ Contains_static_instance (int i, int j) { x = i; y = j; }
+ static Contains_static_instance null;
+};
+
+Contains_static_instance Contains_static_instance::null(0,0);
+Contains_static_instance csi(10,20);
+
+class Contains_nested_static_instance
+{
+ public:
+ class Nested
+ {
+ public:
+ Nested(int i) : z(i) {}
+ int z;
+ static Contains_nested_static_instance xx;
+ };
+
+ Contains_nested_static_instance(int i, int j) : x(i), y(j) {}
+
+ int x;
+ int y;
+
+ static Contains_nested_static_instance null;
+ static Nested yy;
+};
+
+Contains_nested_static_instance Contains_nested_static_instance::null(0, 0);
+Contains_nested_static_instance::Nested Contains_nested_static_instance::yy(5);
+Contains_nested_static_instance
+ Contains_nested_static_instance::Nested::xx(1,2);
+Contains_nested_static_instance cnsi(30,40);
+
+typedef struct {
+ int one;
+ int two;
+} tagless_struct;
+tagless_struct v_tagless;
+
+/* Try to get the compiler to allocate a class in a register. */
+class small {
+ public:
+ int x;
+ int method ();
+};
+
+int
+small::method ()
+{
+ return x + 5;
+}
+
+void marker_reg1 () {}
+
+int
+register_class ()
+{
+ /* We don't call any methods for v, so gcc version cygnus-2.3.3-930220
+ might put this variable in a register. This is a lose, though, because
+ it means that GDB can't call any methods for that variable. */
+ register small v;
+
+ int i;
+
+ /* Perform a computation sufficiently complicated that optimizing compilers
+ won't optimized out the variable. If some compiler constant-folds this
+ whole loop, maybe using a parameter to this function here would help. */
+ v.x = 0;
+ for (i = 0; i < 13; ++i)
+ v.x += i;
+ --v.x; /* v.x is now 77 */
+ marker_reg1 ();
+ return v.x + 5;
+}
+
+int
+main()
+{
+#ifdef usestubs
+ set_debug_traps();
+ breakpoint();
+#endif
+ inheritance1 ();
+ inheritance3 ();
+ register_class ();
+
+ /* FIXME: pmi gets optimized out. Need to do some more computation with
+ it or something. (No one notices, because the test is xfail'd anyway,
+ but that probably won't always be true...). */
+ int Foo::* pmi = &Foo::y;
+
+ /* Make sure the AIX linker doesn't remove the variable. */
+ v_tagless.one = 5;
+
+ /* Class with enumeration inside it */
+ ClassWithEnum obj_with_enum;
+ obj_with_enum.priv_enum = ClassWithEnum::green;
+
+ return foo.*pmi;
+}
+
+/* Create an instance for some classes, otherwise they get optimized away. */
+
+default_public_struct default_public_s;
+explicit_public_struct explicit_public_s;
+protected_struct protected_s;
+private_struct private_s;
+mixed_protection_struct mixed_protection_s;
+public_class public_c;
+protected_class protected_c;
+default_private_class default_private_c;
+explicit_private_class explicit_private_c;
+mixed_protection_class mixed_protection_c;
diff --git a/gdb/testsuite/gdb.c++/misc.exp b/gdb/testsuite/gdb.c++/misc.exp
new file mode 100644
index 00000000000..6090fbb3c2a
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/misc.exp
@@ -0,0 +1,106 @@
+# Copyright (C) 1992, 1994, 1997 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
+# (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
+
+# This file was written by Fred Fish. (fnf@cygnus.com)
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# Check to see if we have an executable to test. If not, then either we
+# haven't tried to compile one, or the compilation failed for some reason.
+# In either case, just notify the user and skip the tests in this file.
+
+set testfile "misc"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+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."
+}
+
+#
+# Deduce language of main()
+#
+
+proc deduce_language_of_main {} {
+ global gdb_prompt
+
+ # See what language gdb thinks main() is, prior to reading full symbols.
+ # I think this fails for COFF targets.
+ setup_xfail "a29k-*-udi"
+ send_gdb "show language\n"
+ gdb_expect {
+ -re ".* source language is \"auto; currently c\[+\]+\".*$gdb_prompt $" {
+ pass "deduced language is C++, before full symbols"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "source language not correct for C++ (psymtabs only)"
+ return
+ }
+ timeout {
+ fail "can't show language (timeout)"
+ return
+ }
+ }
+
+ runto_main
+
+ # See if our idea of the language has changed.
+
+ send_gdb "show language\n"
+ gdb_expect {
+ -re ".* source language is \"auto; currently c\[+\]+\".*$gdb_prompt $" {
+ pass "deduced language is C++, after full symbols"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "source language not correct for C++ (full symbols)"
+ return
+ }
+ timeout {
+ fail "can't show language (timeout)"
+ return
+ }
+ }
+}
+
+proc do_tests {} {
+ global prms_id
+ global bug_id
+ global subdir
+ global objdir
+ global srcdir
+ global binfile
+ global gdb_prompt
+
+ set prms_id 0
+ set bug_id 0
+
+ # Start with a fresh gdb.
+
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load $binfile
+
+ deduce_language_of_main
+ # Check for fixes for PRs 8916 and 8630
+ gdb_test "print s.a" ".* = 0" "print s.a for foo struct (known gcc 2.7.2 and earlier bug)"
+}
+
+do_tests
diff --git a/gdb/testsuite/gdb.c++/overload.cc b/gdb/testsuite/gdb.c++/overload.cc
new file mode 100644
index 00000000000..40feb3b5e84
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/overload.cc
@@ -0,0 +1,151 @@
+#include <stddef.h>
+
+class foo {
+public:
+ foo (int);
+ foo (int, const char *);
+ foo (foo&);
+ ~foo ();
+ void foofunc (int);
+ void foofunc (int, signed char *);
+ int ifoo;
+ const char *ccpfoo;
+
+int overload1arg (void);
+int overload1arg (char);
+int overload1arg (signed char);
+int overload1arg (unsigned char);
+int overload1arg (short);
+int overload1arg (unsigned short);
+int overload1arg (int);
+int overload1arg (unsigned int);
+int overload1arg (long);
+int overload1arg (unsigned long);
+int overload1arg (float);
+int overload1arg (double);
+
+int overloadargs (int a1);
+int overloadargs (int a1, int a2);
+int overloadargs (int a1, int a2, int a3);
+int overloadargs (int a1, int a2, int a3, int a4);
+int overloadargs (int a1, int a2, int a3, int a4, int a5);
+int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6);
+int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7);
+int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8);
+int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9);
+int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
+ int a8, int a9, int a10);
+int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
+ int a8, int a9, int a10, int a11);
+
+
+};
+
+void marker1()
+{}
+
+int main ()
+{
+ char arg2 = 2;
+ signed char arg3 =3;
+ unsigned char arg4 =4;
+ short arg5 =5;
+ unsigned short arg6 =6;
+ int arg7 =7;
+ unsigned int arg8 =8;
+ long arg9 =9;
+ unsigned long arg10 =10;
+ float arg11 =100.0;
+ double arg12 = 200.0;
+
+ char *str = "A";
+ foo foo_instance1(111);
+ foo foo_instance2(222, str);
+ foo foo_instance3(foo_instance2);
+
+ #ifdef usestubs
+ set_debug_traps();
+ breakpoint();
+ #endif
+
+
+ marker1();
+ return 0;
+}
+
+foo::foo (int i) { ifoo = i; ccpfoo = NULL; }
+foo::foo (int i, const char *ccp) { ifoo = i; ccpfoo = ccp; }
+foo::foo (foo& afoo) { ifoo = afoo.ifoo; ccpfoo = afoo.ccpfoo;}
+foo::~foo () {}
+
+
+/* Some functions to test overloading by varying one argument type. */
+
+int foo::overload1arg (void) { return 1; }
+int foo::overload1arg (char arg) { arg = 0; return 2;}
+int foo::overload1arg (signed char arg) { arg = 0; return 3;}
+int foo::overload1arg (unsigned char arg) { arg = 0; return 4;}
+int foo::overload1arg (short arg) { arg = 0; return 5;}
+int foo::overload1arg (unsigned short arg) { arg = 0; return 6;}
+int foo::overload1arg (int arg) { arg = 0; return 7;}
+int foo::overload1arg (unsigned int arg) { arg = 0; return 8;}
+int foo::overload1arg (long arg) { arg = 0; return 9;}
+int foo::overload1arg (unsigned long arg) { arg = 0; return 10;}
+int foo::overload1arg (float arg) { arg = 0; return 11;}
+int foo::overload1arg (double arg) { arg = 0; return 12;}
+
+
+/* Some functions to test overloading by varying argument count. */
+
+int foo::overloadargs (int a1)
+{ a1 = 0;
+return 1;}
+
+int foo::overloadargs (int a1, int a2)
+{ a1 = a2 = 0;
+return 2;}
+
+int foo::overloadargs (int a1, int a2, int a3)
+{ a1 = a2 = a3 = 0;
+return 3;}
+
+int foo::overloadargs (int a1, int a2, int a3, int a4)
+{ a1 = a2 = a3 = a4 = 0;
+return 4;}
+
+int foo::overloadargs (int a1, int a2, int a3, int a4, int a5)
+{ a1 = a2 = a3 = a4 = a5 = 0;
+return 5;}
+
+int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6)
+{ a1 = a2 = a3 = a4 = a5 = a6 = 0;
+return 6;}
+
+int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7)
+{ a1 = a2 = a3 = a4 = a5 = a6 = a7 = 0;
+return 7;}
+
+int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
+ int a8)
+{ a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = 0;
+return 8;}
+
+int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
+ int a8, int a9)
+{
+ a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = 0;
+ return 9;
+}
+
+int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
+ int a8, int a9, int a10)
+ { a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 =
+ a10 = 0; return 10;}
+
+int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
+ int a8, int a9, int a10, int a11)
+ { a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 =
+ a10 = a11 = 0; return 11;}
+
+
+
diff --git a/gdb/testsuite/gdb.c++/overload.exp b/gdb/testsuite/gdb.c++/overload.exp
new file mode 100644
index 00000000000..b1ddb16303a
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/overload.exp
@@ -0,0 +1,338 @@
+# Copyright (C) 1998 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
+# (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
+
+# written by Elena Zannoni (ezannoni@cygnus.com)
+
+# This file is part of the gdb testsuite
+#
+# tests for overloaded member functions. Command Line calls
+#
+
+
+if $tracelevel then {
+ strace $tracelevel
+ }
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+set testfile "overload"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+
+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."
+}
+
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+# set it up at a breakpoint so we can play with the variable values
+#
+if ![runto_main] then {
+ perror "couldn't run to breakpoint"
+ continue
+}
+
+send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
+
+ send_gdb "cont\n"
+ gdb_expect {
+ -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
+ send_gdb "up\n"
+ gdb_expect {
+ -re ".*$gdb_prompt $" {}
+ timeout { fail "up from marker1" }
+ }
+ }
+ -re "$gdb_prompt $" { fail "continue to marker1" }
+ timeout { fail "(timeout) continue to marker1" }
+ }
+
+
+send_gdb "print foo_instance1\n"
+gdb_expect {
+ -re ".\[0-9\]* = \{ifoo = 111, ccpfoo = 0x0\}\r\n$gdb_prompt $" {
+ pass "print foo_instance1"
+ }
+ -re ".*$gdb_prompt $" { fail "print foo_instance1" }
+ timeout { fail "(timeout) print foo_instance1" }
+ }
+
+
+send_gdb "ptype foo_instance1\n"
+gdb_expect {
+ -re "type = class foo \{.*public:.*int ifoo;.*const char \\*ccpfoo;.*foo\\(int\\);.*foo\\(int, (const char|char const) \\*\\);.*foo\\(foo &\\);.*~foo\\(void\\);.*void foofunc\\(int\\);.*void foofunc\\(int, signed char \\*\\);.*int overload1arg\\(void\\);.*int overload1arg\\(char\\);.*int overload1arg\\(signed char\\);.*int overload1arg\\(unsigned char\\);.*int overload1arg\\(short\\);.*int overload1arg\\(unsigned short\\);.*int overload1arg\\(int\\);.*int overload1arg\\(unsigned int\\);.*int overload1arg\\(long\\);.*int overload1arg\\(unsigned long\\);.*int overload1arg\\(float\\);.*int overload1arg\\(double\\);.*int overloadargs\\(int\\);.*int overloadargs\\(int, int\\);.*int overloadargs\\(int, int, int\\);.*int overloadargs\\(int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int, int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int, int, int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int, int, int, int, int, int, int\\);\r\n\}\r\n$gdb_prompt $" {
+ pass "ptype foo_instance1 (HP aCC -- known quirk with ~foo parameter list)"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype foo_instance1" }
+ timeout { fail "(timeout) ptype foo_instance1" }
+ }
+
+send_gdb "print foo_instance2\n"
+gdb_expect {
+ -re ".\[0-9\]* = \{ifoo = 222, ccpfoo = $hex \"A\"\}\r\n$gdb_prompt $" {
+ pass "print foo_instance2"
+ }
+ -re ".*$gdb_prompt $" { fail "print foo_instance2" }
+ timeout { fail "(timeout) print foo_instance2" }
+ }
+
+send_gdb "print foo_instance3\n"
+gdb_expect {
+ -re ".\[0-9\]* = \{ifoo = 222, ccpfoo = $hex \"A\"\}\r\n$gdb_prompt $" {
+ pass "print foo_instance3"
+ }
+ -re ".*$gdb_prompt $" { fail "print foo_instance3" }
+ timeout { fail "(timeout) print foo_instance3" }
+ }
+
+
+
+send_gdb "print foo_instance1.overloadargs(1)\n"
+gdb_expect {
+ -re ".\[0-9\]* = 1\r\n$gdb_prompt $" {
+ pass "print call overloaded func 1 arg"
+ }
+ -re ".*$gdb_prompt $" { fail "print call overloaded func 1 arg" }
+ timeout { fail "(timeout) print call overloaded func 1 arg" }
+ }
+
+send_gdb "print foo_instance1.overloadargs(1, 2)\n"
+gdb_expect {
+ -re ".\[0-9\]* = 2\r\n$gdb_prompt $" {
+ pass "print call overloaded func 2 args"
+ }
+ -re ".*$gdb_prompt $" { fail "print call overloaded func 2 args" }
+ timeout { fail "(timeout) print call overloaded func 2 args" }
+ }
+
+
+send_gdb "print foo_instance1.overloadargs(1, 2, 3)\n"
+gdb_expect {
+ -re ".\[0-9\]* = 3\r\n$gdb_prompt $" {
+ pass "print call overloaded func 3 args"
+ }
+ -re ".*$gdb_prompt $" { fail "print call overloaded func 3 args" }
+ timeout { fail "(timeout) print call overloaded func 3 args" }
+ }
+
+
+send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4)\n"
+gdb_expect {
+ -re ".\[0-9\]* = 4\r\n$gdb_prompt $" {
+ pass "print call overloaded func 4 args"
+ }
+ -re ".*$gdb_prompt $" { fail "print call overloaded func 4 args" }
+ timeout { fail "(timeout) print call overloaded func 4 args" }
+ }
+
+
+send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5)\n"
+gdb_expect {
+ -re ".\[0-9\]* = 5\r\n$gdb_prompt $" {
+ pass "print call overloaded func 5 args"
+ }
+ -re ".*$gdb_prompt $" { fail "print call overloaded func 5 args" }
+ timeout { fail "(timeout) print call overloaded func 5 args" }
+ }
+
+
+send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6)\n"
+gdb_expect {
+ -re ".\[0-9\]* = 6\r\n$gdb_prompt $" {
+ pass "print call overloaded func 6 args"
+ }
+ -re ".*$gdb_prompt $" { fail "print call overloaded func 6 args" }
+ timeout { fail "(timeout) print call overloaded func 6 args" }
+ }
+
+
+send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7)\n"
+gdb_expect {
+ -re ".\[0-9\]* = 7\r\n$gdb_prompt $" {
+ pass "print call overloaded func 7 args"
+ }
+ -re ".*$gdb_prompt $" { fail "print call overloaded func 7 args" }
+ timeout { fail "(timeout) print call overloaded func 7 args" }
+ }
+
+
+send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8)\n"
+gdb_expect {
+ -re ".\[0-9\]* = 8\r\n$gdb_prompt $" {
+ pass "print call overloaded func 8 args"
+ }
+ -re ".*$gdb_prompt $" { fail "print call overloaded func 8 args" }
+ timeout { fail "(timeout) print call overloaded func 8 args" }
+ }
+
+
+send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9)\n"
+gdb_expect {
+ -re ".\[0-9\]* = 9\r\n$gdb_prompt $" {
+ pass "print call overloaded func 9 args"
+ }
+ -re ".*$gdb_prompt $" { fail "print call overloaded func 9 args" }
+ timeout { fail "(timeout) print call overloaded func 9 args" }
+ }
+
+
+send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)\n"
+gdb_expect {
+ -re ".\[0-9\]* = 10\r\n$gdb_prompt $" {
+ pass "print call overloaded func 10 args"
+ }
+ -re ".*$gdb_prompt $" { fail "print call overloaded func 10 args" }
+ timeout { fail "(timeout) print call overloaded func 10 args" }
+ }
+
+
+send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)\n"
+gdb_expect {
+ -re ".\[0-9\]* = 11\r\n$gdb_prompt $" {
+ pass "print call overloaded func 11 args"
+ }
+ -re ".*$gdb_prompt $" { fail "print call overloaded func 11 args" }
+ timeout { fail "(timeout) print call overloaded func 11 args" }
+ }
+
+
+send_gdb "print foo_instance1.overload1arg()\n"
+gdb_expect {
+ -re ".\[0-9\]* = 1\r\n$gdb_prompt $" {
+ pass "print call overloaded func void arg"
+ }
+ -re ".*$gdb_prompt $" { fail "print call overloaded func void arg" }
+ timeout { fail "(timeout) print call overloaded func void arg" }
+ }
+
+send_gdb "print foo_instance1.overload1arg((char)arg2)\n"
+gdb_expect {
+ -re ".\[0-9\]* = 2\r\n$gdb_prompt $" {
+ pass "print call overloaded func char arg"
+ }
+ -re ".*$gdb_prompt $" { fail "print call overloaded func char arg" }
+ timeout { fail "(timeout) print call overloaded func char arg" }
+ }
+
+send_gdb "print foo_instance1.overload1arg((signed char)arg3)\n"
+gdb_expect {
+ -re ".\[0-9\]* = 3\r\n$gdb_prompt $" {
+ pass "print call overloaded func signed char arg"
+ }
+ -re ".*$gdb_prompt $" { fail "print call overloaded func signed char arg" }
+ timeout { fail "(timeout) print call overloaded func signed char arg" }
+ }
+
+
+send_gdb "print foo_instance1.overload1arg((unsigned char)arg4)\n"
+gdb_expect {
+ -re ".\[0-9\]* = 4\r\n$gdb_prompt $" {
+ pass "print call overloaded func unsigned char arg"
+ }
+ -re ".*$gdb_prompt $" { fail "print call overloaded func unsigned char arg" }
+ timeout { fail "(timeout) print call overloaded func unsigned char arg" }
+ }
+
+
+send_gdb "print foo_instance1.overload1arg((short)arg5)\n"
+gdb_expect {
+ -re ".\[0-9\]* = 5\r\n$gdb_prompt $" {
+ pass "print call overloaded func short arg"
+ }
+ -re ".*$gdb_prompt $" { fail "print call overloaded func short arg" }
+ timeout { fail "(timeout) print call overloaded func short arg" }
+ }
+
+
+send_gdb "print foo_instance1.overload1arg((unsigned short)arg6)\n"
+gdb_expect {
+ -re ".\[0-9\]* = 6\r\n$gdb_prompt $" {
+ pass "print call overloaded func unsigned short arg"
+ }
+ -re ".*$gdb_prompt $" { fail "print call overloaded func unsigned short arg" }
+ timeout { fail "(timeout) print call overloaded func unsigned short arg" }
+ }
+
+
+send_gdb "print foo_instance1.overload1arg((int)arg7)\n"
+gdb_expect {
+ -re ".\[0-9\]* = 7\r\n$gdb_prompt $" {
+ pass "print call overloaded func int arg"
+ }
+ -re ".*$gdb_prompt $" { fail "print call overloaded func int arg" }
+ timeout { fail "(timeout) print call overloaded func int arg" }
+ }
+
+
+send_gdb "print foo_instance1.overload1arg((unsigned int)arg8)\n"
+gdb_expect {
+ -re ".\[0-9\]* = 8\r\n$gdb_prompt $" {
+ pass "print call overloaded func unsigned int arg"
+ }
+ -re ".*$gdb_prompt $" { fail "print call overloaded func unsigned int arg" }
+ timeout { fail "(timeout) print call overloaded func unsigned int arg" }
+ }
+
+
+send_gdb "print foo_instance1.overload1arg((long)arg9)\n"
+gdb_expect {
+ -re ".\[0-9\]* = 9\r\n$gdb_prompt $" {
+ pass "print call overloaded func long arg"
+ }
+ -re ".*$gdb_prompt $" { fail "print call overloaded func long arg" }
+ timeout { fail "(timeout) print call overloaded func long arg" }
+ }
+
+
+send_gdb "print foo_instance1.overload1arg((unsigned long)arg10)\n"
+gdb_expect {
+ -re ".\[0-9\]* = 10\r\n$gdb_prompt $" {
+ pass "print call overloaded func unsigned long arg"
+ }
+ -re ".*$gdb_prompt $" { fail "print call overloaded func unsigned long arg" }
+ timeout { fail "(timeout) print call overloaded func unsigned long arg" }
+ }
+
+
+send_gdb "print foo_instance1.overload1arg((float)arg11)\n"
+gdb_expect {
+ -re ".\[0-9\]* = 11\r\n$gdb_prompt $" {
+ pass "print call overloaded func float arg"
+ }
+ -re ".*$gdb_prompt $" { fail "print call overloaded func float arg" }
+ timeout { fail "(timeout) print call overloaded func float arg" }
+ }
+
+
+send_gdb "print foo_instance1.overload1arg((double)arg12)\n"
+gdb_expect {
+ -re ".\[0-9\]* = 12\r\n$gdb_prompt $" {
+ pass "print call overloaded func double arg"
+ }
+ -re ".*$gdb_prompt $" { fail "print call overloaded func double arg" }
+ timeout { fail "(timeout) print call overloaded func double arg" }
+ }
diff --git a/gdb/testsuite/gdb.c++/ovldbreak.cc b/gdb/testsuite/gdb.c++/ovldbreak.cc
new file mode 100644
index 00000000000..9a5b5cbf7c7
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/ovldbreak.cc
@@ -0,0 +1,177 @@
+#include <stddef.h>
+
+class foo {
+public:
+ foo (int);
+ foo (int, const char *);
+ foo (foo&);
+ ~foo ();
+ void foofunc (int);
+ void foofunc (int, signed char *);
+ int ifoo;
+ const char *ccpfoo;
+
+int overload1arg (void);
+int overload1arg (char);
+int overload1arg (signed char);
+int overload1arg (unsigned char);
+int overload1arg (short);
+int overload1arg (unsigned short);
+int overload1arg (int);
+int overload1arg (unsigned int);
+int overload1arg (long);
+int overload1arg (unsigned long);
+int overload1arg (float);
+int overload1arg (double);
+
+int overloadargs (int a1);
+int overloadargs (int a1, int a2);
+int overloadargs (int a1, int a2, int a3);
+int overloadargs (int a1, int a2, int a3, int a4);
+int overloadargs (int a1, int a2, int a3, int a4, int a5);
+int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6);
+int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7);
+int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8);
+int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9);
+int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
+ int a8, int a9, int a10);
+int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
+ int a8, int a9, int a10, int a11);
+
+
+};
+
+void marker1()
+{}
+
+int main ()
+{
+ char arg2 = 2;
+ signed char arg3 =3;
+ unsigned char arg4 =4;
+ short arg5 =5;
+ unsigned short arg6 =6;
+ int arg7 =7;
+ unsigned int arg8 =8;
+ long arg9 =9;
+ unsigned long arg10 =10;
+ float arg11 =100.0;
+ double arg12 = 200.0;
+
+ char ch='A';
+ foo foo_instance1(111);
+ foo foo_instance2(222, &ch);
+ foo foo_instance3(foo_instance2);
+
+ foo_instance1.overload1arg();
+ foo_instance1.overload1arg(arg2);
+ foo_instance1.overload1arg(arg3);
+ foo_instance1.overload1arg(arg4);
+ foo_instance1.overload1arg(arg5);
+ foo_instance1.overload1arg(arg6);
+ foo_instance1.overload1arg(arg7);
+ foo_instance1.overload1arg(arg8);
+ foo_instance1.overload1arg(arg9);
+ foo_instance1.overload1arg(arg10);
+ foo_instance1.overload1arg(arg11);
+ foo_instance1.overload1arg(arg12);
+
+ foo_instance1.overloadargs(1);
+ foo_instance1.overloadargs(1, 2);
+ foo_instance1.overloadargs(1, 2, 3);
+ foo_instance1.overloadargs(1, 2, 3, 4);
+ foo_instance1.overloadargs(1, 2, 3, 4, 5);
+ foo_instance1.overloadargs(1, 2, 3, 4, 5, 6);
+ foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7);
+ foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8);
+ foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9);
+ foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+ foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
+
+
+ #ifdef usestubs
+ set_debug_traps();
+ breakpoint();
+ #endif
+
+
+ marker1();
+ return 0;
+}
+
+foo::foo (int i) { ifoo = i;}
+foo::foo (int i, const char *ccp) { ifoo = i; ccpfoo = ccp; }
+foo::foo (foo& afoo) { ifoo = afoo.ifoo; ccpfoo = afoo.ccpfoo;}
+foo::~foo () {}
+
+
+/* Some functions to test overloading by varying one argument type. */
+
+int foo::overload1arg (void) { return 1; }
+int foo::overload1arg (char arg) { arg = 0; return 2;}
+int foo::overload1arg (signed char arg) { arg = 0; return 3;}
+int foo::overload1arg (unsigned char arg) { arg = 0; return 4;}
+int foo::overload1arg (short arg) { arg = 0; return 5;}
+int foo::overload1arg (unsigned short arg) { arg = 0; return 6;}
+int foo::overload1arg (int arg) { arg = 0; return 7;}
+int foo::overload1arg (unsigned int arg) { arg = 0; return 8;}
+int foo::overload1arg (long arg) { arg = 0; return 9;}
+int foo::overload1arg (unsigned long arg) { arg = 0; return 10;}
+int foo::overload1arg (float arg) { arg = 0; return 11;}
+int foo::overload1arg (double arg) { arg = 0; return 12;}
+
+
+/* Some functions to test overloading by varying argument count. */
+
+int foo::overloadargs (int a1)
+{ a1 = 0;
+return 1;}
+
+int foo::overloadargs (int a1, int a2)
+{ a1 = a2 = 0;
+return 2;}
+
+int foo::overloadargs (int a1, int a2, int a3)
+{ a1 = a2 = a3 = 0;
+return 3;}
+
+int foo::overloadargs (int a1, int a2, int a3, int a4)
+{ a1 = a2 = a3 = a4 = 0;
+return 4;}
+
+int foo::overloadargs (int a1, int a2, int a3, int a4, int a5)
+{ a1 = a2 = a3 = a4 = a5 = 0;
+return 5;}
+
+int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6)
+{ a1 = a2 = a3 = a4 = a5 = a6 = 0;
+return 6;}
+
+int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7)
+{ a1 = a2 = a3 = a4 = a5 = a6 = a7 = 0;
+return 7;}
+
+int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
+ int a8)
+{ a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = 0;
+return 8;}
+
+int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
+ int a8, int a9)
+{
+ a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = 0;
+ return 9;
+}
+
+int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
+ int a8, int a9, int a10)
+ { a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 =
+ a10 = 0; return 10;}
+
+int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
+ int a8, int a9, int a10, int a11)
+ { a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 =
+ a10 = a11 = 0; return 11;}
+
+
+
diff --git a/gdb/testsuite/gdb.c++/ovldbreak.exp b/gdb/testsuite/gdb.c++/ovldbreak.exp
new file mode 100644
index 00000000000..c90b51d6be3
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/ovldbreak.exp
@@ -0,0 +1,680 @@
+# Copyright (C) 1998 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
+# (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
+
+# written by Elena Zannoni (ezannoni@cygnus.com)
+
+# This file is part of the gdb testsuite
+#
+# tests for overloaded member functions. Set breakpoints on
+# overloaded member functions
+#
+
+
+if $tracelevel then {
+ strace $tracelevel
+ }
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+set testfile "ovldbreak"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+
+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."
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+# set it up at a breakpoint so we can play with the variable values
+#
+if ![runto_main] then {
+ perror "couldn't run to breakpoint"
+ continue
+}
+
+
+
+send_gdb "break foo::overload1arg\n"
+gdb_expect {
+-re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
+ send_gdb "12\n"
+ gdb_expect {
+ -re "Breakpoint 2 at $hex: file.*$srcfile, line 111.\r\n$gdb_prompt $" {
+ pass "set bp on overload1arg(char)" }
+ -re ".*$gdb_prompt $" {
+ fail "set bp on overload1arg(char) wrong bp reply" }
+ timeout {
+ fail "(timeout)set bp on overload1arg(char) wrong bp reply" }
+ }
+ }
+ -re ".*$gdb_prompt $" { fail "set bp on overload1arg(char)(wrong menu)" }
+ timeout { fail "(timeout)set bp on overload1arg(char)(wrong menu)" }
+ }
+
+
+gdb_test "info break" \
+ "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
+\[\t \]+breakpoint already hit 1 time\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111" \
+ "breakpoint info"
+
+
+send_gdb "break foo::overload1arg\n"
+gdb_expect {
+-re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
+ send_gdb "11\n"
+ gdb_expect {
+ -re "Breakpoint 3 at $hex: file.*$srcfile, line 112.\r\n$gdb_prompt $" {
+ pass "set bp on overload1arg(signed char)" }
+ -re ".*$gdb_prompt $" {
+ fail "set bp on overload1arg(signed char) wrong bp reply" }
+ timeout {
+ fail "(timeout)set bp on overload1arg(signed char) wrong bp reply" }
+ }
+ }
+ -re ".*$gdb_prompt $" { fail "set bp on overload1arg(signed char)(wrong menu)" }
+ timeout { fail "(timeout)set bp on overload1arg(signed char)(wrong menu)" }
+ }
+
+
+gdb_test "info break" \
+ "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
+\[\t \]+breakpoint already hit 1 time\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112" \
+ "breakpoint info"
+
+
+
+
+
+send_gdb "break foo::overload1arg\n"
+gdb_expect {
+-re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
+ send_gdb "10\n"
+ gdb_expect {
+ -re "Breakpoint 4 at $hex: file.*$srcfile, line 113.\r\n$gdb_prompt $" {
+ pass "set bp on overload1arg(unsigned char)" }
+ -re ".*$gdb_prompt $" {
+ fail "set bp on overload1arg(unsigned char) wrong bp reply" }
+ timeout {
+ fail "(timeout)set bp on overload1arg(unsigned char) wrong bp reply" }
+ }
+ }
+ -re ".*$gdb_prompt $" { fail "set bp on overload1arg(unsigned char)(wrong menu)" }
+ timeout { fail "(timeout)set bp on overload1arg(unsigned char)(wrong menu)" }
+ }
+
+
+
+gdb_test "info break" \
+ "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
+\[\t \]+breakpoint already hit 1 time\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113" \
+ "breakpoint info"
+
+
+
+send_gdb "break foo::overload1arg\n"
+gdb_expect {
+-re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
+ send_gdb "9\n"
+ gdb_expect {
+ -re "Breakpoint 5 at $hex: file.*$srcfile, line 114.\r\n$gdb_prompt $" {
+ pass "set bp on overload1arg(short)" }
+ -re ".*$gdb_prompt $" {
+ fail "set bp on overload1arg(short) wrong bp reply" }
+ timeout {
+ fail "(timeout)set bp on overload1arg(short) wrong bp reply" }
+ }
+ }
+ -re ".*$gdb_prompt $" { fail "set bp on overload1arg(short)(wrong menu)" }
+ timeout { fail "(timeout)set bp on overload1arg(short)(wrong menu)" }
+ }
+
+
+gdb_test "info break" \
+ "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
+\[\t \]+breakpoint already hit 1 time\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(short\\) at.*$srcfile:114" \
+ "breakpoint info"
+
+
+
+send_gdb "break foo::overload1arg\n"
+gdb_expect {
+-re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
+ send_gdb "8\n"
+ gdb_expect {
+ -re "Breakpoint 6 at $hex: file.*$srcfile, line 115.\r\n$gdb_prompt $" {
+ pass "set bp on overload1arg(unsigned short)" }
+ -re ".*$gdb_prompt $" {
+ fail "set bp on overload1arg(unsigned short) wrong bp reply" }
+ timeout {
+ fail "(timeout)set bp on overload1arg(unsigned short) wrong bp reply" }
+ }
+ }
+ -re ".*$gdb_prompt $" { fail "set bp on overload1arg(unsigned short)(wrong menu)" }
+ timeout { fail "(timeout)set bp on overload1arg(unsigned short)(wrong menu)" }
+ }
+
+
+gdb_test "info break" \
+ "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
+\[\t \]+breakpoint already hit 1 time\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(short\\) at.*$srcfile:114\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115" \
+ "breakpoint info"
+
+
+
+send_gdb "break foo::overload1arg\n"
+gdb_expect {
+-re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
+ send_gdb "7\n"
+ gdb_expect {
+ -re "Breakpoint 7 at $hex: file.*$srcfile, line 116.\r\n$gdb_prompt $" {
+ pass "set bp on overload1arg(int)" }
+ -re ".*$gdb_prompt $" {
+ fail "set bp on overload1arg(int) wrong bp reply" }
+ timeout {
+ fail "(timeout)set bp on overload1arg(int) wrong bp reply" }
+ }
+ }
+ -re ".*$gdb_prompt $" { fail "set bp on overload1arg(int)(wrong menu)" }
+ timeout { fail "(timeout)set bp on overload1arg(int)(wrong menu)" }
+ }
+
+
+gdb_test "info break" \
+ "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
+\[\t \]+breakpoint already hit 1 time\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(short\\) at.*$srcfile:114\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(int\\) at.*$srcfile:116" \
+ "breakpoint info"
+
+
+
+send_gdb "break foo::overload1arg\n"
+gdb_expect {
+-re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
+ send_gdb "6\n"
+ gdb_expect {
+ -re "Breakpoint 8 at $hex: file.*$srcfile, line 117.\r\n$gdb_prompt $" {
+ pass "set bp on overload1arg(unsigned int)" }
+ -re ".*$gdb_prompt $" {
+ fail "set bp on overload1arg(unsigned int) wrong bp reply" }
+ timeout {
+ fail "(timeout)set bp on overload1arg(unsigned int) wrong bp reply" }
+ }
+ }
+ -re ".*$gdb_prompt $" { fail "set bp on overload1arg(unsigned int)(wrong menu)" }
+ timeout { fail "(timeout)set bp on overload1arg(unsigned int)(wrong menu)" }
+ }
+
+
+gdb_test "info break" \
+ "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
+\[\t \]+breakpoint already hit 1 time\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(short\\) at.*$srcfile:114\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(int\\) at.*$srcfile:116\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned int\\) at.*$srcfile:117" \
+ "breakpoint info"
+
+
+
+send_gdb "break foo::overload1arg\n"
+gdb_expect {
+-re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
+ send_gdb "5\n"
+ gdb_expect {
+ -re "Breakpoint 9 at $hex: file.*$srcfile, line 118.\r\n$gdb_prompt $" {
+ pass "set bp on overload1arg(long)" }
+ -re ".*$gdb_prompt $" {
+ fail "set bp on overload1arg(long) wrong bp reply" }
+ timeout {
+ fail "(timeout)set bp on overload1arg(long) wrong bp reply" }
+ }
+ }
+ -re ".*$gdb_prompt $" { fail "set bp on overload1arg(long)(wrong menu)" }
+ timeout { fail "(timeout)set bp on overload1arg(long)(wrong menu)" }
+ }
+
+
+gdb_test "info break" \
+ "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
+\[\t \]+breakpoint already hit 1 time\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(short\\) at.*$srcfile:114\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(int\\) at.*$srcfile:116\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(long\\) at.*$srcfile:118" \
+ "breakpoint info"
+
+
+
+send_gdb "break foo::overload1arg\n"
+gdb_expect {
+-re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
+ send_gdb "4\n"
+ gdb_expect {
+ -re "Breakpoint 10 at $hex: file.*$srcfile, line 119.\r\n$gdb_prompt $" {
+ pass "set bp on overload1arg(unsigned long)" }
+ -re ".*$gdb_prompt $" {
+ fail "set bp on overload1arg(unsigned long) wrong bp reply" }
+ timeout {
+ fail "(timeout)set bp on overload1arg(unsigned long) wrong bp reply" }
+ }
+ }
+ -re ".*$gdb_prompt $" { fail "set bp on overload1arg(unsigned long)(wrong menu)" }
+ timeout { fail "(timeout)set bp on overload1arg(unsigned long)(wrong menu)" }
+ }
+
+
+gdb_test "info break" \
+ "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
+\[\t \]+breakpoint already hit 1 time\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(short\\) at.*$srcfile:114\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(int\\) at.*$srcfile:116\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(long\\) at.*$srcfile:118\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119" \
+ "breakpoint info"
+
+
+send_gdb "break foo::overload1arg\n"
+gdb_expect {
+-re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
+ send_gdb "3\n"
+ gdb_expect {
+ -re "Breakpoint 11 at $hex: file.*$srcfile, line 120.\r\n$gdb_prompt $" {
+ pass "set bp on overload1arg(float)" }
+ -re ".*$gdb_prompt $" {
+ fail "set bp on overload1arg(float) wrong bp reply" }
+ timeout {
+ fail "(timeout)set bp on overload1arg(float) wrong bp reply" }
+ }
+ }
+ -re ".*$gdb_prompt $" { fail "set bp on overload1arg(float)(wrong menu)" }
+ timeout { fail "(timeout)set bp on overload1arg(float)(wrong menu)" }
+ }
+
+gdb_test "info break" \
+ "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
+\[\t \]+breakpoint already hit 1 time\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(short\\) at.*$srcfile:114\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(int\\) at.*$srcfile:116\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(long\\) at.*$srcfile:118\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(float\\) at.*$srcfile:120" \
+ "breakpoint info"
+
+
+
+send_gdb "break foo::overload1arg\n"
+gdb_expect {
+-re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
+ send_gdb "2\n"
+ gdb_expect {
+ -re "Breakpoint 12 at $hex: file.*$srcfile, line 121.\r\n$gdb_prompt $" {
+ pass "set bp on overload1arg(double)" }
+ -re ".*$gdb_prompt $" {
+ fail "set bp on overload1arg(double) wrong bp reply" }
+ timeout {
+ fail "(timeout)set bp on overload1arg(double) wrong bp reply" }
+ }
+ }
+ -re ".*$gdb_prompt $" { fail "set bp on overload1arg(double)(wrong menu)" }
+ timeout { fail "(timeout)set bp on overload1arg(double)(wrong menu)" }
+ }
+
+
+gdb_test "info break" \
+ "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
+\[\t \]+breakpoint already hit 1 time\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(short\\) at.*$srcfile:114\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(int\\) at.*$srcfile:116\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(long\\) at.*$srcfile:118\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(float\\) at.*$srcfile:120\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(double\\) at.*$srcfile:121" \
+ "breakpoint info"
+
+
+
+send_gdb "break foo::overload1arg\n"
+gdb_expect {
+-re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
+ send_gdb "13\n"
+ gdb_expect {
+ -re "Breakpoint 13 at $hex: file.*$srcfile, line 110.\r\n$gdb_prompt $" {
+ pass "set bp on overload1arg(void)" }
+ -re ".*$gdb_prompt $" {
+ fail "set bp on overload1arg(void) wrong bp reply" }
+ timeout {
+ fail "(timeout)set bp on overload1arg(void) wrong bp reply" }
+ }
+ }
+ -re ".*$gdb_prompt $" { fail "set bp on overload1arg(void)(wrong menu)" }
+ timeout { fail "(timeout)set bp on overload1arg(void)(wrong menu)" }
+ }
+
+
+gdb_test "info break" \
+ "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
+\[\t \]+breakpoint already hit 1 time\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(short\\) at.*$srcfile:114\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(int\\) at.*$srcfile:116\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(long\\) at.*$srcfile:118\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(float\\) at.*$srcfile:120\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(double\\) at.*$srcfile:121\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(void\\) at.*$srcfile:110" \
+ "breakpoint info"
+
+
+
+
+send_gdb "break foo::overload1arg\n"
+gdb_expect {
+-re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
+ send_gdb "0\n"
+ gdb_expect {
+ -re "cancelled\r\n$gdb_prompt $" {
+ pass "set bp cancelled" }
+ -re ".*$gdb_prompt $" {
+ fail "set bp cancelled wrong bp reply" }
+ timeout {
+ fail "(timeout)set bp cancelled wrong bp reply" }
+ }
+ }
+ -re ".*$gdb_prompt $" { fail "set bp cancelled(wrong menu)" }
+ timeout { fail "(timeout)set bp cancelled(wrong menu)" }
+ }
+
+
+
+
+gdb_test "info break" \
+ "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
+\[\t \]+breakpoint already hit 1 time\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(short\\) at.*$srcfile:114\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(int\\) at.*$srcfile:116\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(long\\) at.*$srcfile:118\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(float\\) at.*$srcfile:120\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(double\\) at.*$srcfile:121\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(void\\) at.*$srcfile:110" \
+ "breakpoint info"
+
+
+
+
+
+send_gdb "delete breakpoints\n"
+gdb_expect {
+ -re "Delete all breakpoints.*$" {
+ send_gdb "y\n"
+ gdb_expect {
+ -re ".*$gdb_prompt $" {
+ send_gdb "info breakpoints\n"
+ gdb_expect {
+ -re "No breakpoints or watchpoints..*$gdb_prompt $" {
+ pass "Deleted all breakpoints"
+ }
+ -re ".*$gdb_prompt $" { fail "Deleted all breakpoints" }
+ timeout { fail "Deleted all breakpoints (timeout)" }
+ }
+ }
+ timeout { fail "Deleted all breakpoints (timeout)" }
+ }
+ }
+ -re ".*$gdb_prompt $" { fail "Deleted all breakpoints" }
+ timeout { fail "Deleted all breakpoints (timeout)" }
+}
+
+
+
+
+send_gdb "break foo::overload1arg\n"
+gdb_expect {
+-re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
+ send_gdb "1\n"
+ gdb_expect {
+ -re "Breakpoint $decimal at $hex: file.*$srcfile, line 121.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 120.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 119.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 118.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 117.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 116.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 115.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 114.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 113.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 112.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 111.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 110.\r\nMultiple breakpoints were set.\r\nUse the .delete. command to delete unwanted breakpoints.\r\n$gdb_prompt $" {
+ pass "set bp on all overload1arg()" }
+ -re ".*$gdb_prompt $" {
+ fail "set bp on all overload1arg() wrong bp reply" }
+ timeout {
+ fail "(timeout)set bp on all overload1arg() wrong bp reply" }
+ }
+ }
+ -re ".*$gdb_prompt $" { fail "set bp on all overload1arg()(wrong menu)" }
+ timeout { fail "(timeout)set bp on all overload1arg()(wrong menu)" }
+ }
+
+
+
+gdb_test "info break" \
+ "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(double\\) at.*$srcfile:121\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(float\\) at.*$srcfile:120\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(long\\) at.*$srcfile:118\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(int\\) at.*$srcfile:116\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(short\\) at.*$srcfile:114\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(void\\) at.*$srcfile:110" \
+ "breakpoint info"
+
+
+ send_gdb "cont\n"
+ gdb_expect {
+ -re "Continuing.\r\n\r\nBreakpoint 25, foo::overload1arg \\(this=$hex\\) at.*$srcfile:110\r\n110\[\t \]+int foo::overload1arg \\(void\\)\[\t \]+\{ return 1; \}\r\n$gdb_prompt $" {
+ pass "continue to bp overloaded : void"
+ }
+ -re "$gdb_prompt $" { fail "continue to bp overloaded : void" }
+ timeout { fail "(timeout) continue to bp overloaded : void" }
+ }
+
+
+ send_gdb "cont\n"
+ gdb_expect {
+ -re "Continuing.\r\n\r\nBreakpoint 24, foo::overload1arg \\(this=$hex, arg=2 \\'\\\\002\\'\\) at.*$srcfile:111\r\n111\[\t \]+int foo::overload1arg \\(char arg\\).*$gdb_prompt $" {
+ pass "continue to bp overloaded : char"
+ }
+ -re "$gdb_prompt $" { fail "continue to bp overloaded : char" }
+ timeout { fail "(timeout) continue to bp overloaded : char" }
+ }
+
+
+ send_gdb "cont\n"
+ gdb_expect {
+ -re "Continuing.\r\n\r\nBreakpoint 23, foo::overload1arg \\(this=$hex, arg=3 \\'\\\\003\\'\\) at.*$srcfile:112\r\n112\[\t \]+int foo::overload1arg \\(signed char arg\\).*$gdb_prompt $" {
+ pass "continue to bp overloaded : signed char"
+ }
+ -re "$gdb_prompt $" { fail "continue to bp overloaded : signed char" }
+ timeout { fail "(timeout) continue to bp overloaded : signed char" }
+ }
+
+
+ send_gdb "cont\n"
+ gdb_expect {
+ -re "Continuing.\r\n\r\nBreakpoint 22, foo::overload1arg \\(this=$hex, arg=4 \\'\\\\004\\'\\) at.*$srcfile:113\r\n113\[\t \]+int foo::overload1arg \\(unsigned char arg\\).*$gdb_prompt $" {
+ pass "continue to bp overloaded : unsigned char"
+ }
+ -re "$gdb_prompt $" { fail "continue to bp overloaded : unsigned char" }
+ timeout { fail "(timeout) continue to bp overloaded : unsigned char" }
+ }
+
+
+ send_gdb "cont\n"
+ gdb_expect {
+ -re "Continuing.\r\n\r\nBreakpoint 21, foo::overload1arg \\(this=$hex, arg=5\\) at.*$srcfile:114\r\n114\[\t \]+int foo::overload1arg \\(short arg\\).*$gdb_prompt $" {
+ pass "continue to bp overloaded : short"
+ }
+ -re "$gdb_prompt $" { fail "continue to bp overloaded : short" }
+ timeout { fail "(timeout) continue to bp overloaded : short" }
+ }
+
+
+ send_gdb "cont\n"
+ gdb_expect {
+ -re "Continuing.\r\n\r\nBreakpoint 20, foo::overload1arg \\(this=$hex, arg=6\\) at.*$srcfile:115\r\n115\[\t \]+int foo::overload1arg \\(unsigned short arg\\).*$gdb_prompt $" {
+ pass "continue to bp overloaded : unsigned short"
+ }
+ -re "$gdb_prompt $" { fail "continue to bp overloaded : unsigned short" }
+ timeout { fail "(timeout) continue to bp overloaded : unsigned short" }
+ }
+
+
+ send_gdb "cont\n"
+ gdb_expect {
+ -re "Continuing.\r\n\r\nBreakpoint 19, foo::overload1arg \\(this=$hex, arg=7\\) at.*$srcfile:116\r\n116\[\t \]+int foo::overload1arg \\(int arg\\).*$gdb_prompt $" {
+ pass "continue to bp overloaded : int"
+ }
+ -re "$gdb_prompt $" { fail "continue to bp overloaded : int" }
+ timeout { fail "(timeout) continue to bp overloaded : int" }
+ }
+
+
+ send_gdb "cont\n"
+ gdb_expect {
+ -re "Continuing.\r\n\r\nBreakpoint 18, foo::overload1arg \\(this=$hex, arg=8\\) at.*$srcfile:117\r\n117\[\t \]+int foo::overload1arg \\(unsigned int arg\\).*$gdb_prompt $" {
+ pass "continue to bp overloaded : unsigned int"
+ }
+ -re "$gdb_prompt $" { fail "continue to bp overloaded : unsigned int" }
+ timeout { fail "(timeout) continue to bp overloaded : unsigned int" }
+ }
+
+
+ send_gdb "cont\n"
+ gdb_expect {
+ -re "Continuing.\r\n\r\nBreakpoint 17, foo::overload1arg \\(this=$hex, arg=9\\) at.*$srcfile:118\r\n118\[\t \]+int foo::overload1arg \\(long arg\\).*$gdb_prompt $" {
+ pass "continue to bp overloaded : long"
+ }
+ -re "$gdb_prompt $" { fail "continue to bp overloaded : long" }
+ timeout { fail "(timeout) continue to bp overloaded : long" }
+ }
+
+
+ send_gdb "cont\n"
+ gdb_expect {
+ -re "Continuing.\r\n\r\nBreakpoint 16, foo::overload1arg \\(this=$hex, arg=10\\) at.*$srcfile:119\r\n119\[\t \]+int foo::overload1arg \\(unsigned long arg\\).*$gdb_prompt $" {
+ pass "continue to bp overloaded : unsigned long"
+ }
+ -re "$gdb_prompt $" { fail "continue to bp overloaded : unsigned long" }
+ timeout { fail "(timeout) continue to bp overloaded : unsigned long" }
+ }
+
+
+ send_gdb "cont\n"
+ gdb_expect {
+ -re "Continuing.\r\n\r\nBreakpoint 15, foo::overload1arg \\(this=$hex, arg=100\\) at.*$srcfile:120\r\n120\[\t \]+int foo::overload1arg \\(float arg\\).*$gdb_prompt $" {
+ pass "continue to bp overloaded : float"
+ }
+ -re "$gdb_prompt $" { fail "continue to bp overloaded : float" }
+ timeout { fail "(timeout) continue to bp overloaded : float" }
+ }
+
+ send_gdb "cont\n"
+ gdb_expect {
+ -re "Continuing.\r\n\r\nBreakpoint 14, foo::overload1arg \\(this=$hex, arg=200\\) at.*$srcfile:121\r\n121\[\t \]+int foo::overload1arg \\(double arg\\).*$gdb_prompt $" {
+ pass "continue to bp overloaded : double"
+ }
+ -re "$gdb_prompt $" { fail "continue to bp overloaded : double" }
+ timeout { fail "(timeout) continue to bp overloaded : double" }
+ }
+
+ send_gdb "cont\n"
+ gdb_expect {
+ -re "Continuing.\r\n\r\nProgram exited normally.\r\n$gdb_prompt $" {
+ pass "finish program"
+ }
+ -re "$gdb_prompt $" { fail "finish program" }
+ timeout { fail "(timeout) finish program" }
+ }
diff --git a/gdb/testsuite/gdb.c++/ref-types.cc b/gdb/testsuite/gdb.c++/ref-types.cc
new file mode 100644
index 00000000000..8ee5c405d87
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/ref-types.cc
@@ -0,0 +1,30 @@
+void marker1 (void)
+{
+
+}
+
+
+
+int main(void)
+{
+ short s;
+ short &rs = s;
+ short *ps;
+ short *&rps = ps;
+ short as[4];
+ short (&ras)[4] = as;
+ s = -1;
+ ps = &s;
+ as[0] = 0;
+ as[1] = 1;
+ as[2] = 2;
+ as[3] = 3;
+
+ #ifdef usestubs
+ set_debug_traps();
+ breakpoint();
+ #endif
+ marker1();
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.c++/ref-types.exp b/gdb/testsuite/gdb.c++/ref-types.exp
new file mode 100644
index 00000000000..7f255909575
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/ref-types.exp
@@ -0,0 +1,276 @@
+# Copyright (C) 1998 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
+# (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
+
+# written by Elena Zannoni (ezannoni@cygnus.com)
+
+# This file is part of the gdb testsuite
+#
+# tests for reference types
+# with short type variables.
+#
+
+if $tracelevel then {
+ strace $tracelevel
+ }
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+set testfile "ref-types"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+
+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."
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+
+#
+# set it up at a breakpoint so we can play with the variable values
+#
+if ![runto_main] then {
+ perror "couldn't run to breakpoint"
+ continue
+}
+
+send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
+
+ send_gdb "cont\n"
+ gdb_expect {
+ -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
+ send_gdb "up\n"
+ gdb_expect {
+ -re ".*$gdb_prompt $" {}
+ timeout { fail "up from marker1" }
+ }
+ }
+ -re "$gdb_prompt $" { fail "continue to marker1" }
+ timeout { fail "(timeout) continue to marker1" }
+ }
+
+
+proc gdb_start_again {} {
+global srcdir
+global subdir
+global binfile
+global gdb_prompt
+global decimal
+
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+source ${binfile}.ci
+
+#
+# set it up at a breakpoint so we can play with the variable values
+#
+if ![runto_main] then {
+ perror "couldn't run to breakpoint"
+ continue
+}
+
+send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
+
+ send_gdb "cont\n"
+ gdb_expect {
+ -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
+ send_gdb "up\n"
+ gdb_expect {
+ -re ".*$gdb_prompt $" {}
+ timeout { fail "up from marker1" }
+ }
+ }
+ -re "$gdb_prompt $" { fail "continue to marker1" }
+ timeout { fail "(timeout) continue to marker1" }
+ }
+}
+
+
+
+
+
+send_gdb "print s\n"
+gdb_expect {
+ -re ".\[0-9\]* = -1.*$gdb_prompt $" {
+ pass "print value of s"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of s" }
+ timeout { fail "(timeout) print value of s" }
+ }
+
+
+send_gdb "ptype s\n"
+gdb_expect {
+ -re "type = short.*$gdb_prompt $" { pass "ptype s" }
+ -re ".*$gdb_prompt $" { fail "ptype s" }
+ timeout { fail "(timeout) ptype s" }
+}
+
+
+send_gdb "print *ps\n"
+gdb_expect {
+ -re ".\[0-9\]* = -1.*$gdb_prompt $" {
+ pass "print value of ps"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of ps" }
+ timeout { fail "(timeout) print value of ps" }
+ }
+
+
+send_gdb "ptype ps\n"
+gdb_expect {
+ -re "type = short \*.*$gdb_prompt $" { pass "ptype ps" }
+ -re ".*$gdb_prompt $" { fail "ptype ps" }
+ timeout { fail "(timeout) ptype ps" }
+}
+
+send_gdb "print as\[0\]\n"
+gdb_expect {
+ -re ".\[0-9\]* = 0.*$gdb_prompt $" {
+ pass "print value of as\[0\]"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of as\[0\]" }
+ timeout { fail "(timeout) print value of as\[0\]" }
+ }
+
+
+send_gdb "ptype as\n"
+gdb_expect {
+ -re "type = short \\\[4\\\].*$gdb_prompt $" { pass "ptype as" }
+ -re ".*$gdb_prompt $" { fail "ptype as" }
+ timeout { fail "(timeout) ptype as" }
+}
+
+send_gdb "print as\[1\]\n"
+gdb_expect {
+ -re ".\[0-9\]* = 1.*$gdb_prompt $" {
+ pass "print value of as\[1\]"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of as\[1\]" }
+ timeout { fail "(timeout) print value of as\[1\]" }
+ }
+
+send_gdb "print as\[2\]\n"
+gdb_expect {
+ -re ".\[0-9\]* = 2.*$gdb_prompt $" {
+ pass "print value of as\[2\]"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of as\[2\]" }
+ timeout { fail "(timeout) print value of as\[2\]" }
+ }
+
+send_gdb "print as\[3\]\n"
+gdb_expect {
+ -re ".\[0-9\]* = 3.*$gdb_prompt $" {
+ pass "print value of as\[3\]"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of as\[3\]" }
+ timeout { fail "(timeout) print value of as\[3\]" }
+ }
+
+send_gdb "print rs\n"
+gdb_expect {
+ -re ".\[0-9\]* = \\(short &\\) @$hex: -1.*$gdb_prompt $" {
+ pass "print value of rs"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of rs" }
+ timeout { fail "(timeout) print value of rs" }
+ eof { fail "print rs ($GDB dumped core) (FIXME)" ; gdb_start_again ; }
+
+ }
+
+send_gdb "ptype rs\n"
+gdb_expect {
+ -re "type = short &.*$gdb_prompt $" { pass "ptype rs" }
+ -re ".*$gdb_prompt $" { fail "ptype rs" }
+ timeout { fail "(timeout) ptype rs" }
+}
+
+
+send_gdb "print *rps\n"
+gdb_expect {
+ -re ".\[0-9\]* = -1.*$gdb_prompt $" {
+ pass "print value of *rps"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of *rps" }
+ timeout { fail "(timeout) print value of *rps" }
+ }
+
+
+send_gdb "ptype rps\n"
+gdb_expect {
+ -re "type = short \\*&.*$gdb_prompt $" { pass "ptype rps" }
+ -re ".*$gdb_prompt $" { fail "ptype rps" }
+ timeout { fail "(timeout) ptype rps" }
+}
+
+
+
+send_gdb "print ras\[0\]\n"
+gdb_expect {
+ -re ".\[0-9\]* = 0.*$gdb_prompt $" {
+ pass "print value of ras\[0\]"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of ras\[0\]" }
+ timeout { fail "(timeout) print value of ras\[0\]" }
+ }
+
+
+send_gdb "ptype ras\n"
+gdb_expect {
+ -re "type = short \\\(&\\\)\\\[4\\\].*$gdb_prompt $" { pass "ptype ras" }
+ -re ".*$gdb_prompt $" { fail "ptype ras" }
+ timeout { fail "(timeout) ptype ras" }
+}
+
+send_gdb "print ras\[1\]\n"
+gdb_expect {
+ -re ".\[0-9\]* = 1.*$gdb_prompt $" {
+ pass "print value of ras\[1\]"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of ras\[1\]" }
+ timeout { fail "(timeout) print value of ras\[1\]" }
+ }
+
+send_gdb "print ras\[2\]\n"
+gdb_expect {
+ -re ".\[0-9\]* = 2.*$gdb_prompt $" {
+ pass "print value of ras\[2\]"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of ras\[2\]" }
+ timeout { fail "(timeout) print value of ras\[2\]" }
+ }
+
+send_gdb "print ras\[3\]\n"
+gdb_expect {
+ -re ".\[0-9\]* = 3.*$gdb_prompt $" {
+ pass "print value of ras\[3\]"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of ras\[3\]" }
+ timeout { fail "(timeout) print value of ras\[3\]" }
+ }
diff --git a/gdb/testsuite/gdb.c++/ref-types2.cc b/gdb/testsuite/gdb.c++/ref-types2.cc
new file mode 100644
index 00000000000..62c982d91c1
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/ref-types2.cc
@@ -0,0 +1,47 @@
+int f()
+{
+ int f1;
+ f1 = 1;
+ return f1;
+}
+
+int main(void)
+{
+ char C;
+ unsigned char UC;
+ short S;
+ unsigned short US;
+ int I;
+ unsigned int UI;
+ long L;
+ unsigned long UL;
+ float F;
+ double D;
+ char &rC = C;
+ unsigned char &rUC = UC;
+ short &rS = S;
+ unsigned short &rUS = US;
+ int &rI = I;
+ unsigned int &rUI = UI;
+ long &rL = L;
+ unsigned long &rUL = UL;
+ float &rF = F;
+ double &rD = D;
+ C = 'A';
+ UC = 21;
+ S = -14;
+ US = 7;
+ I = 102;
+ UI = 1002;
+ L = -234;
+ UL = 234;
+ F = 1.25E10;
+ D = -1.375E-123;
+ I = f();
+ #ifdef usestubs
+ set_debug_traps();
+ breakpoint();
+ #endif
+ return 0;
+
+}
diff --git a/gdb/testsuite/gdb.c++/ref-types2.exp b/gdb/testsuite/gdb.c++/ref-types2.exp
new file mode 100644
index 00000000000..675414754c4
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/ref-types2.exp
@@ -0,0 +1,450 @@
+# Copyright (C) 1998 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
+# (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
+
+# written by Elena Zannoni (ezannoni@cygnus.com)
+
+# This file is part of the gdb testsuite
+#
+# tests for reference types
+# with elementary type variables.
+#
+
+if $tracelevel then {
+ strace $tracelevel
+ }
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+set testfile "ref-types2"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+
+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."
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+
+#
+# set it up at a breakpoint so we can play with the variable values
+#
+if ![runto_main] then {
+ perror "couldn't run to breakpoint"
+ continue
+}
+
+send_gdb "break f\n" ; gdb_expect -re ".*$gdb_prompt $"
+
+ send_gdb "cont\n"
+ gdb_expect {
+ -re "Break.* f \\(\\) at .*:$decimal.*$gdb_prompt $" {
+ send_gdb "up\n"
+ gdb_expect {
+ -re ".*$gdb_prompt $" {}
+ timeout { fail "up from f" }
+ }
+ }
+ -re "$gdb_prompt $" { fail "continue to f" }
+ timeout { fail "(timeout) continue to f" }
+ }
+
+
+send_gdb "print C\n"
+gdb_expect {
+ -re ".\[0-9\]* = 65 \'A\'.*$gdb_prompt $" {
+ pass "print value of C"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of C" }
+ timeout { fail "(timeout) print value of C" }
+ }
+
+
+send_gdb "ptype C\n"
+gdb_expect {
+ -re "type = char.*$gdb_prompt $" { pass "ptype C" }
+ -re ".*$gdb_prompt $" { fail "ptype C" }
+ timeout { fail "(timeout) ptype C" }
+}
+
+
+send_gdb "print UC\n"
+gdb_expect {
+ -re ".\[0-9\]* = 21 '\.025'\.*$gdb_prompt $" {
+ pass "print value of UC"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of UC" }
+ timeout { fail "(timeout) print value of UC" }
+ }
+
+
+send_gdb "ptype UC\n"
+gdb_expect {
+ -re "type = unsigned char.*$gdb_prompt $" { pass "ptype UC" }
+ -re ".*$gdb_prompt $" { fail "ptype UC" }
+ timeout { fail "(timeout) ptype UC" }
+}
+
+
+send_gdb "print S\n"
+gdb_expect {
+ -re ".\[0-9\]* = -14.*$gdb_prompt $" {
+ pass "print value of S"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of S" }
+ timeout { fail "(timeout) print value of S" }
+ }
+
+
+send_gdb "ptype S\n"
+gdb_expect {
+ -re "type = short.*$gdb_prompt $" { pass "ptype S" }
+ -re ".*$gdb_prompt $" { fail "ptype S" }
+ timeout { fail "(timeout) ptype S" }
+}
+
+
+send_gdb "print US\n"
+gdb_expect {
+ -re ".\[0-9\]* = 7.*$gdb_prompt $" {
+ pass "print value of US"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of US" }
+ timeout { fail "(timeout) print value of US" }
+ }
+
+
+send_gdb "ptype US\n"
+gdb_expect {
+ -re "type = unsigned short.*$gdb_prompt $" { pass "ptype US" }
+ -re ".*$gdb_prompt $" { fail "ptype US" }
+ timeout { fail "(timeout) ptype US" }
+}
+
+
+send_gdb "print I\n"
+gdb_expect {
+ -re ".\[0-9\]* = 102.*$gdb_prompt $" {
+ pass "print value of I"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of I" }
+ timeout { fail "(timeout) print value of I" }
+ }
+
+
+send_gdb "ptype I\n"
+gdb_expect {
+ -re "type = int.*$gdb_prompt $" { pass "ptype I" }
+ -re ".*$gdb_prompt $" { fail "ptype I" }
+ timeout { fail "(timeout) ptype I" }
+}
+
+
+send_gdb "print UI\n"
+gdb_expect {
+ -re ".\[0-9\]* = 1002.*$gdb_prompt $" {
+ pass "print value of UI"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of UI" }
+ timeout { fail "(timeout) print value of UI" }
+ }
+
+
+send_gdb "ptype UI\n"
+gdb_expect {
+ -re "type = unsigned int.*$gdb_prompt $" { pass "ptype UI" }
+ -re ".*$gdb_prompt $" { fail "ptype UI" }
+ timeout { fail "(timeout) ptype UI" }
+}
+
+
+send_gdb "print L\n"
+gdb_expect {
+ -re ".\[0-9\]* = -234.*$gdb_prompt $" {
+ pass "print value of L"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of L" }
+ timeout { fail "(timeout) print value of L" }
+ }
+
+
+send_gdb "ptype L\n"
+gdb_expect {
+ -re "type = long.*$gdb_prompt $" { pass "ptype L" }
+ -re ".*$gdb_prompt $" { fail "ptype L" }
+ timeout { fail "(timeout) ptype L" }
+}
+
+
+send_gdb "print UL\n"
+gdb_expect {
+ -re ".\[0-9\]* = 234.*$gdb_prompt $" {
+ pass "print value of UL"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of UL" }
+ timeout { fail "(timeout) print value of UL" }
+ }
+
+
+send_gdb "ptype UL\n"
+gdb_expect {
+ -re "type = unsigned long.*$gdb_prompt $" { pass "ptype UL" }
+ -re ".*$gdb_prompt $" { fail "ptype UL" }
+ timeout { fail "(timeout) ptype UL" }
+}
+
+
+send_gdb "print F\n"
+gdb_expect {
+ -re ".\[0-9\]* = 1.2\[0-9\]*e\\+10.*$gdb_prompt $" {
+ pass "print value of F"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of F" }
+ timeout { fail "(timeout) print value of F" }
+ }
+
+
+
+send_gdb "ptype F\n"
+gdb_expect {
+ -re "type = float.*$gdb_prompt $" { pass "ptype F" }
+ -re ".*$gdb_prompt $" { fail "ptype F" }
+ timeout { fail "(timeout) ptype F" }
+}
+
+
+send_gdb "print D\n"
+gdb_expect {
+ -re ".\[0-9\]* = -1.375e-123.*$gdb_prompt $" {
+ pass "print value of D"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of D" }
+ timeout { fail "(timeout) print value of D" }
+ }
+
+
+send_gdb "ptype D\n"
+gdb_expect {
+ -re "type = double.*$gdb_prompt $" { pass "ptype D" }
+ -re ".*$gdb_prompt $" { fail "ptype D" }
+ timeout { fail "(timeout) ptype D" }
+}
+
+
+
+#
+# test reference types
+#
+
+
+
+
+send_gdb "ptype rC\n"
+gdb_expect {
+ -re "type = char &.*$gdb_prompt $" { pass "ptype rC" }
+ -re ".*$gdb_prompt $" { fail "ptype rC" }
+ timeout { fail "(timeout) ptype rC" }
+}
+
+
+
+
+send_gdb "ptype rUC\n"
+gdb_expect {
+ -re "type = unsigned char &.*$gdb_prompt $" { pass "ptype rUC" }
+ -re ".*$gdb_prompt $" { fail "ptype rUC" }
+ timeout { fail "(timeout) ptype rUC" }
+}
+
+
+
+send_gdb "ptype rS\n"
+gdb_expect {
+ -re "type = short &.*$gdb_prompt $" { pass "ptype rS" }
+ -re ".*$gdb_prompt $" { fail "ptype rS" }
+ timeout { fail "(timeout) ptype rS" }
+}
+
+
+
+send_gdb "ptype rUS\n"
+gdb_expect {
+ -re "type = unsigned short &.*$gdb_prompt $" { pass "ptype rUS" }
+ -re ".*$gdb_prompt $" { fail "ptype rUS" }
+ timeout { fail "(timeout) ptype rUS" }
+}
+
+
+send_gdb "ptype rI\n"
+gdb_expect {
+ -re "type = int &.*$gdb_prompt $" { pass "ptype rI" }
+ -re ".*$gdb_prompt $" { fail "ptype rI" }
+ timeout { fail "(timeout) ptype rI" }
+}
+
+
+
+send_gdb "ptype rUI\n"
+gdb_expect {
+ -re "type = unsigned int &.*$gdb_prompt $" { pass "ptype rUI" }
+ -re ".*$gdb_prompt $" { fail "ptype rUI" }
+ timeout { fail "(timeout) ptype rUI" }
+}
+
+
+
+send_gdb "ptype rL\n"
+gdb_expect {
+ -re "type = long &.*$gdb_prompt $" { pass "ptype rL" }
+ -re ".*$gdb_prompt $" { fail "ptype rL" }
+ timeout { fail "(timeout) ptype rL" }
+}
+
+
+send_gdb "ptype rUL\n"
+gdb_expect {
+ -re "type = unsigned long &.*$gdb_prompt $" { pass "ptype rUL" }
+ -re ".*$gdb_prompt $" { fail "ptype rUL" }
+ timeout { fail "(timeout) ptype rUL" }
+}
+
+
+send_gdb "ptype rF\n"
+gdb_expect {
+ -re "type = float &.*$gdb_prompt $" { pass "ptype rF" }
+ -re ".*$gdb_prompt $" { fail "ptype rF" }
+ timeout { fail "(timeout) ptype rF" }
+}
+
+
+send_gdb "ptype rD\n"
+gdb_expect {
+ -re "type = double &.*$gdb_prompt $" { pass "ptype rD" }
+ -re ".*$gdb_prompt $" { fail "ptype rD" }
+ timeout { fail "(timeout) ptype rD" }
+}
+
+
+send_gdb "print rC\n"
+gdb_expect {
+ -re ".\[0-9\]* = \\(char &\\) @$hex: 65 \'A\'.*$gdb_prompt $" {
+ pass "print value of rC"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of rC" }
+ timeout { fail "(timeout) print value of rC" }
+ }
+
+
+send_gdb "print rUC\n"
+gdb_expect {
+ -re ".\[0-9\]* = \\(unsigned char &\\) @$hex: 21 \'.025\'.*$gdb_prompt $" {
+ pass "print value of rUC"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of rUC" }
+ timeout { fail "(timeout) print value of rUC" }
+ }
+
+
+send_gdb "print rS\n"
+gdb_expect {
+ -re ".\[0-9\]* = \\(short &\\) @$hex: -14.*$gdb_prompt $" {
+ pass "print value of rS"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of rS" }
+ timeout { fail "(timeout) print value of rS" }
+ }
+
+
+send_gdb "print rUS\n"
+gdb_expect {
+ -re ".\[0-9\]* = \\(unsigned short &\\) @$hex: 7.*$gdb_prompt $" {
+ pass "print value of rUS"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of rUS" }
+ timeout { fail "(timeout) print value of rUS" }
+ }
+
+
+send_gdb "print rI\n"
+gdb_expect {
+ -re ".\[0-9\]* = \\(int &\\) @$hex: 102.*$gdb_prompt $" {
+ pass "print value of rI"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of rI" }
+ timeout { fail "(timeout) print value of rI" }
+ }
+
+
+send_gdb "print rUI\n"
+gdb_expect {
+ -re ".\[0-9\]* = \\(unsigned int &\\) @$hex: 1002.*$gdb_prompt $" {
+ pass "print value of UI"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of rUI" }
+ timeout { fail "(timeout) print value of rUI" }
+ }
+
+
+send_gdb "print rL\n"
+gdb_expect {
+ -re ".\[0-9\]* = \\(long &\\) @$hex: -234.*$gdb_prompt $" {
+ pass "print value of rL"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of rL" }
+ timeout { fail "(timeout) print value of rL" }
+ }
+
+
+
+send_gdb "print rUL\n"
+gdb_expect {
+ -re ".\[0-9\]* = \\(unsigned long &\\) @$hex: 234.*$gdb_prompt $" {
+ pass "print value of rUL"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of rUL" }
+ timeout { fail "(timeout) print value of rUL" }
+ }
+
+
+send_gdb "print rF\n"
+gdb_expect {
+ -re ".\[0-9\]* = \\(float &\\) @$hex: 1.2\[0-9\]*e\\+10.*$gdb_prompt $" {
+ pass "print value of rF"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of rF" }
+ timeout { fail "(timeout) print value of rF" }
+ }
+
+
+send_gdb "print rD\n"
+gdb_expect {
+ -re ".\[0-9\]* = \\(double &\\) @$hex: -1.375e-123.*$gdb_prompt $" {
+ pass "print value of rD"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of rD" }
+ timeout { fail "(timeout) print value of rD" }
+ }
+
diff --git a/gdb/testsuite/gdb.c++/templates.cc b/gdb/testsuite/gdb.c++/templates.cc
new file mode 100644
index 00000000000..25241dc6dbf
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/templates.cc
@@ -0,0 +1,785 @@
+/* This test code is from Wendell Baker (wbaker@comet.berkeley.edu) */
+
+#include <stddef.h>
+
+int a_i;
+char a_c;
+double a_d;
+
+typedef void *Pix;
+
+int
+f(int i)
+{ return 0; }
+
+int
+f(int i, char c)
+{ return 0; }
+
+int
+f(int i, char c, double d)
+{ return 0; }
+
+int
+f(int i, char c, double d, char *cs)
+{ return 0; }
+
+int
+f(int i, char c, double d, char *cs, void (*fig)(int, char))
+{ return 0; }
+
+int
+f(int i, char c, double d, char *cs, void (*fig)(char, int))
+{ return 0; }
+
+class R {
+public:
+ int i;
+};
+class S {
+public:
+ int i;
+};
+class T {
+public:
+ int i;
+};
+
+char g(char, const char, volatile char)
+{ return 'c'; }
+char g(R, char&, const char&, volatile char&)
+{ return 'c'; }
+char g(char*, const char*, volatile char*)
+{ return 'c'; }
+char g(S, char*&, const char*&, volatile char*&)
+{ return 'c'; }
+
+signed char g(T,signed char, const signed char, volatile signed char)
+{ return 'c'; }
+signed char g(T, R, signed char&, const signed char&, volatile signed char&)
+{ return 'c'; }
+signed char g(T, signed char*, const signed char*, volatile signed char*)
+{ return 'c'; }
+signed char g(T, S, signed char*&, const signed char*&, volatile signed char*&)
+{ return 'c'; }
+
+unsigned char g(unsigned char, const unsigned char, volatile unsigned char)
+{ return 'c'; }
+unsigned char g(R, unsigned char&, const unsigned char&, volatile unsigned char&)
+{ return 'c'; }
+unsigned char g(unsigned char*, const unsigned char*, volatile unsigned char*)
+{ return 'c'; }
+unsigned char g(S, unsigned char*&, const unsigned char*&, volatile unsigned char*&)
+{ return 'c'; }
+
+short g(short, const short, volatile short)
+{ return 0; }
+short g(R, short&, const short&, volatile short&)
+{ return 0; }
+short g(short*, const short*, volatile short*)
+{ return 0; }
+short g(S, short*&, const short*&, volatile short*&)
+{ return 0; }
+
+signed short g(T, signed short, const signed short, volatile signed short)
+{ return 0; }
+signed short g(T, R, signed short&, const signed short&, volatile signed short&)
+{ return 0; }
+signed short g(T, signed short*, const signed short*, volatile signed short*)
+{ return 0; }
+signed short g(T, S, double, signed short*&, const signed short*&, volatile signed short*&)
+{ return 0; }
+
+unsigned short g(unsigned short, const unsigned short, volatile unsigned short)
+{ return 0; }
+unsigned short g(R, unsigned short&, const unsigned short&, volatile unsigned short&)
+{ return 0; }
+unsigned short g(unsigned short*, const unsigned short*, volatile unsigned short*)
+{ return 0; }
+unsigned short g(S, unsigned short*&, const unsigned short*&, volatile unsigned short*&)
+{ return 0; }
+
+int g(int, const int, volatile int)
+{ return 0; }
+int g(R, int&, const int&, volatile int&)
+{ return 0; }
+int g(int*, const int*, volatile int*)
+{ return 0; }
+int g(S, int*&, const int*&, volatile int*&)
+{ return 0; }
+
+signed int g(T, signed int, const signed int, volatile signed int)
+{ return 0; }
+signed int g(T, R, signed int&, const signed int&, volatile signed int&)
+{ return 0; }
+signed int g(T, signed int*, const signed int*, volatile signed int*)
+{ return 0; }
+signed int g(T, S, signed int*&, const signed int*&, volatile signed int*&)
+{ return 0; }
+
+unsigned int g(unsigned int, const unsigned int, volatile unsigned int)
+{ return 0; }
+unsigned int g(R, unsigned int&, const unsigned int&, volatile unsigned int&)
+{ return 0; }
+unsigned int g(unsigned int*, const unsigned int*, volatile unsigned int*)
+{ return 0; }
+unsigned int g(S, unsigned int*&, const unsigned int*&, volatile unsigned int*&)
+{ return 0; }
+
+long g(long, const long, volatile long)
+{ return 0; }
+long g(R, long&, const long&, volatile long&)
+{ return 0; }
+long g(long*, const long*, volatile long*)
+{ return 0; }
+long g(S, long*&, const long*&, volatile long*&)
+{ return 0; }
+
+signed long g(T, signed long, const signed long, volatile signed long)
+{ return 0; }
+signed long g(T, R, signed long&, const signed long&, volatile signed long&)
+{ return 0; }
+signed long g(T, signed long*, const signed long*, volatile signed long*)
+{ return 0; }
+signed long g(T, S, signed long*&, const signed long*&, volatile signed long*&)
+{ return 0; }
+
+unsigned long g(unsigned long, const unsigned long, volatile unsigned long)
+{ return 0; }
+unsigned long g(S, unsigned long&, const unsigned long&, volatile unsigned long&)
+{ return 0; }
+unsigned long g(unsigned long*, const unsigned long*, volatile unsigned long*)
+{ return 0; }
+unsigned long g(S, unsigned long*&, const unsigned long*&, volatile unsigned long*&)
+{ return 0; }
+
+#ifdef __GNUC__
+long long g(long long, const long long, volatile long long)
+{ return 0; }
+long long g(S, long long&, const long long&, volatile long long&)
+{ return 0; }
+long long g(long long*, const long long*, volatile long long*)
+{ return 0; }
+long long g(R, long long*&, const long long*&, volatile long long*&)
+{ return 0; }
+
+signed long long g(T, signed long long, const signed long long, volatile signed long long)
+{ return 0; }
+signed long long g(T, R, signed long long&, const signed long long&, volatile signed long long&)
+{ return 0; }
+signed long long g(T, signed long long*, const signed long long*, volatile signed long long*)
+{ return 0; }
+signed long long g(T, S, signed long long*&, const signed long long*&, volatile signed long long*&)
+{ return 0; }
+
+unsigned long long g(unsigned long long, const unsigned long long, volatile unsigned long long)
+{ return 0; }
+unsigned long long g(R, unsigned long long*, const unsigned long long*, volatile unsigned long long*)
+{ return 0; }
+unsigned long long g(unsigned long long&, const unsigned long long&, volatile unsigned long long&)
+{ return 0; }
+unsigned long long g(S, unsigned long long*&, const unsigned long long*&, volatile unsigned long long*&)
+{ return 0; }
+#endif
+
+float g(float, const float, volatile float)
+{ return 0; }
+float g(char, float&, const float&, volatile float&)
+{ return 0; }
+float g(float*, const float*, volatile float*)
+{ return 0; }
+float g(char, float*&, const float*&, volatile float*&)
+{ return 0; }
+
+double g(double, const double, volatile double)
+{ return 0; }
+double g(char, double&, const double&, volatile double&)
+{ return 0; }
+double g(double*, const double*, volatile double*)
+{ return 0; }
+double g(char, double*&, const double*&, volatile double*&)
+{ return 0; }
+
+#ifdef __GNUC__
+long double g(long double, const long double, volatile long double)
+{ return 0; }
+long double g(char, long double&, const long double&, volatile long double&)
+{ return 0; }
+long double g(long double*, const long double*, volatile long double*)
+{ return 0; }
+long double g(char, long double*&, const long double*&, volatile long double*&)
+{ return 0; }
+#endif
+
+class c {
+public:
+ c(int) {};
+ int i;
+};
+
+class c g(c, const c, volatile c)
+{ return 0; }
+c g(char, c&, const c&, volatile c&)
+{ return 0; }
+c g(c*, const c*, volatile c*)
+{ return 0; }
+c g(char, c*&, const c*&, volatile c*&)
+{ return 0; }
+
+/*
+void h(char = 'a')
+{ }
+void h(char, signed char = 'a')
+{ }
+void h(unsigned char = 'a')
+{ }
+*/
+/*
+void h(char = (char)'a')
+{ }
+void h(char, signed char = (signed char)'a')
+{ }
+void h(unsigned char = (unsigned char)'a')
+{ }
+
+
+void h(short = (short)43)
+{ }
+void h(char, signed short = (signed short)43)
+{ }
+void h(unsigned short = (unsigned short)43)
+{ }
+
+void h(int = (int)43)
+{ }
+void h(char, signed int = (signed int)43)
+{ }
+void h(unsigned int = (unsigned int)43)
+{ }
+
+
+void h(long = (long)43)
+{ }
+void h(char, signed long = (signed long)43)
+{ }
+void h(unsigned long = (unsigned long)43)
+{ }
+
+#ifdef __GNUC__
+void h(long long = 43)
+{ }
+void h(char, signed long long = 43)
+{ }
+void h(unsigned long long = 43)
+{ }
+#endif
+
+void h(float = 4.3e-10)
+{ }
+void h(double = 4.3)
+{ }
+#ifdef __GNUC__
+void h(long double = 4.33e33)
+{ }
+#endif
+*/
+void printf(const char *format, ... )
+{
+ // elipsis
+}
+
+class T1 {
+public:
+ static void* operator new(size_t);
+ static void operator delete(void *pointer);
+
+ void operator=(const T1&);
+ T1& operator=(int);
+
+ int operator==(int) const;
+ int operator==(const T1&) const;
+ int operator!=(int) const;
+ int operator!=(const T1&) const;
+
+ int operator<=(int) const;
+ int operator<=(const T1&) const;
+ int operator<(int) const;
+ int operator<(const T1&) const;
+ int operator>=(int) const;
+ int operator>=(const T1&) const;
+ int operator>(int) const;
+ int operator>(const T1&) const;
+
+ void operator+(int) const;
+ T1& operator+(const T1&) const;
+ void operator+=(int) const;
+ T1& operator+=(const T1&) const;
+
+ T1& operator++() const;
+
+ void operator-(int) const;
+ T1& operator-(const T1&) const;
+ void operator-=(int) const;
+ T1& operator-=(const T1&) const;
+
+ T1& operator--() const;
+
+ void operator*(int) const;
+ T1& operator*(const T1&) const;
+ void operator*=(int) const;
+ T1& operator*=(const T1&) const;
+
+ void operator/(int) const;
+ T1& operator/(const T1&) const;
+ void operator/=(int) const;
+ T1& operator/=(const T1&) const;
+
+ void operator%(int) const;
+ T1& operator%(const T1&) const;
+ void operator%=(int) const;
+ T1& operator%=(const T1&) const;
+
+ void operator&&(int) const;
+ T1& operator&&(const T1&) const;
+
+ void operator||(int) const;
+ T1& operator||(const T1&) const;
+
+ void operator&(int) const;
+ T1& operator&(const T1&) const;
+ void operator&=(int) const;
+ T1& operator&=(const T1&) const;
+
+ void operator|(int) const;
+ T1& operator|(const T1&) const;
+ void operator|=(int) const;
+ T1& operator|=(const T1&) const;
+
+ void operator^(int) const;
+ T1& operator^(const T1&) const;
+ void operator^=(int) const;
+ T1& operator^=(const T1&) const;
+
+ T1& operator!() const;
+ T1& operator~() const;
+};
+
+void*
+T1::operator new(size_t)
+{ return 0; }
+
+void
+T1::operator delete(void *pointer)
+{ }
+
+class T2 {
+public:
+ T2(int i): integer(i)
+ { }
+ int integer;
+};
+
+int operator==(const T2&, const T2&)
+{ return 0; }
+int operator==(const T2&, char)
+{ return 0; }
+int operator!=(const T2&, const T2&)
+{ return 0; }
+int operator!=(const T2&, char)
+{ return 0; }
+
+int operator<=(const T2&, const T2&)
+{ return 0; }
+int operator<=(const T2&, char)
+{ return 0; }
+int operator<(const T2&, const T2&)
+{ return 0; }
+int operator<(const T2&, char)
+{ return 0; }
+int operator>=(const T2&, const T2&)
+{ return 0; }
+int operator>=(const T2&, char)
+{ return 0; }
+int operator>(const T2&, const T2&)
+{ return 0; }
+int operator>(const T2&, char)
+{ return 0; }
+
+T2 operator+(const T2 t, int i)
+{ return t.integer + i; }
+T2 operator+(const T2 a, const T2& b)
+{ return a.integer + b.integer; }
+T2& operator+=(T2& t, int i)
+{ t.integer += i; return t; }
+T2& operator+=(T2& a, const T2& b)
+{ a.integer += b.integer; return a; }
+
+T2 operator-(const T2 t, int i)
+{ return t.integer - i; }
+T2 operator-(const T2 a, const T2& b)
+{ return a.integer - b.integer; }
+T2& operator-=(T2& t, int i)
+{ t.integer -= i; return t; }
+T2& operator-=(T2& a, const T2& b)
+{ a.integer -= b.integer; return a; }
+
+T2 operator*(const T2 t, int i)
+{ return t.integer * i; }
+T2 operator*(const T2 a, const T2& b)
+{ return a.integer * b.integer; }
+T2& operator*=(T2& t, int i)
+{ t.integer *= i; return t; }
+T2& operator*=(T2& a, const T2& b)
+{ a.integer *= b.integer; return a; }
+
+T2 operator/(const T2 t, int i)
+{ return t.integer / i; }
+T2 operator/(const T2 a, const T2& b)
+{ return a.integer / b.integer; }
+T2& operator/=(T2& t, int i)
+{ t.integer /= i; return t; }
+T2& operator/=(T2& a, const T2& b)
+{ a.integer /= b.integer; return a; }
+
+T2 operator%(const T2 t, int i)
+{ return t.integer % i; }
+T2 operator%(const T2 a, const T2& b)
+{ return a.integer % b.integer; }
+T2& operator%=(T2& t, int i)
+{ t.integer %= i; return t; }
+T2& operator%=(T2& a, const T2& b)
+{ a.integer %= b.integer; return a; }
+
+template<class T>
+class T5 {
+public:
+ T5(int);
+ T5(const T5<T>&);
+ ~T5();
+ static void* operator new(size_t);
+ static void operator delete(void *pointer);
+ int value();
+
+ static T X;
+ T x;
+ int val;
+};
+
+template<class T>
+T5<T>::T5(int v)
+{ val = v; }
+
+template<class T>
+T5<T>::T5(const T5<T>&)
+{}
+
+template<class T>
+T5<T>::~T5()
+{}
+
+template<class T>
+void*
+T5<T>::operator new(size_t)
+{ return 0; }
+
+template<class T>
+void
+T5<T>::operator delete(void *pointer)
+{ }
+
+template<class T>
+int
+T5<T>::value()
+{ return val; }
+
+
+#if ! defined(__GNUC__) || defined(GCC_BUG)
+template<class T>
+T T5<T>::X;
+#endif
+
+
+
+
+T5<char> t5c(1);
+T5<int> t5i(2);
+T5<int (*)(char, void *)> t5fi1(3);
+T5<int (*)(int, double **, void *)> t5fi2(4);
+
+
+
+
+
+
+class x {
+public:
+ int (*manage[5])(double,
+ void *(*malloc)(unsigned size),
+ void (*free)(void *pointer));
+ int (*device[5])(int open(const char *, unsigned mode, unsigned perms, int extra = 0),
+ int *(*read)(int fd, void *place, unsigned size),
+ int *(*write)(int fd, void *place, unsigned size),
+ void (*close)(int fd));
+};
+T5<x> t5x(5);
+
+#if !defined(__GNUC__) || (__GNUC__ >= 2 && __GNUC_MINOR__ >= 6)
+template class T5<char>;
+template class T5<int>;
+template class T5<int (*)(char, void *)>;
+template class T5<int (*)(int, double **, void *)>;
+template class T5<x>;
+#endif
+
+class T7 {
+public:
+ static int get();
+ static void put(int);
+};
+
+int
+T7::get()
+{ return 1; }
+
+void
+T7::put(int i)
+{
+ // nothing
+}
+
+// More template kinds. GDB 4.16 didn't handle these, but
+// Wildebeest does. Note: Assuming HP aCC is used to compile
+// this file; with g++ or HP cfront or other compilers the
+// demangling may not get done correctly.
+
+// Ordinary template, to be instantiated with different types
+template<class T>
+class Foo {
+public:
+ int x;
+ T t;
+ T foo (int, T);
+};
+
+
+template<class T> T Foo<T>::foo (int i, T tt)
+{
+ return tt;
+}
+
+// Template with int parameter
+
+template<class T, int sz>
+class Bar {
+public:
+ int x;
+ T t;
+ T bar (int, T);
+};
+
+
+template<class T, int sz> T Bar<T, sz>::bar (int i, T tt)
+{
+ if (i < sz)
+ return tt;
+ else
+ return 0;
+}
+
+// function template with int parameter
+template<class T> int dummy (T tt, int i)
+{
+ return tt;
+}
+
+// Template with partial specializations
+template<class T1, class T2>
+class Spec {
+public:
+ int x;
+ T1 spec (T2);
+};
+
+template<class T1, class T2>
+T1 Spec<T1, T2>::spec (T2 t2)
+{
+ return 0;
+}
+
+template<class T>
+class Spec<T, T*> {
+public:
+ int x;
+ T spec (T*);
+};
+
+template<class T>
+T Spec<T, T*>::spec (T * tp)
+{
+ return *tp;
+}
+
+// Template with char parameter
+template<class T, char sz>
+class Baz {
+public:
+ int x;
+ T t;
+ T baz (int, T);
+};
+
+template<class T, char sz> T Baz<T, sz>::baz (int i, T tt)
+{
+ if (i < sz)
+ return tt;
+ else
+ return 0;
+}
+
+// Template with char * parameter
+template<class T, char * sz>
+class Qux {
+public:
+ int x;
+ T t;
+ T qux (int, T);
+};
+
+template<class T, char * sz> T Qux<T, sz>::qux (int i, T tt)
+{
+ if (sz[0] == 'q')
+ return tt;
+ else
+ return 0;
+}
+
+// Template with a function pointer parameter
+template<class T, int (*f)(int) >
+class Qux1 {
+public:
+ int x;
+ T t;
+ T qux (int, T);
+};
+
+template<class T, int (*f)(int)> T Qux1<T, f>::qux (int i, T tt)
+{
+ if (f != 0)
+ return tt;
+ else
+ return 0;
+}
+
+// Some functions to provide as arguments to template
+int gf1 (int a) {
+ return a * 2 + 13;
+}
+int gf2 (int a) {
+ return a * 2 + 26;
+}
+
+char string[3];
+
+
+// Template for nested instantiations
+
+template<class T>
+class Garply {
+public:
+ int x;
+ T t;
+ T garply (int, T);
+};
+
+template<class T> T Garply<T>::garply (int i, T tt)
+{
+ if (i > x)
+ return tt;
+ else
+ {
+ x += i;
+ return tt;
+ }
+}
+
+
+int main()
+{
+ int i;
+#ifdef usestubs
+ set_debug_traps();
+ breakpoint();
+#endif
+ i = i + 1;
+
+ // New tests added here
+
+ Foo<int> fint;
+ Foo<char> fchar;
+ Foo<volatile char *> fvpchar;
+
+ Bar<int, 33> bint;
+ Bar<int, (4 > 3)> bint2;
+
+ Baz<int, 's'> bazint;
+ Baz<char, 'a'> bazint2;
+
+ Qux<char, string> quxint2;
+ Qux<int, string> quxint;
+
+ Qux1<int, gf1> qux11;
+
+ int x = fint.foo(33, 47);
+ char c = fchar.foo(33, 'x');
+ volatile char * cp = fvpchar.foo(33, 0);
+
+ int y = dummy<int> (400, 600);
+
+ int z = bint.bar(55, 66);
+ z += bint2.bar(55, 66);
+
+ c = bazint2.baz(4, 'y');
+ c = quxint2.qux(4, 'z');
+
+ y = bazint.baz(4,3);
+ y = quxint.qux(4, 22);
+ y += qux11.qux(4, 22);
+
+ y *= gf1(y) - gf2(y);
+
+ Spec<int, char> sic;
+ Spec<int, int *> siip;
+
+ sic.spec ('c');
+ siip.spec (&x);
+
+ Garply<int> f;
+ Garply<char> fc;
+ f.x = 13;
+
+ Garply<Garply<char> > nf;
+ nf.x = 31;
+
+ x = f.garply (3, 4);
+
+ fc = nf.garply (3, fc);
+
+ y = x + fc.x;
+
+
+ return 0;
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/gdb/testsuite/gdb.c++/templates.exp b/gdb/testsuite/gdb.c++/templates.exp
new file mode 100644
index 00000000000..ee25eaa9ad7
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/templates.exp
@@ -0,0 +1,202 @@
+# Copyright (C) 1992, 1996, 1997 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
+# (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
+
+# This file was written by Fred Fish. (fnf@cygnus.com)
+
+set ws "\[\r\n\t \]+"
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set testfile "templates"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+
+# Create and source the file that provides information about the compiler
+# used to compile the test case.
+if [get_compiler_info ${binfile} "c++"] {
+ return -1
+}
+source ${binfile}.ci
+
+# if we are on HPUX and we are not compiled with gcc, then skip these tests.
+
+if [istarget hppa*-*-hpux*] {
+ if {!$gcc_compiled} {
+ continue
+ }
+}
+
+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."
+}
+
+source ${binfile}.ci
+
+#
+# Test printing of the types of templates.
+#
+
+proc test_ptype_of_templates {} {
+ global gdb_prompt
+ global ws
+
+ send_gdb "ptype T5<int>\n"
+ gdb_expect {
+ -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}T5\\<int> & operator=\\(T5<int> const &\\);${ws}T5\\(int\\);${ws}T5\\(T5<int> const &\\);${ws}~T5\\(void\\);${ws}static void \\* operator new\\(unsigned (int|long)\\);${ws}static void operator delete\\(void \\*\\);${ws}int value\\(void\\);${ws}\}\r\n$gdb_prompt $" {
+ pass "ptype T5<int>"
+ }
+ -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;((${ws}T5\\<int> & operator=\\(T5<int> const &\\);)|(${ws}T5\\(int\\);)|(${ws}T5\\(T5<int> const &\\);)|(${ws}~T5\\(void\\);)|(${ws}static void \\* operator new\\(unsigned (int|long)\\);)|(${ws}static void operator delete\\(void \\*\\);)|(${ws}int value\\(void\\);))*${ws}\}\r\n$gdb_prompt $" {
+ pass "ptype T5<int> (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype T5<int>"
+ }
+ timeout {
+ fail "ptype T5<int> (timeout)"
+ }
+ }
+
+ send_gdb "ptype t5i\n"
+ gdb_expect {
+ -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}T5<int> & operator=\\(T5<int> const &\\);${ws}T5\\(int\\);${ws}T5\\(T5<int> const &\\);${ws}~T5\\(void\\);${ws}static void \\* operator new\\(unsigned (int|long)\\);${ws}static void operator delete\\(void \\*\\);${ws}int value\\(void\\);${ws}\}\r\n$gdb_prompt $" {
+ pass "ptype t5i"
+ }
+ -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;((${ws}T5<int> & operator=\\(T5<int> const &\\);)|(${ws}T5\\(int\\);)|(${ws}T5\\(T5<int> const &\\);)|(${ws}~T5\\(void\\);)|(${ws}static void \\* operator new\\(unsigned (int|long)\\);)|(${ws}static void operator delete\\(void \\*\\);)|(${ws}int value\\(void\\);))*${ws}\}\r\n$gdb_prompt $" {
+ pass "ptype t5i (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype t5i"
+ }
+ timeout {
+ fail "ptype t5i (timeout)"
+ }
+ }
+}
+
+#
+# Test breakpoint setting on template methods.
+#
+
+proc test_template_breakpoints {} {
+ global gdb_prompt
+ global testfile
+ global srcdir
+
+ send_gdb "break T5<int>::T5\n"
+ gdb_expect {
+ -re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2. T5<int>::T5\\(int\\) at .*\[\r\n\]*.3. T5<int>::T5\\(T5<int> const &\\) at .*\[\r\n\]*> $" {
+ gdb_test "0" \
+ "cancelled" \
+ "constructor breakpoint (obsolete format!)"
+ }
+ -re ".0. cancel\[\r\n\]*.1. all\[\r\n\]*.2. T5<int>::T5\\(T5<int> const &\\) at .*templates.cc:.*\[\r\n\]*.3. T5<int>::T5\\(int\\) at .*templates.cc:.*\[\r\n\]*> $" {
+ gdb_test "0" \
+ "cancelled" \
+ "constructor breakpoint"
+ }
+ -re ".*$gdb_prompt $" { fail "constructor breakpoint" }
+ default { fail "constructor breakpoint (timeout)" }
+ }
+
+ gdb_test "break T5<int>::~T5" \
+ "Breakpoint.*at.* file .*${testfile}.cc, line.*" \
+ "destructor breakpoint"
+
+ gdb_test "break T5<int>::value" \
+ "Breakpoint.*at.* file .*${testfile}.cc, line.*" \
+ "value method breakpoint"
+
+ delete_breakpoints
+}
+
+#
+# Test calling of template methods.
+#
+
+proc test_template_calls {} {
+ global gdb_prompt
+
+ if [target_info exists gdb,cannot_call_functions] {
+ setup_xfail "*-*-*" 2416
+ fail "This target can not call functions"
+ return
+ }
+
+ send_gdb "print t5i.value()\n"
+ gdb_expect {
+ -re ".* = 2\[\r\n\]*$gdb_prompt $" { pass "print t5i.value()" }
+ -re "Cannot invoke functions on this machine.*$gdb_prompt $" {
+ fail "print t5i.value()"
+ }
+ -re ".*$gdb_prompt $" { fail "print t5i.value()" }
+ default { fail "print t5i.value() (timeout)" }
+ }
+}
+
+
+proc do_tests {} {
+ global prms_id
+ global bug_id
+ global subdir
+ global objdir
+ global srcdir
+ global binfile
+ global gdb_prompt
+ global supports_template_debugging
+
+ set prms_id 0
+ set bug_id 0
+
+ # Start with a fresh gdb.
+
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load $binfile
+
+ if { !$supports_template_debugging } {
+ warning "compiler lacks debugging info for templates; tests suppressed." 0
+ return
+ }
+
+ # Get the debug format for the compiled test case. If that
+ # format is DWARF 1 then just skip all the tests since none of
+ # them will pass.
+
+ if [ runto_main] then {
+ get_debug_format
+ if [ setup_xfail_format "DWARF 1" ] then {
+ fail "C++ tests skipped due to limited C++ support in DWARF 1 debug format"
+ return
+ }
+ clear_xfail "*-*-*"
+ }
+
+ test_ptype_of_templates
+ test_template_breakpoints
+
+ if [ runto_main] {
+ test_template_calls
+ }
+}
+
+do_tests
+
diff --git a/gdb/testsuite/gdb.c++/userdef.cc b/gdb/testsuite/gdb.c++/userdef.cc
new file mode 100644
index 00000000000..9ad6c869b6e
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/userdef.cc
@@ -0,0 +1,339 @@
+#include <iostream.h>
+
+void marker1()
+{
+ return;
+}
+
+class A1 {
+ int x;
+ int y;
+
+friend ostream& operator<<(ostream& outs, A1 one);
+
+public:
+
+ A1(int a, int b)
+ {
+ x=a;
+ y=b;
+ }
+
+A1 operator+=(int value);
+A1 operator+(const A1&);
+A1 operator-(const A1&);
+A1 operator%(const A1&);
+int operator==(const A1&);
+int operator!=(const A1&);
+int operator&&(const A1&);
+int operator||(const A1&);
+A1 operator<<(int);
+A1 operator>>(int);
+A1 operator|(const A1&);
+A1 operator^(const A1&);
+A1 operator&(const A1&);
+int operator<(const A1&);
+int operator<=(const A1&);
+int operator>=(const A1&);
+int operator>(const A1&);
+A1 operator*(const A1&);
+A1 operator/(const A1&);
+A1 operator=(const A1&);
+
+A1 operator~();
+A1 operator-();
+int operator!();
+A1 operator++();
+A1 operator++(int);
+A1 operator--();
+A1 operator--(int);
+
+};
+
+
+A1 A1::operator+(const A1& second)
+{
+ A1 sum(0,0);
+ sum.x = x + second.x;
+ sum.y = y + second.y;
+
+ return (sum);
+}
+
+A1 A1::operator*(const A1& second)
+{
+ A1 product(0,0);
+ product.x = this->x * second.x;
+ product.y = this->y * second.y;
+
+ return product;
+}
+
+A1 A1::operator-(const A1& second)
+{
+ A1 diff(0,0);
+ diff.x = x - second.x;
+ diff.y = y - second.y;
+
+ return diff;
+}
+
+A1 A1::operator/(const A1& second)
+{
+ A1 div(0,0);
+ div.x = x / second.x;
+ div.y = y / second.y;
+
+ return div;
+}
+
+A1 A1::operator%(const A1& second)
+{
+ A1 rem(0,0);
+ rem.x = x % second.x;
+ rem.y = y % second.y;
+
+ return rem;
+}
+
+int A1::operator==(const A1& second)
+{
+ int a = (x == second.x);
+ int b = (y == second.y);
+
+ return (a && b);
+}
+
+int A1::operator!=(const A1& second)
+{
+ int a = (x != second.x);
+ int b = (y != second.y);
+
+ return (a || b);
+}
+
+int A1::operator&&(const A1& second)
+{
+ return ( x && second.x);
+}
+
+int A1::operator||(const A1& second)
+{
+ return ( x || second.x);
+}
+
+A1 A1::operator<<(int value)
+{
+ A1 lshft(0,0);
+ lshft.x = x << value;
+ lshft.y = y << value;
+
+ return lshft;
+}
+
+A1 A1::operator>>(int value)
+{
+ A1 rshft(0,0);
+ rshft.x = x >> value;
+ rshft.y = y >> value;
+
+ return rshft;
+}
+
+A1 A1::operator|(const A1& second)
+{
+ A1 abitor(0,0);
+ abitor.x = x | second.x;
+ abitor.y = y | second.y;
+
+ return abitor;
+}
+
+A1 A1::operator^(const A1& second)
+{
+ A1 axor(0,0);
+ axor.x = x ^ second.x;
+ axor.y = y ^ second.y;
+
+ return axor;
+}
+
+A1 A1::operator&(const A1& second)
+{
+ A1 abitand(0,0);
+ abitand.x = x & second.x;
+ abitand.y = y & second.y;
+
+ return abitand;
+}
+
+int A1::operator<(const A1& second)
+{
+ A1 b(0,0);
+ b.x = 3;
+ return (x < second.x);
+}
+
+int A1::operator<=(const A1& second)
+{
+ return (x <= second.x);
+}
+
+int A1::operator>=(const A1& second)
+{
+ return (x >= second.x);
+}
+
+int A1::operator>(const A1& second)
+{
+ return (x > second.x);
+}
+
+int A1::operator!(void)
+{
+ return (!x);
+}
+
+A1 A1::operator-(void)
+{
+ A1 neg(0,0);
+ neg.x = -x;
+ neg.y = -y;
+
+ return (neg);
+}
+
+A1 A1::operator~(void)
+{
+ A1 acompl(0,0);
+ acompl.x = ~x;
+ acompl.y = ~y;
+
+ return (acompl);
+}
+
+A1 A1::operator++() // pre increment
+{
+ x = x +1;
+
+ return (*this);
+}
+
+A1 A1::operator++(int) // post increment
+{
+ y = y +1;
+
+ return (*this);
+}
+
+A1 A1::operator--() // pre decrement
+{
+ x = x -1;
+
+ return (*this);
+}
+
+A1 A1::operator--(int) // post decrement
+{
+ y = y -1;
+
+ return (*this);
+}
+
+
+A1 A1::operator=(const A1& second)
+{
+
+ x = second.x;
+ y = second.y;
+
+ return (*this);
+}
+
+A1 A1::operator+=(int value)
+{
+
+ x += value;
+ y += value;
+
+ return (*this);
+}
+
+ostream& operator<<(ostream& outs, A1 one)
+{
+ return (outs << endl << "x = " << one.x << endl << "y = " << one.y << endl << "-------" << endl);
+}
+
+int main (void)
+{
+ A1 one(2,3);
+ A1 two(4,5);
+ A1 three(0,0);
+ int val;
+
+ marker1();
+ cout << one;
+ cout << two;
+ three = one + two;
+ cout << "+ " << three;
+ three = one - two;
+ cout << "- " << three;
+ three = one * two;
+ cout <<"* " << three;
+ three = one / two;
+ cout << "/ " << three;
+ three = one % two;
+ cout << "% " << three;
+ three = one | two;
+ cout << "| " <<three;
+ three = one ^ two;
+ cout << "^ " <<three;
+ three = one & two;
+ cout << "& "<< three;
+
+ val = one && two;
+ cout << "&& " << val << endl << "-----"<<endl;
+ val = one || two;
+ cout << "|| " << val << endl << "-----"<<endl;
+ val = one == two;
+ cout << " == " << val << endl << "-----"<<endl;
+ val = one != two;
+ cout << "!= " << val << endl << "-----"<<endl;
+ val = one >= two;
+ cout << ">= " << val << endl << "-----"<<endl;
+ val = one <= two;
+ cout << "<= " << val << endl << "-----"<<endl;
+ val = one < two;
+ cout << "< " << val << endl << "-----"<<endl;
+ val = one > two;
+ cout << "> " << val << endl << "-----"<<endl;
+
+ three = one << 2;
+ cout << "lsh " << three;
+ three = one >> 2;
+ cout << "rsh " << three;
+
+ three = one;
+ cout << " = "<< three;
+ three += 5;
+ cout << " += "<< three;
+
+ val = (!one);
+ cout << "! " << val << endl << "-----"<<endl;
+ three = (-one);
+ cout << "- " << three;
+ three = (~one);
+ cout << " ~" << three;
+ three++;
+ cout << "postinc " << three;
+ three--;
+ cout << "postdec " << three;
+
+ --three;
+ cout << "predec " << three;
+ ++three;
+ cout << "preinc " << three;
+
+ return 0;
+
+}
diff --git a/gdb/testsuite/gdb.c++/userdef.exp b/gdb/testsuite/gdb.c++/userdef.exp
new file mode 100644
index 00000000000..c9bb0530f37
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/userdef.exp
@@ -0,0 +1,317 @@
+# Copyright (C) 1998 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
+# (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
+
+# written by Elena Zannoni (ezannoni@cygnus.com)
+#
+# testing overloaded operators resolution.
+#
+# source file "userdef.cc"
+#
+
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# Check to see if we have an executable to test. If not, then either we
+# haven't tried to compile one, or the compilation failed for some reason.
+# In either case, just notify the user and skip the tests in this file.
+
+set testfile "userdef"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+
+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."
+}
+
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+
+if ![runto_main] then {
+ perror "couldn't run to breakpoint"
+ continue
+}
+
+send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
+ send_gdb "cont\n"
+ gdb_expect {
+ -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
+ send_gdb "up\n"
+ gdb_expect {
+ -re ".*$gdb_prompt $" { pass "up from marker1" }
+ timeout { fail "up from marker1" }
+ }
+ }
+ -re "$gdb_prompt $" { fail "continue to marker1" }
+ timeout { fail "(timeout) continue to marker1" }
+ }
+
+
+ setup_xfail hppa_*_*
+send_gdb "print one+two\n"
+gdb_expect {
+ -re "FIXME.*$gdb_prompt $" {
+ pass "print value of one + two"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of one two" }
+ timeout { fail "(timeout) print value of one two" }
+ }
+
+send_gdb "print one-two\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of one - two"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of one - two" }
+ timeout { fail "(timeout) print value of one - two" }
+ }
+
+send_gdb "print one*two\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of one * two"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of one * two" }
+ timeout { fail "(timeout) print value of one * two" }
+ }
+
+send_gdb "print one/two\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of one / two"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of one / two" }
+ timeout { fail "(timeout) print value of one / two" }
+ }
+
+send_gdb "print one%two\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of one % two"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of one % two" }
+ timeout { fail "(timeout) print value of one % two" }
+ }
+
+send_gdb "print one&&two\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of one && two"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of one && two" }
+ timeout { fail "(timeout) print value of one && two" }
+ }
+
+send_gdb "print one||two\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of one|| two"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of one|| two" }
+ timeout { fail "(timeout) print value of one|| two" }
+ }
+
+send_gdb "print one&two\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of one & two"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of one & two" }
+ timeout { fail "(timeout) print value of one & two" }
+ }
+
+send_gdb "print one|two\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of one | two"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of one | two" }
+ timeout { fail "(timeout) print value of one | two" }
+ }
+
+send_gdb "print one ^ two\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of one ^ two"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of one ^ two" }
+ timeout { fail "(timeout) print value of one ^ two" }
+ }
+
+send_gdb "print one < two\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of one < two"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of one < two" }
+ timeout { fail "(timeout) print value of one < two" }
+ }
+
+send_gdb "print one <= two\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of one <= two"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of one <= two" }
+ timeout { fail "(timeout) print value of one <= two" }
+ }
+
+send_gdb "print one > two\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of one > two"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of one > two" }
+ timeout { fail "(timeout) print value of one > two" }
+ }
+
+send_gdb "print one >= two\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of one >= two"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of one >= two" }
+ timeout { fail "(timeout) print value of one >= two" }
+ }
+
+
+send_gdb "print one==two\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of one == two"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of one == two" }
+ timeout { fail "(timeout) print value of one == two" }
+ }
+
+send_gdb "print one!=two\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of one != two"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of one != two" }
+ timeout { fail "(timeout) print value of one != two" }
+ }
+
+send_gdb "print one<<31\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of one<<31"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of one<<31" }
+ timeout { fail "(timeout) print value of one<<31" }
+ }
+
+send_gdb "print one>>31\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of one>>31"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of one>>31" }
+ timeout { fail "(timeout) print value of one>>31" }
+ }
+
+send_gdb "print !one\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of !one"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of !one" }
+ timeout { fail "(timeout) print value of !one" }
+ }
+
+send_gdb "print ~one\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of ~one"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of ~one" }
+ timeout { fail "(timeout) print value of ~one" }
+ }
+
+send_gdb "print -one\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of -one"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of -one" }
+ timeout { fail "(timeout) print value of -one" }
+ }
+
+send_gdb "print one++\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of one++"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of one++" }
+ timeout { fail "(timeout) print value of one++" }
+ }
+
+send_gdb "print ++one\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of ++one>>31"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of ++one" }
+ timeout { fail "(timeout) print value of ++one" }
+ }
+
+send_gdb "print one--\n"
+gdb_expect {
+ -re ".*.FIXME*$gdb_prompt $" {
+ pass "print value of one-->>31"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of one-->>31" }
+ timeout { fail "(timeout) print value of one-->>31" }
+ }
+
+send_gdb "print --one\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of --one"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of --one" }
+ timeout { fail "(timeout) print value of --one" }
+ }
+
+send_gdb "print one+=7\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of one+=7"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of one+=7" }
+ timeout { fail "(timeout) print value of one+=7" }
+ }
+
+send_gdb "print two=one\n"
+gdb_expect {
+ -re ".*FIXME.*$gdb_prompt $" {
+ pass "print value of two=one"
+ }
+ -re ".*$gdb_prompt $" { xfail "print value of two=one" }
+ timeout { fail "(timeout) print value of two=one" }
+ }
+
+gdb_exit
+return 0
diff --git a/gdb/testsuite/gdb.c++/virtfunc.cc b/gdb/testsuite/gdb.c++/virtfunc.cc
new file mode 100644
index 00000000000..883d502ea11
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/virtfunc.cc
@@ -0,0 +1,199 @@
+// Pls try the following program on virtual functions and try to do print on
+// most of the code in main(). Almost none of them works !
+
+//
+// The inheritance structure is:
+//
+// V : VA VB
+// A : (V)
+// B : A
+// D : AD (V)
+// C : (V)
+// E : B (V) D C
+//
+
+class VA
+{
+public:
+ int va;
+};
+
+class VB
+{
+public:
+ int vb;
+ int fvb();
+ virtual int vvb();
+};
+
+class V : public VA, public VB
+{
+public:
+ int f();
+ virtual int vv();
+ int w;
+};
+
+class A : virtual public V
+{
+public:
+ virtual int f();
+private:
+ int a;
+};
+
+class B : public A
+{
+public:
+ int f();
+private:
+ int b;
+};
+
+class C : public virtual V
+{
+public:
+ int c;
+};
+
+class AD
+{
+public:
+ virtual int vg() = 0;
+};
+
+class D : public AD, virtual public V
+{
+public:
+ static void s();
+ virtual int vg();
+ virtual int vd();
+ int fd();
+ int d;
+};
+
+class E : public B, virtual public V, public D, public C
+{
+public:
+ int f();
+ int vg();
+ int vv();
+ int e;
+};
+
+D dd;
+D* ppd = &dd;
+AD* pAd = &dd;
+
+A a;
+B b;
+C c;
+D d;
+E e;
+V v;
+VB vb;
+
+
+A* pAa = &a;
+A* pAe = &e;
+
+B* pBe = &e;
+
+D* pDd = &d;
+D* pDe = &e;
+
+V* pVa = &a;
+V* pVv = &v;
+V* pVe = &e;
+V* pVd = &d;
+
+AD* pADe = &e;
+
+E* pEe = &e;
+
+VB* pVB = &vb;
+
+void init()
+{
+ a.vb = 1;
+ b.vb = 2;
+ c.vb = 3;
+ d.vb = 4;
+ e.vb = 5;
+ v.vb = 6;
+ vb.vb = 7;
+
+ d.d = 1;
+ e.d = 2;
+}
+
+extern "C" int printf(const char *, ...);
+
+int all_count = 0;
+int failed_count = 0;
+
+#define TEST(EXPR, EXPECTED) \
+ ret = EXPR; \
+ if (ret != EXPECTED) {\
+ printf("Failed %s is %d, should be %d!\n", #EXPR, ret, EXPECTED); \
+ failed_count++; } \
+ all_count++;
+
+int ret;
+
+void test_calls()
+{
+ TEST(pAe->f(), 20);
+ TEST(pAa->f(), 1);
+
+ TEST(pDe->vg(), 202);
+ TEST(pADe->vg(), 202);
+ TEST(pDd->vg(), 101);
+
+ TEST(pEe->vvb(), 411);
+
+ TEST(pVB->vvb(), 407);
+
+ TEST(pBe->vvb(), 411);
+ TEST(pDe->vvb(), 411);
+
+ TEST(pEe->vd(), 282);
+ TEST(pEe->fvb(), 311);
+
+ TEST(pEe->D::vg(), 102);
+ printf("Did %d tests, of which %d failed.\n", all_count, failed_count);
+}
+#ifdef usestubs
+extern "C" {
+ void set_debug_traps();
+ void breakpoint();
+};
+#endif
+
+main()
+{
+#ifdef usestubs
+ set_debug_traps();
+ breakpoint();
+#endif
+ init();
+
+ e.w = 7;
+ e.vb = 11;
+
+ test_calls();
+}
+
+int A::f() {return 1;}
+int B::f() {return 2;}
+void D::s() {}
+int E::f() {return 20;}
+int D::vg() {return 100+d;}
+int E::vg() {return 200+d;}
+int V::f() {return 600+w;}
+int V::vv() {return 400+w;}
+int E::vv() {return 450+w;}
+int D::fd() {return 250+d;}
+int D::vd() {return 280+d;}
+int VB::fvb() {return 300+vb;}
+int VB::vvb() {return 400+vb;}
diff --git a/gdb/testsuite/gdb.c++/virtfunc.exp b/gdb/testsuite/gdb.c++/virtfunc.exp
new file mode 100644
index 00000000000..d0db7557fd1
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/virtfunc.exp
@@ -0,0 +1,751 @@
+# Copyright (C) 1992, 1994, 1997 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
+# (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
+
+# This file was written by Fred Fish. (fnf@cygnus.com)
+
+set ws "\[\r\n\t \]+"
+set nl "\[\r\n\]+"
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set testfile "virtfunc"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+
+if [get_compiler_info ${binfile} "c++"] {
+ return -1
+}
+
+# if we are on HPUX and we are not compiled with gcc, then skip these tests.
+
+if [istarget hppa*-*-hpux*] {
+ if {!$gcc_compiled} {
+ continue
+ }
+}
+
+
+
+# Check to see if we have an executable to test. If not, then either we
+# haven't tried to compile one, or the compilation failed for some reason.
+# In either case, just notify the user and skip the tests in this file.
+
+set src "${srcdir}/${subdir}/${srcfile}"
+if { [gdb_compile "${src}" "${binfile}" executable {c++ debug}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+proc gdb_virtfunc_init {} {
+ global srcdir subdir binfile
+ global gdb_prompt
+
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load $binfile
+
+ send_gdb "set language c++\n"
+ gdb_expect -re "$gdb_prompt $"
+ send_gdb "set width 0\n"
+ gdb_expect -re "$gdb_prompt $"
+}
+
+proc gdb_virtfunc_restart {} {
+ gdb_exit;
+ gdb_start;
+ gdb_virtfunc_init;
+ runto 'test_calls(void)';
+}
+
+#
+# Test printing of the types of various classes.
+#
+
+proc test_ptype_of_classes {} {
+ global gdb_prompt
+ global ws
+ global nl
+
+ # This used to be a fail if it printed "struct" not "class". But
+ # since this struct doesn't use any special C++ features, it is
+ # considered right for GDB to print it as "struct".
+ send_gdb "ptype VA\n"
+ gdb_expect {
+ -re "type = (struct|class) VA \{(${ws}public:|)${ws}int va;${ws}VA & operator=\\(VA const &\\);${ws}VA\\(VA const &\\);${ws}VA\\(void\\);${ws}\}.*$gdb_prompt $" {
+ pass "ptype VA"
+ }
+ -re "type = (struct|class) VA \{(${ws}public:|)${ws}int va;((${ws}VA & operator=\\(VA const &\\);)|(${ws}VA\\(VA const &\\);)|(${ws}VA\\(void\\);))*${ws}\}.*$gdb_prompt $" {
+ pass "ptype VA (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype VA"
+ }
+ timeout {
+ fail "ptype VA (timeout)"
+ }
+ }
+
+ send_gdb "ptype VB\n"
+ gdb_expect {
+ -re "type = class VB \{${ws}public:${ws}int vb;${ws}VB & operator=\\(VB const &\\);${ws}VB\\(VB const &\\);${ws}VB\\(void\\);${ws}int fvb\\(void\\);${ws}virtual int vvb\\(void\\);${ws}\}.*$gdb_prompt $" {
+ pass "ptype VB"
+ }
+ -re "type = class VB \{${ws}public:${ws}int vb;((${ws}VB & operator=\\(VB const &\\);)|(${ws}VB\\(VB const &\\);)|(${ws}VB\\(void\\);)|(${ws}int fvb\\(void\\);)|(${ws}virtual int vvb\\(void\\);))*${ws}\}.*$gdb_prompt $" {
+ pass "ptype VB (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype VB"
+ }
+ timeout {
+ fail "ptype VB (timeout)"
+ }
+ }
+
+ send_gdb "ptype V\n"
+ gdb_expect {
+ -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype V"
+ }
+ -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype V (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype V"
+ }
+ timeout {
+ fail "ptype V (timeout)"
+ }
+ }
+
+ send_gdb "ptype A\n"
+ gdb_expect {
+ -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb\[\\\$\.\]+V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype A"
+ }
+ -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb\[\\\$\.\]+V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype A (obsolescent gcc or gdb)"
+ }
+ -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.FOO;${ws}int a;${ws}public:${ws}virtual int f.void.;${ws}\}$nl$gdb_prompt $" {
+ # This happens because the type is defined only after it is
+ # too late.
+ fail "ptype A (known failure with gcc cygnus-2.4.5-930417)"
+ # Many of the rest of these tests have the same problem.
+ return 0
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype A"
+ }
+ timeout {
+ fail "ptype A (timeout)"
+ }
+ }
+
+ send_gdb "ptype B\n"
+ gdb_expect {
+ -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const &\\);${ws}B\\(int, B const &\\);${ws}B\\(int\\);${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype B"
+ }
+ -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:((${ws}B & operator=\\(B const &\\);)|(${ws}B\\(int, B const &\\);)|(${ws}B\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype B (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype B"
+ }
+ timeout {
+ fail "ptype B (timeout)"
+ }
+ }
+
+ send_gdb "ptype C\n"
+ gdb_expect {
+ -re "type = class C : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int c;${ws}C & operator=\\(C const &\\);${ws}C\\(int, C const &\\);${ws}C\\(int\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype C"
+ }
+ -re "type = class C : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int c;((${ws}C & operator=\\(C const &\\);)|(${ws}C\\(int, C const &\\);)|(${ws}C\\(int\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype C (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype C"
+ }
+ timeout {
+ fail "ptype C (timeout)"
+ }
+ }
+
+ send_gdb "ptype AD\n"
+ gdb_expect {
+ -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const &\\);${ws}AD\\(AD const &\\);${ws}AD\\(void\\);${ws}virtual int vg\\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype AD"
+ }
+ -re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const &\\);)|(${ws}AD\\(AD const &\\);)|(${ws}AD\\(void\\);)|(${ws}virtual int vg\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype AD (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype AD"
+ }
+ timeout {
+ fail "ptype AD (timeout)"
+ }
+ }
+
+ send_gdb "ptype D\n"
+ gdb_expect {
+ -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype D"
+ }
+ -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype D (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype D"
+ }
+ timeout {
+ fail "ptype D (timeout)"
+ }
+ }
+
+ send_gdb "ptype E\n"
+ gdb_expect {
+ -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const &\\);${ws}E\\(int, E const &\\);${ws}E\\(int\\);${ws}virtual int f\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vv\\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype E"
+ }
+ -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;((${ws}E & operator=\\(E const &\\);)|(${ws}E\\(int, E const &\\);)|(${ws}E\\(int\\);)|(${ws}virtual int f\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype E (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype E"
+ }
+ timeout {
+ fail "ptype E (timeout)"
+ }
+ }
+
+ send_gdb "ptype dd\n"
+ gdb_expect {
+ -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype dd"
+ }
+ -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype dd (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype dd"
+ }
+ timeout {
+ fail "ptype dd (timeout)"
+ }
+ }
+
+ send_gdb "ptype ppd\n"
+ gdb_expect {
+ -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype ppd"
+ }
+ -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype ppd (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype ppd"
+ }
+ timeout {
+ fail "ptype ppd (timeout)"
+ }
+ }
+
+ send_gdb "ptype pAd\n"
+ gdb_expect {
+ -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const &\\);${ws}AD\\(AD const &\\);${ws}AD\\(void\\);${ws}virtual int vg\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pAd"
+ }
+ -re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const &\\);)|(${ws}AD\\(AD const &\\);)|(${ws}AD\\(void\\);)|(${ws}virtual int vg\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pAd (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype pAd"
+ }
+ timeout {
+ fail "ptype pAd (timeout)"
+ }
+ }
+
+ send_gdb "ptype a\n"
+ gdb_expect {
+ -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype a"
+ }
+ -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype a (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype a"
+ }
+ timeout {
+ fail "ptype a (timeout)"
+ }
+ }
+
+ send_gdb "ptype b\n"
+ gdb_expect {
+ -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const &\\);${ws}B\\(int, B const &\\);${ws}B\\(int\\);${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype b"
+ }
+ -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:((${ws}B & operator=\\(B const &\\);)|(${ws}B\\(int, B const &\\);)|(${ws}B\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype b (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype b"
+ }
+ timeout {
+ fail "ptype b (timeout)"
+ }
+ }
+
+ send_gdb "ptype c\n"
+ gdb_expect {
+ -re "type = class C : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int c;${ws}C & operator=\\(C const &\\);${ws}C\\(int, C const &\\);${ws}C\\(int\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype c"
+ }
+ -re "type = class C : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int c;((${ws}C & operator=\\(C const &\\);)|(${ws}C\\(int, C const &\\);)|(${ws}C\\(int\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype c (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype c"
+ }
+ timeout {
+ fail "ptype c (timeout)"
+ }
+ }
+
+ send_gdb "ptype d\n"
+ gdb_expect {
+ -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype d"
+ }
+ -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype d (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype d"
+ }
+ timeout {
+ fail "ptype d (timeout)"
+ }
+ }
+
+ send_gdb "ptype e\n"
+ gdb_expect {
+ -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const &\\);${ws}E\\(int, E const &\\);${ws}E\\(int\\);${ws}virtual int f\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vv\\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype e"
+ }
+ -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;((${ws}E & operator=\\(E const &\\);)|(${ws}E\\(int, E const &\\);)|(${ws}E\\(int\\);)|(${ws}virtual int f\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype e (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype e"
+ }
+ timeout {
+ fail "ptype e (timeout)"
+ }
+ }
+
+ send_gdb "ptype v\n"
+ gdb_expect {
+ -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype v"
+ }
+ -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype v (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype v"
+ }
+ timeout {
+ fail "ptype v (timeout)"
+ }
+ }
+
+ send_gdb "ptype vb\n"
+ gdb_expect {
+ -re "type = class VB \{${ws}public:${ws}int vb;${ws}VB & operator=\\(VB const &\\);${ws}VB\\(VB const &\\);${ws}VB\\(void\\);${ws}int fvb\\(void\\);${ws}virtual int vvb\\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype vb"
+ }
+ -re "type = class VB \{${ws}public:${ws}int vb;((${ws}VB & operator=\\(VB const &\\);)|(${ws}VB\\(VB const &\\);)|(${ws}VB\\(void\\);)|(${ws}int fvb\\(void\\);)|(${ws}virtual int vvb\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
+ pass "ptype vb (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype vb"
+ }
+ timeout {
+ fail "ptype vb (timeout)"
+ }
+ }
+
+ send_gdb "ptype pAa\n"
+ gdb_expect {
+ -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pAa"
+ }
+ -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pAa (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype pAa"
+ }
+ timeout {
+ fail "ptype pAa (timeout)"
+ }
+ }
+
+ send_gdb "ptype pAe\n"
+ gdb_expect {
+ -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pAe"
+ }
+ -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pAe (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype pAe"
+ }
+ timeout {
+ fail "ptype pAe (timeout)"
+ }
+ }
+
+ send_gdb "ptype pBe\n"
+ gdb_expect {
+ -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const &\\);${ws}B\\(int, B const &\\);${ws}B\\(int\\);${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pBe"
+ }
+ -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:((${ws}B & operator=\\(B const &\\);)|(${ws}B\\(int, B const &\\);)|(${ws}B\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pBe (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype pBe"
+ }
+ timeout {
+ fail "ptype pBe (timeout)"
+ }
+ }
+
+ send_gdb "ptype pDd\n"
+ gdb_expect {
+ -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pDd"
+ }
+ -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pDd (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype pDd"
+ }
+ timeout {
+ fail "ptype pDd (timeout)"
+ }
+ }
+
+ send_gdb "ptype pDe\n"
+ gdb_expect {
+ -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pDe"
+ }
+ -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pDe (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype pDe"
+ }
+ timeout {
+ fail "ptype pDe (timeout)"
+ }
+ }
+
+ send_gdb "ptype pVa\n"
+ gdb_expect {
+ -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pVa"
+ }
+ -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pVa (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype pVa"
+ }
+ timeout {
+ fail "ptype pVa (timeout)"
+ }
+ }
+
+ send_gdb "ptype pVv\n"
+ gdb_expect {
+ -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pVv"
+ }
+ -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pVv (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype pVv"
+ }
+ timeout {
+ fail "ptype pVv (timeout)"
+ }
+ }
+
+ send_gdb "ptype pVe\n"
+ gdb_expect {
+ -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pVe"
+ }
+ -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pVe (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype pVe"
+ }
+ timeout {
+ fail "ptype pVe (timeout)"
+ }
+ }
+
+ send_gdb "ptype pVd\n"
+ gdb_expect {
+ -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pVd"
+ }
+ -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pVd (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype pVd"
+ }
+ timeout {
+ fail "ptype pVd (timeout)"
+ }
+ }
+
+ send_gdb "ptype pADe\n"
+ gdb_expect {
+ -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const &\\);${ws}AD\\(AD const &\\);${ws}AD\\(void\\);${ws}virtual int vg\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pADe"
+ }
+ -re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const &\\);)|(${ws}AD\\(AD const &\\);)|(${ws}AD\\(void\\);)|(${ws}virtual int vg\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pADe (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype pADe"
+ }
+ timeout {
+ fail "ptype pADe (timeout)"
+ }
+ }
+
+ send_gdb "ptype pEe\n"
+ gdb_expect {
+ -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const &\\);${ws}E\\(int, E const &\\);${ws}E\\(int\\);${ws}virtual int f\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pEe"
+ }
+ -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;((${ws}E & operator=\\(E const &\\);)|(${ws}E\\(int, E const &\\);)|(${ws}E\\(int\\);)|(${ws}virtual int f\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pEe (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype pEe"
+ }
+ timeout {
+ fail "ptype pEe (timeout)"
+ }
+ }
+
+ send_gdb "ptype pVB\n"
+ gdb_expect {
+ -re "type = class VB \{${ws}public:${ws}int vb;${ws}VB & operator=\\(VB const &\\);${ws}VB\\(VB const &\\);${ws}VB\\(void\\);${ws}int fvb\\(void\\);${ws}virtual int vvb\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pVB"
+ }
+ -re "type = class VB \{${ws}public:${ws}int vb;((${ws}VB & operator=\\(VB const &\\);)|(${ws}VB\\(VB const &\\);)|(${ws}VB\\(void\\);)|(${ws}int fvb\\(void\\);)|(${ws}virtual int vvb\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pVB (obsolescent gcc or gdb)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "ptype pVB"
+ }
+ timeout {
+ fail "ptype pVB (timeout)"
+ }
+ }
+}
+
+#
+# Test calling of virtual functions.
+#
+
+proc test_virtual_calls {} {
+ global gdb_prompt
+ global GDB
+ global nl
+
+ if [target_info exists gdb,cannot_call_functions] {
+ setup_xfail "*-*-*" 2416
+ fail "This target can not call functions"
+ return 0
+ }
+
+ send_gdb "print pAe->f()\n"
+ gdb_expect {
+ -re ".* = 20$nl$gdb_prompt $" { pass "print pAe->f()" }
+ -re "Cannot invoke functions on this machine.*$gdb_prompt $" {
+ fail "print pAe->f() (cannot invoke functions, skipping virtual calls)"
+ return 0
+ }
+ -re ".*Cannot access memory at address 0x8.*$gdb_prompt $" {
+ fail "print pAe->f() \
+(known failure with gcc cygnus-2.4.5-930417, skipping virtual calls)"
+ return 0
+ }
+ -re ".*$gdb_prompt $" { fail "print pAe->f()" }
+ timeout { fail "print pAe->f() (timeout)" }
+ eof { fail "print pAe->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
+ }
+
+ send_gdb "print pAa->f()\n"
+ gdb_expect {
+ -re ".* = 1$nl$gdb_prompt $" { pass "print pAa->f()" }
+ -re ".*$gdb_prompt $" { fail "print pAa->f()" }
+ timeout { fail "print pAa->f() (timeout)" }
+ eof { fail "print pAa->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
+ }
+
+ send_gdb "print pDe->vg()\n"
+# setup_xfail "*-*-*"
+ gdb_expect {
+ -re ".* = 202$nl$gdb_prompt $" { pass "print pDe->vg()" }
+ -re ".*$gdb_prompt $" { fail "print pDe->vg()" }
+ timeout { fail "print pDe->vg() (timeout)" }
+ eof { fail "print pDe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
+ }
+
+ send_gdb "print pADe->vg()\n"
+ gdb_expect {
+ -re ".* = 202$nl$gdb_prompt $" { pass "print pADe->vg()" }
+ -re ".*$gdb_prompt $" { fail "print pADe->vg()" }
+ timeout { fail "print pADe->vg() (timeout)" }
+ eof { fail "print pADe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
+ }
+
+ send_gdb "print pDd->vg()\n"
+# setup_xfail "*-*-*"
+ gdb_expect {
+ -re ".* = 101$nl$gdb_prompt $" { pass "print pDd->vg()" }
+ -re ".*$gdb_prompt $" { fail "print pDd->vg()" }
+ timeout { fail "print pDd->vg() (timeout)" }
+ eof { fail "print pDd->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
+ }
+
+ send_gdb "print pEe->vvb()\n"
+# setup_xfail "*-*-*"
+ gdb_expect {
+ -re ".* = 411$nl$gdb_prompt $" { pass "print pEe->vvb()" }
+ -re ".*$gdb_prompt $" { fail "print pEe->vvb()" }
+ timeout { fail "print pEe->vvb() (timeout)" }
+ eof { fail "print pEe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
+ }
+
+ send_gdb "print pVB->vvb()\n"
+ gdb_expect {
+ -re ".* = 407$nl$gdb_prompt $" { pass "print pVB->vvb()" }
+ -re ".*$gdb_prompt $" { fail "print pVB->vvb()" }
+ timeout { fail "print pVB->vvb() (timeout)" }
+ eof { fail "print pVB->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
+ }
+
+ send_gdb "print pBe->vvb()\n"
+# setup_xfail "*-*-*"
+ gdb_expect {
+ -re ".* = 411$nl$gdb_prompt $" { pass "print pBe->vvb()" }
+ -re ".*$gdb_prompt $" { fail "print pBe->vvb()" }
+ timeout { fail "print pBe->vvb() (timeout)" }
+ eof { fail "print pBe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
+ }
+
+ send_gdb "print pDe->vvb()\n"
+# setup_xfail "*-*-*"
+ gdb_expect {
+ -re ".* = 411$nl$gdb_prompt $" { pass "print pDe->vvb()" }
+ -re ".*$gdb_prompt $" { fail "print pDe->vvb()" }
+ timeout { fail "print pDe->vvb() (timeout)" }
+ eof { fail "print pDe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
+ }
+
+ send_gdb "print pEe->vd()\n"
+# setup_xfail "*-*-*"
+ gdb_expect {
+ -re ".* = 282$nl$gdb_prompt $" { pass "print pEe->vd()" }
+ -re ".*$gdb_prompt $" { fail "print pEe->vd()" }
+ timeout { fail "print pEe->vd() (timeout)" }
+ eof { fail "print pEe->vd() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
+ }
+
+ send_gdb "print pEe->fvb()\n"
+# setup_xfail "*-*-*"
+ gdb_expect {
+ -re ".* = 311$nl$gdb_prompt $" { pass "print pEe->fvb()" }
+ -re ".*$gdb_prompt $" { fail "print pEe->fvb()" }
+ timeout { fail "print pEe->fvb() (timeout)" }
+ eof { fail "print pEe->fvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
+ }
+
+ send_gdb "print pEe->D::vg()\n"
+ setup_xfail "*-*-*"
+ gdb_expect {
+ -re ".* = 102$nl$gdb_prompt $" { pass "print pEe->D::vg()" }
+ -re ".*$gdb_prompt $" { fail "print pEe->D::vg()" }
+ timeout { fail "print pEe->D::vg() (timeout)" }
+ eof { fail "print pEe->D::vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
+ }
+}
+
+proc do_tests {} {
+ global prms_id
+ global bug_id
+
+ set prms_id 0
+ set bug_id 0
+
+ gdb_start;
+ gdb_virtfunc_init;
+
+ # Get the debug format for the compiled test case. If that
+ # format is DWARF 1 then just skip all the tests since none of
+ # them will pass.
+
+ if [ runto_main ] then {
+ get_debug_format
+ if [ setup_xfail_format "DWARF 1" ] then {
+ fail "C++ tests skipped due to limited C++ support in DWARF 1 debug format"
+ return
+ }
+ clear_xfail "*-*-*"
+ }
+
+ test_ptype_of_classes
+
+ if [ runto 'test_calls(void)' ] then {
+ test_virtual_calls
+ }
+}
+
+do_tests