📄 maint.exp
字号:
}proc maint_pass_if {val name} { if $val { pass $name } else { fail $name }}maint_pass_if $header "maint print objfiles: header"maint_pass_if $psymtabs "maint print objfiles: psymtabs"maint_pass_if $symtabs "maint print objfiles: symtabs"send_gdb "maint print psymbols\n"gdb_expect { -re "print-psymbols takes an output file name and optional symbol file name.*$gdb_prompt $"\ { pass "maint print psymbols w/o args" } -re ".*$gdb_prompt $" { fail "maint print psymbols w/o args" } timeout { fail "(timeout) maint print psymbols w/o args" } }send_gdb "maint print psymbols psymbols_output ${srcdir}/${subdir}/${srcfile}\n"gdb_expect { -re "^maint print psymbols psymbols_output \[^\n\]*\r\n$gdb_prompt $"\ { send_gdb "shell ls psymbols_output\n" gdb_expect { -re "psymbols_output\r\n$gdb_prompt $"\ { # We want this grep to be as specific as possible, # so it's less likely to match symbol file names in # psymbols_output. Yes, this actually happened; # poor expect got tons of output, and timed out # trying to match it. --- Jim Blandy <jimb@cygnus.com> send_gdb "shell grep 'main.*function' psymbols_output\n" gdb_expect { -re ".main., function, $hex.*$gdb_prompt $"\ { pass "maint print psymbols 1" } -re ".*main. .., function, $hex.*$gdb_prompt $"\ { pass "maint print psymbols 2" } -re ".*$gdb_prompt $" { fail "maint print psymbols" } timeout { fail "(timeout) maint print psymbols" } } gdb_test "shell rm -f psymbols_output" "" } -re ".*$gdb_prompt $" { fail "maint print psymbols" } timeout { fail "(timeout) maint print psymbols" } } } -re ".*$gdb_prompt $" { fail "maint print psymbols" } timeout { fail "(timeout) maint print psymbols" } }send_gdb "maint print msymbols\n"gdb_expect { -re "print-msymbols takes an output file name and optional symbol file name.*$gdb_prompt $"\ { pass "maint print msymbols w/o args" } -re ".*$gdb_prompt $" { fail "maint print msymbols w/o args" } timeout { fail "(timeout) maint print msymbols w/o args" } }send_gdb "maint print msymbols msymbols_output ${binfile}\n"gdb_expect { -re "^maint print msymbols msymbols_output \[^\n\]*\r\n$gdb_prompt $"\ { send_gdb "shell ls msymbols_output\n" gdb_expect { -re "msymbols_output\r\n$gdb_prompt $"\ { send_gdb "shell grep factorial msymbols_output\n" gdb_expect { -re "\\\[ *$decimal\\\] T\[ \t\]+$hex factorial.*$gdb_prompt $"\ { pass "maint print msymbols" } -re ".*$gdb_prompt $" { fail "maint print msymbols" } timeout { fail "(timeout) maint print msymbols" } } gdb_test "shell rm -f msymbols_output" "" } -re ".*$gdb_prompt $" { fail "maint print msymbols" } timeout { fail "(timeout) maint print msymbols" } } } -re ".*$gdb_prompt $" { fail "maint print msymbols" } timeout { fail "(timeout) maint print msymbols" } }send_gdb "maint print symbols\n"gdb_expect { -re "Arguments missing: an output file name and an optional symbol file name.*$gdb_prompt $"\ { pass "maint print symbols w/o args" } -re ".*$gdb_prompt $" { fail "maint print symbols w/o args" } timeout { fail "(timeout) maint print symbols w/o args" } }# Request symbols for one particular source file so that we don't try to# dump the symbol information for the entire C library - over 500MB nowadays# for GNU libc.send_gdb "maint print symbols symbols_output ${srcdir}/${subdir}/${srcfile}\n"gdb_expect { -re "^maint print symbols symbols_output \[^\n\]*\r\n$gdb_prompt $"\ { send_gdb "shell ls symbols_output\n" gdb_expect { -re "symbols_output\r\n$gdb_prompt $"\ { # See comments for `maint print psymbols'. send_gdb "shell grep 'main(.*block' symbols_output\n" gdb_expect { -re "int main\\(int, char \\*\\*, char \\*\\*\\); block.*$gdb_prompt $"\ { pass "maint print symbols" } -re ".*$gdb_prompt $" { fail "maint print symbols" } timeout { fail "(timeout) maint print symbols" } } gdb_test "shell rm -f symbols_output" "" } -re ".*$gdb_prompt $" { fail "maint print symbols" } timeout { fail "(timeout) maint print symbols" } } } -re ".*$gdb_prompt $" { fail "maint print symbols" } timeout { fail "(timeout) maint print symbols" } }send_gdb "maint print type argc\n"gdb_expect { -re "type node $hex\r\nname .int. \\($hex\\)\r\ntagname .<NULL>. \\($hex\\)\r\ncode $hex \\(TYPE_CODE_INT\\)\r\nlength \[24\]\r\nupper_bound_type $hex \\(BOUND_SIMPLE\\)\r\nlower_bound_type $hex \\(BOUND_SIMPLE\\)\r\nobjfile $hex\r\ntarget_type $hex\r\npointer_type $hex\r\nreference_type $hex\r\ntype_chain $hex\r\ninstance_flags $hex\r\nflags $hex\r\nnfields 0 $hex\r\nvptr_basetype $hex\r\nvptr_fieldno -1\r\ntype_specific $hex\r\n$gdb_prompt $"\ { pass "maint print type" } -re ".*$gdb_prompt $" { fail "maint print type" } timeout { fail "(timeout) maint print type" } }if [istarget "hppa*-*-11*"] { setup_xfail hppa*-*-*11* CLLbs14860 send "maint print unwind &main\n" expect { -re ".*unwind_table_entry \\($hex\\):\r\n\tregion_start = $hex <main>\r\n\tregion_end = $hex <main\\+\[0-9\]*>\r\n\tflags = Args_stored Save_RP\r\n\tRegion_description = $hex\r\n\tEntry_FR = $hex\r\n\tEntry_GR = $hex\r\n\tTotal_frame_size = $hex\r\n$gdb_prompt $"\ { pass "maint print unwind" } -re ".*unwind_table_entry \\($hex\\):\r\n\tregion_start = $hex <main>\r\n\tregion_end = $hex <main\\+\[0-9\]*>\r\n\tflags = Args_stored Save_RP\r\n\tFLD = $hex\r\n\tFLD = $hex\r\n\tFLD = $hex\r\n\tFLD = $hex\r\n$gdb_prompt $"\ { xfail "maint print unwind" } -re ".*$gdb_prompt $" { xfail "maint info unwind" } timeout { fail "(timeout) maint print unwind" } }}set oldtimeout $timeoutset timeout [expr $timeout + 300]# It'd be nice to check for every possible section. However, that's# problematic, since the relative ordering wanders from release to# release of the compilers. Instead, we'll just check for two# sections which appear to always come out in the same relative# order. (If that changes, then we should just check for one# section.)## And by the way: This testpoint will break for PA64, where a.out's# are ELF files.#send_gdb "maint info sections\n"gdb_expect { -re "Exec file:\r\n.*break($EXEEXT)?., file type.*$gdb_prompt $"\ { pass "maint info sections" } -re ".*$gdb_prompt $" { fail "maint info sections" } timeout { fail "(timeout) maint info sections" } }# Test for new option: maint info sections <section name># If you don't have a .text section, this will require tweaking.send_gdb "maint info sections .text\n"gdb_expect { -re ".*bss.*$gdb_prompt $" { fail "maint info sections .text" } -re ".*data.*$gdb_prompt $" { fail "maint info sections .text" } -re ".* .text .*$gdb_prompt $" { pass "maint info sections .text" } -re ".*$gdb_prompt $" { fail "maint info sections .text" } timeout { fail "(timeout) maint info sections .text" }}# Test for new option: CODE section flag# If your data section is tagged CODE, xfail this test.send_gdb "maint info sections CODE\n"gdb_expect { -re ".* .data .*$gdb_prompt $" { fail "maint info sections CODE" } -re ".* .text .*$gdb_prompt $" { pass "maint info sections CODE" } -re ".*$gdb_prompt $" { fail "maint info sections CODE" } timeout { fail "(timeout) maint info sections CODE" }}# Test for new option: DATA section flag# If your text section is tagged DATA, xfail this test.send_gdb "maint info sections DATA\n"gdb_expect { -re ".* .text .*$gdb_prompt $" { fail "maint info sections DATA" } -re ".* .data .*$gdb_prompt $" { pass "maint info sections DATA" } -re ".*$gdb_prompt $" { fail "maint info sections DATA" } timeout { fail "(timeout) maint info sections DATA" }}set bp_location6 [gdb_get_line_number "set breakpoint 6 here"]send_gdb "maint info breakpoints\n"gdb_expect { -re "Num\[ \t\]+Type\[ \t\]+Disp\[ \t\]+Enb\[ \t\]+Address\[ \t\]+What\r\n1\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex\[ \t\]+in main at.*break.c:$bp_location6\r\n\[ \t\]+breakpoint already hit 1 time\r\n.*$gdb_prompt $"\ { pass "maint info breakpoints" } -re "Num\[ \t\]+Type\[ \t\]+Disp\[ \t\]+Enb\[ \t\]+Address\[ \t\]+What\r\n1\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex in main at.*break.c:$bp_location6\r\n\[ \t\]+breakpoint already hit 1 time\r\n-1\[ \t\]+shlib events\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex.*breakpoint already hit.*$gdb_prompt $"\ { pass "maint info breakpoints (with shlib events)" } -re ".*$gdb_prompt $" { fail "maint info breakpoints" } timeout { fail "(timeout) maint info breakpoints" }}send_gdb "maint print\n"gdb_expect { -re "\"maintenance print\" must be followed by the name of a print command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\ { pass "maint print w/o args" } -re ".*$gdb_prompt $" { fail "maint print w/o args" } timeout { fail "(timeout) maint print w/o args" } }send_gdb "maint info\n"gdb_expect { -re "\"maintenance info\" must be followed by the name of an info command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\ { pass "maint info w/o args" } -re ".*$gdb_prompt $" { fail "maint info w/o args" } timeout { fail "(timeout) maint info w/o args" } }send_gdb "maint\n"gdb_expect { -re "\"maintenance\" must be followed by the name of a maintenance command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\ { pass "maint w/o args" } -re ".*$gdb_prompt $" { fail "maint w/o args" }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -