summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.c++/classes.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.c++/classes.exp')
-rw-r--r--gdb/testsuite/gdb.c++/classes.exp109
1 files changed, 49 insertions, 60 deletions
diff --git a/gdb/testsuite/gdb.c++/classes.exp b/gdb/testsuite/gdb.c++/classes.exp
index dbdea5d69c6..3f398acc5ec 100644
--- a/gdb/testsuite/gdb.c++/classes.exp
+++ b/gdb/testsuite/gdb.c++/classes.exp
@@ -1,5 +1,5 @@
-# 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
@@ -55,7 +55,7 @@ proc test_ptype_class_objects {} {
# Note that struct members are public by default, so we don't print
# "public:" for the public members of structs.
- # Accept it as an expected failure if gdb just fails to distinguish between
+ # Accept it if gdb just fails to distinguish between
# class and struct, and everything else is OK.
send_gdb "ptype struct default_public_struct\n"
@@ -64,8 +64,7 @@ proc test_ptype_class_objects {} {
pass "ptype struct default_public_struct"
}
-re "type = class default_public_struct \{$nl.*int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
- setup_xfail "*-*-*"
- fail "ptype struct default_public_struct"
+ pass "ptype struct default_public_struct"
}
-re ".*$gdb_prompt $" { fail "ptype struct default_public_struct" }
timeout { fail "ptype struct default_public_struct (timeout)" ; return }
@@ -73,7 +72,7 @@ proc test_ptype_class_objects {} {
# Note that struct members are public by default, so we don't print
# "public:" for the public members of structs.
- # Accept it as an expected failure if gdb just fails to distinguish between
+ # Accept it if gdb just fails to distinguish between
# class and struct, and everything else is OK.
send_gdb "ptype struct explicit_public_struct\n"
@@ -82,78 +81,70 @@ proc test_ptype_class_objects {} {
pass "ptype struct explicit_public_struct"
}
-re "type = class explicit_public_struct \{$nl.*int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
- setup_xfail "*-*-*"
- fail "ptype struct explicit_public_struct"
+ pass "ptype struct explicit_public_struct"
}
-re ".*$gdb_prompt $" { fail "ptype struct explicit_public_struct" }
timeout { fail "ptype struct explicit_public_struct (timeout)" ; return }
}
- # Accept it as an expected failure if gdb just fails to distinguish between
+ # Accept it if gdb just fails to distinguish between
# class and struct, and everything else is OK.
- setup_xfail_format "DWARF 1"
send_gdb "ptype struct protected_struct\n"
gdb_expect {
-re "type = struct protected_struct \{${ws}protected:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
- pass "ptype struct protected_struct (FIXME)"
+ pass "ptype struct protected_struct"
}
-re "type = class protected_struct \{${ws}protected:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
- setup_xfail "*-*-*"
- fail "ptype struct protected_struct (FIXME)"
+ pass "ptype struct protected_struct"
}
-re ".*$gdb_prompt $" { fail "ptype struct protected_struct" }
timeout { fail "ptype struct protected_struct (timeout)" ; return }
}
- # Accept it as an expected failure if gdb just fails to distinguish between
+ # Accept it if gdb just fails to distinguish between
# class and struct, and everything else is OK.
- setup_xfail_format "DWARF 1"
send_gdb "ptype struct private_struct\n"
gdb_expect {
-re "type = struct private_struct \{${ws}private:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
- pass "ptype struct private_struct (FIXME)"
+ pass "ptype struct private_struct"
}
-re "type = class private_struct \{${ws}private:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
- setup_xfail "*-*-*"
- fail "ptype struct private_struct (FIXME)"
+ pass "ptype struct private_struct"
}
-re ".*$gdb_prompt $" { fail "ptype struct private_struct" }
timeout { fail "ptype struct private_struct (timeout)" ; return }
}
- # Accept it as an expected failure if gdb just fails to distinguish between
+ # Accept it if gdb just fails to distinguish between
# class and struct, and everything else is OK.
- setup_xfail_format "DWARF 1"
send_gdb "ptype struct mixed_protection_struct\n"
gdb_expect {
-re "type = struct mixed_protection_struct \{${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;$nl\}$nl$gdb_prompt $" {
- pass "ptype struct mixed_protection_struct (FIXME)"
+ pass "ptype struct mixed_protection_struct"
}
-re "type = struct mixed_protection_struct \{${ws}public:${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;$nl.*\}$nl$gdb_prompt $" {
pass "ptype struct mixed_protection_struct (extra public)"
}
-re "type = class mixed_protection_struct \{${ws}public:${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;$nl.*\}$nl$gdb_prompt $" {
- setup_xfail "*-*-*"
- fail "ptype struct mixed_protection_struct (FIXME)"
+ pass "ptype struct mixed_protection_struct"
}
-re ".*$gdb_prompt $" { fail "ptype struct mixed_protection_struct" }
timeout { fail "ptype struct mixed_protection_struct (timeout)" ; return }
}
- # Accept it as an expected failure if gdb just fails to distinguish between
+ # Accept it if gdb just fails to distinguish between
# class and struct, and everything else is OK.
send_gdb "ptype class public_class\n"
gdb_expect {
-re "type = class public_class \{${ws}public:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
- pass "ptype class public_class (FIXME)"
+ pass "ptype class public_class"
}
-re "type = struct public_class \{${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
- setup_xfail "*-*-*"
- fail "ptype class public_class (FIXME)"
+ pass "ptype class public_class"
}
-re ".*$gdb_prompt $" { fail "ptype class public_class" }
timeout { fail "ptype class public_class (timeout)" ; return }
@@ -165,27 +156,24 @@ proc test_ptype_class_objects {} {
pass "ptype class protected_class"
}
-re "type = struct protected_class \{${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
- setup_xfail "*-*-*"
fail "ptype class protected_class"
}
-re ".*$gdb_prompt $" { fail "ptype class protected_class" }
timeout { fail "ptype class protected_class (timeout)" ; return }
}
- # Accept it as an expected failure if gdb just emits a superflous "private:"
+ # Accept it if gdb just emits a superflous "private:"
# attribute, since classes default to private and for consistency with
# structs (where we don't print the "public:" attribute) we don't print
# the "private:" attribute.
- setup_xfail_format "DWARF 1"
send_gdb "ptype class default_private_class\n"
gdb_expect {
-re "type = class default_private_class \{${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
- pass "ptype class default_private_class (FIXME)"
+ pass "ptype class default_private_class"
}
-re "type = class default_private_class \{${ws}private:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
- setup_xfail "*-*-*"
- fail "ptype class default_private_class (FIXME)"
+ pass "ptype class default_private_class"
}
-re ".*$gdb_prompt $" { fail "ptype class default_private_class" }
timeout { fail "ptype class default_private_class (timeout)" ; return }
@@ -197,10 +185,9 @@ proc test_ptype_class_objects {} {
pass "ptype class explicit_private_class"
}
-re "type = class explicit_private_class \{${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
- pass "ptype class explicit_private_class (OK for HP aCC)"
+ pass "ptype class explicit_private_class"
}
-re "type = struct explicit_private_class \{${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
- setup_xfail "*-*-*"
fail "ptype class explicit_private_class"
}
-re ".*$gdb_prompt $" { fail "ptype class explicit_private_class" }
@@ -213,7 +200,6 @@ proc test_ptype_class_objects {} {
pass "ptype class mixed_protection_class"
}
-re "type = struct mixed_protection_class \{${ws}int a;${ws}int b;${ws}int c;${ws}int d;${ws}int e;${ws}int f;${ws}int g;${ws}int h;${ws}int i;$nl.*\}$nl$gdb_prompt $" {
- setup_xfail "*-*-*"
fail "ptype class mixed_protection_class"
}
-re ".*$gdb_prompt $" { fail "ptype class mixed_protection_class" }
@@ -236,7 +222,6 @@ proc test_ptype_class_objects {} {
}
}
- 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 $" {
@@ -254,7 +239,6 @@ proc test_ptype_class_objects {} {
}
}
- 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 $" {
@@ -272,7 +256,6 @@ proc test_ptype_class_objects {} {
}
}
- 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 $" {
@@ -290,7 +273,6 @@ proc test_ptype_class_objects {} {
}
}
- 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 $" {
@@ -354,7 +336,6 @@ proc test_ptype_class_objects {} {
# 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 $" {
@@ -384,7 +365,6 @@ proc test_ptype_class_objects {} {
# 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 $" {
@@ -414,7 +394,6 @@ proc test_ptype_class_objects {} {
# 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 $" {
@@ -444,7 +423,6 @@ proc test_ptype_class_objects {} {
# 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 $" {
@@ -470,7 +448,6 @@ proc test_ptype_class_objects {} {
}
}
- 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 $" {
@@ -491,7 +468,6 @@ proc test_ptype_class_objects {} {
}
}
- setup_xfail_format "DWARF 1"
send_gdb "ptype class Foo\n"
gdb_expect {
-re "type = class Foo \{${ws}public:${ws}int x;${ws}int y;${ws}static int st;\r\n${ws}Foo\\(int, int\\);${ws}int operator!\\((void|)\\);${ws}operator int\\((void|)\\);${ws}int times\\(int\\);$nl\}$nl$gdb_prompt $" {
@@ -512,7 +488,6 @@ proc test_ptype_class_objects {} {
}
}
- 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 $" {
@@ -682,23 +657,45 @@ proc test_enums {} {
}
# ptype on the object
- # g++ is putting out the wrong debug info. This works with aCC
- if {!$hp_aCC_compiler} {setup_xfail "*-*-*"}
send_gdb "ptype obj_with_enum\n"
gdb_expect {
-re "type = class ClassWithEnum \\{\r\n\[ \t\]*public:\r\n\[ \t\]*(enum |)ClassWithEnum::PrivEnum priv_enum;\r\n\[ \t\]*int x;\r\n\\}\r\n$gdb_prompt $" { pass "ptype obj_with_enum" }
+ -re "type = class ClassWithEnum \\{\r\n\[ \t\]*public:\r\n\[ \t\]*(enum |)PrivEnum priv_enum;\r\n\[ \t\]*int x;.*\\}\r\n$gdb_prompt $"
+ {
+ # NOTE: carlton/2003-02-28: One could certainly argue that
+ # this output is acceptable: PrivEnum is a member of
+ # ClassWithEnum, so there's no need to explicitly qualify
+ # its name with "ClassWithEnum::". The truth, though, is
+ # that GDB is simply forgetting that PrivEnum is a member
+ # of ClassWithEnum, so we do that output for a bad reason
+ # instead of a good reason. Under stabs, we probably
+ # can't get this right; under DWARF-2, we can.
+ kfail "gdb/57" "ptype obj_with_enum"
+ }
-re "$gdb_prompt $" { fail "ptype obj_with_enum" }
timeout { fail "(timeout) ptype obj_with_enum" }
}
- # g++ is putting out the wrong debug info. This works with aCC
- if {!$hp_aCC_compiler} {setup_xfail "*-*-*"}
+ # We'll do this test twice, because of a parser bug: see
+ # PR gdb/826.
+
send_gdb "print (ClassWithEnum::PrivEnum) 42\n"
gdb_expect {
-re "\\$\[0-9\]* = yellow.*$gdb_prompt $" { pass "print (ClassWithEnum::PrivEnum) 42" }
+ -re "A parse error in expression, near `42'.\r\n$gdb_prompt $"
+ { kfail "gdb/826" "print (ClassWithEnum::PrivEnum) 42" }
-re "$gdb_prompt $" { fail "print (ClassWithEnum::PrivEnum) 42" }
timeout { fail "(timeout) print (ClassWithEnum::PrivEnum) 42" }
}
+
+ send_gdb "print ('ClassWithEnum::PrivEnum') 42\n"
+ gdb_expect {
+ -re "\\$\[0-9\]* = yellow.*$gdb_prompt $" { pass "print ('ClassWithEnum::PrivEnum') 42" }
+ -re "No symbol \"ClassWithEnum::PrivEnum\" in current context.\r\n$gdb_prompt $"
+ { kfail "gdb/57" "print ('ClassWithEnum::PrivEnum') 42" }
+ -re "$gdb_prompt $" { fail "print ('ClassWithEnum::PrivEnum') 42" }
+ timeout { fail "(timeout) print ('ClassWithEnum::PrivEnum') 42" }
+ }
}
#
@@ -737,7 +734,6 @@ proc test_pointers_to_class_members {} {
}
clear_xfail "*-*-*"
- setup_xfail_format "DWARF 1"
gdb_test "print (int)pmi == sizeof(int)" ".* = false" "print (int)pmi == sizeof(int)"
}
@@ -822,11 +818,9 @@ proc test_static_members {} {
"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"
@@ -856,12 +850,7 @@ proc do_tests {} {
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 {