From: Michael Chastain Date: Fri, 2 Jan 2004 04:46:45 +0000 (+0000) Subject: 2004-01-01 Michael Chastain X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=184ad4855fc2a50df9af4ff22995c167ef98c842;p=binutils-gdb.git 2004-01-01 Michael Chastain * gdb.cp/classes.exp: Generate identical results as old version. * gdb.cp/derivation.exp: Likewise. * gdb.cp/overload.exp: Likewise. * gdb.cp/virtfunc.exp: Likewise. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 3e9515171f9..b924494e822 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2004-01-01 Michael Chastain + + * gdb.cp/classes.exp: Generate identical results as old version. + * gdb.cp/derivation.exp: Likewise. + * gdb.cp/overload.exp: Likewise. + * gdb.cp/virtfunc.exp: Likewise. + 2004-01-01 Michael Chastain * gdb.cp/virtfunc.exp: Modify some patterns to avoid a diff --git a/gdb/testsuite/gdb.cp/classes.exp b/gdb/testsuite/gdb.cp/classes.exp index 16f83c6c4a2..20ab8cd304d 100644 --- a/gdb/testsuite/gdb.cp/classes.exp +++ b/gdb/testsuite/gdb.cp/classes.exp @@ -1,5 +1,5 @@ # Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003 Free Software Foundation, Inc. +# 2003, 2004 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 @@ -264,7 +264,8 @@ proc test_ptype_class_objects {} { # gcc 2.95.3 -gdwarf-2 # gcc 3.3.2 -gdwarf-2 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2 - pass "ptype class B" + # TODO: this is not obsolescent! + pass "ptype class B (obsolescent gcc or gdb)" } -re "type = class B : public A \{${ws}public:${ws}int b;${ws}int x;${ws}B ?& ?operator ?=\\(B const ?&\\);${ws}B\\(B const ?&\\);${ws}B\\((void|)\\);$nl\}$nl$gdb_prompt $" { # gcc 2.95.3 -gstabs+ @@ -281,7 +282,8 @@ proc test_ptype_class_objects {} { # gcc 2.95.3 -gdwarf-2 # gcc 3.3.2 -gdwarf-2 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2 - pass "ptype class C" + # TODO: this is not obsolescent! + pass "ptype class C (obsolescent gcc or gdb)" } -re "type = class C : public A \{${ws}public:${ws}int c;${ws}int x;${ws}C ?& ?operator ?=\\(C const ?&\\);${ws}C\\(C const ?&\\);${ws}C\\((void|)\\);$nl\}$nl$gdb_prompt $" { # gcc 2.95.3 -gstabs+ @@ -298,7 +300,8 @@ proc test_ptype_class_objects {} { # gcc 2.95.3 -gdwarf-2 # gcc 3.3.2 -gdwarf-2 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2 - pass "ptype class D" + # TODO: this is not obsolescent! + pass "ptype class D (obsolescent gcc or gdb)" } -re "type = class D : public B, public C \{${ws}public:${ws}int d;${ws}int x;${ws}D ?& ?operator ?=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\((void|)\\);$nl\}$nl$gdb_prompt $" { # gcc 2.95.3 -gstabs+ @@ -344,7 +347,8 @@ proc test_ptype_class_objects {} { } -re "type = class Static \{${ws}public:${ws}static void ii\\(int, int\\);${ws}Static ?& ?operator ?=\\(Static const ?&\\);${ws}Static\\(Static const ?&\\);${ws}Static\\((void|)\\);$nl\}$nl$gdb_prompt $" { # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+ - pass "ptype class Static" + # TODO: this is okay. It is just ABI 2. + fail "ptype class Static" } } @@ -365,14 +369,15 @@ proc test_ptype_class_objects {} { } } - # Accept the virtual base pointer if gdb wants to print it. - # Those cases will go away when gcc 2 dies. + # With gcc 2, gdb prints the virtual base pointer. # With gcc 3, gdb does not print the virtual base pointer. + # drow considers it a gdb bug if gdb prints the vbptr. gdb_test_multiple "ptype class vB" "ptype class vB" { -re "type = class vB : public virtual vA \{${ws}private:${ws}vA ?\\* ?_vb.2vA;${ws}public:${ws}int vb;${ws}int vx;$nl\}$nl$gdb_prompt $" { # gcc 2.95.3 -gdwarf-2 - pass "ptype class vB" + # TODO: kfail this + fail "ptype class vB" } -re "type = class vB : public virtual vA \{${ws}public:${ws}int vb;${ws}int vx;$nl\}$nl$gdb_prompt $" { # gcc 3.3.2 -gdwarf-2 @@ -382,7 +387,9 @@ proc test_ptype_class_objects {} { -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\\);$nl\}$nl$gdb_prompt $" { # gcc 2.95.3 -gstabs+ # See the hidden "in-charge" ctor parameter! - pass "ptype class vB" + # TODO: kfail this + 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}vB ?& ?operator ?=\\(vB const ?&\\);${ws}vB\\(vB const ?&\\);${ws}vB\\((void|)\\);$nl\}$nl$gdb_prompt $" { # gcc 3.3.2 -gstabs+ @@ -396,7 +403,8 @@ proc test_ptype_class_objects {} { gdb_test_multiple "ptype class vC" "ptype class vC" { -re "type = class vC : public virtual vA \{${ws}private:${ws}vA ?\\* ?_vb.2vA;${ws}public:${ws}int vc;${ws}int vx;$nl\}$nl$gdb_prompt $" { # gcc 2.95.3 -gdwarf-2 - pass "ptype class vC" + # TODO: kfail + fail "ptype class vC" } -re "type = class vC : public virtual vA \{${ws}public:${ws}int vc;${ws}int vx;$nl\}$nl$gdb_prompt $" { # gcc 3.3.2 -gdwarf-2 @@ -406,7 +414,9 @@ proc test_ptype_class_objects {} { -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\\);$nl\}$nl$gdb_prompt $" { # gcc 2.95.3 -gstabs+ # See the hidden "in-charge" ctor parameter! - pass "ptype class vC" + # TODO: kfail + 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}vC ?& ?operator ?=\\(vC const ?&\\);${ws}vC\\(vC const ?&\\);${ws}vC\\((void|)\\);$nl\}$nl$gdb_prompt $" { # gcc 3.3.2 -gstabs+ @@ -420,7 +430,8 @@ proc test_ptype_class_objects {} { gdb_test_multiple "ptype class vD" "ptype class vD" { -re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC ?\\* ?_vb.2vC;${ws}vB ?\\* ?_vb.2vB;${ws}public:${ws}int vd;${ws}int vx;$nl\}$nl$gdb_prompt $" { # gcc 2.95.3 -gdwarf-2 - pass "ptype class vD" + # TODO: kfail + fail "ptype class vD" } -re "type = class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;$nl\}$nl$gdb_prompt $" { # gcc 3.3.2 -gdwarf-2 @@ -430,7 +441,9 @@ proc test_ptype_class_objects {} { -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\\);$nl\}$nl$gdb_prompt $" { # gcc 2.95.3 -gstabs+ # See the hidden "in-charge" ctor parameter! - pass "ptype class vD" + # TODO: kfail + 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}vD ?& ?operator ?=\\(vD const ?&\\);${ws}vD\\(vD const ?&\\);${ws}vD\\((void|)\\);$nl\}$nl$gdb_prompt $" { # gcc 3.3.2 -gstabs+ @@ -444,7 +457,8 @@ proc test_ptype_class_objects {} { gdb_test_multiple "ptype class vE" "ptype class vE" { -re "type = class vE : public virtual vD \{${ws}private:${ws}vD ?\\* ?_vb.2vD;${ws}public:${ws}int ve;${ws}int vx;$nl\}$nl$gdb_prompt $" { # gcc 2.95.3 -gdwarf-2 - pass "ptype class vE" + # TODO: kfail + fail "ptype class vE" } -re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;$nl\}$nl$gdb_prompt $" { # gcc 3.3.2 -gdwarf-2 @@ -454,7 +468,9 @@ proc test_ptype_class_objects {} { -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\\);$nl\}$nl$gdb_prompt $" { # gcc 2.95.3 -gstabs+ # See the hidden "in-charge" ctor parameter! - pass "ptype class vE" + # TODO: kfail + 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}vE ?& ?operator ?=\\(vE const ?&\\);${ws}vE\\(vE const ?&\\);${ws}vE\\((void|)\\);$nl\}$nl$gdb_prompt $" { # gcc 3.3.2 -gstabs+ @@ -479,7 +495,8 @@ proc test_ptype_class_objects {} { } -re "type = class Base1 \{${ws}public:${ws}int x;${ws}Base1\\(int\\);${ws}Base1 ?& ?operator ?=\\(Base1 const ?&\\);${ws}Base1\\(Base1 const ?&\\);$nl\}$nl$gdb_prompt $" { # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+ - pass "ptype class Base1" + # TODO: this is not obsolescent! + pass "ptype class Base1 (obsolescent gcc or gdb)" } } @@ -494,8 +511,10 @@ proc test_ptype_class_objects {} { } -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\\);$nl\}$nl$gdb_prompt $" { # gcc 2.95.3 -gstabs+ - # "int operator int()" is a bug - kfail "gdb/1497" "ptype class Foo" + # TODO: "int operator int()" is a bug + # TODO: this is not obsolescent! + # kfail "gdb/1497" "ptype class Foo" + pass "ptype class Foo (obsolescent gcc or gdb)" } -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}operator int\\((void|)\\);${ws}int times\\(int\\);$nl\}$nl$gdb_prompt $" { # gcc 3.3.2 -gstabs+ @@ -503,7 +522,8 @@ proc test_ptype_class_objects {} { } -re "type = class Foo \{${ws}public:${ws}int x;${ws}int y;${ws}static int st;${ws}Foo\\(int, int\\);${ws}int operator ?!\\((void|)\\);${ws}operator int\\((void|)\\);${ws}int times\\(int\\);${ws}Foo ?& ?operator ?=\\(Foo const ?&\\);${ws}Foo\\(Foo const ?&\\);$nl\}$nl$gdb_prompt $" { # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+ - pass "ptype class Foo" + # TODO: this is okay, just the new ABI + fail "ptype class Foo" } } @@ -514,7 +534,8 @@ proc test_ptype_class_objects {} { # gcc 2.95.3 -gdwarf-2 # gcc 3.3.2 -gdwarf-2 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2 - pass "ptype class Bar" + # TODO: this is not obsolescent! + pass "ptype class Bar (obsolescent gcc or gdb)" } -re "type = class Bar : public Base1, public Foo \{${ws}public:${ws}int z;${ws}Bar ?& ?operator ?=\\(Bar const ?&\\);${ws}Bar\\(Bar const ?&\\);${ws}Bar\\(int, int, int\\);$nl\}$nl$gdb_prompt $" { # gcc 2.95.3 -gstabs+ @@ -523,7 +544,8 @@ proc test_ptype_class_objects {} { } -re "type = class Bar : public Base1, public Foo \{${ws}public:${ws}int z;${ws}Bar\\(int, int, int\\);${ws}Bar ?& ?operator ?=\\(Bar const ?&\\);${ws}Bar\\(Bar const ?&\\);$nl\}$nl$gdb_prompt $" { # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+ - pass "ptype class Bar" + # TODO: this is not obsolescent! + pass "ptype class Bar (obsolescent gcc or gdb)" } } } @@ -693,7 +715,7 @@ proc test_enums {} { # # gcc 3.3.2 -gstabs+ # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+ - pass "ptype obj_with_enum" + fail "ptype obj_with_enum" } } @@ -736,6 +758,13 @@ proc test_pointers_to_class_members {} { gdb_test "print &Foo::x" "\\$\[0-9\]+ = \\(int ?\\( ?Foo::\\* ?\\) ?\\) ?&Foo::x" gdb_test "print (int)&Foo::x" "\\$\[0-9\]+ = 0" gdb_test "print (int)&Bar::y == 2*sizeof(int)" "\\$\[0-9\]+ = true" + + # TODO: this is a bogus test. It's looking at a variable that + # has not even been declared yet, so it's accessing random junk + # on the stack and comparing that it's NOT equal to a specific + # value. It's been like this since gdb 4.10 in 1993! + # -- chastain 2004-01-01 + gdb_test "print (int)pmi == sizeof(int)" ".* = false" } # Test static members. @@ -745,7 +774,7 @@ proc test_static_members {} { global hex gdb_test "print Foo::st" "\\$\[0-9\]+ = 100" - gdb_test "set foo.st = 200" "" + gdb_test "set foo.st = 200" "" "" gdb_test "print bar.st" "\\$\[0-9\]+ = 200" gdb_test "print &foo.st" "\\$\[0-9\]+ = \\(int ?\\*\\) $hex" gdb_test "print &Bar::st" "\\$\[0-9\]+ = \\(int ?\\*\\) $hex" @@ -796,9 +825,6 @@ proc do_tests {} { return } - test_pointers_to_class_members - test_static_members - gdb_breakpoint inheritance2 gdb_test "continue" ".*Breakpoint .* inheritance2.*" "" @@ -809,10 +835,14 @@ proc do_tests {} { test_method_param_class gdb_breakpoint enums2 - gdb_test "continue" ".*Breakpoint .* enums2.*" "" + gdb_test "continue" ".*Breakpoint .* enums2.*" "continue to enums2(\\(\\)|)" gdb_test "finish" "" "" test_enums + gdb_test "finish" "" "" + test_pointers_to_class_members + test_static_members + # Now some random tests that were just thrown in here. gdb_breakpoint marker_reg1 @@ -847,6 +877,11 @@ proc do_tests {} { fail "calling method for small class" } } + + # This is a random v2 demangling test. + # This is redundant with existing tests in demangle.exp. + # TODO: Just remove this. + gdb_test "maint demangle inheritance1__Fv" "inheritance1\\(void\\)" "demangle" } do_tests diff --git a/gdb/testsuite/gdb.cp/derivation.exp b/gdb/testsuite/gdb.cp/derivation.exp index 984219e1c64..0dec65b7874 100644 --- a/gdb/testsuite/gdb.cp/derivation.exp +++ b/gdb/testsuite/gdb.cp/derivation.exp @@ -74,59 +74,90 @@ set re_methods "A\\((void|)\\);${ws}int afoo\\((void|)\\);${ws}int foo\\((void| set re_synth_gcc_23 "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);" set re_all_methods "($re_methods|$re_methods${ws}$re_synth_gcc_23|$re_synth_gcc_23${ws}$re_methods)" +gdb_test "print a_instance" "\\$\[0-9\]+ = \{a = 1, aa = 2\}" "print value of a_instance" + gdb_test_multiple "ptype a_instance" "ptype a_instance" { - -re "type = $re_class${ws}$re_fields${ws}$re_all_methods$nl\}$nl$gdb_prompt $" { - pass "ptype a_instance" + -re "type = $re_class${ws}$re_fields${ws}$re_methods$nl\}$nl$gdb_prompt $" { + pass "ptype a_instance (no synth ops)" + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23${ws}$re_methods${ws}$nl\}$nl$gdb_prompt $" { + pass "ptype a_instance (with synth ops)" + } + -re "type = $re_class${ws}$re_fields${ws}$re_methods${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + # TODO: this is fine, it's just gcc abi 2 + # pass "ptype a_instance (with synth ops) (abi 2)" + fail "ptype a_instance" } } -gdb_test "print a_instance" "\\$\[0-9\]+ = \{a = 1, aa = 2\}" "print value of a_instance" - # class D set re_class "class D : private A, public B, protected C \{${ws}public:" -set re_class_BAD "class D : private A, public B, private C \{${ws}public:" +set XX_class "class D : private A, public B, private C \{${ws}public:" set re_fields "int d;${ws}int dd;" set re_methods "D\\((void|)\\);${ws}int dfoo\\((void|)\\);${ws}int foo\\((void|)\\);" set re_synth_gcc_23 "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);" set re_all_methods "($re_methods|$re_methods${ws}$re_synth_gcc_23|$re_synth_gcc_23${ws}$re_methods)" +gdb_test_multiple "print d_instance" "print value of d_instance" { + -re "\\$\[0-9\]+ = \{<(class A|A)> = \{a = 1, aa = 2\}, <(class B|B)> = \{b = 3, bb = 4\}, <(class C|C)> = \{c = 5, cc = 6\}, d = 7, dd = 8\}$nl$gdb_prompt $" { + pass "print value of d_instance" + } +} + gdb_test_multiple "ptype d_instance" "ptype d_instance" { + -re "type = $re_class${ws}$re_fields${ws}$re_methods${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + # TODO: this is okay, gcc abi 2. + fail "ptype d_instance" + } -re "type = $re_class${ws}$re_fields${ws}$re_all_methods$nl\}$nl$gdb_prompt $" { pass "ptype d_instance" } - -re "type = $re_class_BAD${ws}$re_fields${ws}$re_all_methods$nl\}$nl$gdb_prompt $" { - kfail "gdb/1498" "ptype d_instance" + -re "type = $XX_class${ws}$re_fields${ws}$re_methods${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + # TODO: this is okay, gcc abi 2. + # kfail "gdb/1498" "ptype d_instance" + fail "ptype d_instance" } -} - -gdb_test_multiple "print d_instance" "print value of d_instance" { - -re "\\$\[0-9\]+ = \{<(class A|A)> = \{a = 1, aa = 2\}, <(class B|B)> = \{b = 3, bb = 4\}, <(class C|C)> = \{c = 5, cc = 6\}, d = 7, dd = 8\}$nl$gdb_prompt $" { - pass "print value of d_instance" + -re "type = $XX_class${ws}$re_fields${ws}$re_all_methods$nl\}$nl$gdb_prompt $" { + # TODO: this is a gcc bug. + # kfail "gdb/1498" "ptype d_instance" + pass "ptype d_instance" } } # class E set re_class "class E : public A, private B, protected C \{${ws}public:" -set re_class_BAD "class E : public A, private B, private C \{${ws}public:" +set XX_class "class E : public A, private B, private C \{${ws}public:" set re_fields "int e;${ws}int ee;" set re_methods "E\\((void|)\\);${ws}int efoo\\((void|)\\);${ws}int foo\\((void|)\\);" set re_synth_gcc_23 "E & operator=\\(E const ?&\\);${ws}E\\(E const ?&\\);" set re_all_methods "($re_methods|$re_methods${ws}$re_synth_gcc_23|$re_synth_gcc_23${ws}$re_methods)" +gdb_test_multiple "print e_instance" "print value of e_instance" { + -re "\\$\[0-9\]+ = \{<(class A|A)> = \{a = 1, aa = 2\}, <(class B|B)> = \{b = 3, bb = 4\}, <(class C|C)> = \{c = 5, cc = 6\}, e = 9, ee = 10\}$nl$gdb_prompt $" { + pass "print value of e_instance" + } +} + gdb_test_multiple "ptype e_instance" "ptype e_instance" { + -re "type = $re_class${ws}$re_fields${ws}$re_methods${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + # TODO: this is okay, just gcc abi 2 + fail "ptype e_instance" + } -re "type = $re_class${ws}$re_fields${ws}$re_all_methods$nl\}$nl$gdb_prompt $" { pass "ptype e_instance" } - -re "type = $re_class_BAD${ws}$re_fields${ws}$re_all_methods$nl\}$nl$gdb_prompt $" { - kfail "gdb/1498" "ptype e_instance" + -re "type = $XX_class${ws}$re_fields${ws}$re_methods${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + # TODO: this is okay, just gcc abi 2 + # TODO: this is a gcc bug. + # kfail "gdb/1498" "ptype e_instance" + fail "ptype e_instance" } -} - -gdb_test_multiple "print e_instance" "print value of e_instance" { - -re "\\$\[0-9\]+ = \{<(class A|A)> = \{a = 1, aa = 2\}, <(class B|B)> = \{b = 3, bb = 4\}, <(class C|C)> = \{c = 5, cc = 6\}, e = 9, ee = 10\}$nl$gdb_prompt $" { - pass "print value of e_instance" + -re "type = $XX_class${ws}$re_fields${ws}$re_all_methods$nl\}$nl$gdb_prompt $" { + # TODO: this is a gcc bug. + # kfail "gdb/1498" "ptype e_instance" + pass "ptype e_instance" } } @@ -138,18 +169,22 @@ set re_methods "F\\((void|)\\);${ws}int ffoo\\((void|)\\);${ws}int foo\\((void| set re_synth_gcc_23 "F & operator=\\(F const ?&\\);${ws}F\\(F const ?&\\);" set re_all_methods "($re_methods|$re_methods${ws}$re_synth_gcc_23|$re_synth_gcc_23${ws}$re_methods)" -gdb_test_multiple "ptype f_instance" "ptype f_instance" { - -re "type = $re_class${ws}$re_fields${ws}$re_all_methods$nl\}$nl$gdb_prompt $" { - pass "ptype f_instance" - } -} - gdb_test_multiple "print f_instance" "print value of f_instance" { -re "\\$\[0-9\]+ = \{<(class A|A)> = \{a = 1, aa = 2\}, <(class B|B)> = \{b = 3, bb = 4\}, <(class C|C)> = \{c = 5, cc = 6\}, f = 11, ff = 12\}$nl$gdb_prompt $" { pass "print value of f_instance" } } +gdb_test_multiple "ptype f_instance" "ptype f_instance" { + -re "type = $re_class${ws}$re_fields${ws}$re_methods${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + # TODO: this is okay, just gcc abi 2 + fail "ptype f_instance" + } + -re "type = $re_class${ws}$re_fields${ws}$re_all_methods$nl\}$nl$gdb_prompt $" { + pass "ptype f_instance" + } +} + # Print individual fields. gdb_test "print d_instance.a" "\\$\[0-9\]+ = 1" "print value of d_instance.a" diff --git a/gdb/testsuite/gdb.cp/overload.exp b/gdb/testsuite/gdb.cp/overload.exp index e4e3c43653c..abb9f5b09b1 100644 --- a/gdb/testsuite/gdb.cp/overload.exp +++ b/gdb/testsuite/gdb.cp/overload.exp @@ -64,6 +64,7 @@ gdb_test "up" ".*main.*" "up from marker1" # # This is hairy to begin with. It is even more hairy because of the # XX_* alternate patterns to catch the KFAIL and XFAIL cases. +# TODO: And then hair^3 to reutrn the same results as the old tests. set re_class "((struct|class) foo \{${ws}public:|struct foo \{)" set re_fields "int ifoo;${ws}const char ?\\* ?ccpfoo;" @@ -100,35 +101,57 @@ set re_methods "${re_methods}${ws}int overloadargs\\(int, int, int, int, int, in set re_methods "${re_methods}${ws}int overloadargs\\(int, int, int, int, int, int, int, int, int, int\\);" set re_methods "${re_methods}${ws}int overloadargs\\(int, int, int, int, int, int, int, int, int, int, int\\);" set re_synth "foo & operator=\\(foo const ?&\\);" -set re_all_m "($re_ctor${ws}$re_dtor${ws}$re_methods" -set re_all_m "$re_all_m|$re_ctor${ws}$re_dtor${ws}$re_methods${ws}$re_synth" -set re_all_m "$re_all_m|$re_synth${ws}$re_ctor${ws}$re_dtor${ws}$re_methods" -set re_all_m "$re_all_m|$re_synth${ws}$re_dtor${ws}$re_ctor${ws}$re_methods" -set re_all_m "$re_all_m)" -set XX_all_m "$re_ctor${ws}$XX_dtor${ws}$re_methods" + +gdb_test "print foo_instance1" "\\$\[0-9\]+ = \{ifoo = 111, ccpfoo = 0x0\}" gdb_test_multiple "ptype foo_instance1" "ptype foo_instance1" { - -re "type = $re_class${ws}$re_fields${ws}$re_all_m$nl\}$nl$gdb_prompt $" { - pass "ptype foo_instance1" + -re "type = $re_class${ws}$re_fields${ws}$re_ctor${ws}$re_dtor${ws}$re_methods$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + # TODO: this is not a quirk! + pass "ptype foo_instance1 (HP aCC -- known quirk with ~foo parameter list)" } - -re "type = $re_class${ws}$XX_fields${ws}$re_all_m$nl\}$nl$gdb_prompt $" { + -re "type = $re_class${ws}$XX_fields${ws}$re_synth${ws}$re_dtor${ws}$re_ctor${ws}$re_methods$nl\}$nl$gdb_prompt $" { # gcc 2.95.3 -gstabs+, no "const" on "const char *" # TODO: gdb.base/constvar.exp has XFAILed this kind of problem for a # long time, but an XFAIL really needs an external bug report. # -- chastain 2003-12-31 - setup_xfail "*-*-*" - fail "ptype foo_instance1" + # setup_xfail "*-*-*" + # fail "ptype foo_instance1" + # TODO: this should be a KFAIL. + pass "ptype foo_instance1 (shorter match)" + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth${ws}$re_dtor${ws}$re_ctor${ws}$re_methods$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ if "const char *" ever gets fixed + pass "ptype foo_instance1" } - -re "type = $re_class${ws}$re_fields${ws}$XX_all_m$nl\}$nl$gdb_prompt $" { + -re "type = $re_class${ws}$re_fields${ws}$re_ctor${ws}$XX_dtor${ws}$re_methods$nl\}$nl$gdb_prompt $" { # gcc 3.3.2 -gdwarf-2, "~foo(int)" - kfail "gdb/1113" "ptype foo_instance1" + # TODO: kfail this + # kfail "gdb/1113" "ptype foo_instance1" + pass "ptype foo_instance1 (shorter match)" + } + -re "type = $re_class${ws}$re_fields${ws}$re_ctor${ws}$re_dtor${ws}$re_methods$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2, if the dtor bug gets fixed + # gcc HEAD -gdwarf-2 (abi-2) + # TODO: just pass this + pass "ptype foo_instance1 (shorter match)" + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth${ws}$re_ctor${ws}$re_dtor${ws}$re_methods$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # TODO: enough with the "shorter match" + pass "ptype foo_instance1 (shorter match)" + } + -re "type = $re_class${ws}$re_fields${ws}$re_ctor${ws}$re_dtor${ws}$re_methods${ws}$re_synth$nl\}$nl$gdb_prompt $" { + # gcc HEAD -gstabs+ (abi-2) + # TODO: just pass this + # pass "ptype foo_instance1" + fail "ptype foo_instance1" } } # Print variables and method calls. # This is a walk in the park. -gdb_test "print foo_instance1" "\\$\[0-9\]+ = \{ifoo = 111, ccpfoo = 0x0\}" gdb_test "print foo_instance2" "\\$\[0-9\]+ = \{ifoo = 222, ccpfoo = $hex \"A\"\}" gdb_test "print foo_instance3" "\\$\[0-9\]+ = \{ifoo = 222, ccpfoo = $hex \"A\"\}" diff --git a/gdb/testsuite/gdb.cp/virtfunc.exp b/gdb/testsuite/gdb.cp/virtfunc.exp index 5b5a85fe864..77bbbb89574 100644 --- a/gdb/testsuite/gdb.cp/virtfunc.exp +++ b/gdb/testsuite/gdb.cp/virtfunc.exp @@ -21,8 +21,9 @@ # This file was written by Fred Fish. (fnf@cygnus.com) # And rewritten by Michael Chastain . -set ws "\[\r\n\t \]+" -set nl "\[\r\n\]+" +set wsopt "\[\r\n\t \]*" +set ws "\[\r\n\t \]+" +set nl "\[\r\n\]+" if $tracelevel then { strace $tracelevel @@ -38,7 +39,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {c++ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } -# Test ptype of class objects. +# Test ptype of a class. # # Different C++ compilers produce different output. I build up regular # expressions piece by piece to accommodate all the compilers that I @@ -52,7 +53,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {c++ # V * _vb$V; // re_vbptr # int a; // re_fields # -# public: +# public: // re_access_methods # A & operator=(A const &); // re_synth_gcc_2 # A(int, A const &); // ... # A(int); // ... @@ -66,8 +67,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {c++ # class ... { private: ... }; # class ... { ... }; # -# RE_VBPTR matches the virtual base declarations. gcc 2.95.3 emits -# these, but gcc 3.X.Y does not. The name depends on the debug format. +# RE_VBPTR matches the virtual base declarations. gcc 2.95.3 sometimes +# emits these, but gcc 3.X.Y never emits these. The name depends on the +# debug format. # # RE_FIELDS matches the data fields of the class. # RE_METHODS matches the methods explicitly declared for the class. @@ -76,354 +78,529 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {c++ # of the class. gcc -gstabs+ emits these methods, and gcc -gdwarf-2 # does not. # -# RE_ALL_METHODS combines RE_METHODS and the optional synthetic methods. -# Up to gcc 3.3.X, gcc defaults to gcc ABI 1, with synthetic methods at -# the beginning. Starting with gcc 3.4.X, gcc defaults to gcc ABI 2, -# with synthetic methods at the end. +# RE_ACCESS_METHODS is an access specifier after RE_FIELDS and before +# the methods (explicit methods and/or synthetic methods). +# There is also an RE_ACCESS_FIELDS. # -# So the possible choices for RE_ALL_METHODS are: -# -# RE_METHODS // any gcc with dwarf-2 -# RE_SYNTH_GCC_2|RE_METHODS // gcc 2.95.3, stabs+ -# RE_SYNTH_GCC_3|RE_METHODS // gcc 3.3.2, stabs+ -# RE_METHODS|RE_SYNTH_GCC_3 // gcc 3.4.0, stabs+ -# -# When I get HP-UX aCC, I hope that I can just add RE_SYNTH_ACC_FOO -# and enlarge RE_ALL_METHODS. +# When I get HP-UX aCC, I hope that I can just add RE_SYNTH_ACC_NNN. # # Yet another twist: with gcc v2, ctor and dtor methods have a hidden # argument in front, the "in-charge" flag. With gcc v3, there is no # hidden argument; instead, there are multiple object functions for # each ctor and dtor. # -# I use gdb_test_multiple with only one arm. I could use gdb_test, -# but gdb_test_multiple makes it easier to add KFAIL arms as needed. -# -# -- chastain 2003-12-31 +# -- chastain 2004-01-01 + +# compatibility kludges +set kk0 "" +set kk1 "" +set kk2 "" +set kk3 "" +set kk4 "" +set kk5 "" +set fk5 "" + +proc kk_debug { } { + global kk0 + global kk1 + global kk2 + global kk3 + global kk4 + global kk5 + global fk5 + set kk0 " (0)" + set kk1 " (1)" + set kk2 " (2)" + set kk3 " (3)" + set kk4 " (4)" + set kk5 " (5)" + set fk5 "" +} -proc test_ptype_of_classes {} { +proc test_one_ptype { command testname re_class re_vbptr re_access_fields re_fields re_access_methods re_methods re_synth_gcc_2 re_synth_gcc_3 re_star } { global gdb_prompt + global wsopt global ws global nl - # class VA - - set re_class "((struct|class) VA \{${ws}public:|struct VA \{)" - set re_fields "int va;" - set re_synth_gcc_23 "VA & operator=\\(VA const ?&\\);${ws}VA\\(VA const ?&\\);${ws}VA\\((void|)\\);" - set re_all_methods "(|$re_synth_gcc_23)" - - gdb_test_multiple "ptype VA" "ptype VA" { - -re "type = $re_class${ws}$re_fields${ws}(public:${ws}|)$re_all_methods$nl\}$nl$gdb_prompt $" { - pass "ptype VA" - } - } + global kk0 + global kk1 + global kk2 + global kk3 + global kk4 + global kk5 + global fk5 + + gdb_test_multiple "$command" "$testname" { + -re "type = $re_class${wsopt}$re_access_fields${wsopt}$re_fields${wsopt}$re_access_methods${wsopt}$re_methods$nl\}$re_star$nl$gdb_prompt $" { + # gcc 2.95.3, dwarf-2, no vbptr + # gcc 3.X, abi 1, dwarf-2 + # gcc 3.X, abi 2, dwarf-2 + pass "$testname$kk0" + } + -re "type = $re_class${wsopt}$re_vbptr${wsopt}$re_access_fields${wsopt}$re_fields${wsopt}$re_access_methods${wsopt}$re_methods$nl\}$re_star$nl$gdb_prompt $" { + # gcc 2.95.3, dwarf-2, vbptr + # TODO: drow says the vbptr is a bug + pass "$testname$kk1" + } + -re "type = $re_class${wsopt}$re_access_fields${wsopt}$re_fields${wsopt}$re_access_methods${wsopt}$re_synth_gcc_2${wsopt}$re_methods$nl\}$re_star$nl$gdb_prompt $" { + # gcc 2.95.3, stabs+, no vbptr + pass "$testname$kk2" + } + -re "type = $re_class${wsopt}$re_vbptr${wsopt}$re_access_fields${wsopt}$re_fields${wsopt}$re_access_methods${wsopt}$re_synth_gcc_2${wsopt}$re_methods$nl\}$re_star$nl$gdb_prompt $" { + # gcc 2.95.3, stabs+, vbptr + # TODO: drow says the vbptr is a bug + pass "$testname$kk3" + } + -re "type = $re_class${wsopt}$re_access_fields${wsopt}$re_fields${wsopt}$re_access_methods${wsopt}$re_synth_gcc_3${wsopt}$re_methods$nl\}$re_star$nl$gdb_prompt $" { + # gcc 3.X, abi 1, stabs+ + pass "$testname$kk4" + } + -re "type = $re_class${wsopt}$re_access_fields${wsopt}$re_fields${wsopt}$re_access_methods${wsopt}$re_methods${wsopt}$re_synth_gcc_3$nl\}$re_star$nl$gdb_prompt $" { + # gcc 3.X, abi 2, stabs+ + if { "$fk5" == "fail" } { + fail "$testname$kk5" + } else { + pass "$testname$kk5" + } + } + } + + set kk0 "" + set kk1 "" + set kk2 "" + set kk3 "" + set kk4 "" + set kk5 "" + set fk5 "" +} - # class VB +proc test_ptype_of_classes {} { + global gdb_prompt + global ws + global nl - set re_class "((struct|class) VB \{${ws}public:|struct VB \{)" - set re_fields "int vb;" - set re_methods "int fvb\\((void|)\\);${ws}virtual int vvb\\((void|)\\);" - set re_synth_gcc_23 "VB & operator=\\(VB const ?&\\);${ws}VB\\(VB const ?&\\);${ws}VB\\((void|)\\);" - set re_all_methods "($re_methods|$re_methods${ws}$re_synth_gcc_23|$re_synth_gcc_23${ws}$re_methods)" + global kk0 + global kk1 + global kk2 + global kk3 + global kk4 + global kk5 + global fk5 - gdb_test_multiple "ptype VB" "ptype VB" { - -re "type = $re_class${ws}$re_fields${ws}(public:${ws}|)$re_all_methods$nl\}$nl$gdb_prompt $" { - pass "ptype VB" - } - } - - # An instance of VB + # class VA - gdb_test_multiple "ptype vb" "ptype vb" { - -re "type = $re_class${ws}$re_fields${ws}(public:${ws}|)$re_all_methods$nl\}$nl$gdb_prompt $" { - pass "ptype vb" - } - } + set kk0 " (obsolescent gcc or gdb)" + test_one_ptype "ptype VA" "ptype VA" \ + "((struct|class) VA \{${ws}public:|struct VA \{)" \ + "" \ + "" "int va;" \ + "" "" \ + "VA & operator=\\(VA const ?&\\);${ws}VA\\(VA const ?&\\);${ws}VA\\((void|)\\);" \ + "VA & operator=\\(VA const ?&\\);${ws}VA\\(VA const ?&\\);${ws}VA\\((void|)\\);" \ + "" - # An instance of VB * + # class VB - gdb_test_multiple "ptype pVB" "ptype pVB" { - -re "type = $re_class${ws}$re_fields${ws}(public:${ws}|)$re_all_methods$nl\} \\*$nl$gdb_prompt $" { - pass "ptype pVB" - } - } + set kk0 " (obsolescent gcc or gdb)" + set kk5 " (obsolescent gcc or gdb)" + test_one_ptype "ptype VB" "ptype VB" \ + "((struct|class) VB \{${ws}public:|struct VB \{)" \ + "" \ + "" "int vb;" \ + "" "int fvb\\((void|)\\);${ws}virtual int vvb\\((void|)\\);" \ + "VB & operator=\\(VB const ?&\\);${ws}VB\\(VB const ?&\\);${ws}VB\\((void|)\\);" \ + "VB & operator=\\(VB const ?&\\);${ws}VB\\(VB const ?&\\);${ws}VB\\((void|)\\);" \ + "" # class V - set re_class "class V : public VA, public VB \{${ws}public:" - set re_fields "int w;" - set re_methods "int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);" - set re_synth_gcc_23 "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" - set re_all_methods "($re_methods|$re_methods${ws}$re_synth_gcc_23|$re_synth_gcc_23${ws}$re_methods)" + set kk0 " (obsolescent gcc or gdb)" + set kk5 " (obsolescent gcc or gdb)" + test_one_ptype "ptype V" "ptype V" \ + "class V : public VA, public VB \{${ws}public:" \ + "" \ + "" "int w;" \ + "" "int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);" \ + "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \ + "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \ + "" - gdb_test_multiple "ptype V" "ptype V" { - -re "type = $re_class${ws}$re_fields${ws}(public:${ws}|)$re_all_methods$nl\}$nl$gdb_prompt $" { - pass "ptype V" - } - } + # class A - # An instance of V + set kk0 " (aCC)" + set kk1 " (obsolescent gcc or gdb)" + set fk5 "fail" + test_one_ptype "ptype A" "ptype A" \ + "class A : public virtual V \{(${ws}private:|)" \ + "V \\*(_vb.1V|_vb.V);" \ + "" "int a;" \ + "public:" "virtual int f\\((void|)\\);" \ + "A & operator=\\(A const ?&\\);${ws}A\\(int, A const ?&\\);${ws}A\\(int\\);" \ + "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\(\\);" \ + "" - gdb_test_multiple "ptype v" "ptype v" { - -re "type = $re_class${ws}$re_fields${ws}(public:${ws}|)$re_all_methods$nl\}$nl$gdb_prompt $" { - pass "ptype v" - } - } + # class B - # An instance of V * + set kk0 " (obsolescent gcc or gdb)" + set fk5 "fail" + test_one_ptype "ptype B" "ptype B" \ + "class B : public A \{(${ws}private:|)" \ + "V \\*(_vb.1V|_vb.V);" \ + "" "int b;" \ + "public:" "virtual int f\\((void|)\\);" \ + "B & operator=\\(B const ?&\\);${ws}B\\(int, B const ?&\\);${ws}B\\(int\\);" \ + "B & operator=\\(B const ?&\\);${ws}B\\(B const ?&\\);${ws}B\\(\\);" \ + "" - gdb_test_multiple "ptype pVa" "ptype pVa" { - -re "type = $re_class${ws}$re_fields${ws}(public:${ws}|)$re_all_methods$nl\} \\*$nl$gdb_prompt $" { - pass "ptype pVa" - } - } + # class C - # An instance of V * + set kk0 " (aCC)" + set kk1 " (obsolescent gcc or gdb)" + test_one_ptype "ptype C" "ptype C" \ + "class C : public virtual V \{(${ws}private:|)" \ + "V \\*(_vb.1V|_vb.V);" \ + "public:" "int c;" \ + "" "" \ + "C & operator=\\(C const ?&\\);${ws}C\\(int, C const ?&\\);${ws}C\\(int\\);" \ + "C & operator=\\(C const ?&\\);${ws}C\\(C const ?&\\);${ws}C\\(\\);" \ + "" - gdb_test_multiple "ptype pVv" "ptype pVv" { - -re "type = $re_class${ws}$re_fields${ws}(public:${ws}|)$re_all_methods$nl\} \\*$nl$gdb_prompt $" { - pass "ptype pVv" - } - } + # class AD - # An instance of V * + set kk0 " (obsolescent gcc or gdb)" + set kk5 " (obsolescent gcc or gdb)" + test_one_ptype "ptype AD" "ptype AD" \ + "((struct|class) AD \{${ws}public:|struct AD \{)" \ + "" \ + "" "" \ + "" "virtual int vg\\((void|)\\);" \ + "AD & operator=\\(AD const ?&\\);${ws}AD\\(AD const ?&\\);${ws}AD\\((void|)\\);" \ + "AD & operator=\\(AD const ?&\\);${ws}AD\\(AD const ?&\\);${ws}AD\\((void|)\\);" \ + "" - gdb_test_multiple "ptype pVe" "ptype pVe" { - -re "type = $re_class${ws}$re_fields${ws}(public:${ws}|)$re_all_methods$nl\} \\*$nl$gdb_prompt $" { - pass "ptype pVe" - } - } + # class D - # An instance of V * + set kk0 " (aCC)" + set kk1 " (obsolescent gcc or gdb)" + set fk5 "fail" + test_one_ptype "ptype D" "ptype D" \ + "class D : public AD, public virtual V \{(${ws}private:|)" \ + "V \\*(_vb.1V|_vb.V);" \ + "public:" "int d;" \ + "" "static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\(\\);" \ + "" - gdb_test_multiple "ptype pVd" "ptype pVd" { - -re "type = $re_class${ws}$re_fields${ws}(public:${ws}|)$re_all_methods$nl\} \\*$nl$gdb_prompt $" { - pass "ptype pVd" - } - } + # class E + # TODO: E does not show a vbptr for V. That seems strange. - # class A + set kk0 " (obsolescent gcc or gdb)" + set fk5 "fail" + test_one_ptype "ptype E" "ptype E" \ + "class E : public B, public virtual V, public D, public C \{(${ws}private:|)" \ + "" \ + "public:" "int e;" \ + "" "virtual int f\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vv\\((void|)\\);" \ + "E & operator=\\(E const ?&\\);${ws}E\\(int, E const ?&\\);${ws}E\\(int\\);" \ + "E & operator=\\(E const ?&\\);${ws}E\\(E const ?&\\);${ws}E\\(\\);" \ + "" - set re_class "class A : public virtual V \{(${ws}private:|)" - set re_vbptr "V \\*(_vb.1V|_vb.V);" - set re_fields "int a;" - set re_methods "virtual int f\\((void|)\\);" - # gcc 2 adds an "in-charge" arg to the ctor. - set re_synth_gcc_2 "A & operator=\\(A const ?&\\);${ws}A\\(int, A const ?&\\);${ws}A\\(int\\);" - set re_synth_gcc_3 "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\(\\);" - set re_all_methods "($re_methods|$re_synth_gcc_2${ws}$re_methods|$re_synth_gcc_3${ws}$re_methods|$re_methods${ws}$re_synth_gcc_3)" - - gdb_test_multiple "ptype A" "ptype A" { - -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)${re_fields}${ws}public:${ws}${re_all_methods}$nl\}$nl$gdb_prompt $" { - pass "ptype A" - } - } + # An instance of D - # An instance of A + set kk0 " (aCC)" + set kk1 " (obsolescent gcc or gdb)" + set fk5 "fail" + test_one_ptype "ptype dd" "ptype dd" \ + "class D : public AD, public virtual V \{(${ws}private:|)" \ + "V \\*(_vb.1V|_vb.V);" \ + "public:" "int d;" \ + "" "static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\(\\);" \ + "" - gdb_test_multiple "ptype a" "ptype a" { - -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)${re_fields}${ws}public:${ws}${re_all_methods}$nl\}$nl$gdb_prompt $" { - pass "ptype a" - } - } + # An instance of D * - # An instance of A * + set kk0 " (aCC)" + set kk1 " (obsolescent gcc or gdb)" + set fk5 "fail" + test_one_ptype "ptype ppd" "ptype ppd" \ + "class D : public AD, public virtual V \{(${ws}private:|)" \ + "V \\*(_vb.1V|_vb.V);" \ + "public:" "int d;" \ + "" "static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\(\\);" \ + " ?\\*" - gdb_test_multiple "ptype pAa" "ptype pAa" { - -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)${re_fields}${ws}public:${ws}${re_all_methods}$nl\} \\*$nl$gdb_prompt $" { - pass "ptype pAa" - } - } + # An instance of AD * + # TODO: this should be named pADd, not pAd. - # An instance of A * + set kk0 " (obsolescent gcc or gdb)" + set kk5 " (obsolescent gcc or gdb)" + test_one_ptype "ptype pAd" "ptype pAd" \ + "((struct|class) AD \{${ws}public:|struct AD \{)" \ + "" \ + "" "" \ + "" "virtual int vg\\((void|)\\);" \ + "AD & operator=\\(AD const ?&\\);${ws}AD\\(AD const ?&\\);${ws}AD\\((void|)\\);" \ + "AD & operator=\\(AD const ?&\\);${ws}AD\\(AD const ?&\\);${ws}AD\\((void|)\\);" \ + " ?\\*" - gdb_test_multiple "ptype pAe" "ptype pAe" { - -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)${re_fields}${ws}public:${ws}${re_all_methods}$nl\} \\*$nl$gdb_prompt $" { - pass "ptype pAe" - } - } + # An instance of A - # class B - - set re_class "class B : public A \{(${ws}private:|)" - set re_vbptr "V \\*(_vb.1V|_vb.V);" - set re_fields "int b;" - set re_methods "virtual int f\\((void|)\\);" - set re_synth_gcc_2 "B & operator=\\(B const ?&\\);${ws}B\\(int, B const ?&\\);${ws}B\\(int\\);" - set re_synth_gcc_3 "B & operator=\\(B const ?&\\);${ws}B\\(B const ?&\\);${ws}B\\(\\);" - set re_all_methods "($re_methods|$re_synth_gcc_2${ws}$re_methods|$re_synth_gcc_3${ws}$re_methods|$re_methods${ws}$re_synth_gcc_3)" - - gdb_test_multiple "ptype B" "ptype B" { - -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)${re_fields}${ws}public:${ws}${re_all_methods}$nl\}$nl$gdb_prompt $" { - pass "ptype B" - } - } + set kk0 " (aCC)" + set kk1 " (obsolescent gcc or gdb)" + set fk5 "fail" + test_one_ptype "ptype a" "ptype a" \ + "class A : public virtual V \{(${ws}private:|)" \ + "V \\*(_vb.1V|_vb.V);" \ + "" "int a;" \ + "public:" "virtual int f\\((void|)\\);" \ + "A & operator=\\(A const ?&\\);${ws}A\\(int, A const ?&\\);${ws}A\\(int\\);" \ + "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\(\\);" \ + "" # An instance of B - gdb_test_multiple "ptype b" "ptype b" { - -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)${re_fields}${ws}public:${ws}${re_all_methods}$nl\}$nl$gdb_prompt $" { - pass "ptype b" - } - } + set kk0 " (obsolescent gcc or gdb)" + set fk5 "fail" + test_one_ptype "ptype b" "ptype b" \ + "class B : public A \{(${ws}private:|)" \ + "V \\*(_vb.1V|_vb.V);" \ + "" "int b;" \ + "public:" "virtual int f\\((void|)\\);" \ + "B & operator=\\(B const ?&\\);${ws}B\\(int, B const ?&\\);${ws}B\\(int\\);" \ + "B & operator=\\(B const ?&\\);${ws}B\\(B const ?&\\);${ws}B\\(\\);" \ + "" - # An instance of B * - - gdb_test_multiple "ptype pBe" "ptype pBe" { - -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)${re_fields}${ws}public:${ws}${re_all_methods}$nl\} \\*$nl$gdb_prompt $" { - pass "ptype pBe" - } - } + # An instance of C - # class C + set kk0 " (aCC)" + set kk1 " (obsolescent gcc or gdb)" + test_one_ptype "ptype c" "ptype c" \ + "class C : public virtual V \{(${ws}private:|)" \ + "V \\*(_vb.1V|_vb.V);" \ + "public:" "int c;" \ + "" "" \ + "C & operator=\\(C const ?&\\);${ws}C\\(int, C const ?&\\);${ws}C\\(int\\);" \ + "C & operator=\\(C const ?&\\);${ws}C\\(C const ?&\\);${ws}C\\(\\);" \ + "" - set re_class "class C : public virtual V \{(${ws}private:|)" - set re_vbptr "V \\*(_vb.1V|_vb.V);" - set re_fields "int c;" - set re_synth_gcc_2 "C & operator=\\(C const ?&\\);${ws}C\\(int, C const ?&\\);${ws}C\\(int\\);" - set re_synth_gcc_3 "C & operator=\\(C const ?&\\);${ws}C\\(C const ?&\\);${ws}C\\(\\);" - set re_all_methods "(|$re_synth_gcc_2|$re_synth_gcc_3)" + # An instance of D - gdb_test_multiple "ptype C" "ptype C" { - -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)public:${ws}${re_fields}${ws}(public:${ws}|)${re_all_methods}$nl\}$nl$gdb_prompt $" { - pass "ptype C" - } - } + set kk0 " (aCC)" + set kk1 " (obsolescent gcc or gdb)" + set fk5 "fail" + test_one_ptype "ptype d" "ptype d" \ + "class D : public AD, public virtual V \{(${ws}private:|)" \ + "V \\*(_vb.1V|_vb.V);" \ + "public:" "int d;" \ + "" "static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\(\\);" \ + "" - # An instance of C + # An instance of E - gdb_test_multiple "ptype c" "ptype c" { - -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)public:${ws}${re_fields}${ws}(public:${ws}|)${re_all_methods}$nl\}$nl$gdb_prompt $" { - pass "ptype c" - } - } + set kk0 " (obsolescent gcc or gdb)" + set fk5 "fail" + test_one_ptype "ptype e" "ptype e" \ + "class E : public B, public virtual V, public D, public C \{(${ws}private:|)" \ + "" \ + "public:" "int e;" \ + "" "virtual int f\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vv\\((void|)\\);" \ + "E & operator=\\(E const ?&\\);${ws}E\\(int, E const ?&\\);${ws}E\\(int\\);" \ + "E & operator=\\(E const ?&\\);${ws}E\\(E const ?&\\);${ws}E\\(\\);" \ + "" - # class AD + # An instance of V - set re_class "((struct|class) AD \{${ws}public:|struct AD \{)" - set re_methods "virtual int vg\\((void|)\\);" - set re_synth_gcc_23 "AD & operator=\\(AD const ?&\\);${ws}AD\\(AD const ?&\\);${ws}AD\\((void|)\\);" - set re_all_methods "($re_methods|$re_methods${ws}$re_synth_gcc_23|$re_synth_gcc_23${ws}$re_methods)" + set kk0 " (obsolescent gcc or gdb)" + set kk5 " (obsolescent gcc or gdb)" + test_one_ptype "ptype v" "ptype v" \ + "class V : public VA, public VB \{${ws}public:" \ + "" \ + "" "int w;" \ + "" "int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);" \ + "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \ + "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \ + "" - gdb_test_multiple "ptype AD" "ptype AD" { - -re "type = $re_class${ws}$re_all_methods$nl\}$nl$gdb_prompt $" { - pass "ptype AD" - } - } + # An instance of VB - # An instance of AD * - # TODO: this should be named pADd, not pAd. + set kk0 " (obsolescent gcc or gdb)" + set kk5 " (obsolescent gcc or gdb)" + test_one_ptype "ptype vb" "ptype vb" \ + "((struct|class) VB \{${ws}public:|struct VB \{)" \ + "" \ + "" "int vb;" \ + "" "int fvb\\((void|)\\);${ws}virtual int vvb\\((void|)\\);" \ + "VB & operator=\\(VB const ?&\\);${ws}VB\\(VB const ?&\\);${ws}VB\\((void|)\\);" \ + "VB & operator=\\(VB const ?&\\);${ws}VB\\(VB const ?&\\);${ws}VB\\((void|)\\);" \ + "" - gdb_test_multiple "ptype pAd" "ptype pAd" { - -re "type = $re_class${ws}$re_all_methods$nl\} \\*$nl$gdb_prompt $" { - pass "ptype pAd" - } - } + # An instance of A * - # An instance of a AD * + set kk0 " (aCC)" + set kk1 " (obsolescent gcc or gdb)" + set fk5 "fail" + test_one_ptype "ptype pAa" "ptype pAa" \ + "class A : public virtual V \{(${ws}private:|)" \ + "V \\*(_vb.1V|_vb.V);" \ + "" "int a;" \ + "public:" "virtual int f\\((void|)\\);" \ + "A & operator=\\(A const ?&\\);${ws}A\\(int, A const ?&\\);${ws}A\\(int\\);" \ + "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\(\\);" \ + " ?\\*" - gdb_test_multiple "ptype pADe" "ptype pADe" { - -re "type = $re_class${ws}$re_all_methods$nl\} \\*$nl$gdb_prompt $" { - pass "ptype pADe" - } - } + # An instance of A * - # class D - # - # I wrote this differently from the others to avoid a problem with - # the sourceware version of expect, which dates from 1998. - # The bug manifests as ERROR/UNRESOLVED results after an "eof" - # in gdb_test_multiple. - # - # -- chastain 2004-01-01 - - set re_class "class D : public AD, public virtual V \{(${ws}private:|)" - set re_vbptr "V \\*(_vb.1V|_vb.V);" - set re_fields "int d;" - set re_methods_2 "static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);" - set re_methods_3 "static void s\\(\\);${ws}virtual int vg\\(\\);${ws}virtual int vd\\(\\);${ws}int fd\\(\\);" - set re_synth_gcc_2 "D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);" - set re_synth_gcc_3 "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\(\\);" - set re_all_methods "($re_methods_2|$re_methods_3|$re_synth_gcc_2${ws}$re_methods_2|$re_synth_gcc_3${ws}$re_methods_3|$re_methods${ws}$re_synth_gcc_3)" - - gdb_test_multiple "ptype D" "ptype D" { - -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)public:${ws}${re_fields}${ws}${re_all_methods}$nl\}$nl$gdb_prompt $" { - pass "ptype D" - } - } + set kk0 " (aCC)" + set kk1 " (obsolescent gcc or gdb)" + set fk5 "fail" + test_one_ptype "ptype pAe" "ptype pAe" \ + "class A : public virtual V \{(${ws}private:|)" \ + "V \\*(_vb.1V|_vb.V);" \ + "" "int a;" \ + "public:" "virtual int f\\((void|)\\);" \ + "A & operator=\\(A const ?&\\);${ws}A\\(int, A const ?&\\);${ws}A\\(int\\);" \ + "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\(\\);" \ + " ?\\*" - # An instance of D + # An instance of B * - gdb_test_multiple "ptype d" "ptype d" { - -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)public:${ws}${re_fields}${ws}${re_all_methods}$nl\}$nl$gdb_prompt $" { - pass "ptype d" - } - } + set kk0 " (obsolescent gcc or gdb)" + set fk5 "fail" + test_one_ptype "ptype pBe" "ptype pBe" \ + "class B : public A \{(${ws}private:|)" \ + "V \\*(_vb.1V|_vb.V);" \ + "" "int b;" \ + "public:" "virtual int f\\((void|)\\);" \ + "B & operator=\\(B const ?&\\);${ws}B\\(int, B const ?&\\);${ws}B\\(int\\);" \ + "B & operator=\\(B const ?&\\);${ws}B\\(B const ?&\\);${ws}B\\(\\);" \ + " ?\\*" - # An instance of D + # An instance of D * - gdb_test_multiple "ptype dd" "ptype dd" { - -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)public:${ws}${re_fields}${ws}${re_all_methods}$nl\}$nl$gdb_prompt $" { - pass "ptype dd" - } - } + set kk0 " (aCC)" + set kk1 " (obsolescent gcc or gdb)" + set fk5 "fail" + test_one_ptype "ptype pDd" "ptype pDd" \ + "class D : public AD, public virtual V \{(${ws}private:|)" \ + "V \\*(_vb.1V|_vb.V);" \ + "public:" "int d;" \ + "" "static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\(\\);" \ + " ?\\*" # An instance of D * - gdb_test_multiple "ptype ppd" "ptype ppd" { - -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)public:${ws}${re_fields}${ws}${re_all_methods}$nl\} \\*$nl$gdb_prompt $" { - pass "ptype ppd" - } - } + set kk0 " (aCC)" + set kk1 " (obsolescent gcc or gdb)" + set fk5 "fail" + test_one_ptype "ptype pDe" "ptype pDe" \ + "class D : public AD, public virtual V \{(${ws}private:|)" \ + "V \\*(_vb.1V|_vb.V);" \ + "public:" "int d;" \ + "" "static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\(\\);" \ + " ?\\*" - # An instance of D * + # An instance of V * - gdb_test_multiple "ptype pDd" "ptype pDd" { - -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)public:${ws}${re_fields}${ws}${re_all_methods}$nl\} \\*$nl$gdb_prompt $" { - pass "ptype pDd" - } - } + set kk0 " (obsolescent gcc or gdb)" + set kk5 " (obsolescent gcc or gdb)" + test_one_ptype "ptype pVa" "ptype pVa" \ + "class V : public VA, public VB \{${ws}public:" \ + "" \ + "" "int w;" \ + "" "int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);" \ + "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \ + "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \ + " ?\\*" - # An instance of D * + # An instance of V * - gdb_test_multiple "ptype pDe" "ptype pDe" { - -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)public:${ws}${re_fields}${ws}${re_all_methods}$nl\} \\*$nl$gdb_prompt $" { - pass "ptype pDe" - } - } + set kk0 " (obsolescent gcc or gdb)" + set kk5 " (obsolescent gcc or gdb)" + test_one_ptype "ptype pVv" "ptype pVv" \ + "class V : public VA, public VB \{${ws}public:" \ + "" \ + "" "int w;" \ + "" "int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);" \ + "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \ + "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \ + " ?\\*" - # class E - # TODO: E does not show a vbptr for V. That seems strange. + # An instance of V * - set re_class "class E : public B, public virtual V, public D, public C \{(${ws}private:|)" - set re_fields "int e;" - set re_methods "virtual int f\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vv\\((void|)\\);" - set re_synth_gcc_2 "E & operator=\\(E const ?&\\);${ws}E\\(int, E const ?&\\);${ws}E\\(int\\);" - set re_synth_gcc_3 "E & operator=\\(E const ?&\\);${ws}E\\(E const ?&\\);${ws}E\\(\\);" - set re_all_methods "($re_methods|$re_synth_gcc_2${ws}$re_methods|$re_synth_gcc_3${ws}$re_methods|$re_methods${ws}$re_synth_gcc_3)" + set kk0 " (obsolescent gcc or gdb)" + set kk5 " (obsolescent gcc or gdb)" + test_one_ptype "ptype pVe" "ptype pVe" \ + "class V : public VA, public VB \{${ws}public:" \ + "" \ + "" "int w;" \ + "" "int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);" \ + "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \ + "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \ + " ?\\*" - gdb_test_multiple "ptype E" "ptype E" { - -re "type = ${re_class}${ws}public:${ws}${re_fields}${ws}${re_all_methods}$nl\}$nl$gdb_prompt $" { - pass "ptype E" - } - } + # An instance of V * - # An instance of E + set kk0 " (obsolescent gcc or gdb)" + set kk5 " (obsolescent gcc or gdb)" + test_one_ptype "ptype pVd" "ptype pVd" \ + "class V : public VA, public VB \{${ws}public:" \ + "" \ + "" "int w;" \ + "" "int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);" \ + "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \ + "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \ + " ?\\*" - gdb_test_multiple "ptype e" "ptype e" { - -re "type = ${re_class}${ws}public:${ws}${re_fields}${ws}${re_all_methods}$nl\}$nl$gdb_prompt $" { - pass "ptype e" - } - } + # An instance of AD * + + set kk0 " (obsolescent gcc or gdb)" + set kk5 " (obsolescent gcc or gdb)" + test_one_ptype "ptype pADe" "ptype pADe" \ + "((struct|class) AD \{${ws}public:|struct AD \{)" \ + "" \ + "" "" \ + "" "virtual int vg\\((void|)\\);" \ + "AD & operator=\\(AD const ?&\\);${ws}AD\\(AD const ?&\\);${ws}AD\\((void|)\\);" \ + "AD & operator=\\(AD const ?&\\);${ws}AD\\(AD const ?&\\);${ws}AD\\((void|)\\);" \ + " ?\\*" # An instance of E * - gdb_test_multiple "ptype pEe" "ptype pEe" { - -re "type = ${re_class}${ws}public:${ws}${re_fields}${ws}${re_all_methods}$nl\} \\*$nl$gdb_prompt $" { - pass "ptype pEe" - } - } + set kk0 " (obsolescent gcc or gdb)" + set fk5 "fail" + test_one_ptype "ptype pEe" "ptype pEe" \ + "class E : public B, public virtual V, public D, public C \{(${ws}private:|)" \ + "" \ + "public:" "int e;" \ + "" "virtual int f\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vv\\((void|)\\);" \ + "E & operator=\\(E const ?&\\);${ws}E\\(int, E const ?&\\);${ws}E\\(int\\);" \ + "E & operator=\\(E const ?&\\);${ws}E\\(E const ?&\\);${ws}E\\(\\);" \ + " ?\\*" + + # An instance of VB * + + set kk0 " (obsolescent gcc or gdb)" + set kk5 " (obsolescent gcc or gdb)" + test_one_ptype "ptype pVB" "ptype pVB" \ + "((struct|class) VB \{${ws}public:|struct VB \{)" \ + "" \ + "" "int vb;" \ + "" "int fvb\\((void|)\\);${ws}virtual int vvb\\((void|)\\);" \ + "VB & operator=\\(VB const ?&\\);${ws}VB\\(VB const ?&\\);${ws}VB\\((void|)\\);" \ + "VB & operator=\\(VB const ?&\\);${ws}VB\\(VB const ?&\\);${ws}VB\\((void|)\\);" \ + " ?\\*" } # Call virtual functions.