⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inherit.exp

📁 lwip在ucos上的移植
💻 EXP
📖 第 1 页 / 共 3 页
字号:
# Copyright (C) 1992, 1993, 1994, 1997, 1999 Free Software Foundation, Inc.# This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.# # This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# GNU General Public License for more details.# # You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  # Please email any bugs, comments, and/or additions to this file to:# bug-gdb@prep.ai.mit.edu# This file was written by Fred Fish. (fnf@cygnus.com)set ws "\[\r\n\t \]+"set nl "\[\r\n\]+"# The format of a g++ virtual base pointer.set vbptr "(_vb\[$.\]|__vb_)\[0-9\]?"if $tracelevel then {	strace $tracelevel}if { [skip_cplus_tests] } { continue }# Note - create separate "inherit" executable from misc.ccset testfile "inherit"set srcfile misc.ccset binfile ${objdir}/${subdir}/${testfile}# Create and source the file that provides information about the compiler# used to compile the test case.if [get_compiler_info ${binfile} "c++"] {    return -1}if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."}## Single inheritance, print individual members.#proc test_print_si_members {} {    # Print all members of g_A using fully qualified form.    gdb_test "print g_A.A::a" ".* = 1" "print g_A.A::a"    gdb_test "print g_A.A::x" ".* = 2" "print g_A.A::x"    # Print members of g_A using nonambiguous compact form.    gdb_test "print g_A.a" ".* = 1" "print g_A.a"    gdb_test "print g_A.x" ".* = 2" "print g_A.x"    # Print all members of g_B using fully qualified form.    gdb_test "print g_B.A::a" ".* = 3" "print g_B.A::a"    gdb_test "print g_B.A::x" ".* = 4" "print g_B.A::x"    gdb_test "print g_B.B::b" ".* = 5" "print g_B.B::b"    gdb_test "print g_B.B::x" ".* = 6" "print g_B.B::x"    # Print members of g_B using nonambiguous compact form.    setup_xfail_format "DWARF 1"    gdb_test "print g_B.a" ".* = 3" "print g_B.a"    gdb_test "print g_B.b" ".* = 5" "print g_B.b"    gdb_test "print g_B.x" ".* = 6" "print g_B.x"    # Print all members of g_C using fully qualified form.    gdb_test "print g_C.A::a" ".* = 7" "print g_C.A::a"    gdb_test "print g_C.A::x" ".* = 8" "print g_C.A::x"    gdb_test "print g_C.C::c" ".* = 9" "print g_C.C::c"    gdb_test "print g_C.C::x" ".* = 10" "print g_C.C::x"    # Print members of g_C using nonambiguous compact form.    setup_xfail_format "DWARF 1"    gdb_test "print g_C.a" ".* = 7" "print g_C.a"    gdb_test "print g_C.c" ".* = 9" "print g_C.c"    gdb_test "print g_C.x" ".* = 10" "print g_C.x"}## Single inheritance, print type definitions.#proc test_ptype_si {} {    global gdb_prompt    global ws    global nl    global hp_aCC_compiler    # Print class A as a type.    send_gdb "ptype A\n"    gdb_expect {	-re "type = class A \{$nl.*\[ \]*int a;$nl\[ \]*int x;$nl.*\[ \]*\}$nl$gdb_prompt $" {	    pass "ptype A (FIXME)"	}	-re "type = struct A \{$nl\[ \]*int a;$nl\[ \]*int x;$nl\[ \]*\}$nl$gdb_prompt $" {	    setup_xfail "*-*-*"	    fail "ptype A (FIXME)"	}	-re ".*$gdb_prompt $" { fail "ptype A" }	timeout { fail "ptype A (timeout)" ; return }    }    # Print class A as an explicit class.    send_gdb "ptype class A\n"    gdb_expect {	-re "type = class A \{$nl.*\[ \]*int a;$nl\[ \]*int x;$nl.*\[ \]*\}$nl$gdb_prompt $" {	    pass "ptype class A (FIXME)"	}	-re "type = struct A \{$nl\[ \]*int a;$nl\[ \]*int x;$nl\[ \]*\}$nl$gdb_prompt $" {            if {!$hp_aCC_compiler} {setup_xfail "*-*-*"}	    fail "ptype class A (FIXME)"	}	-re ".*$gdb_prompt $" { fail "ptype class A" }	timeout { fail "ptype class A (timeout)" ; return }    }    # Print type of an object of type A.    send_gdb "ptype g_A\n"    gdb_expect {	-re "type = class A \{$nl.*\[ \]*int a;$nl\[ \]*int x;$nl.*\[ \]*\}$nl$gdb_prompt $" {	    pass "ptype g_A (FIXME)"	}	-re "type = struct A \{$nl\[ \]*int a;$nl\[ \]*int x;$nl\[ \]*\}$nl$gdb_prompt $" {            if {!$hp_aCC_compiler} {setup_xfail "*-*-*"}	    fail "ptype g_A (FIXME)"	}	-re ".*$gdb_prompt $" { fail "ptype g_A" }	timeout { fail "ptype g_A (timeout)" ; return }    }    # Print class B as a type.    setup_xfail_format "DWARF 1"    gdb_test "ptype B" "type = class B : public A \{$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    # cygnus-2.3.3-930417.  PR 2819.    send_gdb "ptype tagless_struct\n"    gdb_expect {	-re "type = class \{${ws}public:${ws}int one;${ws}int two;${ws}tagless_struct & operator=\\(tagless_struct &\\);${ws}\\\$_1 \\(tagless_struct &\\);${ws}\\\$_1 \\(\\);${ws}\}$nl$gdb_prompt $" {	    pass "ptype tagless struct"	}	-re "type = (struct|class).*\{.*int one;.*int two;.*\}$nl$gdb_prompt $" {	    pass "ptype tagless struct (obsolete gcc or gdb)"	}	-re ".*$gdb_prompt $" {	    fail "ptype tagless struct"	}	timeout {	    fail "ptype tagless struct (timeout)"	}    }    send_gdb "ptype v_tagless\n"    gdb_expect {	-re "type = class \{${ws}public:${ws}int one;${ws}int two;${ws}tagless_struct & operator=\\(tagless_struct &\\);${ws}\\\$_1 \\(tagless_struct &\\);${ws}\\\$_1 \\(\\);${ws}\}$nl$gdb_prompt $" {	    pass "ptype variable of type tagless struct"	}	-re "type = (struct|class).*\{.*int one;.*int two;.*\}$nl$gdb_prompt $" {	    pass "ptype variable of type tagless struct (obsolete gcc or gdb)"	}	-re ".*$gdb_prompt $" {	    fail "ptype variable of type tagless struct"	}	timeout {	    fail "ptype variable of type tagless struct (timeout)"	}    }}## Single inheritance, print complete classes.#proc test_print_si_classes {} {    # Print all members of g_A.    gdb_test "print g_A" ".* = \{a = 1, x = 2\}" "print g_A"    # Print all members of g_B.    setup_xfail_format "DWARF 1"    gdb_test "print g_B" ".* = \{\<(class |)A\> = \{a = 3, x = 4\}, b = 5, x = 6\}" "print g_B"    # Print all members of g_C.    setup_xfail_format "DWARF 1"    gdb_test "print g_C" ".* = \{\<(class |)A\> = \{a = 7, x = 8\}, c = 9, x = 10\}" "print g_C"}## Single inheritance, print anonymous unions.# GDB versions prior to 4.14 entered an infinite loop when printing# the type of a class containing an anonymous union, and they were also# incapable of printing the member of an anonymous union.# We test the printing of the member first, and perform the other tests# only if the test succeeds, to avoid the infinite loop.#proc test_print_anon_union {} {    global gdb_prompt    global ws    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 $" {	    pass "print variable of type anonymous union"	}	-re ".* = .*\{one = 1, ( = |)\{a = 2, b = .*\}\}$nl$gdb_prompt $" {	    pass "print variable of type anonymous union (obsolete gcc or gdb)"	}	-re ".*$nl$gdb_prompt $" {	    fail "print variable of type anonymous union"	}	timeout {	    fail "print variableof type anonymous union (timeout)"	}    }    setup_xfail_format "DWARF 1"    send_gdb "ptype g_anon_union\n"    gdb_expect {	-re "type = class class_with_anon_union \{${ws}public:${ws}int one;${ws}union \{${ws}public:${ws}int a;${ws}long int b;${ws}union \{\.\.\.\} & operator=\\(union \{\.\.\.\} &\\);${ws}\\\$_0 \\(union \{\.\.\.\} &\\);${ws}\\\$_0 \\(\\);${ws}\};${ws}class_with_anon_union & operator=\\(class_with_anon_union const &\\);${ws}class_with_anon_union\\(class_with_anon_union const &\\);${ws}class_with_anon_union\\(void\\);${ws}\}$nl$gdb_prompt $" {	    pass "print type of anonymous union"	}	-re "type = (struct|class).*\{.*int one;.*union \{.*int a;.*(long|long int|int) b;.*\};.*\}$nl$gdb_prompt $" {	    pass "print type of anonymous union (obsolete gcc or gdb)"	}	-re ".*$nl$gdb_prompt $" {	    fail "print type of anonymous union"	}	timeout {	    fail "print type of anonymous union (timeout)"	}    }}## Multiple inheritance, print individual members.#proc test_print_mi_members {} {    global gdb_prompt    global nl    global hp_aCC_compiler    # Print all members of g_A.    gdb_test "print g_A.A::a" ".* = 1" "print g_A.A::a"        gdb_test "print g_A.A::x" ".* = 2" "print g_A.A::x"    # Print all members of g_B.    gdb_test "print g_B.A::a" ".* = 3" "print g_B.A::a"    gdb_test "print g_B.A::x" ".* = 4" "print g_B.A::x"    gdb_test "print g_B.B::b" ".* = 5" "print g_B.B::b"    gdb_test "print g_B.B::x" ".* = 6" "print g_B.B::x"    # Print all members of g_C.    gdb_test "print g_C.A::a" ".* = 7" "print g_C.A::a"    gdb_test "print g_C.A::x" ".* = 8" "print g_C.A::x"    gdb_test "print g_C.C::c" ".* = 9" "print g_C.C::c"    gdb_test "print g_C.C::x" ".* = 10" "print g_C.C::x"    # Print all members of g_D.    # The following is ambiguous, and gdb should detect this.    # For now, accept gdb's behavior as an expected failure if it    # simply prints either member correctly.    if {!$hp_aCC_compiler} {setup_xfail "*-*-*"}    send_gdb "print g_D.A::a\n"    gdb_expect {		-re "warning: A ambiguous; using D::C::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 15$nl$gdb_prompt $" {	    pass "print g_D.A::a"	}	-re "warning: A ambiguous; using D::B::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 11$nl$gdb_prompt $" {	    pass "print g_D.A::a (using B)"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -