aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.hp/inherit-hp.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.hp/inherit-hp.exp')
-rw-r--r--gdb/testsuite/gdb.hp/inherit-hp.exp849
1 files changed, 0 insertions, 849 deletions
diff --git a/gdb/testsuite/gdb.hp/inherit-hp.exp b/gdb/testsuite/gdb.hp/inherit-hp.exp
deleted file mode 100644
index 645358e..0000000
--- a/gdb/testsuite/gdb.hp/inherit-hp.exp
+++ /dev/null
@@ -1,849 +0,0 @@
-# Copyright (C) 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
-# This file was written by Fred Fish. (fnf@cygnus.com)
-
-set ws "\[\r\n\t \]+"
-
-if $tracelevel then {
- strace $tracelevel
-}
-
-# Check to see if we have an executable to test. If not, then either we
-# haven't tried to compile one, or the compilation failed for some reason.
-# In either case, just notify the user and skip the tests in this file.
-# Note - create separate "inherit" executable from misc.cc
-
-set testfile "inherit-hp"
-set srcfile misc-hp.cc
-set binfile ${objdir}/${subdir}/${testfile}
-
-if [get_compiler_info ${binfile} "c++"] {
- return -1;
-}
-
-
-if {[skip_hp_tests $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."
-}
-
-#
-# Single inheritance, print individual members.
-#
-
-proc test_print_si_members {} {
- # Print all members of g_A using fully qualified form.
-
- gdb_test "print g_A.A::a" ".* = 1" "print g_A.A::a"
-
- gdb_test "print g_A.A::x" ".* = 2" "print g_A.A::x"
-
- # Print members of g_A using nonambiguous compact form.
-
- gdb_test "print g_A.a" ".* = 1" "print g_A.a"
-
- gdb_test "print g_A.x" ".* = 2" "print g_A.x"
-
- # Print all members of g_B using fully qualified form.
-
- gdb_test "print g_B.A::a" ".* = 3" "print g_B.A::a"
-
- gdb_test "print g_B.A::x" ".* = 4" "print g_B.A::x"
-
- gdb_test "print g_B.B::b" ".* = 5" "print g_B.B::b"
-
- gdb_test "print g_B.B::x" ".* = 6" "print g_B.B::x"
-
- # Print members of g_B using nonambiguous compact form.
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_B.a" ".* = 3" "print g_B.a"
-
- gdb_test "print g_B.b" ".* = 5" "print g_B.b"
-
- gdb_test "print g_B.x" ".* = 6" "print g_B.x"
-
- # Print all members of g_C using fully qualified form.
-
- gdb_test "print g_C.A::a" ".* = 7" "print g_C.A::a"
-
- gdb_test "print g_C.A::x" ".* = 8" "print g_C.A::x"
-
- gdb_test "print g_C.C::c" ".* = 9" "print g_C.C::c"
-
- gdb_test "print g_C.C::x" ".* = 10" "print g_C.C::x"
-
- # Print members of g_C using nonambiguous compact form.
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_C.a" ".* = 7" "print g_C.a"
-
- gdb_test "print g_C.c" ".* = 9" "print g_C.c"
-
- gdb_test "print g_C.x" ".* = 10" "print g_C.x"
-}
-
-#
-# Single inheritance, print type definitions.
-#
-
-proc test_ptype_si {} {
- global gdb_prompt
- global ws
-
- # Print class A as a type.
-
- send_gdb "ptype A\n"
- gdb_expect {
- -re "type = class A \{\r\n.*\[ \]*int a;\r\n\[ \]*int x;\r\n.*\[ \]*\}\r\n$gdb_prompt $" {
- pass "ptype A (FIXME)"
- }
- -re "type = struct A \{\r\n\[ \]*int a;\r\n\[ \]*int x;\r\n\[ \]*\}\r\n$gdb_prompt $" {
- setup_xfail "*-*-*"
- fail "ptype A (FIXME)"
- }
- -re ".*$gdb_prompt $" { fail "ptype A" }
- timeout { fail "ptype A (timeout)" ; return }
- }
-
- # Print class A as an explicit class.
-
- send_gdb "ptype class A\n"
- gdb_expect {
- -re "type = class A \{\r\n.*\[ \]*int a;\r\n\[ \]*int x;\r\n.*\[ \]*\}\r\n$gdb_prompt $" {
- pass "ptype class A (FIXME)"
- }
- -re "type = struct A \{\r\n\[ \]*int a;\r\n\[ \]*int x;\r\n\[ \]*\}\r\n$gdb_prompt $" {
- setup_xfail "*-*-*"
- fail "ptype class A (FIXME)"
- }
- -re ".*$gdb_prompt $" { fail "ptype class A" }
- timeout { fail "ptype class A (timeout)" ; return }
- }
-
- # Print type of an object of type A.
-
- send_gdb "ptype g_A\n"
- gdb_expect {
- -re "type = class A \{\r\n.*\[ \]*int a;\r\n\[ \]*int x;\r\n.*\[ \]*\}\r\n$gdb_prompt $" {
- pass "ptype g_A (FIXME)"
- }
- -re "type = struct A \{\r\n\[ \]*int a;\r\n\[ \]*int x;\r\n\[ \]*\}\r\n$gdb_prompt $" {
- setup_xfail "*-*-*"
- fail "ptype g_A (FIXME)"
- }
- -re ".*$gdb_prompt $" { fail "ptype g_A" }
- timeout { fail "ptype g_A (timeout)" ; return }
- }
-
- # Print class B as a type.
-
- setup_xfail_format "DWARF 1"
- gdb_test "ptype B" "type = class B : public A \{\r\n\[ \]*public:\r\n\[ \]*int b;\r\n\[ \]*int x;\r\n.*\}" "ptype B"
-
- # Print class B as an explicit class.
-
- setup_xfail_format "DWARF 1"
- gdb_test "ptype class B" "type = class B : public A \{\r\n\[ \]*public:\r\n\[ \]*int b;\r\n\[ \]*int x;\r\n.*\}" "ptype class B"
-
- # Print type of an object of type B.
-
- setup_xfail_format "DWARF 1"
- gdb_test "ptype g_B" "type = class B : public A \{\r\n\[ \]*public:\r\n\[ \]*int b;\r\n\[ \]*int x;\r\n.*\}" "ptype g_B"
-
- # Print class C as a type.
-
- setup_xfail_format "DWARF 1"
- gdb_test "ptype C" "type = class C : public A \{\r\n\[ \]*public:\r\n\[ \]*int c;\r\n\[ \]*int x;\r\n.*\}" "ptype C"
-
- # Print class C as an explicit class.
-
- setup_xfail_format "DWARF 1"
- gdb_test "ptype class C" "type = class C : public A \{\r\n\[ \]*public:\r\n\[ \]*int c;\r\n\[ \]*int x;\r\n.*\}" "ptype class C"
-
- # Print type of an object of type g_C.
-
- setup_xfail_format "DWARF 1"
- gdb_test "ptype g_C" "type = class C : public A \{\r\n\[ \]*public:\r\n\[ \]*int c;\r\n\[ \]*int x;\r\n.*\}" "ptype g_C"
-
- # gcc cygnus-2.3.3 (Q1) has this bug, but it was fixed as of
- # cygnus-2.3.3-930417. PR 2819.
- send_gdb "ptype tagless_struct\n"
- gdb_expect {
- -re "type = class \{${ws}public:${ws}int one;${ws}int two;${ws}tagless_struct & operator=\\(tagless_struct &\\);${ws}\\\$_1 \\(tagless_struct &\\);${ws}\\\$_1 \\(\\);${ws}\}\r\n$gdb_prompt $" {
- pass "ptype tagless struct"
- }
- -re "type = (struct|class).*\{.*int one;.*int two;.*\}\r\n$gdb_prompt $" {
- pass "ptype tagless struct (obsolete gcc or gdb)"
- }
- -re ".*$gdb_prompt $" {
- fail "ptype tagless struct"
- }
- timeout {
- fail "ptype tagless struct (timeout)"
- }
- }
-
- send_gdb "ptype v_tagless\n"
- gdb_expect {
- -re "type = class \{${ws}public:${ws}int one;${ws}int two;${ws}tagless_struct & operator=\\(tagless_struct &\\);${ws}\\\$_1 \\(tagless_struct &\\);${ws}\\\$_1 \\(\\);${ws}\}\r\n$gdb_prompt $" {
- pass "ptype variable of type tagless struct"
- }
- -re "type = (struct|class).*\{.*int one;.*int two;.*\}\r\n$gdb_prompt $" {
- pass "ptype variable of type tagless struct (obsolete gcc or gdb)"
- }
- -re ".*$gdb_prompt $" {
- fail "ptype variable of type tagless struct"
- }
- timeout {
- fail "ptype variable of type tagless struct (timeout)"
- }
- }
-}
-
-#
-# Single inheritance, print complete classes.
-#
-
-proc test_print_si_classes {} {
- # Print all members of g_A.
-
- gdb_test "print g_A" ".* = \{a = 1, x = 2\}" "print g_A"
-
- # Print all members of g_B.
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_B" ".* = \{\<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" ".* = \{\<class A\> = \{a = 7, x = 8\}, c = 9, x = 10\}" "print g_C"
-}
-
-#
-# Single inheritance, print anonymous unions.
-# GDB versions prior to 4.14 entered an infinite loop when printing
-# the type of a class containing an anonymous union, and they were also
-# incapable of printing the member of an anonymous union.
-# We test the printing of the member first, and perform the other tests
-# only if the test succeeds, to avoid the infinite loop.
-#
-
-proc test_print_anon_union {} {
- global gdb_prompt
- global ws
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_anon_union.a" ".* = 2" "print anonymous union member"
- setup_xfail_format "DWARF 1"
- send_gdb "print g_anon_union\n"
- gdb_expect {
- -re ".* = \{one = 1, \{a = 2, b = 2\}\}\r\n$gdb_prompt $" {
- pass "print variable of type anonymous union"
- }
- -re ".* = .*\{one = 1, = \{a = 2, b = .*\}\}\r\n$gdb_prompt $" {
- pass "print variable of type anonymous union (obsolete gcc or gdb)"
- }
- -re ".*\r\n$gdb_prompt $" {
- fail "print variable of type anonymous union"
- }
- timeout {
- fail "print variableof type anonymous union (timeout)"
- }
- }
- setup_xfail_format "DWARF 1"
- send_gdb "ptype g_anon_union\n"
- gdb_expect {
- -re "type = class class_with_anon_union \{${ws}public:${ws}int one;${ws}union \{${ws}public:${ws}int a;${ws}long int b;${ws}union \{\.\.\.\} & operator=\\(union \{\.\.\.\} &\\);${ws}\\\$_0 \\(union \{\.\.\.\} &\\);${ws}\\\$_0 \\(\\);${ws}\};${ws}class_with_anon_union & operator=\\(class_with_anon_union const &\\);${ws}class_with_anon_union\\(class_with_anon_union const &\\);${ws}class_with_anon_union\\(void\\);${ws}\}\r\n$gdb_prompt $" {
- pass "print type of anonymous union"
- }
- -re "type = (struct|class).*\{.*int one;.*union \{.*int a;.*(long|long int|int) b;.*\};.*\}\r\n$gdb_prompt $" {
- pass "print type of anonymous union (obsolete gcc or gdb)"
- }
- -re ".*\r\n$gdb_prompt $" {
- fail "print type of anonymous union"
- }
- timeout {
- fail "print type of anonymous union (timeout)"
- }
- }
-}
-
-#
-# Multiple inheritance, print individual members.
-#
-
-proc test_print_mi_members {} {
- global gdb_prompt
-
- # Print all members of g_A.
-
- gdb_test "print g_A.A::a" ".* = 1" "print g_A.A::a"
-
- gdb_test "print g_A.A::x" ".* = 2" "print g_A.A::x"
-
- # Print all members of g_B.
-
- gdb_test "print g_B.A::a" ".* = 3" "print g_B.A::a"
-
- gdb_test "print g_B.A::x" ".* = 4" "print g_B.A::x"
-
- gdb_test "print g_B.B::b" ".* = 5" "print g_B.B::b"
-
- gdb_test "print g_B.B::x" ".* = 6" "print g_B.B::x"
-
- # Print all members of g_C.
-
- gdb_test "print g_C.A::a" ".* = 7" "print g_C.A::a"
-
- gdb_test "print g_C.A::x" ".* = 8" "print g_C.A::x"
-
- gdb_test "print g_C.C::c" ".* = 9" "print g_C.C::c"
-
- gdb_test "print g_C.C::x" ".* = 10" "print g_C.C::x"
-
- # Print all members of g_D.
-
- # The following is ambiguous, and gdb should detect this.
- # For now, accept gdb's behavior as an expected failure if it
- # simply prints either member correctly.
-
- # setup_xfail "*-*-*"
- send_gdb "print g_D.A::a\n"
- gdb_expect {
- -re "warning: A ambiguous; using D::B::A. Use a cast to disambiguate.\r\n\\$\[0-9\]* = 11\r\n$gdb_prompt $" {
- pass "print g_D.A::a"
- }
- -re ".* = 15\r\n$gdb_prompt $" {
- fail "print g_D.A::a (did GDB's algorithm change?)"
- }
- -re ".* = 11\r\n$gdb_prompt $" {
- fail "print g_D.A::a (ambiguity not reported)"
- }
- -re ".*$gdb_prompt $" { fail "print g_D.A::a" }
- timeout { fail "print g_D.A::a (timeout)" ; return }
- }
-
- # The following is ambiguous, and gdb should detect this.
- # For now, accept gdb's behavior as an expected failure if it
- # simply prints either member correctly.
-
- # setup_xfail "*-*-*"
- send_gdb "print g_D.A::x\n"
- gdb_expect {
- -re "warning: A ambiguous; using D::B::A. Use a cast to disambiguate.\r\n\\$\[0-9\]* = 12\r\n$gdb_prompt $" {
- pass "print g_D.A::x"
- }
- -re ".* = 16\r\n$gdb_prompt $" {
- fail "print g_D.A::x (did GDB's algorithm change?)"
- }
- -re ".* = 12\r\n$gdb_prompt $" {
- fail "print g_D.A::x (ambiguity not reported)"
- }
- -re ".*$gdb_prompt $" { fail "print g_D.A::x" }
- timeout { fail "print g_D.A::x (timeout)" ; return }
- }
-
- gdb_test "print g_D.B::b" ".* = 13" "print g_D.B::b"
-
- gdb_test "print g_D.B::x" ".* = 14" "print g_D.B::x"
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_D.C::c" ".* = 17" "print g_D.C::c"
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_D.C::x" ".* = 18" "print g_D.C::x"
-
- gdb_test "print g_D.D::d" ".* = 19" "print g_D.D::d"
-
- gdb_test "print g_D.D::x" ".* = 20" "print g_D.D::x"
-
- # Print all members of g_E.
-
- # The following is ambiguous, and gdb should detect this.
- # For now, accept gdb's behavior as an expected failure if it
- # simply prints either member correctly.
-
- #setup_xfail "*-*-*"
- send_gdb "print g_E.A::a\n"
- gdb_expect {
- -re "warning: A ambiguous; using E::D::B::A. Use a cast to disambiguate.\r\n\\$\[0-9\]* = 21\r\n$gdb_prompt $" {
- pass "print g_E.A::a"
- }
- -re ".* = 25\r\n$gdb_prompt $" {
- fail "print g_E.A::a (did GDB's algorithm change?)"
- }
- -re ".* = 21\r\n$gdb_prompt $" {
- fail "print g_E.A::a (ambiguity not reported)"
- }
- -re ".*$gdb_prompt $" { fail "print g_E.A::a" }
- timeout { fail "print g_E.A::a (timeout)" ; return }
- }
-
- # The following is ambiguous, and gdb should detect this.
- # For now, accept gdb's behavior as an expected failure if it
- # simply prints either member correctly.
-
- # setup_xfail "*-*-*"
- send_gdb "print g_E.A::x\n"
- gdb_expect {
- -re "warning: A ambiguous; using E::D::B::A. Use a cast to disambiguate.\r\n\\$\[0-9\]* = 22\r\n$gdb_prompt $" {
- pass "print g_E.A::x"
- }
- -re ".* = 26\r\n$gdb_prompt $" {
- fail "print g_E.A::x (did GDB's algorithm change?)"
- }
- -re ".* = 22\r\n$gdb_prompt $" {
- fail "print g_E.A::x (ambiguity not reported)"
- }
- -re ".*$gdb_prompt $" { fail "print g_E.A::x" }
- timeout { fail "print g_E.A::x (timeout)" ; return }
- }
-
- gdb_test "print g_E.B::b" ".* = 23" "print g_E.B::b"
-
- gdb_test "print g_E.B::x" ".* = 24" "print g_E.B::x"
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_E.C::c" ".* = 27" "print g_E.C::c"
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_E.C::x" ".* = 28" "print g_E.C::x"
-
- gdb_test "print g_E.D::d" ".* = 29" "print g_E.D::d"
-
- gdb_test "print g_E.D::x" ".* = 30" "print g_E.D::x"
-
- gdb_test "print g_E.E::e" ".* = 31" "print g_E.E::e"
-
- gdb_test "print g_E.E::x" ".* = 32" "print g_E.E::x"
-}
-
-#
-# Multiple inheritance, print type definitions.
-#
-
-proc test_ptype_mi {} {
- setup_xfail_format "DWARF 1"
- gdb_test "ptype D" "type = class D : public B, public C \{\r\n\[ \]*public:\r\n\[ \]*int d;\r\n\[ \]*int x;\r\n.*\}" "ptype D"
-
- setup_xfail_format "DWARF 1"
- gdb_test "ptype class D" "type = class D : public B, public C \{\r\n\[ \]*public:\r\n\[ \]*int d;\r\n\[ \]*int x;\r\n.*\}" "ptype class D"
-
- setup_xfail_format "DWARF 1"
- gdb_test "ptype g_D" "type = class D : public B, public C \{\r\n\[ \]*public:\r\n\[ \]*int d;\r\n\[ \]*int x;\r\n.*\}" "ptype g_D"
-
- setup_xfail_format "DWARF 1"
- gdb_test "ptype E" "type = class E : public D \{\r\n\[ \]*public:\r\n\[ \]*int e;\r\n\[ \]*int x;\r\n.*\}" "ptype E"
-
- setup_xfail_format "DWARF 1"
- gdb_test "ptype class E" "type = class E : public D \{\r\n\[ \]*public:\r\n\[ \]*int e;\r\n\[ \]*int x;\r\n.*\}" "ptype class E"
-
- setup_xfail_format "DWARF 1"
- gdb_test "ptype g_E" "type = class E : public D \{\r\n\[ \]*public:\r\n\[ \]*int e;\r\n\[ \]*int x;\r\n.*\}" "ptype g_E"
-}
-
-#
-# Multiple inheritance, print complete classes.
-#
-
-proc test_print_mi_classes {} {
- # Print all members of g_D.
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_D" ".* = \{\<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" ".* = \{\<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"
-}
-
-#
-# Single virtual inheritance, print individual members.
-#
-
-proc test_print_svi_members {} {
- global gdb_prompt
- global decimal
-
- # Print all members of g_vA.
-
- gdb_test "print g_vA.vA::va" ".* = 1" "print g_vA.vA::va"
-
- gdb_test "print g_vA.vA::vx" ".* = 2" "print g_vA.vA::vx"
-
- # Print members of g_vA using compact form.
-
- gdb_test "print g_vA.va" ".* = 1" "print g_vA.va"
-
- gdb_test "print g_vA.vx" ".* = 2" "print g_vA.vx"
-
- # Print all members of g_vB.
-
- setup_xfail_format "DWARF 1"
- send_gdb "print g_vB.vA::va\n"
- gdb_expect {
- -re ".* = 3\r\n$gdb_prompt $" { pass "print g_vB.vA::va" }
- -re ".*virtual baseclass botch.*$gdb_prompt $" {
- # Does not happen with gcc cygnus-2.4.5-930828
- fail "print g_vB.vA::va (known bug with gcc cygnus-2.4.5-930417)"
- # Many of the rest of these tests have the same problem.
- return 0
- }
- -re ".*$gdb_prompt $" { fail "print g_vB.vA::va" }
- timeout { fail "print g_vB.vA::va (timeout)" ; return }
- }
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_vB.vA::vx" ".* = 4" "print g_vB.vA::vx"
-
- gdb_test "print g_vB.vB::vb" ".* = 5" "print g_vB.vB::vb"
-
- gdb_test "print g_vB.vB::vx" ".* = 6" "print g_vB.vB::vx"
-
- # Print members of g_vB using compact form.
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_vB.va" ".* = 3" "print g_vB.va"
-
- gdb_test "print g_vB.vb" ".* = 5" "print g_vB.vb"
-
- gdb_test "print g_vB.vx" ".* = 6" "print g_vB.vx"
-
- # Print all members of g_vC.
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_vC.vA::va" ".* = 7" "print g_vC.vA::va"
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_vC.vA::vx" ".* = 8" "print g_vC.vA::vx"
-
- gdb_test "print g_vC.vC::vc" ".* = 9" "print g_vC.vC::vc"
-
- gdb_test "print g_vC.vC::vx" ".* = 10" "print g_vC.vC::vx"
-
- # Print members of g_vC using compact form.
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_vC.va" ".* = 7" "print g_vC.va"
-
- gdb_test "print g_vC.vc" ".* = 9" "print g_vC.vc"
-
- gdb_test "print g_vC.vx" ".* = 10" "print g_vC.vx"
-}
-
-#
-# Single virtual inheritance, print type definitions.
-#
-
-proc test_ptype_vi {} {
- global gdb_prompt
-
- # This class does not use any C++-specific features, so it's fine for
- # it to print as "struct".
- send_gdb "ptype vA\n"
- gdb_expect {
- -re "type = class vA \{\[\r\n\]+\[ \]*public:\[\r\n\]+\[ \]*int va;\[\r\n\]+\[ \]*int vx;\[\r\n\]+.*\}\[\r\n\]+$gdb_prompt $" {
- pass "ptype vA"
- }
- -re "type = struct vA \{\[\r\n\]+\[ \]*int va;\[\r\n\]+\[ \]*int vx;\[\r\n\]+\}\[\r\n\]+$gdb_prompt $" {
- pass "ptype vA"
- }
- -re ".*$gdb_prompt $" { fail "ptype vA" }
- timeout { fail "ptype vA (timeout)" ; return }
- }
-
- # This class does not use any C++-specific features, so it's fine for
- # it to print as "struct".
- send_gdb "ptype class vA\n"
- gdb_expect {
- -re "type = class vA \{\[\r\n\]+\[ \]*public:\[\r\n\]+\[ \]*int va;\[\r\n\]+\[ \]*int vx;\[\r\n\]+.*\}\[\r\n\]+$gdb_prompt $" {
- pass "ptype class vA"
- }
- -re "type = struct vA \{\[\r\n\]+\[ \]*int va;\[\r\n\]+\[ \]*int vx;\[\r\n\]+\}\[\r\n\]+$gdb_prompt $" {
- pass "ptype class vA"
- }
- -re ".*$gdb_prompt $" { fail "ptype class vA" }
- timeout { fail "ptype class vA (timeout)" ; return }
- }
-
- # This class does not use any C++-specific features, so it's fine for
- # it to print as "struct".
- send_gdb "ptype g_vA\n"
- gdb_expect {
- -re "type = class vA \{\[\r\n\]+\[ \]*public:\[\r\n\]+\[ \]*int va;\[\r\n\]+\[ \]*int vx;\[\r\n\]+.*\}\[\r\n\]+$gdb_prompt $" {
- pass "ptype g_vA"
- }
- -re "type = struct vA \{\[\r\n\]+\[ \]*int va;\[\r\n\]+\[ \]*int vx;\[\r\n\]+\}\[\r\n\]+$gdb_prompt $" {
- pass "ptype g_vA"
- }
- -re ".*$gdb_prompt $" { fail "ptype g_vA" }
- timeout { fail "ptype g_vA (timeout)" ; return }
- }
-
- setup_xfail_format "DWARF 1"
- gdb_test "ptype vB" "ptype vB\[\r\n\]+type = class vB : public virtual vA \{\[\r\n\]+ public:\r\n\[ \]+int vb;\r\n\[ \]+int vx;\r\n.*\}" "ptype vB (aCC)"
-
- setup_xfail_format "DWARF 1"
- gdb_test "ptype class vB" "type = class vB : public virtual vA \{\r\n\[ \]*public:\r\n\[ \]*int vb;\r\n\[ \]*int vx;\r\n.*\}" "ptype class vB (aCC)"
-
- setup_xfail_format "DWARF 1"
- gdb_test "ptype g_vB" "type = class vB : public virtual vA \{\r\n\[ \]*public:\r\n\[ \]*int vb;\r\n\[ \]*int vx;\r\n.*\}" "ptype g_vB (aCC)"
-
- setup_xfail_format "DWARF 1"
- gdb_test "ptype vC" "type = class vC : public virtual vA \{\r\n\[ \]*public:\r\n\[ \]*int vc;\r\n\[ \]*int vx;\r\n.*\}" "ptype vC (aCC)"
-
- setup_xfail_format "DWARF 1"
- gdb_test "ptype class vC" "type = class vC : public virtual vA \{\r\n\[ \]*public:\r\n\[ \]*int vc;\r\n\[ \]*int vx;\r\n.*\}" "ptype class vC (aCC)"
-
- setup_xfail_format "DWARF 1"
- gdb_test "ptype g_vC" "type = class vC : public virtual vA \{\r\n\[ \]*public:\r\n\[ \]*int vc;\r\n\[ \]*int vx;\r\n.*\}" "ptype g_vC (aCC)"
-}
-
-#
-# Single virtual inheritance, print complete classes.
-#
-
-proc test_print_svi_classes {} {
- global gdb_prompt
- global hex
- global decimal
-
- # Print all members of g_vA.
-
- gdb_test "print g_vA" ".* = \{va = 1, vx = 2\}" "print g_vA"
-
- # Print all members of g_vB.
-
- setup_xfail_format "DWARF 1"
- send_gdb "print g_vB\n"
- gdb_expect {
- -re ".* = \{\<class vA\> = \{va = 3, vx = 4\}, vb = 5, vx = 6, Virtual table at $hex\}\r\n$gdb_prompt $" {
- pass "print g_vB"
- }
- -re ".*invalid address 0x0.*$gdb_prompt $" {
- # Does not happen with gcc cygnus-2.4.5-930828
- fail "print g_vB (known bug with gcc cygnus-2.4.5-930417)"
- # Many of the rest of these tests have the same problem.
- return 0
- }
- -re ".*$gdb_prompt $" { fail "print g_vB" }
- timeout { fail "print g_vB (timeout)" ; return }
- }
-
- # Print all members of g_vC.
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_vC" ".* = \{\<class vA\> = \{va = 7, vx = 8\}, vc = 9, vx = 10, Virtual table at $hex\}" "print g_vC"
-}
-
-#
-# Multiple virtual inheritance, print individual members.
-#
-
-proc test_print_mvi_members {} {
- global gdb_prompt
- global decimal
-
- # Print all members of g_vD.
-
- setup_xfail_format "DWARF 1"
- send_gdb "print g_vD.vA::va\n"
- gdb_expect {
- -re ".* = 19\r\n$gdb_prompt $" { pass "print g_vD.vA::va" }
- -re ".*virtual baseclass botch.*$gdb_prompt $" {
- # Does not happen with gcc cygnus-2.4.5-930828
- fail "print g_vD.vA::va (known bug with gcc cygnus-2.4.5-930417)"
- # Many of the rest of these tests have the same problem.
- return 0
- }
- -re ".*$gdb_prompt $" { fail "print g_vD.vA::va" }
- timeout { fail "print g_vD.vA::va (timeout)" ; return }
- }
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_vD.vA::vx" ".* = 20" "print g_vD.vA::vx"
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_vD.vB::vb" ".* = 21" "print g_vD.vB::vb"
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_vD.vB::vx" ".* = 22" "print g_vD.vB::vx"
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_vD.vC::vc" ".* = 23" "print g_vD.vC::vc"
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_vD.vC::vx" ".* = 24" "print g_vD.vC::vx"
-
- gdb_test "print g_vD.vD::vd" ".* = 25" "print g_vD.vD::vd"
-
- gdb_test "print g_vD.vD::vx" ".* = 26" "print g_vD.vD::vx"
-
- # Print all members of g_vE.
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_vE.vA::va" ".* = 0" "print g_vE.vA::va"
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_vE.vA::vx" ".* = 0" "print g_vE.vA::vx"
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_vE.vB::vb" ".* = 0" "print g_vE.vB::vb"
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_vE.vB::vx" ".* = 0" "print g_vE.vB::vx"
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_vE.vC::vc" ".* = 0" "print g_vE.vC::vc"
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_vE.vC::vx" ".* = 0" "print g_vE.vC::vx"
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_vE.vD::vd" ".* = 0" "print g_vE.vD::vd"
-
- gdb_test "print g_vE.vD::vx" ".* = 0" "print g_vE.vD::vx"
-
- gdb_test "print g_vE.vE::ve" ".* = 27" "print g_vE.vE::ve"
-
- gdb_test "print g_vE.vE::vx" ".* = 28" "print g_vE.vE::vx"
-}
-
-#
-# Multiple virtual inheritance, print type definitions.
-#
-
-proc test_ptype_mvi {} {
- setup_xfail_format "DWARF 1"
- gdb_test "ptype vD" "type = class vD : public virtual vB, public virtual vC \{\r\n\[ \]*public:\r\n\[ \]*int vd;\r\n\[ \]*int vx;\r\n.*\}" "ptype vD (aCC)"
-
- setup_xfail_format "DWARF 1"
- gdb_test "ptype class vD" "type = class vD : public virtual vB, public virtual vC \{\r\n\[ \]*public:\r\n\[ \]*int vd;\r\n\[ \]*int vx;\r\n.*\}" "ptype class vD (aCC)"
-
- setup_xfail_format "DWARF 1"
- gdb_test "ptype g_vD" "type = class vD : public virtual vB, public virtual vC \{\r\n\[ \]*public:\r\n\[ \]*int vd;\r\n\[ \]*int vx;\r\n.*\}" "ptype g_vD (aCC)"
-
- setup_xfail_format "DWARF 1"
- gdb_test "ptype vE" "type = class vE : public virtual vD \{\r\n\[ \]*public:\r\n\[ \]*int ve;\r\n\[ \]*int vx;\r\n.*\}" "ptype vE (aCC)"
-
- setup_xfail_format "DWARF 1"
- gdb_test "ptype class vE" "type = class vE : public virtual vD \{\r\n\[ \]*public:\r\n\[ \]*int ve;\r\n\[ \]*int vx;\r\n.*\}" "ptype class vE (aCC)"
-
- setup_xfail_format "DWARF 1"
- gdb_test "ptype g_vE" "type = class vE : public virtual vD \{\r\n\[ \]*public:\r\n\[ \]*int ve;\r\n\[ \]*int vx;\r\n.*\}" "ptype g_vE (aCC)"
-}
-
-#
-# Multiple virtual inheritance, print complete classes.
-#
-
-proc test_print_mvi_classes {} {
- global gdb_prompt
- global hex
- global decimal
-
- # Print all members of g_vD.
-
- 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\}\r\n$gdb_prompt $" {
- pass "print g_vD"
- }
- -re ".*invalid address 0x0.*$gdb_prompt $" {
- # Does not happen with gcc cygnus-2.4.5-930828
- fail "print g_vD (known bug with gcc cygnus-2.4.5-930417)"
- # Many of the rest of these tests have the same problem.
- return 0
- }
- -re ".*$gdb_prompt $" { fail "print g_vD" }
- timeout { fail "print g_vD (timeout)" ; return }
- }
-
- # Print all members of g_vE.
-
- setup_xfail_format "DWARF 1"
- gdb_test "print g_vE" ".* = \{\<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\}" "print g_vE"
-}
-
-proc do_tests {} {
- global prms_id
- global bug_id
- global subdir
- global objdir
- global srcdir
- global binfile
-
- set prms_id 0
- set bug_id 0
-
- # Start with a fresh gdb.
-
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load $binfile
-
- gdb_test "set language c++" ""
- gdb_test "set width 0" ""
-
- # Get the debug format for the compiled test case.
-
- if { ![ runto_main] } {
- gdb_suppress_tests;
- } else {
- get_debug_format
- }
-
- test_ptype_si
- test_ptype_mi
- test_ptype_vi
- test_ptype_mvi
-
- gdb_stop_suppressing_tests;
-
- if { ![ runto 'inheritance2(void)' ] } {
- gdb_suppress_tests;
- }
-
- test_print_si_members
- test_print_si_classes
- test_print_mi_members
- test_print_mi_classes
- test_print_anon_union
-
- gdb_stop_suppressing_tests;
-
- if { ![ runto 'inheritance4(void)' ] } {
- gdb_suppress_tests;
- }
-
- test_print_svi_members
- test_print_svi_classes
- test_print_mvi_members
- test_print_mvi_classes
-}
-
-do_tests