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

📄 classes.exp

📁 lwip在ucos上的移植
💻 EXP
📖 第 1 页 / 共 3 页
字号:
    gdb_test "print &Foo::x" ".* = .int\[ \]*\[( \]*Foo::\[*)\]+\[ \]*&Foo::x" "print &Foo::x"    gdb_test "print (int)&Foo::x" ".* = 0" "print (int)&Foo::x"    send_gdb "print (int)&Bar::y == 2*sizeof(int)\n"    gdb_expect {	-re ".* = true$nl$gdb_prompt $" {	    pass "print (int)&Bar::y == 2*sizeof(int)"	}	-re "There is no field named y.*$gdb_prompt $" {	    setup_xfail "*-*-*"	    fail "print (int)&Bar::y == 2*sizeof(int)"	}	-re ".*$gdb_prompt $" { fail "print (int)&Bar::y == 2*sizeof(int)" }	timeout { fail "print (int)&Bar::y == 2*sizeof(int) (timeout)" ; return }    }    send_gdb "next 2\n"    setup_xfail "*-*-*"    gdb_expect {	-re "$decimal\[ \t\]+inheritance3 \[)(\]+;$nl$gdb_prompt $" {}	-re ".*$gdb_prompt $" { fail "next to inheritance3" ; return }    }    clear_xfail "*-*-*"    setup_xfail_format "DWARF 1"    gdb_test "print (int)pmi == sizeof(int)" ".* = false" "print (int)pmi == sizeof(int)"}## Test static members.#proc test_static_members {} {    global gdb_prompt    global hex    global nl    send_gdb "print Foo::st\n"    gdb_expect {	-re ".* = 100$nl$gdb_prompt $" {	    pass "print Foo::st"	}	-re "There is no field named st.*$gdb_prompt $" {	    setup_xfail "*-*-*"	    fail "print Foo::st"	}	-re ".*$gdb_prompt $" { fail "print Foo::st" }       timeout { fail "print Foo::st (timeout)" ; return }    }    send_gdb "set foo.st = 200\n"    gdb_expect {	-re ".*$gdb_prompt $" {}    }    send_gdb "print bar.st\n"    gdb_expect {	-re ".* = 200$nl$gdb_prompt $" {	    pass "print bar.st"	}	-re "There is no member( or method|) named st.*$gdb_prompt $" {	    setup_xfail "*-*-*"	    fail "print bar.st"	}	-re ".*$gdb_prompt $" { fail "print bar.st" }       timeout { fail "print bar.st (timeout)" ; return }    }    send_gdb "print &foo.st\n"    gdb_expect {	-re ".* = .int \[*)\]+ $hex$nl$gdb_prompt $" {	    pass "print &foo.st"	}	-re "There is no member( or method|) named st.*$gdb_prompt $" {	    setup_xfail "*-*-*"	    fail "print &foo.st"	}	-re ".*$gdb_prompt $" { fail "print &foo.st" }       timeout { fail "print &foo.st (timeout)" ; return }    }    set got_bar_st 0    send_gdb "print &Bar::st\n"    gdb_expect {	-re ".* = .int \[*)\]+ $hex$nl$gdb_prompt $" {	    pass "print &Bar::st"	    set got_bar_st 1	}	-re "There is no field named st.*$gdb_prompt $" {	    setup_xfail "*-*-*"	    fail "print &Bar::st"	}	-re ".*$gdb_prompt $" { fail "print &Bar::st" }       timeout { fail "print &Bar::st (timeout)" ; return }    }    if $got_bar_st then {	gdb_test "print *\$" ".* = 200" "print *\$"    }    gdb_test "set print static-members off" ""    gdb_test "print csi" \	"{x = 10, y = 20}" \	"print csi without static members"    gdb_test "print cnsi" \	"{x = 30, y = 40}" \	"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"}proc do_tests {} {    global prms_id    global bug_id    global subdir    global objdir    global srcdir    global binfile    global gdb_prompt    set prms_id 0    set bug_id 0    # Start with a fresh gdb.    gdb_exit    gdb_start    gdb_reinitialize_dir $srcdir/$subdir    gdb_load $binfile    send_gdb "set language c++\n"    gdb_expect -re "$gdb_prompt $"    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    }    test_ptype_class_objects    if [ runto 'inheritance2(void)' ] then {	test_non_inherited_member_access	test_wrong_class_members	test_nonexistant_members    }    if [istarget "mips-idt-*"] then {	# Restart because IDT/SIM runs out of file descriptors.	gdb_exit	gdb_start	gdb_reinitialize_dir $srcdir/$subdir	gdb_load $binfile    }    if [ runto_main ] then {	test_pointers_to_class_members	test_static_members    }    if [istarget "mips-idt-*"] then {	# Restart because IDT/SIM runs out of file descriptors.	gdb_exit	gdb_start	gdb_reinitialize_dir $srcdir/$subdir	gdb_load $binfile    }     if [ runto marker_reg1 ] then {	gdb_test "finish" "Run till exit from.*" "finish from marker_reg1"	send_gdb "print v.method ()\n"	gdb_expect {	    -re "= 82.*$gdb_prompt $" {		pass "calling method for small class"	    }	    -re "Address requested for identifier .v. which is in a register.*$gdb_prompt $" {		setup_xfail "*-*-*" 2972		fail "calling method for small class"	    }	    -re ".*$gdb_prompt $" { fail "calling method for small class" }	    timeout { fail "calling method for small class (timeout)" }	    eof { fail "calling method for small class (eof)" }	}    }}do_tests# Some additional tests for enums inside classes# set a breakpoint and go theresend_gdb "break 516\n"   gdb_expect {      -re "Breakpoint \[0-9\] at.*$gdb_prompt $" { pass "set break 516" }   -re "$gdb_prompt $"                     { fail "set break 516" }   timeout                             { fail "(timeout) set break 516" }}send_gdb "continue\n"   gdb_expect {      -re "Continuing\\.\r\n\r\nBreakpoint \[0-9\]*, main....at.*misc\\.cc:516\r\n516.*\r\n$gdb_prompt $" { pass "continue" }   -re "$gdb_prompt $"                     { fail "continue" }   timeout                             { fail "(timeout) continue" }}# print the objectsend_gdb "print obj_with_enum\n"   gdb_expect {      -re "\\$\[0-9\]* = \\{priv_enum = red, x = 0\\}.*$gdb_prompt $" { pass "print obj_with_enum (1)" }   -re "$gdb_prompt $"                     { fail "print obj_with_enum (1)" }   timeout                             { fail "(timeout) print obj_with_enum (1)" }}send_gdb "next\n"   gdb_expect {      -re "$gdb_prompt $"                     { pass "next" }   timeout                             { fail "(timeout) next" }}# print the object againsend_gdb "print obj_with_enum\n"   gdb_expect {      -re "\\$\[0-9\]* = \\{priv_enum = green, x = 0\\}.*$gdb_prompt $" { pass "print obj_with_enum (2)" }   -re "$gdb_prompt $"                     { fail "print obj_with_enum (2)" }   timeout                             { fail "(timeout) print obj_with_enum (2)" }}# print out the enum membersend_gdb "print obj_with_enum.priv_enum\n"   gdb_expect {      -re "\\$\[0-9\]* = green.*$gdb_prompt $" { pass "print obj_with_enum.priv_enum" }   -re "$gdb_prompt $"                     { fail "print obj_with_enum.priv_enum" }   timeout                             { fail "(timeout) print obj_with_enum.priv_enum" }}# ptype on the enum member# The third success case is a little dubious, but it's not clear what# ought to be required of a ptype on a private enum... -sts 19990324send_gdb "ptype obj_with_enum.priv_enum\n"   gdb_expect {      -re "type = enum ClassWithEnum::PrivEnum \\{red, green, blue, yellow = 42\\}.*$gdb_prompt $" { pass "ptype obj_with_enum.priv_enum" }   -re "type = enum PrivEnum \\{red, green, blue, yellow = 42\\}.*$gdb_prompt $" { pass "ptype obj_with_enum.priv_enum" }   -re "type = enum \\{red, green, blue, yellow = 42\\}.*$gdb_prompt $" { pass "ptype obj_with_enum.priv_enum" }   -re "$gdb_prompt $"                     { fail "ptype obj_with_enum.priv_enum" }   timeout                             { fail "(timeout) ptype obj_with_enum.priv_enum" }}# ptype on the object# g++ is putting out the wrong debug info.  This works with aCCif {!$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 "$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 aCCif {!$hp_aCC_compiler} {setup_xfail "*-*-*"}send_gdb "print (ClassWithEnum::PrivEnum) 42\n"   gdb_expect {      -re "\\$\[0-9\]* = yellow.*$gdb_prompt $" { pass "print (ClassWithEnum::PrivEnum) 42" }   -re "$gdb_prompt $"                     { fail "print (ClassWithEnum::PrivEnum) 42" }   timeout                             { fail "(timeout) print (ClassWithEnum::PrivEnum) 42" }}send_gdb "maint demangle inheritance1__Fv\n"gdb_expect {   -re "inheritance1\\(void\\).*$gdb_prompt $" { pass "demangle" }   -re ".*$gdb_prompt $"   { fail "demangle" }   timeout           { fail "(timeout) demangle" }}

⌨️ 快捷键说明

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