aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.c++
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>1999-08-02 23:48:37 +0000
committerJason Molenda <jmolenda@apple.com>1999-08-02 23:48:37 +0000
commita0b3c4fd32cf8336bf7b69f373ef86d5c54035f6 (patch)
treecf8f31bccdd267252e6b3c9636a1d323397673e2 /gdb/testsuite/gdb.c++
parent30727aa6d12fb866494020c0b62ab265a2bdcdfe (diff)
downloadgdb-a0b3c4fd32cf8336bf7b69f373ef86d5c54035f6.zip
gdb-a0b3c4fd32cf8336bf7b69f373ef86d5c54035f6.tar.gz
gdb-a0b3c4fd32cf8336bf7b69f373ef86d5c54035f6.tar.bz2
import gdb-1999-08-02 snapshot
Diffstat (limited to 'gdb/testsuite/gdb.c++')
-rw-r--r--gdb/testsuite/gdb.c++/Makefile.in17
-rw-r--r--gdb/testsuite/gdb.c++/ambiguous.cc110
-rw-r--r--gdb/testsuite/gdb.c++/ambiguous.exp235
-rw-r--r--gdb/testsuite/gdb.c++/annota2.exp13
-rw-r--r--gdb/testsuite/gdb.c++/anon-union.cc23
-rw-r--r--gdb/testsuite/gdb.c++/anon-union.exp54
-rw-r--r--gdb/testsuite/gdb.c++/classes.exp46
-rw-r--r--gdb/testsuite/gdb.c++/cplusfuncs.cc6
-rw-r--r--gdb/testsuite/gdb.c++/cplusfuncs.exp25
-rw-r--r--gdb/testsuite/gdb.c++/ctti.exp268
-rw-r--r--gdb/testsuite/gdb.c++/cttiadd.cc29
-rw-r--r--gdb/testsuite/gdb.c++/cttiadd1.cc16
-rw-r--r--gdb/testsuite/gdb.c++/cttiadd2.cc22
-rw-r--r--gdb/testsuite/gdb.c++/cttiadd3.cc33
-rw-r--r--gdb/testsuite/gdb.c++/demangle.exp4
-rw-r--r--gdb/testsuite/gdb.c++/derivation.exp5
-rw-r--r--gdb/testsuite/gdb.c++/inherit.exp254
-rw-r--r--gdb/testsuite/gdb.c++/local.exp57
-rw-r--r--gdb/testsuite/gdb.c++/member-ptr.exp35
-rw-r--r--gdb/testsuite/gdb.c++/method.exp19
-rw-r--r--gdb/testsuite/gdb.c++/misc.cc13
-rw-r--r--gdb/testsuite/gdb.c++/misc.exp55
-rw-r--r--gdb/testsuite/gdb.c++/overload.exp50
-rw-r--r--gdb/testsuite/gdb.c++/ref-types.cc51
-rw-r--r--gdb/testsuite/gdb.c++/ref-types.exp411
-rw-r--r--gdb/testsuite/gdb.c++/templates.cc4
-rw-r--r--gdb/testsuite/gdb.c++/templates.exp246
-rw-r--r--gdb/testsuite/gdb.c++/userdef.exp31
-rw-r--r--gdb/testsuite/gdb.c++/virtfunc.cc4
-rw-r--r--gdb/testsuite/gdb.c++/virtfunc.exp150
30 files changed, 2098 insertions, 188 deletions
diff --git a/gdb/testsuite/gdb.c++/Makefile.in b/gdb/testsuite/gdb.c++/Makefile.in
index 5efba8d..58ef94b 100644
--- a/gdb/testsuite/gdb.c++/Makefile.in
+++ b/gdb/testsuite/gdb.c++/Makefile.in
@@ -1,17 +1,24 @@
VPATH = @srcdir@
srcdir = @srcdir@
-PROGS = annota2 anon-union compiler cplusfuncs derivation inherit local \
- member-ptr method misc \
- overload ovldbreak ref-types ref-types2 templates userdef virtfunc
+EXECUTABLES = ambiguous annota2 anon-union cplusfuncs cttiadd \
+ derivation inherit local member-ptr method misc \
+ overload ovldbreak ref-typ ref-typ2 templates userdef virtfunc
all:
@echo "Nothing to be done for all..."
-#### host, target, and site specific Makefile frags come in here.
+info:
+install-info:
+dvi:
+install:
+uninstall: force
+installcheck:
+check:
clean mostlyclean:
- -rm -f *.ci *.o ${OBJS} ${PROGS} *~ core
+ -rm -f *~ *.o *.ci
+ -rm -f core ${EXECUTABLES}
distclean maintainer-clean realclean: clean
-rm -f Makefile config.status config.log
diff --git a/gdb/testsuite/gdb.c++/ambiguous.cc b/gdb/testsuite/gdb.c++/ambiguous.cc
new file mode 100644
index 0000000..6ee7bc1
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/ambiguous.cc
@@ -0,0 +1,110 @@
+
+void marker1()
+{
+ return;
+}
+
+class A1 {
+public:
+ int x;
+ int y;
+};
+
+class A2 {
+public:
+ int x;
+ int y;
+};
+
+class A3 {
+public:
+ int x;
+ int y;
+};
+
+class X : public A1, public A2 {
+public:
+ int z;
+};
+
+class L : public A1 {
+public:
+ int z;
+};
+
+class LV : public virtual A1 {
+public:
+ int z;
+};
+
+class M : public A2 {
+public:
+ int w;
+};
+
+class N : public L, public M {
+public:
+ int r;
+};
+
+class K : public A1 {
+public:
+ int i;
+};
+
+class KV : public virtual A1 {
+public:
+ int i;
+};
+
+class J : public K, public L {
+public:
+ int j;
+};
+
+class JV : public KV, public LV {
+public:
+ int jv;
+};
+
+class JVA1 : public KV, public LV, public A1 {
+public:
+ int jva1;
+};
+
+class JVA2 : public KV, public LV, public A2 {
+public:
+ int jva2;
+};
+
+class JVA1V : public KV, public LV, public virtual A1 {
+public:
+ int jva1v;
+};
+
+int main()
+{
+ A1 a1;
+ A2 a2;
+ A3 a3;
+ X x;
+ L l;
+ M m;
+ N n;
+ K k;
+ J j;
+ JV jv;
+ JVA1 jva1;
+ JVA2 jva2;
+ JVA1V jva1v;
+
+ int i;
+
+ i += k.i + m.w + a1.x + a2.x + a3.x + x.z + l.z + n.r + j.j;
+
+ marker1();
+
+}
+
+
+
diff --git a/gdb/testsuite/gdb.c++/ambiguous.exp b/gdb/testsuite/gdb.c++/ambiguous.exp
new file mode 100644
index 0000000..998b478
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/ambiguous.exp
@@ -0,0 +1,235 @@
+# 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 is part of the gdb testsuite
+
+# tests relating to ambiguous class members
+# Written by Satish Pai <pai@apollo.hp.com> 1997-07-28
+
+# 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 "ambiguous"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+
+if [get_compiler_info ${binfile} "c++"] {
+ return -1;
+}
+
+if { $gcc_compiled } then { 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."
+}
+
+
+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 $" { pass "up from marker1" }
+ timeout { fail "up from marker1" }
+ }
+ }
+ -re "$gdb_prompt $" { fail "continue to marker1" }
+ timeout { fail "(timeout) continue to marker1" }
+ }
+
+# print out various class objects' members. The values aren't
+# important, just check that the warning is emitted at the
+# right times.
+
+# X is derived from A1 and A2; both A1 and A2 have a member 'x'
+send_gdb "print x.x\n"
+gdb_expect {
+ -re "warning: x ambiguous; using X::A2::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" {
+ pass "print x.x"
+ }
+ -re "warning: x ambiguous; using X::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" {
+ pass "print x.x"
+ }
+ -re ".*$gdb_prompt $" { fail "print x.x" }
+ timeout { fail "(timeout) print x.x" }
+}
+
+
+# N is derived from A1 and A2, but not immediately -- two steps
+# up in the hierarchy. Both A1 and A2 have a member 'x'.
+send_gdb "print n.x\n"
+gdb_expect {
+ -re "warning: x ambiguous; using N::M::A2::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" {
+ pass "print n.x"
+ }
+ -re "warning: x ambiguous; using N::L::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" {
+ pass "print n.x"
+ }
+ -re ".*$gdb_prompt $" { fail "print n.x" }
+ timeout { fail "(timeout) print n.x" }
+}
+
+# J is derived from A1 twice. A1 has a member x.
+send_gdb "print j.x\n"
+gdb_expect {
+ -re "warning: x ambiguous; using J::L::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" {
+ pass "print j.x"
+ }
+ -re "warning: x ambiguous; using J::K::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" {
+ pass "print j.x"
+ }
+ -re ".*$gdb_prompt $" { fail "print j.x" }
+ timeout { fail "(timeout) print j.x" }
+}
+
+# JV is derived from A1 but A1 is a virtual base. Should not
+# report an ambiguity in this case.
+send_gdb "print jv.x\n"
+gdb_expect {
+ -re "warning: x ambiguous.*Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" {
+ fail "print jv.x (ambiguity reported)"
+ }
+ -re "\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { pass "print jv.x" }
+ -re ".*$gdb_prompt $" { fail "print jv.x (??)" }
+ timeout { fail "(timeout) print jv.x" }
+}
+
+# JVA1 is derived from A1; A1 occurs as a virtual base in two
+# ancestors, and as a non-virtual immediate base. Ambiguity must
+# be reported.
+send_gdb "print jva1.x\n"
+gdb_expect {
+ -re "warning: x ambiguous; using JVA1::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" {
+ pass "print jva1.x"
+ }
+ -re "warning: x ambiguous; using JVA1::KV::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" {
+ pass "print jva1.x"
+ }
+ -re ".*$gdb_prompt $" { fail "print jva1.x" }
+ timeout { fail "(timeout) print jva1.x" }
+}
+
+# JVA2 is derived from A1 & A2; A1 occurs as a virtual base in two
+# ancestors, and A2 is a non-virtual immediate base. Ambiguity must
+# be reported as A1 and A2 both have a member 'x'.
+send_gdb "print jva2.x\n"
+gdb_expect {
+ -re "warning: x ambiguous; using JVA2::A2::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" {
+ pass "print jva2.x"
+ }
+ -re "warning: x ambiguous; using JVA2::KV::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" {
+ pass "print jva2.x"
+ }
+ -re ".*$gdb_prompt $" { fail "print jva2.x" }
+ timeout { fail "(timeout) print jva2.x" }
+}
+
+# JVA1V is derived from A1; A1 occurs as a virtual base in two
+# ancestors, and also as a virtual immediate base. Ambiguity must
+# not be reported.
+send_gdb "print jva1v.x\n"
+gdb_expect {
+ -re "warning: x ambiguous.*Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" {
+ fail "print jva1v.x (ambiguity reported)"
+ }
+ -re "\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { pass "print jva1v.x" }
+ -re ".*$gdb_prompt $" { fail "print jva1v.x (??)" }
+ timeout { fail "(timeout) print jva1v.x" }
+}
+
+# Now check for ambiguous bases.
+
+# J is derived from A1 twice; report ambiguity if a J is
+# cast to an A1.
+send_gdb "print (A1)j\n"
+gdb_expect {
+ -re "warning: A1 ambiguous; using J::L::A1. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" {
+ pass "print (A1)j"
+ }
+ -re "warning: A1 ambiguous; using J::K::A1. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" {
+ pass "print (A1)j"
+ }
+ -re ".*$gdb_prompt $" { fail "print (A1)j" }
+ timeout { fail "(timeout) print (A1)j" }
+}
+
+# JV is derived from A1 twice, but A1 is a virtual base; should
+# not report ambiguity when a JV is cast to an A1.
+send_gdb "print (A1)jv\n"
+gdb_expect {
+ -re "warning: A1 ambiguous.*Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" {
+ fail "print (A1)jv (ambiguity reported)"
+ }
+ -re "\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { pass "print (A1)jv" }
+ -re ".*$gdb_prompt $" { fail "print (A1)jv (??)" }
+ timeout { fail "(timeout) print (A1)jv" }
+}
+
+# JVA1 is derived from A1; A1 is a virtual base and also a
+# non-virtual base. Must report ambiguity if a JVA1 is cast to an A1.
+send_gdb "print (A1)jva1\n"
+gdb_expect {
+ -re "warning: A1 ambiguous; using JVA1::A1. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" {
+ pass "print (A1)jva1"
+ }
+ -re "warning: A1 ambiguous; using JVA1::KV::A1. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" {
+ pass "print (A1)jva1"
+ }
+ -re ".*$gdb_prompt $" { fail "print (A1)jva1" }
+ timeout { fail "(timeout) print (A1)jva1" }
+}
+
+# JVA1V is derived from A1; A1 is a virtual base indirectly
+# and also directly; must not report ambiguity when a JVA1V is cast to an A1.
+send_gdb "print (A1)jva1v\n"
+gdb_expect {
+ -re "warning: A1 ambiguous.*Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" {
+ fail "print (A1)jva1v (ambiguity reported)"
+ }
+ -re "\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { pass "print (A1)jva1v"
+ }
+ -re ".*$gdb_prompt $" { fail "print (A1)jva1v (??)" }
+ timeout { fail "(timeout) print (A1)jva1v" }
+}
+
diff --git a/gdb/testsuite/gdb.c++/annota2.exp b/gdb/testsuite/gdb.c++/annota2.exp
index aabc551..0a58cd4 100644
--- a/gdb/testsuite/gdb.c++/annota2.exp
+++ b/gdb/testsuite/gdb.c++/annota2.exp
@@ -95,8 +95,7 @@ gdb_expect {
send_gdb "run\n"
gdb_expect {
- -re "\r\n\032\032post-prompt\r\nStarting program: $binfile \(\r\n\r\n\032\032frames-invalid\)+\(\r\n\r\n\032\032breakpoints-invalid\)*.*\(\r\n\r\n\032\032frames-invalid\)*\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\r\n\r\n\032\032breakpoint 1\r\n\r\nBreakpoint 1, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*annota2.cc\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$main_line\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \
- { pass "run until main breakpoint" }
+ -re "$main_line.*$gdb_prompt$" { pass "run until main breakpoint" }
-re ".*$gdb_prompt$" { fail "run until main breakpoint" }
timeout { fail "run until main breakpoint (timeout)" }
}
@@ -135,7 +134,7 @@ gdb_expect {
#
send_gdb "delete\n"
gdb_expect {
- -re " " {
+ -re ".*Delete all breakpoints. \\(y or n\\) \r\n\032\032query.*$" {
send_gdb "y\n"
gdb_expect {
-re " " { pass "delete bps" }
@@ -166,10 +165,11 @@ set main_line 22
#
# run program up to breakpoint.
#
+
+
send_gdb "run\n"
gdb_expect {
- -re "\r\n\032\032post-prompt\r\n.*Starting program: $binfile \(\r\n\r\n\032\032frames-invalid\)+\(\r\n\r\n\032\032breakpoints-invalid\)*.*\(\r\n\r\n\032\032frames-invalid\)*\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\r\n\r\n\032\032breakpoint 2\r\n\r\nBreakpoint 2, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*annota2.cc\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$main_line\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \
- { pass "run until main breakpoint" }
+ -re "$main_line.*$gdb_prompt$" { pass "run until main breakpoint" }
-re ".*$gdb_prompt$" { fail "run until main breakpoint" }
timeout { fail "run until main breakpoint (timeout)" }
}
@@ -179,7 +179,7 @@ send_gdb "run\n"
#
send_gdb "watch a.x\n"
gdb_expect {
- -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\nWatchpoint 3: a.x\r\n$gdb_prompt$" \
+ -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\n.*atchpoint 3: a.x\r\n$gdb_prompt$" \
{ pass "set watch on a.x" }
-re ".*$gdb_prompt$" { fail "set watch on a.x" }
timeout { fail "set watch on a.x (timeout)" }
@@ -222,3 +222,4 @@ gdb_expect {
# reinstall the old prompt for the rest of the testsuite.
set gdb_prompt $old_gdb_prompt
+
diff --git a/gdb/testsuite/gdb.c++/anon-union.cc b/gdb/testsuite/gdb.c++/anon-union.cc
index c58a306..0b3fd13 100644
--- a/gdb/testsuite/gdb.c++/anon-union.cc
+++ b/gdb/testsuite/gdb.c++/anon-union.cc
@@ -4,13 +4,13 @@ struct Foo {
int zero;
unsigned int one;
} num1;
-
- union {
- int pebble;
- struct {
+ struct X {
int rock;
unsigned int rock2;
- } x;
+ };
+ union {
+ int pebble;
+ X x;
union {
int qux;
unsigned int mux;
@@ -32,22 +32,23 @@ union Bar {
unsigned int y;
};
-Foo foo;
-Bar bar;
int main()
{
+ Foo foo = {0, 0};
+
foo.paper = 33;
foo.pebble = 44;
foo.mux = 55;
- bar.x = 33;
+ Bar bar = {0};
- union
- {
+ union {
int z;
unsigned int w;
- };
+ }; w = 0;
+
+ bar.x = 33;
w = 45;
diff --git a/gdb/testsuite/gdb.c++/anon-union.exp b/gdb/testsuite/gdb.c++/anon-union.exp
index 83171a2..5ed924f 100644
--- a/gdb/testsuite/gdb.c++/anon-union.exp
+++ b/gdb/testsuite/gdb.c++/anon-union.exp
@@ -76,6 +76,16 @@ gdb_expect -re "$gdb_prompt $"
# NOTE: Add -- ptype foo.x, etc. when things are working
+#Initialize foo
+send_gdb "next\n"
+gdb_expect {
+ -re "40\[ \t\]*foo.paper = 33;\r\n$gdb_prompt $" {
+ pass "next 1"
+ }
+ -re ".*$gdb_prompt $" { fail "next 1" }
+ timeout { fail "(timeout) next 1" }
+}
+
# Print out the big anon union.
send_gdb "print foo\n"
gdb_expect {
@@ -245,10 +255,10 @@ gdb_expect {
}
-# Step over next two assignments
-send_gdb "next 2\n"
+# Step over next four assignments
+send_gdb "next 4\n"
gdb_expect {
- -re "52\[ \t\]*w = 45;\r\n$gdb_prompt $" {
+ -re "53\[ \t\]*w = 45;\r\n$gdb_prompt $" {
pass "next 3"
}
-re ".*$gdb_prompt $" { fail "next 3" }
@@ -257,30 +267,28 @@ gdb_expect {
# 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" }
-#}
+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" }
+}
+
+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 $" {
+ -re "55\[ \t\]*\}\r\n$gdb_prompt $" {
pass "next 4"
}
-re ".*$gdb_prompt $" { fail "next 4" }
diff --git a/gdb/testsuite/gdb.c++/classes.exp b/gdb/testsuite/gdb.c++/classes.exp
index 05a6cde..445f2e6 100644
--- a/gdb/testsuite/gdb.c++/classes.exp
+++ b/gdb/testsuite/gdb.c++/classes.exp
@@ -42,13 +42,6 @@ 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."
@@ -142,6 +135,9 @@ proc test_ptype_class_objects {} {
-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 = struct 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 $" {
+ pass "ptype struct mixed_protection_struct (extra public)"
+ }
-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)"
@@ -203,6 +199,9 @@ proc test_ptype_class_objects {} {
-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 = class explicit_private_class \{${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
+ pass "ptype class explicit_private_class (OK for HP aCC)"
+ }
-re "type = struct explicit_private_class \{${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
setup_xfail "*-*-*"
fail "ptype class explicit_private_class"
@@ -340,6 +339,9 @@ proc test_ptype_class_objects {} {
setup_xfail "*-*-*"
fail "ptype class vB (FIXME: non-portable virtual table constructs)"
}
+ -re "type = class vB : public virtual vA \{${ws}public:${ws}int vb;${ws}int vx;${ws}\}$nl$gdb_prompt $" {
+ pass "ptype class vB (aCC)"
+ }
-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)"
@@ -364,6 +366,9 @@ proc test_ptype_class_objects {} {
setup_xfail "*-*-*"
fail "ptype class vC (FIXME: non-portable virtual table constructs)"
}
+ -re "type = class vC : public virtual vA \{${ws}public:${ws}int vc;${ws}int vx;${ws}\}$nl$gdb_prompt $" {
+ pass "ptype class vC (aCC)"
+ }
-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)"
@@ -388,6 +393,9 @@ proc test_ptype_class_objects {} {
setup_xfail "*-*-*"
fail "ptype class vD (FIXME: non-portable virtual table constructs)"
}
+ -re "type = class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;${ws}\}$nl$gdb_prompt $" {
+ pass "ptype class vD (aCC)"
+ }
-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)"
@@ -412,6 +420,9 @@ proc test_ptype_class_objects {} {
setup_xfail "*-*-*"
fail "ptype class vE (FIXME: non-portable virtual table constructs)"
}
+ -re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;${ws}\}$nl$gdb_prompt $" {
+ pass "ptype class vE (aCC)"
+ }
-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)"
@@ -446,6 +457,9 @@ proc test_ptype_class_objects {} {
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;\r\n${ws}Foo\\(int, int\\);${ws}int operator!.void.;${ws}operator int.void.;${ws}int times.int.;$nl\}$nl$gdb_prompt $" {
+ pass "ptype class Foo(aCC)"
+ }
-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"
}
@@ -584,7 +598,7 @@ proc test_pointers_to_class_members {} {
timeout { fail "print (int)&Bar::y == 2*sizeof(int) (timeout)" ; return }
}
- send_gdb "next\n"
+ send_gdb "next 2\n"
setup_xfail "*-*-*"
gdb_expect {
-re "$decimal\[ \t\]+inheritance3 \[)(\]+;$nl$gdb_prompt $" {}
@@ -774,15 +788,15 @@ do_tests
# set a breakpoint and go there
-send_gdb "break 503\n"
+send_gdb "break 516\n"
gdb_expect {
- -re "Breakpoint \[0-9\] at.*$gdb_prompt $" { pass "set break 503" }
- -re "$gdb_prompt $" { fail "set break 503" }
- timeout { fail "(timeout) set break 503" }
+ -re "Breakpoint \[0-9\] at.*$gdb_prompt $" { pass "set break 516" }
+ -re "$gdb_prompt $" { fail "set break 516" }
+ timeout { fail "(timeout) set break 516" }
}
send_gdb "continue\n"
gdb_expect {
- -re "Continuing\\.\r\n\r\nBreakpoint \[0-9\]*, main....at.*misc\\.cc:503\r\n503.*\r\n$gdb_prompt $" { pass "continue" }
+ -re "Continuing\\.\r\n\r\nBreakpoint \[0-9\]*, main....at.*misc\\.cc:516\r\n516.*\r\n$gdb_prompt $" { pass "continue" }
-re "$gdb_prompt $" { fail "continue" }
timeout { fail "(timeout) continue" }
}
@@ -829,13 +843,17 @@ gdb_expect {
}
# ptype on the object
+# g++ is putting out the wrong debug info. This works with aCC
+if {!$hp_aCC_compiler} {setup_xfail "hppa*-*-*"}
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 "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" }
}
+# g++ is putting out the wrong debug info. This works with aCC
+if {!$hp_aCC_compiler} {setup_xfail "hppa*-*-*"}
send_gdb "print (ClassWithEnum::PrivEnum) 42\n"
gdb_expect {
-re "\\$\[0-9\]* = yellow.*$gdb_prompt $" { pass "print (ClassWithEnum::PrivEnum) 42" }
diff --git a/gdb/testsuite/gdb.c++/cplusfuncs.cc b/gdb/testsuite/gdb.c++/cplusfuncs.cc
index acb73b1..0c835eb 100644
--- a/gdb/testsuite/gdb.c++/cplusfuncs.cc
+++ b/gdb/testsuite/gdb.c++/cplusfuncs.cc
@@ -36,7 +36,7 @@ public:
void operator || (foo&);
void operator ~ (void);
void operator -- (int);
- void operator -> (void);
+ foo* operator -> (void);
void operator -= (foo&);
void operator /= (foo&);
void operator <<= (foo&);
@@ -63,7 +63,7 @@ extern "C" {
};
#endif
-main () {
+int main () {
#ifdef usestubs
set_debug_traps();
breakpoint();
@@ -105,7 +105,7 @@ 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) {}
+foo* foo::operator -> (void) {return this;}
void foo::operator -= (foo& afoo) { afoo.ifoo = 0; }
void foo::operator /= (foo& afoo) { afoo.ifoo = 0; }
void foo::operator <<= (foo& afoo) { afoo.ifoo = 0; }
diff --git a/gdb/testsuite/gdb.c++/cplusfuncs.exp b/gdb/testsuite/gdb.c++/cplusfuncs.exp
index e36d379..16283f3 100644
--- a/gdb/testsuite/gdb.c++/cplusfuncs.exp
+++ b/gdb/testsuite/gdb.c++/cplusfuncs.exp
@@ -34,6 +34,10 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
+if {[get_compiler_info $binfile "c++"] == -1} {
+ return -1
+}
+
#
# Cause gdb to lookup a specific C++ function and print the demangled
# form.
@@ -44,7 +48,10 @@ proc info_func { regex demangled } {
send_gdb "info function $regex\n"
gdb_expect {
- -re "File .*:\r\n$demangled\r\n$gdb_prompt $" {
+ -re "File .*:\r\n$demangled\r\n.*$gdb_prompt $" {
+ pass "info function for \"$regex\""
+ }
+ -re "File .*:\r\nclass $demangled\r\n.*$gdb_prompt $" {
pass "info function for \"$regex\""
}
-re ".*$gdb_prompt $" {
@@ -125,7 +132,7 @@ proc test_lookup_operator_functions {} {
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 delete(" "void foo::operator delete\\(void \\*\\)(| static);"
info_func "operator/(" "void foo::operator/\\(foo &\\);"
info_func "operator==(" "void foo::operator==\\(foo &\\);"
info_func "operator^(" "void foo::operator\\^\\(foo &\\);"
@@ -146,14 +153,14 @@ proc test_lookup_operator_functions {} {
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 new(" "void \\*foo::operator new\\(.*\\)(| static);"
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->(" "foo \\*foo::operator->\\(void\\);"
info_func "operator->\\*(" "void foo::operator->\\*\\(foo &\\);"
info_func "operator>>(" "void foo::operator\>\>\\(foo &\\);"
@@ -167,6 +174,7 @@ proc test_lookup_operator_functions {} {
proc test_paddr_operator_functions {} {
global hex
+ global hp_aCC_compiler
print_addr_of "foo::operator&&(foo &)"
print_addr_of "foo::operator&=(foo &)"
@@ -184,7 +192,12 @@ proc test_paddr_operator_functions {} {
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 *)"
+ if { !$hp_aCC_compiler } {
+ print_addr_of "foo::operator delete(void *)"
+ } else {
+ gdb_test "print &'foo::operator delete(void *) static'" \
+ " = .*(0x\[0-9a-f\]+|) <foo::operator delete.*>"
+ }
print_addr_of "foo::operator/(foo &)"
print_addr_of "foo::operator==(foo &)"
print_addr_of "foo::operator^(foo &)"
@@ -200,7 +213,7 @@ proc test_paddr_operator_functions {} {
print_addr_of "foo::operator!=(foo &)"
print_addr_of "foo::operator!(void)"
gdb_test "print &'foo::operator new'" \
- " = .* $hex <foo::operator new\\(.*\\)>"
+ " = .* $hex <foo::operator new\\(.*\\)(| static)>"
print_addr_of "foo::operator||(foo &)"
print_addr_of "foo::operator char *(void)"
print_addr_of "foo::operator int(void)"
diff --git a/gdb/testsuite/gdb.c++/ctti.exp b/gdb/testsuite/gdb.c++/ctti.exp
new file mode 100644
index 0000000..b8c7cc9
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/ctti.exp
@@ -0,0 +1,268 @@
+# 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 is part of the gdb testsuite
+# file written by Elena Zannoni (ezannoni@cygnus.com)
+#
+# source files cttiadd.cc, cttiadd1.cc, cttiadd2.cc, cttiadd3.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 "cttiadd"
+set srcfile ${testfile}.cc
+set srcfile1 ${testfile}1.cc
+set srcfile2 ${testfile}2.cc
+set srcfile3 ${testfile}3.cc
+set binfile ${objdir}/${subdir}/${testfile}
+
+if [get_compiler_info ${binfile} "c++"] {
+ return -1;
+}
+
+if { $gcc_compiled } then { continue }
+
+#if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3}" "${binfile}" executable {debug c++}] != "" } {
+# gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+#}
+
+set cmdline "$CXX_FOR_TARGET ${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3} -g -o ${binfile}"
+
+remote_exec build $cmdline
+
+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 "n\n"
+gdb_expect {
+ -re "$decimal.*i = 2;.*$gdb_prompt $" {
+ pass "next "
+ }
+ -re ".*$gdb_prompt $" { fail "next " }
+ timeout { fail "next " }
+ }
+
+
+send_gdb "n\n"
+gdb_expect {
+ -re "$decimal.*f = 4.5;.*$gdb_prompt $" {
+ pass "next "
+ }
+ -re ".*$gdb_prompt $" { fail "next " }
+ timeout { fail "next " }
+ }
+
+send_gdb "n\n"
+gdb_expect {
+ -re "$decimal.*c = add\\(c, c\\);.*$gdb_prompt $" {
+ pass "next "
+ }
+ -re ".*$gdb_prompt $" { fail "next " }
+ timeout { fail "next " }
+ }
+
+send_gdb "n\n"
+gdb_expect {
+ -re "$decimal.*i = add\\(i, i\\);.*$gdb_prompt $" {
+ pass "next "
+ }
+ -re ".*$gdb_prompt $" { fail "next " }
+ timeout { fail "next " }
+ }
+
+send_gdb "n\n"
+gdb_expect {
+ -re "$decimal.*f = add\\(f, f\\);.*$gdb_prompt $" {
+ pass "next "
+ }
+ -re ".*$gdb_prompt $" { fail "next " }
+ timeout { fail "next " }
+ }
+
+send_gdb "n\n"
+gdb_expect {
+ -re "$decimal.*add1\\(\\);.*$gdb_prompt $" {
+ pass "next "
+ }
+ -re ".*$gdb_prompt $" { fail "next " }
+ timeout { fail "next " }
+ }
+
+send_gdb "print c\n"
+gdb_expect {
+ -re ".$decimal = -62.*\r\n$gdb_prompt $" {
+ pass "print value of c"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of c" }
+ timeout { fail "(timeout) print value of c" }
+ }
+
+
+send_gdb "print f\n"
+gdb_expect {
+ -re ".$decimal = 9\r\n$gdb_prompt $" {
+ pass "print value of f"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of f" }
+ timeout { fail "(timeout) print value of f" }
+ }
+
+
+send_gdb "print i\n"
+gdb_expect {
+ -re ".$decimal = 4\r\n$gdb_prompt $" {
+ pass "print value of i"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of i" }
+ timeout { fail "(timeout) print value of i" }
+ }
+
+
+
+send_gdb "print add<int>(2,2)\n"
+gdb_expect {
+ -re ".$decimal = 4\r\n$gdb_prompt $" {
+ pass "print value of add<int>(2,2)"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of add<int>(2,2)" }
+ timeout { fail "(timeout) print value of add<int>(2,2)" }
+ }
+
+send_gdb "print add<float>(2.3,2.3)\n"
+gdb_expect {
+ -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" {
+ pass "print value of add<float>(2.3,2.3)"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of add<float>(2.3,2.3)" }
+ timeout { fail "(timeout) print value of add<float>(2.3,2.3)" }
+ }
+
+send_gdb "print add<char>('A','A')\n"
+gdb_expect {
+ -re ".$decimal = -126.*202.\r\n$gdb_prompt $" {
+ pass "print value of add<char>('A','A')"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of add<char>('A','A')" }
+ timeout { fail "(timeout) print value of add<char>('A','A')" }
+ }
+
+
+send_gdb "print add2<int>(2,2)\n"
+gdb_expect {
+ -re ".$decimal = 4\r\n$gdb_prompt $" {
+ pass "print value of add2<int>(2,2)"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of add2<int>(2,2)" }
+ timeout { fail "(timeout) print value of add2<int>(2,2)" }
+ }
+
+send_gdb "print add2<float>(2.3,2.3)\n"
+gdb_expect {
+ -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" {
+ pass "print value of add2<float>(2.3,2.3)"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of add2<float>(2.3,2.3)" }
+ timeout { fail "(timeout) print value of add2<float>(2.3,2.3)" }
+ }
+
+send_gdb "print add2<char>('A','A')\n"
+gdb_expect {
+ -re ".$decimal = -126.*202.\r\n$gdb_prompt $" {
+ pass "print value of add2<char>('A','A')"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of add2<char>('A','A')" }
+ timeout { fail "(timeout) print value of add2<char>('A','A')" }
+ }
+
+send_gdb "print add3<int>(2,2)\n"
+gdb_expect {
+ -re ".$decimal = 4\r\n$gdb_prompt $" {
+ pass "print value of add3<int>(2,2)"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of add3<int>(2,2)" }
+ timeout { fail "(timeout) print value of add3<int>(2,2)" }
+ }
+
+send_gdb "print add3<float>(2.3,2.3)\n"
+gdb_expect {
+ -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" {
+ pass "print value of add3<float>(2.3,2.3)"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of add3<float>(2.3,2.3)" }
+ timeout { fail "(timeout) print value of add3<float>(2.3,2.3)" }
+ }
+
+send_gdb "print add3<char>('A','A')\n"
+gdb_expect {
+ -re ".$decimal = -126.*202.\r\n$gdb_prompt $" {
+ pass "print value of add3<char>('A','A')"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of add3<char>('A','A')" }
+ timeout { fail "(timeout) print value of add3<char>('A','A')" }
+ }
+
+send_gdb "print add4<int>(2,2)\n"
+gdb_expect {
+ -re ".$decimal = 4\r\n$gdb_prompt $" {
+ pass "print value of add4<int>(2,2)"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of add4<int>(2,2)" }
+ timeout { fail "(timeout) print value of add4<int>(2,2)" }
+ }
+
+send_gdb "print add4<float>(2.3,2.3)\n"
+gdb_expect {
+ -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" {
+ pass "print value of add4<float>(2.3,2.3)"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of add4<float>(2.3,2.3)" }
+ timeout { fail "(timeout) print value of add4<float>(2.3,2.3)" }
+ }
+
+send_gdb "print add4<char>('A','A')\n"
+gdb_expect {
+ -re ".$decimal = -126.*202.\r\n$gdb_prompt $" {
+ pass "print value of add4<char>('A','A')"
+ }
+ -re ".*$gdb_prompt $" { fail "print value of add4<char>('A','A')" }
+ timeout { fail "(timeout) print value of add4<char>('A','A')" }
+ }
+
+
+gdb_exit
+return 0
diff --git a/gdb/testsuite/gdb.c++/cttiadd.cc b/gdb/testsuite/gdb.c++/cttiadd.cc
new file mode 100644
index 0000000..1f50fae
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/cttiadd.cc
@@ -0,0 +1,29 @@
+template<class T> T add(T v1, T v2)
+{
+ T v3;
+ v3 = v1;
+ v3 += v2;
+ return v3;
+ }
+
+int main()
+{
+ char c;
+ int i;
+ float f;
+ extern void add1();
+ extern void subr2();
+ extern void subr3();
+
+ c = 'a';
+ i = 2;
+ f = 4.5;
+
+ c = add(c, c);
+ i = add(i, i);
+ f = add(f, f);
+
+ add1();
+ subr2();
+ subr3();
+}
diff --git a/gdb/testsuite/gdb.c++/cttiadd1.cc b/gdb/testsuite/gdb.c++/cttiadd1.cc
new file mode 100644
index 0000000..7113ece
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/cttiadd1.cc
@@ -0,0 +1,16 @@
+template<class T> T add(T v1, T v2);
+
+void add1()
+{
+ char c;
+ int i;
+ float f;
+
+ c = 'b';
+ i = 3;
+ f = 6.5;
+
+ c = add(c, c);
+ i = add(i, i);
+ f = add(f, f);
+}
diff --git a/gdb/testsuite/gdb.c++/cttiadd2.cc b/gdb/testsuite/gdb.c++/cttiadd2.cc
new file mode 100644
index 0000000..d0d9891
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/cttiadd2.cc
@@ -0,0 +1,22 @@
+template<class T> T add2(T v1, T v2)
+{
+ T v3;
+ v3 = v1;
+ v3 += v2;
+ return v3;
+}
+
+void subr2()
+{
+ char c;
+ int i;
+ float f;
+
+ c = 'b';
+ i = 3;
+ f = 6.5;
+
+ c = add2(c, c);
+ i = add2(i, i);
+ f = add2(f, f);
+}
diff --git a/gdb/testsuite/gdb.c++/cttiadd3.cc b/gdb/testsuite/gdb.c++/cttiadd3.cc
new file mode 100644
index 0000000..7ba1b01
--- /dev/null
+++ b/gdb/testsuite/gdb.c++/cttiadd3.cc
@@ -0,0 +1,33 @@
+template<class T> T add3(T v1, T v2)
+{
+ T v3;
+ v3 = v1;
+ v3 += v2;
+ return v3;
+}
+
+template<class T> T add4(T v1, T v2)
+{
+ T v3;
+ v3 = v1;
+ v3 += v2;
+ return v3;
+}
+
+void subr3()
+{
+ char c;
+ int i;
+ float f;
+
+ c = 'b';
+ i = 3;
+ f = 6.5;
+
+ c = add3(c, c);
+ i = add3(i, i);
+ f = add3(f, f);
+ c = add4(c, c);
+ i = add4(i, i);
+ f = add4(f, f);
+}
diff --git a/gdb/testsuite/gdb.c++/demangle.exp b/gdb/testsuite/gdb.c++/demangle.exp
index 7f9f174..d63ab04 100644
--- a/gdb/testsuite/gdb.c++/demangle.exp
+++ b/gdb/testsuite/gdb.c++/demangle.exp
@@ -54,11 +54,11 @@ proc set_demangling_style {style} {
pass "$style: check demangling style"
}
-re ".*$gdb_prompt $" {
- fail "gnu: check demangling style"
+ fail "$style: check demangling style"
error "set_demangling_style: check style"
}
timeout {
- fail "gnu: check demangling style (timeout)"
+ fail "$style: check demangling style (timeout)"
error "set_demangling_style: check style"
}
}
diff --git a/gdb/testsuite/gdb.c++/derivation.exp b/gdb/testsuite/gdb.c++/derivation.exp
index 657b166..0ac4eca 100644
--- a/gdb/testsuite/gdb.c++/derivation.exp
+++ b/gdb/testsuite/gdb.c++/derivation.exp
@@ -127,6 +127,7 @@ gdb_expect {
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 & operator=\\(D const &\\);\[\r\n\t ]+D\\(D const &\\);\[\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 "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" }
}
@@ -156,6 +157,7 @@ gdb_expect {
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 & operator=\\(E const &\\);\[\r\n\t ]+E\\(E const &\\);\[\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 "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" }
}
@@ -302,6 +304,7 @@ gdb_expect {
timeout { fail "(timeout) print value of g_instance.c" }
}
+if { $gcc_compiled } { setup_xfail "hppa*-hp-hpux*" }
send_gdb "print g_instance.afoo()\n"
gdb_expect {
-re ".\[0-9\]* = 1.*$gdb_prompt $" {
@@ -311,6 +314,7 @@ gdb_expect {
timeout { fail "(timeout) print value of g_instance.afoo()" }
}
+if { $gcc_compiled } { setup_xfail "hppa*-hp-hpux*" }
send_gdb "print g_instance.bfoo()\n"
gdb_expect {
-re ".\[0-9\]* = 2.*$gdb_prompt $" {
@@ -320,6 +324,7 @@ gdb_expect {
timeout { fail "(timeout) print value of g_instance.bfoo()" }
}
+if { $gcc_compiled } { setup_xfail "hppa*-hp-hpux*" }
send_gdb "print g_instance.cfoo()\n"
gdb_expect {
-re ".\[0-9\]* = 3.*$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.c++/inherit.exp b/gdb/testsuite/gdb.c++/inherit.exp
index 8c7a90c..b1c28ed 100644
--- a/gdb/testsuite/gdb.c++/inherit.exp
+++ b/gdb/testsuite/gdb.c++/inherit.exp
@@ -43,15 +43,6 @@ 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."
}
@@ -120,6 +111,7 @@ proc test_ptype_si {} {
global gdb_prompt
global ws
global nl
+ global hp_aCC_compiler
# Print class A as a type.
@@ -144,7 +136,7 @@ proc test_ptype_si {} {
pass "ptype class A (FIXME)"
}
-re "type = struct A \{$nl\[ \]*int a;$nl\[ \]*int x;$nl\[ \]*\}$nl$gdb_prompt $" {
- setup_xfail "*-*-*"
+ if {!$hp_aCC_compiler} {setup_xfail "*-*-*"}
fail "ptype class A (FIXME)"
}
-re ".*$gdb_prompt $" { fail "ptype class A" }
@@ -159,7 +151,7 @@ proc test_ptype_si {} {
pass "ptype g_A (FIXME)"
}
-re "type = struct A \{$nl\[ \]*int a;$nl\[ \]*int x;$nl\[ \]*\}$nl$gdb_prompt $" {
- setup_xfail "*-*-*"
+ if {!$hp_aCC_compiler} {setup_xfail "*-*-*"}
fail "ptype g_A (FIXME)"
}
-re ".*$gdb_prompt $" { fail "ptype g_A" }
@@ -243,12 +235,12 @@ proc test_print_si_classes {} {
# 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"
+ gdb_test "print g_B" ".* = \{\<(class |)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"
+ gdb_test "print g_C" ".* = \{\<(class |)A\> = \{a = 7, x = 8\}, c = 9, x = 10\}" "print g_C"
}
#
@@ -270,10 +262,10 @@ proc test_print_anon_union {} {
setup_xfail_format "DWARF 1"
send_gdb "print g_anon_union\n"
gdb_expect {
- -re ".* = \{one = 1, = \{a = 2, b = 2\}\}$nl$gdb_prompt $" {
+ -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 $" {
+ -re ".* = .*\{one = 1, ( = |)\{a = 2, b = .*\}\}$nl$gdb_prompt $" {
pass "print variable of type anonymous union (obsolete gcc or gdb)"
}
-re ".*$nl$gdb_prompt $" {
@@ -308,6 +300,7 @@ proc test_print_anon_union {} {
proc test_print_mi_members {} {
global gdb_prompt
global nl
+ global hp_aCC_compiler
# Print all members of g_A.
@@ -341,15 +334,21 @@ proc test_print_mi_members {} {
# For now, accept gdb's behavior as an expected failure if it
# simply prints either member correctly.
- setup_xfail "*-*-*"
+ if {!$hp_aCC_compiler} {setup_xfail "*-*-*"}
send_gdb "print g_D.A::a\n"
- gdb_expect {
- -re ".* = 11$nl$gdb_prompt $" {
- fail "print g_D.A::a (FIXME)"
+ gdb_expect {
+ -re "warning: A ambiguous; using D::C::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 15$nl$gdb_prompt $" {
+ pass "print g_D.A::a"
+ }
+ -re "warning: A ambiguous; using D::B::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 11$nl$gdb_prompt $" {
+ pass "print g_D.A::a (using B)"
}
-re ".* = 15$nl$gdb_prompt $" {
fail "print g_D.A::a (FIXME)"
}
+ -re ".* = 11$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 }
}
@@ -358,15 +357,21 @@ proc test_print_mi_members {} {
# For now, accept gdb's behavior as an expected failure if it
# simply prints either member correctly.
- setup_xfail "*-*-*"
+ if {!$hp_aCC_compiler} {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 "warning: A ambiguous; using D::C::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 16$nl$gdb_prompt $" {
+ pass "print g_D.A::x"
+ }
+ -re "warning: A ambiguous; using D::B::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 12$nl$gdb_prompt $" {
+ pass "print g_D.A::x (using B)"
}
-re ".* = 16$nl$gdb_prompt $" {
fail "print g_D.A::x (FIXME)"
}
+ -re ".* = 12$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 }
}
@@ -408,15 +413,21 @@ proc test_print_mi_members {} {
# For now, accept gdb's behavior as an expected failure if it
# simply prints either member correctly.
- setup_xfail "*-*-*"
+ if {!$hp_aCC_compiler} {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 "warning: A ambiguous; using E::D::C::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 26$nl$gdb_prompt $" {
+ pass "print g_E.A::x"
+ }
+ -re "warning: A ambiguous; using E::D::B::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 22$nl$gdb_prompt $" {
+ pass "print g_E.A::x (using B)"
}
-re ".* = 26$nl$gdb_prompt $" {
fail "print g_E.A::x (FIXME)"
}
+ -re ".* = 22$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 }
}
@@ -474,12 +485,12 @@ 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"
+ gdb_test "print g_D" ".* = \{\<(class |)B\> = \{\<(class |)A\> = \{a = 11, x = 12\}, b = 13, x = 14\}, \<(class |)C\> = \{\<(class |)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"
+ gdb_test "print g_E" ".* = \{\<(class |)D\> = \{\<(class |)B\> = \{\<(class |)A\> = \{a = 21, x = 22\}, b = 23, x = 24\}, \<(class |)C\> = \{\<(class |)A\> = \{a = 25, x = 26\}, c = 27, x = 28\}, d = 29, x = 30\}, e = 31, x = 32\}" "print g_E"
}
#
@@ -563,6 +574,7 @@ proc test_print_svi_members {} {
proc test_ptype_vi {} {
global gdb_prompt
+ global ws
global nl
# This class does not use any C++-specific features, so it's fine for
@@ -608,22 +620,82 @@ proc test_ptype_vi {} {
}
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"
+ send_gdb "ptype vB\n"
+ gdb_expect {
+ -re "ptype vB${nl}type = class vB : public virtual vA \{$nl private:${ws}vA \[*\]+_vb\[\\\$\.\]+vA;$nl public:${ws}int vb;${ws}int vx;$nl.*\}$nl$gdb_prompt $" {
+ pass "ptype vB"
+ }
+ -re "ptype vB${nl}type = class vB : public virtual vA \{$nl public:${ws}int vb;${ws}int vx;$nl.*\}$nl$gdb_prompt $" {
+ pass "ptype vB (aCC)"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype vB" }
+ timeout { fail "ptype vB (timeout)" }
+ }
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"
+ send_gdb "ptype class vB\n"
+ gdb_expect {
+ -re "type = class vB : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
+ pass "ptype class vB"
+ }
+ -re "type = class vB : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
+ pass "ptype class vB (aCC)"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype class vB" }
+ timeout { fail "ptype class vB (timeout)" }
+ }
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"
+ send_gdb "ptype g_vB\n"
+ gdb_expect {
+ -re "type = class vB : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
+ pass "ptype g_vB"
+ }
+ -re "type = class vB : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
+ pass "ptype g_vB (aCC)"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype g_vB" }
+ timeout { fail "ptype g_vB (timeout)" }
+ }
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"
+ send_gdb "ptype vC\n"
+ gdb_expect {
+ -re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
+ pass "ptype vC"
+ }
+ -re "type = class vC : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
+ pass "ptype vC (aCC)"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype vC" }
+ timeout { fail "ptype vC (timeout)" }
+ }
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"
+ send_gdb "ptype class vC\n"
+ gdb_expect {
+ -re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
+ pass "ptype class vC"
+ }
+ -re "type = class vC : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
+ pass "ptype class vC (aCC)"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype class vC" }
+ timeout { fail "ptype class vC (timeout)" }
+ }
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"
+ send_gdb "ptype g_vC\n"
+ gdb_expect {
+ -re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \[*\]+_vb\[\\\$\.\]vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
+ pass "ptype g_vC"
+ }
+ -re "type = class vC : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
+ pass "ptype g_vC (aCC)"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype g_vC" }
+ timeout { fail "ptype g_vC (timeout)" }
+ }
}
#
@@ -645,6 +717,12 @@ proc test_print_svi_classes {} {
setup_xfail_format "DWARF 1"
send_gdb "print g_vB\n"
gdb_expect {
+ -re ".* = \{\<class vA\> = \{va = 3, vx = 4\}, vb = 5, vx = 6, Virtual table at $hex\}$nl$gdb_prompt $" {
+ pass "print g_vB (aCC)"
+ }
+ -re ".* = \{\<class vA\> = \{va = 3, vx = 4\}, vb = 5, vx = 6, __vfp = $hex\}$nl$gdb_prompt $" {
+ pass "print g_vB (aCC)"
+ }
-re ".* = \{\<vA\> = \{va = 3, vx = 4\}, _vb\[\\\$\.\]vA = $hex, vb = 5, vx = 6\}$nl$gdb_prompt $" {
pass "print g_vB"
}
@@ -661,7 +739,20 @@ proc test_print_svi_classes {} {
# 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"
+ send_gdb "print g_vC\n"
+ gdb_expect {
+ -re ".* = \{\<class vA\> = \{va = 7, vx = 8\}, vc = 9, vx = 10, Virtual table at $hex\}$nl$gdb_prompt $" {
+ pass "print g_vC (aCC)"
+ }
+ -re ".* = \{\<class vA\> = \{va = 7, vx = 8\}, vc = 9, vx = 10, __vfp = $hex\}$nl$gdb_prompt $" {
+ pass "print g_vC (aCC)"
+ }
+ -re ".* = \{\<vA\> = \{va = 7, vx = 8\}, _vb\[\\\$\.\]vA = $hex, vc = 9, vx = 10\}$nl$gdb_prompt $" {
+ pass "print g_vC"
+ }
+ -re ".*$gdb_prompt $" { fail "print g_vC" }
+ timeout { fail "print g_vC (timeout)" }
+ }
}
#
@@ -743,25 +834,87 @@ proc test_print_mvi_members {} {
#
proc test_ptype_mvi {} {
+ global gdb_prompt
+ global ws
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"
+ send_gdb "ptype 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;$nl.*\}.*$gdb_prompt $" {
+ pass "ptype vD"
+ }
+ -re ".*class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;.*\}.*$gdb_prompt $" {
+ pass "ptype vD"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype vD" }
+ timeout { fail "(timeout) 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"
+ 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;$nl.*\}.*$gdb_prompt $" {
+ pass "ptype class vD"
+ }
+ -re ".*class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;.*\}.*$gdb_prompt $" {
+ pass "ptype class vD"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype class vD" }
+ timeout { fail "(timeout) 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"
+ send_gdb "ptype g_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;$nl.*\}.*$gdb_prompt $" {
+ pass "ptype g_vD"
+ }
+ -re ".*class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;\r\n.*\}.*$gdb_prompt $" {
+ pass "ptype g_vD"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype g_vD" }
+ timeout { fail "(timeout) 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"
+ send_gdb "ptype 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;$nl.*\}.*$gdb_prompt $" {
+ pass "ptype vE"
+ }
+ -re ".*class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;\r\n.*\}.*$gdb_prompt $" {
+ pass "ptype vE"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype vE" }
+ timeout { fail "(timeout) 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"
+ 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;$nl.*\}.*$gdb_prompt $" {
+ pass "ptype class vE"
+ }
+ -re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;\r\n.*\}.*$gdb_prompt $" {
+ pass "ptype class vE"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype class vE" }
+ timeout { fail "(timeout) 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"
+ send_gdb "ptype g_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;$nl.*\}.*$gdb_prompt $" {
+ pass "ptype g_vE"
+ }
+ -re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;\r\n.*\}.*$gdb_prompt $" {
+ pass "ptype g_vE"
+ }
+ -re ".*$gdb_prompt $" { fail "ptype g_vE" }
+ timeout { fail "(timeout) ptype g_vE" }
+ }
}
#
@@ -779,6 +932,12 @@ proc test_print_mvi_classes {} {
setup_xfail_format "DWARF 1"
send_gdb "print g_vD\n"
gdb_expect {
+ -re ".* = \{\<class vB\> = \{\<class vA\> = \{va = 19, vx = 20\}, vb = 21, vx = 22, Virtual table at $hex\}, \<class vC\> = \{vc = 23, vx = 24, Virtual table at $hex\}, vd = 25, vx = 26, Virtual table at $hex\}$nl$gdb_prompt $" {
+ pass "print g_vD (aCC)"
+ }
+ -re ".* = \{\<class vB\> = \{\<class vA\> = \{va = 19, vx = 20\}, vb = 21, vx = 22, __vfp = $hex\}, \<class vC\> = \{vc = 23, vx = 24, __vfp = $hex\}, vd = 25, vx = 26, __vfp = $hex\}$nl$gdb_prompt $" {
+ pass "print g_vD (aCC)"
+ }
-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"
}
@@ -795,7 +954,20 @@ proc test_print_mvi_classes {} {
# 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"
+ send_gdb "print g_vE\n"
+ gdb_expect {
+ -re ".* = \{\<class vD\> = \{\<class vB\> = \{\<class vA\> = \{va = 0, vx = 0\}, vb = 0, vx = 0, Virtual table at $hex\}, \<class vC\> = \{vc = 0, vx = 0, Virtual table at $hex\}, vd = 0, vx = 0, Virtual table at $hex\}, ve = 27, vx = 28, Virtual table at $hex\}$nl$gdb_prompt $" {
+ pass "print g_vE (aCC)"
+ }
+ -re ".* = \{\<class vD\> = \{\<class vB\> = \{\<class vA\> = \{va = 0, vx = 0\}, vb = 0, vx = 0, __vfp = $hex\}, \<class vC\> = \{vc = 0, vx = 0, __vfp = $hex\}, vd = 0, vx = 0, __vfp = $hex\}, ve = 27, vx = 28, __vfp = $hex\}$nl$gdb_prompt $" {
+ pass "print g_vE (aCC)"
+ }
+ -re ".* = \{\<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\}$nl$gdb_prompt $" {
+ pass "print g_vE"
+ }
+ -re ".*$gdb_prompt $" { fail "print g_vE" }
+ timeout { fail "print g_vE (timeout)" }
+ }
}
proc do_tests {} {
diff --git a/gdb/testsuite/gdb.c++/local.exp b/gdb/testsuite/gdb.c++/local.exp
index 0aa8468..0335796 100644
--- a/gdb/testsuite/gdb.c++/local.exp
+++ b/gdb/testsuite/gdb.c++/local.exp
@@ -41,6 +41,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
+if [get_compiler_info $binfile "c++"] {
+ return -1
+}
gdb_exit
gdb_start
@@ -71,38 +74,72 @@ send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
timeout { fail "(timeout) continue to marker1" }
}
+# srikanth, These tests have always been run only with aCC. Now in
+# the new scheme of things, we run it twice, once with aCC, and once
+# with g++. Flag these tests as expected failures when run with g++.
+# as these are failing now and were never known to pass with g++.
+global gcc_compiled
+if {$gcc_compiled} then {
+setup_xfail "*-*-*"
+}
+
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 "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\\.cc: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\\.cc:\[0-9\]*\\).*$gdb_prompt $" { pass "ptype Local (incorrect line number?)" }
+ -re "type = class Local \{\r\n\[\t \]*public:\r\n\[\t \]*int loc1;\r\n\r\n\[\t \]*Local & Local::operator=\\(foobar__Fi___0::Local const &\\);\r\n\[\t \]*Local::Local\\(foobar__Fi___0::Local const &\\);\r\n\[\t \]*Local::Local\\(void\\);\r\n\[\t \]*char Local::loc_foo\\(char\\);\r\n\[\t \]*\}*.*$gdb_prompt $" { pass "ptype Local" }
+ -re "type = class Local \{\r\n\[\t \]*public:\r\n\[\t \]*int loc1;\r\n\r\n\[\t \]*Local & Local const &\\);\r\n\[\t \]*Local const &\\);\r\n\[\t \]*Local\\(void\\);\r\n\[\t \]*char loc_foo\\(char\\);\r\n\[\t \]*\}\[\t \]*.*$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 \]*\\(Local at.*local\\.cc:\[0-9\]*\\)\r\n\}.*$gdb_prompt $" { pass "ptype Local (aCC)" }
-re ".*$gdb_prompt $" { fail "ptype Local" }
timeout { fail "(timeout) ptype Local" }
}
+# DTS CLLbs14316 and CLLbs17058
+# coulter - I added a clause for HP's aCC compiler. We print out the type
+# as xx instead of const unsigned char, but we still have an expected failure
+# because of two reasons:
+# There is a number at the end of InnerLocal4 which should not be there,
+# DTS CLLbs14316
+# The line number for the class
+setup_xfail "hppa*-*-*" CLLbs14316
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 "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\\.cc: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\\.cc: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\\.cc:\[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\\.cc:\[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 \]*InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(unsigned char const &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:36\\).*$gdb_prompt $" { pass "ptype InnerLocal HP aCC" }
+ -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*NestedInnerLocal nest1;\r\n\r\n\[\t \]*InnerLocal & InnerLocal::operator=\\(main___0::InnerLocal const &\\);\r\n\[\t \]*InnerLocal::InnerLocal\\(main___0::InnerLocal const &\\);\r\n\[\t \]*InnerLocal::InnerLocal\\(void\\);\r\n\[\t \]*int InnerLocal::il_foo\\(unsigned char const &\\);\r\n\*\}\r\n*.*$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 \]*NestedInnerLocal nest1;\r\n\r\n\[\t \]*InnerLocal & InnerLocal const &\\);\r\n\[\t \]*InnerLocal const &\\);\r\n\[\t \]*InnerLocal\\(void\\);\r\n\[\t \]*.int il_foo\\(unsigned char const &\\);\r\n\[\t \]*\}\[\t \]*.*$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 InnerLocal4::NestedInnerLocal nest1;\r\n\r\n\[\t \]*int il_foo\\(unsigned char const &\\);\r\n\[\t \]*\\(Local at.*local\.cc:\[0-9\]+\\)\r\n\}.*$gdb_prompt $" { pass "ptype InnerLocal (aCC)" }
-re ".*$gdb_prompt $" { fail "ptype InnerLocal" }
timeout { fail "(timeout) ptype InnerLocal" }
}
+if {$gcc_compiled} then {
+setup_xfail "*-*-*"
+}
+
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 "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\\.cc: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\\.cc:\[0-9\]*\\).*$gdb_prompt $" { pass "ptype NestedInnerLocal (incorrect line number?)" }
+ -re "type = class NestedInnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*int nil;\r\n\r\n\[\t \]*NestedInnerLocal & InnerLocal::NestedInnerLocal::operator=\\(main___1::InnerLocal::NestedInnerLocal const &\\);\r\n\[\t \]*InnerLocal::NestedInnerLocal::NestedInnerLocal\\(main___1::InnerLocal::NestedInnerLocal const &\\);\r\n\[\t \]*InnerLocal::NestedInnerLocal::NestedInnerLocal\\(void\\);\r\n\[\t \]*int InnerLocal::NestedInnerLocal::nil_foo\\(int\\);\r\n\}\r\n*.*$gdb_prompt $" { pass "ptype NestedInnerLocal" }
+ -re "type = class NestedInnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*int nil;\r\n\r\n\[\t \]*NestedInnerLocal & NestedInnerLocal const &\\);\r\n\[\t \]*NestedInnerLocal const &\\);\r\n\[\t \]*NestedInnerLocal\\(void\\);\r\n\[\t \]*int nil_foo\\(int\\);\r\n\[\t \]*\}\r\n*.*$gdb_prompt $" { pass "ptype NestedInnerLocal" }
-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" }
}
+# gdb incorrectly interprets the NestedInnerLocal in
+# InnerLocal::NestedInnerLocal as field name instead of a type name;
+# See CLLbs14784.
+setup_xfail hppa*-*-* CLLbs14784
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 "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\\.cc: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\\.cc:\[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.exp b/gdb/testsuite/gdb.c++/member-ptr.exp
index 9bf2431..d1de663 100644
--- a/gdb/testsuite/gdb.c++/member-ptr.exp
+++ b/gdb/testsuite/gdb.c++/member-ptr.exp
@@ -103,6 +103,7 @@ gdb_expect {
# print pointer to data member
+setup_xfail "hppa*-*-*" CLLbs16901
send_gdb "print pmi\n"
gdb_expect {
-re "\\$\[0-9\]* = \\(int \\( A::\\*\\)\\) &A::j\r\n$gdb_prompt $" {
@@ -115,6 +116,7 @@ gdb_expect {
# print dereferenced pointer to data member
+setup_xfail "hppa*-*-*" CLLbs16901
send_gdb "print a.*pmi\n"
gdb_expect {
-re "\\$\[0-9\]* = 121\r\n$gdb_prompt $" {
@@ -127,6 +129,7 @@ gdb_expect {
# print dereferenced pointer to data member
# this time, dereferenced through a pointer
+setup_xfail "hppa*-*-*" CLLbs16901
send_gdb "print a_p->*pmi\n"
gdb_expect {
-re "\\$\[0-9\]* = 121\r\n$gdb_prompt $" {
@@ -212,6 +215,7 @@ gdb_expect {
}
# Double-check by printing a.
+setup_xfail "hppa*-*-*" CLLbs16901
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 $" {
@@ -244,6 +248,7 @@ gdb_expect {
}
# Double-check by printing a.
+setup_xfail "hppa*-*-*" CLLbs16901
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 $" {
@@ -290,6 +295,7 @@ gdb_expect {
# Ptype a pointer to a method.
+setup_xfail "hppa*-*-*" CLLbs16901
send_gdb "ptype pmf\n"
gdb_expect {
-re "type = int \\( A::\\*\\)\\(\\.\\.\\.\\)\r\n$gdb_prompt $" {
@@ -301,6 +307,7 @@ gdb_expect {
# print a pointer to a method
+setup_xfail "hppa*-*-*" CLLbs16901
send_gdb "print pmf\n"
gdb_expect {
-re "\\$\[0-9\]* = \\(int \\( A::\\*\\)\\(\\.\\.\\.\\)\\) \\?\\? <not supported with HP aCC>\r\n$gdb_prompt $" {
@@ -313,6 +320,7 @@ gdb_expect {
# Ptype a pointer to a pointer to a method
+setup_xfail "hppa*-*-*" CLLbs16901
send_gdb "ptype pmf_p\n"
gdb_expect {
-re "type = int \\( A::\\*\\*\\)\\(\\.\\.\\.\\)\r\n$gdb_prompt $" {
@@ -324,6 +332,7 @@ gdb_expect {
# print a pointer to a pointer to a method
+setup_xfail "hppa*-*-*" CLLbs16901
send_gdb "print pmf_p\n"
gdb_expect {
-re "\\$\[0-9\]* = \\(int \\( A::\\*\\*\\)\\(\\.\\.\\.\\)\\) $hex\r\n$gdb_prompt $" {
@@ -335,39 +344,43 @@ gdb_expect {
# print dereferenced pointer to method
+setup_xfail "hppa*-*-*" CLLbs16901
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 -- ??" }
+ -re ".*$gdb_prompt $" { fail "print a.*pmf" }
timeout { fail "(timeout) print a.*pmf" }
}
# print dereferenced pointer to method, using ->*
+setup_xfail "hppa*-*-*" CLLbs16901
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 -- ??" }
+ -re ".*$gdb_prompt $" { fail "print a_p->*pmf" }
timeout { fail "(timeout) print a_p->*pmf" }
}
# set the pointer to data member
+setup_xfail "hppa*-*-*"
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 -- ??" }
+ -re ".*$gdb_prompt $" { fail "set var pmf" }
timeout { fail "(timeout) set var pmf" }
}
# Try to dereference the pointer to method without any object
+setup_xfail "hppa*-*-*" CLLbs16901
send_gdb "print *pmf\n"
gdb_expect {
-re "Attempt to dereference pointer to member without an object\r\n$gdb_prompt $" {
@@ -389,6 +402,7 @@ gdb_expect {
}
# Check cast of pointer to member to integer
+setup_xfail "hppa*-*-*" CLLbs16901
send_gdb "print (int) pmi\n"
gdb_expect {
-re "\\$\[0-9\]* = 8\r\n$gdb_prompt $" {
@@ -399,37 +413,41 @@ gdb_expect {
}
# Check cast of pointer to method to integer
+setup_xfail "hppa*-*-*" CLLbs16901
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 -- ??" }
+ -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
+setup_xfail "hppa*-*-*" CLLbs16901
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) -- ???" }
+ -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
+setup_xfail "hppa*-*-*" CLLbs16901
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) -- ???" }
+ -re ".*$gdb_prompt $" { fail "print (a.*pmf)(3)" }
timeout { fail "(timeout) print (a.*pmf)(3)" }
}
# Go past assignment of NULL to pmi
+setup_xfail "hppa*-*-*" CLLbs16901
send_gdb "next\n"
gdb_expect {
-re "\r\n85\[ \t\]*k = \\(a.\\*pmf\\)\\(3\\);\r\n$gdb_prompt $" {
@@ -449,6 +467,7 @@ gdb_expect {
#}
# Dereference the null pointer to member
+setup_xfail "hppa*-*-*" CLLbs16901
send_gdb "print a.*pmi\n"
gdb_expect {
-re "Attempted dereference of null pointer-to-member\r\n$gdb_prompt $" {
@@ -469,6 +488,7 @@ gdb_expect {
timeout { fail "(timeout) set break at 91" }
}
+setup_xfail "hppa*-*-*" CLLbs16901
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 $" {
@@ -482,6 +502,7 @@ gdb_expect {
# Now check again that pmi works even when not set to
# something that's at the beginning of the object
+setup_xfail "hppa*-*-*" CLLbs16901
send_gdb "print pmi\n"
gdb_expect {
-re "\\$\[0-9\]* = \\(int \\( A::\\*\\)\\) &A::jj\r\n$gdb_prompt $" {
@@ -494,6 +515,7 @@ gdb_expect {
# print dereferenced pointer to data member
+setup_xfail "hppa*-*-*" CLLbs16901
send_gdb "print a.*pmi\n"
gdb_expect {
-re "\\$\[0-9\]* = 1331\r\n$gdb_prompt $" {
@@ -506,6 +528,7 @@ gdb_expect {
# print dereferenced pointer to data member
# this time, dereferenced through a pointer
+setup_xfail "hppa*-*-*" CLLbs16901
send_gdb "print a_p->*pmi\n"
gdb_expect {
-re "\\$\[0-9\]* = 1331\r\n$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.c++/method.exp b/gdb/testsuite/gdb.c++/method.exp
index edfa689..a0d005b 100644
--- a/gdb/testsuite/gdb.c++/method.exp
+++ b/gdb/testsuite/gdb.c++/method.exp
@@ -50,7 +50,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
-
+if [get_compiler_info $binfile "c++"] {
+ return -1
+}
gdb_exit
gdb_start
@@ -143,7 +145,20 @@ gdb_expect {
send_gdb "print this\n"
gdb_expect {
-re "\\$\[0-9\]* = \\(const class A \\*\\) $hex\r\n$gdb_prompt $" {
+ global gcc_compiled
+ if {$gcc_compiled} {
+ xfail "print this (in bar)"
+ } else {
+ pass "print this (in bar)"
+ }
+ }
+ -re "\\$\[0-9\]* = \\(A \\*\\) $hex\r\n$gdb_prompt $" {
+ global gcc_compiled
+ if {$gcc_compiled} {
pass "print this (in bar)"
+ } else {
+ xfail "print this (in bar)"
+ }
}
-re ".*$gdb_prompt $" { fail "print this (in bar)" }
timeout { fail "(timeout) print this (in bar)" }
@@ -209,7 +224,7 @@ gdb_expect {
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 $" {
+ -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 $" {
diff --git a/gdb/testsuite/gdb.c++/misc.cc b/gdb/testsuite/gdb.c++/misc.cc
index 4cf9318..7c212cc 100644
--- a/gdb/testsuite/gdb.c++/misc.cc
+++ b/gdb/testsuite/gdb.c++/misc.cc
@@ -1,5 +1,9 @@
// Test various -*- C++ -*- things.
+// ====================== basic C++ types =======================
+bool v_bool;
+bool v_bool_array[2];
+
typedef struct fleep fleep;
struct fleep { int a; } s;
@@ -477,6 +481,14 @@ register_class ()
return v.x + 5;
}
+void dummy()
+{
+ v_bool = true;
+ v_bool_array[0] = false;
+ v_bool_array[1] = v_bool;
+}
+
+
int
main()
{
@@ -484,6 +496,7 @@ main()
set_debug_traps();
breakpoint();
#endif
+ dummy();
inheritance1 ();
inheritance3 ();
register_class ();
diff --git a/gdb/testsuite/gdb.c++/misc.exp b/gdb/testsuite/gdb.c++/misc.exp
index 6090fbb..7d64e4a 100644
--- a/gdb/testsuite/gdb.c++/misc.exp
+++ b/gdb/testsuite/gdb.c++/misc.exp
@@ -79,6 +79,23 @@ proc deduce_language_of_main {} {
}
}
+proc test_expr { args } {
+ if { [llength $args] % 2 } {
+ warning "an even # of arguments should be passed to test_expr"
+ }
+ set last_ent [expr [llength $args] - 1];
+ set testname [lindex $args $last_ent];
+ if [gdb_test [lindex $args 0] "" "$testname (setup)"] {
+ gdb_suppress_tests;
+ }
+ for {set x 1} {$x < $last_ent} {set x [expr $x + 2]} {
+ if [gdb_test [lindex $args $x] [lindex $args [expr $x + 1]] "$testname ([lindex $args $x])"] {
+ gdb_suppress_tests;
+ }
+ }
+ gdb_stop_suppressing_tests;
+}
+
proc do_tests {} {
global prms_id
global bug_id
@@ -104,3 +121,41 @@ proc do_tests {} {
}
do_tests
+
+test_expr "set language c++" \
+ "print 1 == 1" "print.*\\$\[0-9\]* = true" \
+ "print 1 == 2" "print.*\\$\[0-9\]* = false" \
+ "print as bool"
+
+# Test bool type printing, etc.
+# Note: Language is already set to C++ above!
+gdb_test "print v_bool" "\\$\[0-9\]* = false" "print a bool var"
+
+# set a bool variable
+test_expr "set variable v_bool = true" \
+ "print v_bool" "\\$\[0-9\]* = true" \
+ "set a bool var"
+
+# next print an array of bool
+gdb_test "print v_bool_array" "\\$\[0-9\]* = \\{false, false\\}" "print a bool array"
+
+# set elements of a bool array
+test_expr "set variable v_bool_array\[1\] = true" \
+ "print v_bool_array" "\\$\[0-9\]* = \\{false, true\\}" \
+ "set a bool array elem"
+
+# bool constants
+gdb_test "print true" "\\$\[0-9\]* = true" "print true"
+gdb_test "print false" "\\$\[0-9\]* = false" "print false"
+
+# arithmetic conversions
+gdb_test "print 1 + true" "\\$\[0-9\]* = 2" "1 + true"
+gdb_test "print 3 + false" "\\$\[0-9\]* = 3" "3 + false"
+gdb_test "print 1 < 2 < 3" "\\$\[0-9\]* = true" "1 < 2 < 3"
+gdb_test "print 2 < 1 > 4" "\\$\[0-9\]* = false" "2 < 1 > 4"
+gdb_test "print (bool)43" "\\$\[0-9\]* = true" "(bool)43"
+gdb_test "print (bool)0" "\\$\[0-9\]* = false" "(bool)0"
+gdb_test "print (bool)17.93" "\\$\[0-9\]* = true" "(bool)17.93"
+gdb_test "print (bool)0.0" "\\$\[0-9\]* = false" "(bool)0.0"
+gdb_test "print (int)true" "\\$\[0-9\]* = 1" "(int)true"
+gdb_test "print (int)false" "\\$\[0-9\]* = 0" "(int)false"
diff --git a/gdb/testsuite/gdb.c++/overload.exp b/gdb/testsuite/gdb.c++/overload.exp
index e77d2dc..c49d76a 100644
--- a/gdb/testsuite/gdb.c++/overload.exp
+++ b/gdb/testsuite/gdb.c++/overload.exp
@@ -43,9 +43,6 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
-# 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
}
@@ -88,6 +85,7 @@ gdb_expect {
}
+setup_xfail "hppa*-*-*" CLLbs16901
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 $" {
@@ -123,8 +121,8 @@ gdb_expect {
# work right for G++ output, since the list of parameters seems not to
# be filled in correctly. Until this gets fixed, don't expect to pass
# these tests.
-if {$gcc_compiled} then { setup_xfail "*-*-*" }
+setup_xfail "*-*-*" CLLbs16901
send_gdb "print foo_instance1.overloadargs(1)\n"
gdb_expect {
-re ".\[0-9\]* = 1\r\n$gdb_prompt $" {
@@ -135,7 +133,7 @@ gdb_expect {
}
-if {$gcc_compiled} then { setup_xfail "*-*-*" }
+setup_xfail "*-*-*" CLLbs16901
send_gdb "print foo_instance1.overloadargs(1, 2)\n"
gdb_expect {
@@ -147,7 +145,7 @@ gdb_expect {
}
-if {$gcc_compiled} then { setup_xfail "*-*-*" }
+setup_xfail "*-*-*" CLLbs16901
send_gdb "print foo_instance1.overloadargs(1, 2, 3)\n"
gdb_expect {
@@ -159,7 +157,7 @@ gdb_expect {
}
-if {$gcc_compiled} then { setup_xfail "*-*-*" }
+setup_xfail "*-*-*" CLLbs16901
send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4)\n"
gdb_expect {
@@ -171,7 +169,7 @@ gdb_expect {
}
-if {$gcc_compiled} then { setup_xfail "*-*-*" }
+setup_xfail "*-*-*" CLLbs16901
send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5)\n"
gdb_expect {
@@ -183,7 +181,7 @@ gdb_expect {
}
-if {$gcc_compiled} then { setup_xfail "*-*-*" }
+setup_xfail "*-*-*" CLLbs16901
send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6)\n"
gdb_expect {
@@ -195,7 +193,7 @@ gdb_expect {
}
-if {$gcc_compiled} then { setup_xfail "*-*-*" }
+setup_xfail "*-*-*" CLLbs16901
send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7)\n"
gdb_expect {
@@ -207,7 +205,7 @@ gdb_expect {
}
-if {$gcc_compiled} then { setup_xfail "*-*-*" }
+setup_xfail "*-*-*" CLLbs16901
send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8)\n"
gdb_expect {
@@ -219,7 +217,7 @@ gdb_expect {
}
-if {$gcc_compiled} then { setup_xfail "*-*-*" }
+setup_xfail "*-*-*" CLLbs16901
send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9)\n"
gdb_expect {
@@ -231,7 +229,7 @@ gdb_expect {
}
-if {$gcc_compiled} then { setup_xfail "*-*-*" }
+setup_xfail "*-*-*" CLLbs16901
send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)\n"
gdb_expect {
@@ -243,7 +241,7 @@ gdb_expect {
}
-if {$gcc_compiled} then { setup_xfail "*-*-*" }
+setup_xfail "*-*-*" CLLbs16901
send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)\n"
gdb_expect {
@@ -255,7 +253,7 @@ gdb_expect {
}
-if {$gcc_compiled} then { setup_xfail "*-*-*" }
+setup_xfail "*-*-*" CLLbs16901
send_gdb "print foo_instance1.overload1arg()\n"
gdb_expect {
@@ -267,7 +265,7 @@ gdb_expect {
}
-if {$gcc_compiled} then { setup_xfail "*-*-*" }
+setup_xfail "*-*-*" CLLbs16901
send_gdb "print foo_instance1.overload1arg((char)arg2)\n"
gdb_expect {
@@ -279,7 +277,7 @@ gdb_expect {
}
-if {$gcc_compiled} then { setup_xfail "*-*-*" }
+setup_xfail "*-*-*" CLLbs16901
send_gdb "print foo_instance1.overload1arg((signed char)arg3)\n"
gdb_expect {
@@ -291,7 +289,7 @@ gdb_expect {
}
-if {$gcc_compiled} then { setup_xfail "*-*-*" }
+setup_xfail "*-*-*" CLLbs16901
send_gdb "print foo_instance1.overload1arg((unsigned char)arg4)\n"
gdb_expect {
@@ -303,7 +301,7 @@ gdb_expect {
}
-if {$gcc_compiled} then { setup_xfail "*-*-*" }
+setup_xfail "*-*-*" CLLbs16901
send_gdb "print foo_instance1.overload1arg((short)arg5)\n"
gdb_expect {
@@ -315,7 +313,7 @@ gdb_expect {
}
-if {$gcc_compiled} then { setup_xfail "*-*-*" }
+setup_xfail "*-*-*" CLLbs16901
send_gdb "print foo_instance1.overload1arg((unsigned short)arg6)\n"
gdb_expect {
@@ -327,7 +325,7 @@ gdb_expect {
}
-if {$gcc_compiled} then { setup_xfail "*-*-*" }
+setup_xfail "*-*-*" CLLbs16901
send_gdb "print foo_instance1.overload1arg((int)arg7)\n"
gdb_expect {
@@ -339,7 +337,7 @@ gdb_expect {
}
-if {$gcc_compiled} then { setup_xfail "*-*-*" }
+setup_xfail "*-*-*" CLLbs16901
send_gdb "print foo_instance1.overload1arg((unsigned int)arg8)\n"
gdb_expect {
@@ -351,7 +349,7 @@ gdb_expect {
}
-if {$gcc_compiled} then { setup_xfail "*-*-*" }
+setup_xfail "*-*-*" CLLbs16901
send_gdb "print foo_instance1.overload1arg((long)arg9)\n"
gdb_expect {
@@ -363,7 +361,7 @@ gdb_expect {
}
-if {$gcc_compiled} then { setup_xfail "*-*-*" }
+setup_xfail "*-*-*" CLLbs16901
send_gdb "print foo_instance1.overload1arg((unsigned long)arg10)\n"
gdb_expect {
@@ -375,7 +373,7 @@ gdb_expect {
}
-if {$gcc_compiled} then { setup_xfail "*-*-*" }
+setup_xfail "*-*-*" CLLbs16901
send_gdb "print foo_instance1.overload1arg((float)arg11)\n"
gdb_expect {
@@ -387,7 +385,7 @@ gdb_expect {
}
-if {$gcc_compiled} then { setup_xfail "*-*-*" }
+setup_xfail "*-*-*" CLLbs16901
send_gdb "print foo_instance1.overload1arg((double)arg12)\n"
gdb_expect {
diff --git a/gdb/testsuite/gdb.c++/ref-types.cc b/gdb/testsuite/gdb.c++/ref-types.cc
index 8ee5c40..23cc510 100644
--- a/gdb/testsuite/gdb.c++/ref-types.cc
+++ b/gdb/testsuite/gdb.c++/ref-types.cc
@@ -1,3 +1,5 @@
+int main2(void);
+
void marker1 (void)
{
@@ -25,6 +27,53 @@ int main(void)
breakpoint();
#endif
marker1();
-
+
+ main2();
+
+ return 0;
+}
+
+int f()
+{
+ int f1;
+ f1 = 1;
+ return f1;
+}
+
+int main2(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();
+
return 0;
+
}
diff --git a/gdb/testsuite/gdb.c++/ref-types.exp b/gdb/testsuite/gdb.c++/ref-types.exp
index 2a9d337..611dc6f 100644
--- a/gdb/testsuite/gdb.c++/ref-types.exp
+++ b/gdb/testsuite/gdb.c++/ref-types.exp
@@ -276,3 +276,414 @@ gdb_expect {
-re ".*$gdb_prompt $" { fail "print value of ras\[3\]" }
timeout { fail "(timeout) print value of ras\[3\]" }
}
+
+
+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 "type = short unsigned.*$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 "type = long unsigned.*$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 "type = short int &.*$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 "type = short unsigned int &.*$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 "type = long int &.*$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 "type = long unsigned int &.*$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 ".\[0-9\]* = \\(short int &\\) @$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 ".\[0-9\]* = \\(short unsigned int &\\) @$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 ".\[0-9\]* = \\(long int &\\) @$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 ".\[0-9\]* = \\(long unsigned int &\\) @$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
index 470024c..e1d6810 100644
--- a/gdb/testsuite/gdb.c++/templates.cc
+++ b/gdb/testsuite/gdb.c++/templates.cc
@@ -516,7 +516,7 @@ 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 (*device[5])(int open(const char *, unsigned mode, unsigned perms, int extra),
int *(*read)(int fd, void *place, unsigned size),
int *(*write)(int fd, void *place, unsigned size),
void (*close)(int fd));
@@ -716,7 +716,7 @@ int main()
Foo<int> fint;
Foo<char> fchar;
- Foo<volatile char *> fvpchar;
+ Foo<volatile char *> fvpchar = {0, 0};
Bar<int, 33> bint;
Bar<int, (4 > 3)> bint2;
diff --git a/gdb/testsuite/gdb.c++/templates.exp b/gdb/testsuite/gdb.c++/templates.exp
index ee25eaa..6c643b1 100644
--- a/gdb/testsuite/gdb.c++/templates.exp
+++ b/gdb/testsuite/gdb.c++/templates.exp
@@ -36,20 +36,10 @@ if [get_compiler_info ${binfile} "c++"] {
}
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.
#
@@ -63,6 +53,8 @@ proc test_ptype_of_templates {} {
-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}${ws}T5 \\(int\\);${ws}T5 \\(const class T5<int> &\\);${ws}void ~T5 \\(int\\);${ws}static void \\* new \\(unsigned int\\);${ws}static void delete \\(void \\*\\);${ws}int value \\(void\\);${ws}\\}${ws}$gdb_prompt $" { pass "ptype T5<int> -- new with unsigned int" }
+ -re "type = class T5<int> \\{.*public:.*static int X;.*int x;.*int val;.*T5 \\(int\\);.*T5 \\(const class T5<int> &\\);.*void ~T5 \\(int\\);.*static void \\* new \\(unsigned long\\);.*static void delete \\(void \\*\\);.*int value \\(void\\);.*\\}\r\n$gdb_prompt $" { pass "ptype T5<int> -- new with unsigned long" }
-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)"
}
@@ -76,6 +68,12 @@ proc test_ptype_of_templates {} {
send_gdb "ptype t5i\n"
gdb_expect {
+ -re "type = class T5<int> \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;\r\n${ws}T5\\(int\\);${ws}T5\\(T5<int> const &\\);${ws}~T5\\(void\\);${ws}static void \\* operator new\\(unsigned int\\);${ws}static void operator delete\\(void \\*\\);${ws}int value\\(void\\);${ws}\\}\r\n$gdb_prompt $" { pass "ptype T5<int> -- with several fixes from 4.17" }
+ -re "type = class T5<int> \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;\r\n${ws}T5 \\(int\\);${ws}T5 \\(const class T5<int> &\\);${ws}void ~T5 \\(int\\);${ws}static void \\* new \\(unsigned int\\);${ws}static void delete \\(void \\*\\);${ws}int value \\(void\\);${ws}\\}\r\n$gdb_prompt $" { pass "ptype t5i<int> -- new with unsigned int" }
+ -re "type = class T5<int> \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;\r\n${ws}T5 \\(int\\);${ws}T5 \\(const class T5<int> &\\);${ws}void ~T5 \\(int\\);${ws}static void \\* new \\(unsigned long\\);${ws}static void delete \\(void \\*\\);${ws}int value \\(void\\);${ws}\\}\r\n$gdb_prompt $" { pass "ptype t5i<int> -- new with unsigned long" }
+ -re "type = class T5<int> \{.*public:.*static int X;.*int x;.*int val;.*.*T5 \\(int\\);.*.*void ~T5 \\(int\\).*.*.*int value \\(void\\);.*\}.*$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"
}
@@ -99,6 +97,7 @@ proc test_template_breakpoints {} {
global gdb_prompt
global testfile
global srcdir
+ global hp_aCC_compiler
send_gdb "break T5<int>::T5\n"
gdb_expect {
@@ -116,7 +115,9 @@ proc test_template_breakpoints {} {
default { fail "constructor breakpoint (timeout)" }
}
- gdb_test "break T5<int>::~T5" \
+# See CLLbs14792
+ if {$hp_aCC_compiler} {setup_xfail hppa*-*-* CLLbs14792}
+ gdb_test "break T5<int>::~T5" \
"Breakpoint.*at.* file .*${testfile}.cc, line.*" \
"destructor breakpoint"
@@ -133,6 +134,7 @@ proc test_template_breakpoints {} {
proc test_template_calls {} {
global gdb_prompt
+ global hp_aCC_compiler
if [target_info exists gdb,cannot_call_functions] {
setup_xfail "*-*-*" 2416
@@ -140,14 +142,19 @@ proc test_template_calls {} {
return
}
+ if {!$hp_aCC_compiler} {setup_xfail hppa*-*-*}
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 "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
+ setup_xfail hppa*-*-* CLLbs16899
+ xfail "print t5i.value"
+ }
-re ".*$gdb_prompt $" { fail "print t5i.value()" }
- default { fail "print t5i.value() (timeout)" }
+ timeout { fail "print t5i.value() (timeout)" }
}
}
@@ -200,3 +207,218 @@ proc do_tests {} {
do_tests
+if {!$hp_aCC_compiler} {continue}
+
+# More tests for different kinds of template parameters,
+# templates with partial specializations, nested templates, etc.
+# These have been tested only with HP aCC. They probably won't
+# work with other compilers because of differences in mangling
+# schemes.
+# Added by Satish Pai <pai@apollo.hp.com> 1997-09-25
+
+send_gdb "print fint\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \\{x = 0, t = 0\\}\r\n$gdb_prompt $" { pass "print fint" }
+ -re "$gdb_prompt $" { fail "print fint" }
+ timeout { fail "(timeout) print fint" }
+}
+
+send_gdb "print fvpchar\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \\{x = 0, t = 0x0\\}\r\n$gdb_prompt $" { pass "print fvpchar" }
+ -re "$gdb_prompt $" { fail "print fvpchar" }
+ timeout { fail "(timeout) print fvpchar" }
+}
+
+# Template Foo<T>
+
+setup_xfail hppa2.0w-*-* CLLbs16092
+send_gdb "ptype Foo\n"
+gdb_expect {
+ -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Foo<volatile char \\*>\r\n\[ \t\]*(class |)Foo<char>\r\n\[ \t\]*(class |)Foo<int>\r\n$gdb_prompt $" { pass "ptype Foo" }
+ -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Foo" }
+ -re "$gdb_prompt $" { fail "ptype Foo" }
+ timeout { fail "(timeout) ptype Foo" }
+}
+
+# ptype Foo<int>
+
+send_gdb "ptype fint\n"
+gdb_expect {
+ -re "type = (class |)Foo<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int foo\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype fint" }
+ -re "$gdb_prompt $" { fail "ptype fint" }
+ timeout { fail "(timeout) ptype fint" }
+}
+
+# ptype Foo<char>
+
+send_gdb "ptype fchar\n"
+gdb_expect {
+ -re "type = (class |)Foo<char> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char foo\\(int, char\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype fchar" }
+ -re "$gdb_prompt $" { fail "ptype fchar" }
+ timeout { fail "(timeout) ptype fchar" }
+}
+
+# ptype Foo<volatile char *>
+
+send_gdb "ptype fvpchar\n"
+gdb_expect {
+ -re "type = (class |)Foo<volatile char \\*> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*volatile char \\*t;\r\n\r\n\[ \t\]*volatile char \\* foo\\(int, volatile char \\*\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype fvpchar" }
+ -re "$gdb_prompt $" { fail "ptype fvpchar" }
+ timeout { fail "(timeout) ptype fvpchar" }
+}
+
+# print a function from Foo<volatile char *>
+
+send_gdb "print Foo<volatile char *>::foo\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \\{volatile char \\*\\((class |)Foo<volatile char \\*> \\*, int, volatile char \\*\\)\\} $hex <Foo<volatile char \\*>::foo\\(int, volatile char \\*\\)>\r\n$gdb_prompt $" { pass "print Foo<volatile char *>::foo" }
+ -re "$gdb_prompt $" { fail "print Foo<volatile char *>::foo" }
+ timeout { fail "(timeout) print Foo<volatile char *>::foo" }
+}
+
+# Template Bar<T, int>
+
+setup_xfail hppa2.0w-*-* CLLbs16092
+send_gdb "ptype Bar\n"
+gdb_expect {
+ -re "type = template <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Bar<int,(\\(int\\)|)1>\r\n\[ \t\]*(class |)Bar<int,(\\(int\\)|)33>\r\n$gdb_prompt $" { pass "ptype Bar" }
+ -re "type = <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Bar" }
+ -re "$gdb_prompt $" { fail "ptype Bar" }
+ timeout { fail "(timeout) ptype Bar" }
+}
+
+
+# ptype Bar<int,33>
+
+send_gdb "ptype bint\n"
+gdb_expect {
+ -re "type = (class |)Bar<int,(\\(int\\)|)33> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int bar\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bint" }
+ -re "$gdb_prompt $" { fail "ptype bint" }
+ timeout { fail "(timeout) ptype bint" }
+}
+
+# ptype Bar<int, (4>3)>
+
+send_gdb "ptype bint2\n"
+gdb_expect {
+ -re "type = (class |)Bar<int,(\\(int\\)|)1> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int bar\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bint2" }
+ -re "$gdb_prompt $" { fail "ptype bint2" }
+ timeout { fail "(timeout) ptype bint2" }
+}
+
+# Template Baz<T, char>
+
+setup_xfail hppa2.0w-*-* CLLbs16092
+send_gdb "ptype Baz\n"
+gdb_expect {
+ -re "type = template <(class |)T, (class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Baz<char,(\\(char\\)|)97>\r\n\[ \t\]*(class |)Baz<int,(\\(char\\)|)115>\r\n$gdb_prompt $" { pass "ptype Baz" }
+ -re "type = <(class |)T, (class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Baz" }
+ -re "$gdb_prompt $" { fail "ptype Baz" }
+ timeout { fail "(timeout) ptype Baz" }
+}
+
+
+# ptype Baz<int, 's'>
+
+send_gdb "ptype bazint\n"
+gdb_expect {
+ -re "type = (class |)Baz<int,(\\(char\\)|)115> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int baz\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bazint" }
+ -re "$gdb_prompt $" { fail "ptype bazint" }
+ timeout { fail "(timeout) ptype bazint" }
+}
+
+# ptype Baz<char, 'a'>
+
+send_gdb "ptype bazint2\n"
+gdb_expect {
+ -re "type = (class |)Baz<char,(\\(char\\)|)97> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char baz\\(int, char\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bazint2" }
+ -re "$gdb_prompt $" { fail "ptype bazint2" }
+ timeout { fail "(timeout) ptype bazint2" }
+}
+
+# Template Qux<T, int (*f)(int) >
+
+send_gdb "ptype Qux\n"
+gdb_expect {
+ -re "type = template <(class |)T, (class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Qux<int,&string>\r\n\[ \t\]*(class |)Qux<char,&string>\r\n$gdb_prompt $" { pass "ptype Qux" }
+ -re ".*type = template <(class |)T.*, (class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}.*$gdb_prompt $" { pass "ptype Qux" }
+ -re "$gdb_prompt $" { fail "ptype Qux" }
+ timeout { fail "(timeout) ptype Qux" }
+}
+
+# pt Qux<int,&string>
+
+send_gdb "ptype quxint\n"
+gdb_expect {
+ -re "type = class Qux<int,&string> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int qux\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint" }
+ -re "$gdb_prompt $" { fail "ptype quxint" }
+ timeout { fail "(timeout) ptype quxint" }
+}
+
+# pt Qux<char,0>
+
+# commented out this as quxint2 declaration was commented out in
+# templates.exp -- ovidiu
+# send_gdb "ptype quxint2\n"
+# gdb_expect {
+# -re "type = class Qux<char,&string> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char qux\\(int, char\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint2" }
+# -re "$gdb_prompt $" { fail "ptype quxint2" }
+# timeout { fail "(timeout) ptype quxint2" }
+# }
+
+# Template Spec<T1, T2>
+
+setup_xfail hppa2.0w-*-* CLLbs16092
+send_gdb "ptype Spec\n"
+gdb_expect {
+ -re "type = template <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Spec<int,int \\*>\r\n\[ \t\]*(class |)Spec<int,char>\r\n$gdb_prompt $" { pass "ptype Spec" }
+ -re "type = <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Spec" }
+ -re "$gdb_prompt $" { fail "ptype Spec" }
+ timeout { fail "(timeout) ptype Spec" }
+}
+
+# pt Spec<char,0>
+
+send_gdb "ptype siip\n"
+gdb_expect {
+ -re "type = class Spec<int,int \\*> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\r\n\[ \t\]*int spec\\(int \\*\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype siip" }
+ -re "$gdb_prompt $" { fail "ptype siip" }
+ timeout { fail "(timeout) ptype siip" }
+}
+
+# pt Garply<int>
+
+send_gdb "ptype Garply<int>\n"
+gdb_expect {
+ -re "type = class Garply<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int garply\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype Garply<int>" }
+ -re "$gdb_prompt $" { fail "ptype Garply<int>" }
+ timeout { fail "(timeout) ptype Garply<int>" }
+}
+
+# ptype of nested template name
+
+send_gdb "ptype Garply<Garply<char> >\n"
+gdb_expect {
+ -re "type = (class |)Garply<Garply<char> > \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*(class |)Garply<char> t;\r\n\r\n\[ \t\]*(class |)Garply<char> garply\\(int, (class |)Garply<char>\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype Garply<Garply<char> >" }
+ -re "$gdb_prompt $" { fail "ptype Garply<Garply<char> >" }
+ timeout { fail "(timeout) ptype Garply<Garply<char> >" }
+}
+
+# print out a function from a nested template name
+
+send_gdb "print Garply<Garply<char> >::garply\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = \\{(class |)Garply<char> \\((class |)Garply<Garply<char> > \\*, int, (class |)Garply<char>\\)\\} $hex <Garply<Garply<char>>::garply\\(int, (class |)Garply<char>\\)>\r\n$gdb_prompt $" { pass "print Garply<Garply<char> >::garply" }
+ -re ".*$gdb_prompt $" { fail "print Garply<Garply<char> >::garply" }
+ timeout { fail "print Garply<Garply<char> >::garply (timeout)" }
+}
+
+# UNFORTUNATELY, "break Garply<Garply<char> >::garply" doesn't yet work.
+
+#send_gdb "break Garply<Garply<char> >::garply
+#gdb_expect {
+# -re "Breakpoint \[0-9\]* at $hex: file .*templates.cc, line.*\r\n$gdb_prompt $" { pass "break Garply<Garply<char> >::garply" }
+# -re ".*$gdb_prompt $" { fail "break Garply<Garply<char> >::garply" }
+# timeout { fail "break Garply<Garply<char> >::garply (timeout)" }
+#}
diff --git a/gdb/testsuite/gdb.c++/userdef.exp b/gdb/testsuite/gdb.c++/userdef.exp
index c9bb053..055ff0d 100644
--- a/gdb/testsuite/gdb.c++/userdef.exp
+++ b/gdb/testsuite/gdb.c++/userdef.exp
@@ -68,7 +68,7 @@ send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
}
- setup_xfail hppa_*_*
+setup_xfail "hppa*-*-*"
send_gdb "print one+two\n"
gdb_expect {
-re "FIXME.*$gdb_prompt $" {
@@ -78,6 +78,7 @@ gdb_expect {
timeout { fail "(timeout) print value of one two" }
}
+setup_xfail "hppa*-*-*"
send_gdb "print one-two\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -87,6 +88,7 @@ gdb_expect {
timeout { fail "(timeout) print value of one - two" }
}
+setup_xfail "hppa*-*-*"
send_gdb "print one*two\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -96,6 +98,7 @@ gdb_expect {
timeout { fail "(timeout) print value of one * two" }
}
+setup_xfail "hppa*-*-*"
send_gdb "print one/two\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -105,6 +108,7 @@ gdb_expect {
timeout { fail "(timeout) print value of one / two" }
}
+setup_xfail "hppa*-*-*"
send_gdb "print one%two\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -114,6 +118,7 @@ gdb_expect {
timeout { fail "(timeout) print value of one % two" }
}
+setup_xfail "hppa*-*-*"
send_gdb "print one&&two\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -123,6 +128,7 @@ gdb_expect {
timeout { fail "(timeout) print value of one && two" }
}
+setup_xfail "hppa*-*-*"
send_gdb "print one||two\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -132,6 +138,7 @@ gdb_expect {
timeout { fail "(timeout) print value of one|| two" }
}
+setup_xfail "hppa*-*-*"
send_gdb "print one&two\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -141,6 +148,7 @@ gdb_expect {
timeout { fail "(timeout) print value of one & two" }
}
+setup_xfail "hppa*-*-*"
send_gdb "print one|two\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -150,6 +158,7 @@ gdb_expect {
timeout { fail "(timeout) print value of one | two" }
}
+setup_xfail "hppa*-*-*"
send_gdb "print one ^ two\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -159,6 +168,8 @@ gdb_expect {
timeout { fail "(timeout) print value of one ^ two" }
}
+
+setup_xfail "hppa*-*-*"
send_gdb "print one < two\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -168,6 +179,7 @@ gdb_expect {
timeout { fail "(timeout) print value of one < two" }
}
+setup_xfail "hppa*-*-*"
send_gdb "print one <= two\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -177,6 +189,7 @@ gdb_expect {
timeout { fail "(timeout) print value of one <= two" }
}
+setup_xfail "hppa*-*-*"
send_gdb "print one > two\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -186,6 +199,7 @@ gdb_expect {
timeout { fail "(timeout) print value of one > two" }
}
+setup_xfail "hppa*-*-*"
send_gdb "print one >= two\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -196,6 +210,7 @@ gdb_expect {
}
+setup_xfail "hppa*-*-*"
send_gdb "print one==two\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -205,6 +220,8 @@ gdb_expect {
timeout { fail "(timeout) print value of one == two" }
}
+
+setup_xfail "hppa*-*-*"
send_gdb "print one!=two\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -214,6 +231,7 @@ gdb_expect {
timeout { fail "(timeout) print value of one != two" }
}
+setup_xfail "hppa*-*-*"
send_gdb "print one<<31\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -223,6 +241,7 @@ gdb_expect {
timeout { fail "(timeout) print value of one<<31" }
}
+setup_xfail "hppa*-*-*"
send_gdb "print one>>31\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -232,6 +251,7 @@ gdb_expect {
timeout { fail "(timeout) print value of one>>31" }
}
+setup_xfail "hppa*-*-*"
send_gdb "print !one\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -241,6 +261,7 @@ gdb_expect {
timeout { fail "(timeout) print value of !one" }
}
+setup_xfail "hppa*-*-*"
send_gdb "print ~one\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -250,6 +271,7 @@ gdb_expect {
timeout { fail "(timeout) print value of ~one" }
}
+setup_xfail "hppa*-*-*"
send_gdb "print -one\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -259,6 +281,7 @@ gdb_expect {
timeout { fail "(timeout) print value of -one" }
}
+setup_xfail "hppa*-*-*"
send_gdb "print one++\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -268,6 +291,7 @@ gdb_expect {
timeout { fail "(timeout) print value of one++" }
}
+setup_xfail "hppa*-*-*"
send_gdb "print ++one\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -277,6 +301,7 @@ gdb_expect {
timeout { fail "(timeout) print value of ++one" }
}
+setup_xfail "hppa*-*-*"
send_gdb "print one--\n"
gdb_expect {
-re ".*.FIXME*$gdb_prompt $" {
@@ -286,6 +311,8 @@ gdb_expect {
timeout { fail "(timeout) print value of one-->>31" }
}
+
+setup_xfail "hppa*-*-*"
send_gdb "print --one\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -295,6 +322,7 @@ gdb_expect {
timeout { fail "(timeout) print value of --one" }
}
+setup_xfail "hppa*-*-*"
send_gdb "print one+=7\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
@@ -304,6 +332,7 @@ gdb_expect {
timeout { fail "(timeout) print value of one+=7" }
}
+setup_xfail "hppa*-*-*"
send_gdb "print two=one\n"
gdb_expect {
-re ".*FIXME.*$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.c++/virtfunc.cc b/gdb/testsuite/gdb.c++/virtfunc.cc
index 883d502..005de9d 100644
--- a/gdb/testsuite/gdb.c++/virtfunc.cc
+++ b/gdb/testsuite/gdb.c++/virtfunc.cc
@@ -170,7 +170,7 @@ extern "C" {
};
#endif
-main()
+int main()
{
#ifdef usestubs
set_debug_traps();
@@ -182,6 +182,8 @@ main()
e.vb = 11;
test_calls();
+ return 0;
+
}
int A::f() {return 1;}
diff --git a/gdb/testsuite/gdb.c++/virtfunc.exp b/gdb/testsuite/gdb.c++/virtfunc.exp
index d0db755..e182744 100644
--- a/gdb/testsuite/gdb.c++/virtfunc.exp
+++ b/gdb/testsuite/gdb.c++/virtfunc.exp
@@ -34,15 +34,6 @@ 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.
@@ -106,6 +97,9 @@ proc test_ptype_of_classes {} {
-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}int fvb \\(void\\);${ws}virtual int vvb \\(void\\);${ws}\}.*$gdb_prompt $" {
+ pass "ptype VB (aCC)"
+ }
-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)"
}
@@ -122,6 +116,9 @@ proc test_ptype_of_classes {} {
-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}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype V (aCC)"
+ }
-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)"
}
@@ -138,6 +135,9 @@ proc test_ptype_of_classes {} {
-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}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype A (aCC)"
+ }
-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)"
}
@@ -161,6 +161,9 @@ proc test_ptype_of_classes {} {
-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}virtual int f \\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype B (aCC)"
+ }
-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)"
}
@@ -177,6 +180,9 @@ proc test_ptype_of_classes {} {
-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}public:${ws}int c;${ws}\}$nl$gdb_prompt $" {
+ pass "ptype C (aCC)"
+ }
-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)"
}
@@ -193,6 +199,9 @@ proc test_ptype_of_classes {} {
-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}virtual int vg \\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype AD (aCC)"
+ }
-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)"
}
@@ -209,6 +218,9 @@ proc test_ptype_of_classes {} {
-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}public:${ws}int d;${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 (aCC)"
+ }
-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)"
}
@@ -225,6 +237,9 @@ proc test_ptype_of_classes {} {
-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}virtual int f \\(void\\);${ws}virtual int vg \\(void\\);${ws}virtual int vv \\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype E (aCC)"
+ }
-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)"
}
@@ -241,6 +256,9 @@ proc test_ptype_of_classes {} {
-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}public:${ws}int d;${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 (aCC)"
+ }
-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)"
}
@@ -257,6 +275,9 @@ proc test_ptype_of_classes {} {
-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}public:${ws}int d;${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 (aCC)"
+ }
-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)"
}
@@ -273,6 +294,9 @@ proc test_ptype_of_classes {} {
-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}virtual int vg \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pAd (aCC)"
+ }
-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)"
}
@@ -289,6 +313,9 @@ proc test_ptype_of_classes {} {
-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}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype a (aCC)"
+ }
-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)"
}
@@ -305,6 +332,9 @@ proc test_ptype_of_classes {} {
-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}virtual int f \\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype b (aCC)"
+ }
-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)"
}
@@ -321,6 +351,9 @@ proc test_ptype_of_classes {} {
-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}public:${ws}int c;${ws}\}$nl$gdb_prompt $" {
+ pass "ptype c (aCC)"
+ }
-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)"
}
@@ -337,6 +370,9 @@ proc test_ptype_of_classes {} {
-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}public:${ws}int d;${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 (aCC)"
+ }
-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)"
}
@@ -353,6 +389,9 @@ proc test_ptype_of_classes {} {
-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}virtual int f \\(void\\);${ws}virtual int vg \\(void\\);${ws}virtual int vv \\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype e (aCC)"
+ }
-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)"
}
@@ -369,6 +408,9 @@ proc test_ptype_of_classes {} {
-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}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype v (aCC)"
+ }
-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)"
}
@@ -385,6 +427,9 @@ proc test_ptype_of_classes {} {
-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}int fvb \\(void\\);${ws}virtual int vvb \\(void\\);${ws}\}$nl$gdb_prompt $" {
+ pass "ptype vb (aCC)"
+ }
-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)"
}
@@ -401,6 +446,9 @@ proc test_ptype_of_classes {} {
-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}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pAa (aCC)"
+ }
-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)"
}
@@ -417,6 +465,9 @@ proc test_ptype_of_classes {} {
-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}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pAe (aCC)"
+ }
-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)"
}
@@ -433,6 +484,9 @@ proc test_ptype_of_classes {} {
-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}virtual int f \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pBe (aCC)"
+ }
-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)"
}
@@ -449,6 +503,9 @@ proc test_ptype_of_classes {} {
-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}public:${ws}int d;${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 (aCC)"
+ }
-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)"
}
@@ -465,6 +522,9 @@ proc test_ptype_of_classes {} {
-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}public:${ws}int d;${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 (aCC)"
+ }
-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)"
}
@@ -481,6 +541,9 @@ proc test_ptype_of_classes {} {
-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}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pVa (aCC)"
+ }
-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)"
}
@@ -497,6 +560,9 @@ proc test_ptype_of_classes {} {
-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}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pVv (aCC)"
+ }
-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)"
}
@@ -513,6 +579,9 @@ proc test_ptype_of_classes {} {
-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}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pVe (aCC)"
+ }
-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)"
}
@@ -529,6 +598,9 @@ proc test_ptype_of_classes {} {
-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}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pVd (aCC)"
+ }
-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)"
}
@@ -545,6 +617,9 @@ proc test_ptype_of_classes {} {
-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}virtual int vg \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pADe (aCC)"
+ }
-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)"
}
@@ -561,6 +636,9 @@ proc test_ptype_of_classes {} {
-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}virtual int f \\(void\\);${ws}virtual int vg \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pEe (aCC)"
+ }
-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)"
}
@@ -577,6 +655,9 @@ proc test_ptype_of_classes {} {
-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}int fvb \\(void\\);${ws}virtual int vvb \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
+ pass "ptype pVB (aCC)"
+ }
-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)"
}
@@ -616,6 +697,10 @@ proc test_virtual_calls {} {
(known failure with gcc cygnus-2.4.5-930417, skipping virtual calls)"
return 0
}
+ -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
+ setup_xfail hppa*-*-* CLLbs16899
+ fail "print pAe->f()"
+ }
-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 }
@@ -624,15 +709,22 @@ proc test_virtual_calls {} {
send_gdb "print pAa->f()\n"
gdb_expect {
-re ".* = 1$nl$gdb_prompt $" { pass "print pAa->f()" }
+ -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
+ setup_xfail hppa*-*-* CLLbs16899
+ fail "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 "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
+ setup_xfail hppa*-*-* CLLbs16899
+ fail "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 }
@@ -641,24 +733,34 @@ proc test_virtual_calls {} {
send_gdb "print pADe->vg()\n"
gdb_expect {
-re ".* = 202$nl$gdb_prompt $" { pass "print pADe->vg()" }
+ -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
+ setup_xfail hppa*-*-* CLLbs16899
+ fail "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 "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
+ setup_xfail hppa*-*-* CLLbs16899
+ fail "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 "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
+ setup_xfail hppa*-*-* CLLbs16899
+ fail "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 }
@@ -667,42 +769,58 @@ proc test_virtual_calls {} {
send_gdb "print pVB->vvb()\n"
gdb_expect {
-re ".* = 407$nl$gdb_prompt $" { pass "print pVB->vvb()" }
+ -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
+ setup_xfail hppa*-*-* CLLbs16899
+ fail "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 "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
+ setup_xfail hppa*-*-* CLLbs16899
+ fail "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 "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
+ setup_xfail hppa*-*-* CLLbs16899
+ fail "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 "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
+ setup_xfail hppa*-*-* CLLbs16899
+ fail "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 "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
+ setup_xfail hppa*-*-* CLLbs16899
+ fail "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 }