-# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
-# Free Software Foundation, Inc.
+# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003 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
# Accept it as an expected failure if gdb just fails to distinguish between
# class and struct, and everything else is OK.
- setup_xfail_format "DWARF 1"
send_gdb "ptype struct protected_struct\n"
gdb_expect {
-re "type = struct protected_struct \{${ws}protected:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
# Accept it as an expected failure if gdb just fails to distinguish between
# class and struct, and everything else is OK.
- setup_xfail_format "DWARF 1"
send_gdb "ptype struct private_struct\n"
gdb_expect {
-re "type = struct private_struct \{${ws}private:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
# Accept it as an expected failure if gdb just fails to distinguish between
# class and struct, and everything else is OK.
- setup_xfail_format "DWARF 1"
send_gdb "ptype struct mixed_protection_struct\n"
gdb_expect {
-re "type = struct mixed_protection_struct \{${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;$nl\}$nl$gdb_prompt $" {
# structs (where we don't print the "public:" attribute) we don't print
# the "private:" attribute.
- setup_xfail_format "DWARF 1"
send_gdb "ptype class default_private_class\n"
gdb_expect {
-re "type = class default_private_class \{${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
}
}
- setup_xfail_format "DWARF 1"
send_gdb "ptype class B\n"
gdb_expect {
-re "type = class B : public A \{${ws}public:${ws}int b;${ws}int x;${ws}B & operator=\\(B const ?&\\);${ws}B\\((B const|const B) ?&\\);${ws}B\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
}
}
- setup_xfail_format "DWARF 1"
send_gdb "ptype class C\n"
gdb_expect {
-re "type = class C : public A \{${ws}public:${ws}int c;${ws}int x;${ws}C & operator=\\(C const ?&\\);${ws}C\\((C const|const C) ?&\\);${ws}C\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
}
}
- setup_xfail_format "DWARF 1"
send_gdb "ptype class D\n"
gdb_expect {
-re "type = class D : public B, public C \{${ws}public:${ws}int d;${ws}int x;${ws}D & operator=\\(D const ?&\\);${ws}D\\((D const|const D) ?&\\);${ws}D\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
}
}
- setup_xfail_format "DWARF 1"
send_gdb "ptype class E\n"
gdb_expect {
-re "type = class E : public D \{${ws}public:${ws}int e;${ws}int x;${ws}E & operator=\\(E const ?&\\);${ws}E\\((E const|const E) ?&\\);${ws}E\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
# The format of a g++ virtual base pointer.
set vbptr "(_vb\[$.\]|__vb_)\[0-9\]?"
- setup_xfail_format "DWARF 1"
send_gdb "ptype class vB\n"
gdb_expect {
-re "type = class vB : public virtual vA \{${ws}public:${ws}int vb;${ws}int vx;${ws}vB & operator=\\(vB const ?&\\);${ws}vB\\((vB const|const vB) ?&\\);${ws}vB\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
# for now, but with a FIXME. At some future point, gdb should use a
# portable representation for the virtual table constructs.
- setup_xfail_format "DWARF 1"
send_gdb "ptype class vC\n"
gdb_expect {
-re "type = class vC : public virtual vA \{${ws}public:${ws}int vc;${ws}int vx;${ws}vC & operator=\\(vC const ?&\\);${ws}vC\\((vC const|const vC) ?&\\);${ws}vC\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
# for now, but with a FIXME. At some future point, gdb should use a
# portable representation for the virtual table constructs.
- setup_xfail_format "DWARF 1"
send_gdb "ptype class vD\n"
gdb_expect {
-re "type = class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;${ws}vD & operator=\\(vD const ?&\\);${ws}vD\\((vD const|const vD) ?&\\);${ws}vD\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
# for now, but with a FIXME. At some future point, gdb should use a
# portable representation for the virtual table constructs.
- setup_xfail_format "DWARF 1"
send_gdb "ptype class vE\n"
gdb_expect {
-re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;${ws}vE & operator=\\(vE const ?&\\);${ws}vE\\((vE const|const vE) ?&\\);${ws}vE\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
}
}
- setup_xfail_format "DWARF 1"
send_gdb "ptype class Base1\n"
gdb_expect {
-re "type = class Base1 \{${ws}public:${ws}int x;${ws}Base1 & operator=\\(Base1 const ?&\\);${ws}Base1\\(((Base1 const)|(const Base1)) ?&\\);${ws}Base1\\(int\\);${ws}\}$nl$gdb_prompt $" {
}
}
- 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 $" {
}
}
- setup_xfail_format "DWARF 1"
send_gdb "ptype class Bar\n"
gdb_expect {
-re "type = class Bar : public Base1, public Foo \{${ws}public:${ws}int z;${ws}Bar & operator=\\(Bar const ?&\\);${ws}Bar\\((Bar const|const Bar) ?&\\);${ws}Bar\\(int, int, int\\);${ws}\}$nl$gdb_prompt $" {
}
clear_xfail "*-*-*"
- setup_xfail_format "DWARF 1"
gdb_test "print (int)pmi == sizeof(int)" ".* = false" "print (int)pmi == sizeof(int)"
}
"print cnsi without static members"
gdb_test "set print static-members on" ""
- setup_xfail_format "DWARF 1"
gdb_test "print csi" \
"{x = 10, y = 20, static null = {x = 0, y = 0, static null = <same as static member of an already seen type>}}" \
"print csi with static members"
- setup_xfail_format "DWARF 1"
gdb_test "print cnsi" \
"{x = 30, y = 40, static null = {x = 0, y = 0, static null = <same as static member of an already seen type>, static yy = {z = 5, static xx = {x = 1, y = 2, static null = <same as static member of an already seen type>, static yy = <same as static member of an already seen type>}}}, static yy = <same as static member of an already seen type>}" \
"print cnsi with static members"
send_gdb "set width 0\n"
gdb_expect -re "$gdb_prompt $"
- # Get the debug format for the compiled test case.
-
- if [ runto_main ] then {
- get_debug_format
- }
-
+ runto_main
test_ptype_class_objects
if [ runto 'inheritance2' ] then {
# 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"
# 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"
# Print class B as a type.
- setup_xfail_format "DWARF 1"
gdb_test "ptype B" "type = class B : public A \{$nl\[ \]*public:$nl\[ \]*int b;$nl\[ \]*int x;$nl.*\}" "ptype B"
# Print class B as an explicit class.
- setup_xfail_format "DWARF 1"
gdb_test "ptype class B" "type = class B : public A \{$nl\[ \]*public:$nl\[ \]*int b;$nl\[ \]*int x;$nl.*\}" "ptype class B"
# Print type of an object of type B.
- setup_xfail_format "DWARF 1"
gdb_test "ptype g_B" "type = class B : public A \{$nl\[ \]*public:$nl\[ \]*int b;$nl\[ \]*int x;$nl.*\}" "ptype g_B"
# Print class C as a type.
- setup_xfail_format "DWARF 1"
gdb_test "ptype C" "type = class C : public A \{$nl\[ \]*public:$nl\[ \]*int c;$nl\[ \]*int x;$nl.*\}" "ptype C"
# Print class C as an explicit class.
- setup_xfail_format "DWARF 1"
gdb_test "ptype class C" "type = class C : public A \{$nl\[ \]*public:$nl\[ \]*int c;$nl\[ \]*int x;$nl.*\}" "ptype class C"
# Print type of an object of type g_C.
- setup_xfail_format "DWARF 1"
gdb_test "ptype g_C" "type = class C : public A \{$nl\[ \]*public:$nl\[ \]*int c;$nl\[ \]*int x;$nl.*\}" "ptype g_C"
# gcc cygnus-2.3.3 (Q1) has this bug, but it was fixed as of
# 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"
}
global ws
global nl
- setup_xfail_format "DWARF 1"
gdb_test "print g_anon_union.a" ".* = 2" "print anonymous union member"
- setup_xfail_format "DWARF 1"
send_gdb "print g_anon_union\n"
gdb_expect {
-re ".* = \{one = 1, ( = |)\{a = 2, b = 2\}\}$nl$gdb_prompt $" {
fail "print variableof type anonymous union (timeout)"
}
}
- setup_xfail_format "DWARF 1"
send_gdb "ptype g_anon_union\n"
gdb_expect {
-re "type = class class_with_anon_union \{${ws}public:${ws}int one;${ws}union \{${ws}public:${ws}int a;${ws}long int b;${ws}union \{\.\.\.\} & operator=\\(union \{\.\.\.\} &\\);${ws}\\\$_0 \\(union \{\.\.\.\} &\\);${ws}\\\$_0 \\(\\);${ws}\};${ws}class_with_anon_union & operator=\\(class_with_anon_union const &\\);${ws}class_with_anon_union\\(class_with_anon_union const &\\);${ws}class_with_anon_union\\(void\\);${ws}\}$nl$gdb_prompt $" {
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_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"
proc test_ptype_mi {} {
global nl
- setup_xfail_format "DWARF 1"
gdb_test "ptype D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype D"
- setup_xfail_format "DWARF 1"
gdb_test "ptype class D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype class D"
- setup_xfail_format "DWARF 1"
gdb_test "ptype g_D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype g_D"
- setup_xfail_format "DWARF 1"
gdb_test "ptype E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype E"
- setup_xfail_format "DWARF 1"
gdb_test "ptype class E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype class E"
- setup_xfail_format "DWARF 1"
gdb_test "ptype g_E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype g_E"
}
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"
}
# Print all members of g_vB.
- setup_xfail_format "DWARF 1"
send_gdb "print g_vB.vA::va\n"
gdb_expect {
-re ".* = 3$nl$gdb_prompt $" { pass "print g_vB.vA::va" }
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"
# 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"
# 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"
# 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"
timeout { fail "ptype g_vA (timeout)" ; return }
}
- setup_xfail_format "DWARF 1"
send_gdb "ptype vB\n"
gdb_expect {
-re "ptype vB${nl}type = class vB : public virtual vA \{$nl private:${ws}vA \\*${vbptr}vA;$nl public:${ws}int vb;${ws}int vx;$nl.*\}$nl$gdb_prompt $" {
timeout { fail "ptype vB (timeout)" }
}
- setup_xfail_format "DWARF 1"
send_gdb "ptype class vB\n"
gdb_expect {
-re "type = class vB : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
timeout { fail "ptype class vB (timeout)" }
}
- setup_xfail_format "DWARF 1"
send_gdb "ptype g_vB\n"
gdb_expect {
-re "type = class vB : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
timeout { fail "ptype g_vB (timeout)" }
}
- setup_xfail_format "DWARF 1"
send_gdb "ptype vC\n"
gdb_expect {
-re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
timeout { fail "ptype vC (timeout)" }
}
- setup_xfail_format "DWARF 1"
send_gdb "ptype class vC\n"
gdb_expect {
-re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
timeout { fail "ptype class vC (timeout)" }
}
- setup_xfail_format "DWARF 1"
send_gdb "ptype g_vC\n"
gdb_expect {
-re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
# 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\}$nl$gdb_prompt $" {
# Print all members of g_vC.
- setup_xfail_format "DWARF 1"
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 $" {
# Print all members of g_vD.
- setup_xfail_format "DWARF 1"
send_gdb "print g_vD.vA::va\n"
gdb_expect {
-re ".* = 19$nl$gdb_prompt $" { pass "print g_vD.vA::va" }
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"
# 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"
global nl
global vbptr
- setup_xfail_format "DWARF 1"
send_gdb "ptype vD\n"
gdb_expect {
-re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \\*${vbptr}vC;${ws}vB \\*${vbptr}vB;${ws}public:${ws}int vd;${ws}int vx;$nl.*\}.*$gdb_prompt $" {
timeout { fail "(timeout) ptype vD" }
}
- setup_xfail_format "DWARF 1"
send_gdb "ptype class vD\n"
gdb_expect {
-re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \\*${vbptr}vC;${ws}vB \\*${vbptr}vB;${ws}public:${ws}int vd;${ws}int vx;$nl.*\}.*$gdb_prompt $" {
timeout { fail "(timeout) ptype class vD" }
}
- setup_xfail_format "DWARF 1"
send_gdb "ptype g_vD\n"
gdb_expect {
-re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \\*${vbptr}vC;${ws}vB \\*${vbptr}vB;${ws}public:${ws}int vd;${ws}int vx;$nl.*\}.*$gdb_prompt $" {
timeout { fail "(timeout) ptype g_vD" }
}
- setup_xfail_format "DWARF 1"
send_gdb "ptype vE\n"
gdb_expect {
-re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*${vbptr}vD;${ws}public:${ws}int ve;${ws}int vx;$nl.*\}.*$gdb_prompt $" {
timeout { fail "(timeout) ptype vE" }
}
- setup_xfail_format "DWARF 1"
send_gdb "ptype class vE\n"
gdb_expect {
-re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*${vbptr}vD;${ws}public:${ws}int ve;${ws}int vx;$nl.*\}.*$gdb_prompt $" {
timeout { fail "(timeout) ptype class vE" }
}
- setup_xfail_format "DWARF 1"
send_gdb "ptype g_vE\n"
gdb_expect {
-re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*${vbptr}vD;${ws}public:${ws}int ve;${ws}int vx;$nl.*\}.*$gdb_prompt $" {
# 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\}$nl$gdb_prompt $" {
# Print all members of g_vE.
- setup_xfail_format "DWARF 1"
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 $" {