📄 classes.exp
字号:
# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,# 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# 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. # This file was written by Fred Fish. (fnf@cygnus.com)# And rewritten by Michael Chastain <mec.gnu@mindspring.com>.set nl "\[\r\n\]+"if $tracelevel then { strace $tracelevel}if { [skip_cplus_tests] } { continue }load_lib "cp-support.exp"set testfile "classes"set srcfile ${testfile}.ccset binfile ${objdir}/${subdir}/${testfile}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."}# Test ptype of class objects.proc test_ptype_class_objects {} { # Simple type. cp_test_ptype_class \ "ptype struct default_public_struct" "" "struct" "default_public_struct" \ { { field public "int a;" } { field public "int b;" } } # Another simple type. cp_test_ptype_class \ "ptype struct explicit_public_struct" "" "struct" "explicit_public_struct" \ { { field public "int a;" } { field public "int b;" } } # Another simple type. cp_test_ptype_class \ "ptype struct protected_struct" "" "struct" "protected_struct" \ { { field protected "int a;" } { field protected "int b;" } } # Another simple type. cp_test_ptype_class \ "ptype struct private_struct" "" "struct" "private_struct" \ { { field private "int a;" } { field private "int b;" } } # A bigger type. cp_test_ptype_class \ "ptype struct mixed_protection_struct" "" "struct" "mixed_protection_struct" \ { { field public "int a;" } { field public "int b;" } { field private "int c;" } { field private "int d;" } { field protected "int e;" } { field protected "int f;" } { field public "int g;" } { field private "int h;" } { field protected "int i;" } } # All that again with "class" instead of "struct". # gdb does not care about the difference anyways. cp_test_ptype_class \ "ptype class public_class" "" "class" "public_class" \ { { field public "int a;" } { field public "int b;" } } # Another simple type. cp_test_ptype_class \ "ptype class protected_class" "" "class" "protected_class" \ { { field protected "int a;" } { field protected "int b;" } } # Another simple type. cp_test_ptype_class \ "ptype class default_private_class" "" "class" "default_private_class" \ { { field private "int a;" } { field private "int b;" } } # Another simple type. cp_test_ptype_class \ "ptype class explicit_private_class" "" "class" "explicit_private_class" \ { { field private "int a;" } { field private "int b;" } } # A bigger type. cp_test_ptype_class \ "ptype class mixed_protection_class" "" "class" "mixed_protection_class" \ { { field public "int a;" } { field public "int b;" } { field private "int c;" } { field private "int d;" } { field protected "int e;" } { field protected "int f;" } { field public "int g;" } { field private "int h;" } { field protected "int i;" } } # Here are some classes with inheritance. # Base class. cp_test_ptype_class \ "ptype class A" "" "class" "A" \ { { field public "int a;" } { field public "int x;" } } # Derived class. cp_test_ptype_class \ "ptype class B" "" "class" "B" \ { { base "public A" } { field public "int b;" } { field public "int x;" } } # Derived class. cp_test_ptype_class \ "ptype class C" "" "class" "C" \ { { base "public A" } { field public "int c;" } { field public "int x;" } } # Derived class, multiple inheritance. cp_test_ptype_class \ "ptype class D" "" "class" "D" \ { { base "public B" } { base "public C" } { field public "int d;" } { field public "int x;" } } # Derived class. cp_test_ptype_class \ "ptype class E" "" "class" "E" \ { { base "public D" } { field public "int e;" } { field public "int x;" } } # This is a break from inheritance tests. # # gcc 2.X with stabs (stabs or stabs+?) used to have a problem with # static methods whose name is the same as their argument mangling. cp_test_ptype_class \ "ptype class Static" "" "class" "Static" \ { { method public "static void ii(int, int);" } } # Here are some virtual inheritance tests. # A virtual base class. cp_test_ptype_class \ "ptype class vA" "" "class" "vA" \ { { field public "int va;" } { field public "int vx;" } } # A derived class with a virtual base. cp_test_ptype_class \ "ptype class vB" "" "class" "vB" \ { { base "public virtual vA" } { vbase "vA" } { field public "int vb;" } { field public "int vx;" } } # Another derived class with a virtual base. cp_test_ptype_class \ "ptype class vC" "" "class" "vC" \ { { base "public virtual vA" } { vbase "vA" } { field public "int vc;" } { field public "int vx;" } } # A classic diamond class. cp_test_ptype_class \ "ptype class vD" "" "class" "vD" \ { { base "public virtual vB" } { base "public virtual vC" } { vbase "vC" } { vbase "vB" } { field public "int vd;" } { field public "int vx;" } } # A class derived from a diamond class. cp_test_ptype_class \ "ptype class vE" "" "class" "vE" \ { { base "public virtual vD" } { vbase "vD" } { field public "int ve;" } { field public "int vx;" } } # Another inheritance series. # A base class. cp_test_ptype_class \ "ptype class Base1" "" "class" "Base1" \ { { field public "int x;" } { method public "Base1(int);" } } # Another base class. cp_test_ptype_class \ "ptype class Foo" "" "class" "Foo" \ { { field public "int x;" } { field public "int y;" } { field public "static int st;" } { method public "Foo(int, int);" } { method public "int operator!();" } { method public "operator int();" } { method public "int times(int);" } } \ "" \ { { "operator int();" "int operator int();" { setup_kfail "gdb/1497" "*-*-*" } } { "operator int();" "int operator int(void);" { setup_kfail "gdb/1497" "*-*-*" } } } # A multiple inheritance derived class. cp_test_ptype_class \ "ptype class Bar" "" "class" "Bar" \ { { base "public Base1" } { base "public Foo" }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -