📄 maint.exp
字号:
# Copyright 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# 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 Elena Zannoni (ezannoni@cygnus.com)# this file tests maintenance commands and help on those.# source file used is break.c#maintenance check-symtabs -- Check consistency of psymtabs and symtabs#maintenance space -- Set the display of space usage#maintenance set -- Set GDB internal variables used by the GDB maintainer#maintenance show -- Show GDB internal variables used by the GDB maintainer#maintenance time -- Set the display of time usage#maintenance demangle -- Demangle a C++ mangled name#maintenance dump-me -- Get fatal error; make debugger dump its core#maintenance print -- Maintenance command for printing GDB internal state#maintenance info -- Commands for showing internal info about the program being debugged#maintenance internal-error -- Give GDB an internal error.##maintenance print dummy-frames -- Print the dummy frame stack#maintenance print statistics -- Print statistics about internal gdb state#maintenance print objfiles -- Print dump of current object file definitions#maintenance print psymbols -- Print dump of current partial symbol definitions#maintenance print msymbols -- Print dump of current minimal symbol definitions#maintenance print symbols -- Print dump of current symbol definitions#maintenance print type -- Print a type chain for a given symbol#maintenance print unwind -- Print unwind table entry at given address###maintenance info sections -- List the BFD sections of the exec and core files#maintenance info breakpoints -- Status of all breakpoints#if $tracelevel then { strace $tracelevel }global usestubs## test running programs#set prms_id 0set bug_id 0set testfile "break"set srcfile ${testfile}.cset srcfile1 ${testfile}1.cset binfile ${objdir}/${subdir}/${testfile}if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug additional_flags=-w}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."}if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug additional_flags=-w}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."}if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug additional_flags=-w}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."}gdb_exitgdb_startgdb_reinitialize_dir $srcdir/$subdirgdb_load ${binfile}if ![runto_main] then { perror "tests suppressed"}# The commands we test here produce many lines of output; disable "press # <return> to continue" prompts.send_gdb "set height 0\n"gdb_expect -re "$gdb_prompt $"# use a larger expect input buffer for long help outputs.match_max 6000## this command does not produce any output# unless there is some problem with the symtabs and psymtabs# so that branch will really never be covered in this tests here!!## guo: on linux this command output is huge. for some reason splitting up# the regexp checks works.#send_gdb "maint check-symtabs\n"gdb_expect { -re "^maint check-symtabs" { gdb_expect { -re "$gdb_prompt $" \ { pass "maint check-symtabs" } timeout { fail "(timeout) maint check-symtabs" } } } -re ".*$gdb_prompt $" { fail "maint check-symtabs" } timeout { fail "(timeout) maint check-symtabs" } }send_gdb "maint space\n"gdb_expect { -re "\"maintenance space\" takes a numeric argument\\..*$gdb_prompt $"\ { pass "maint space" } -re ".*$gdb_prompt $" { fail "maint space" } timeout { fail "(timeout) maint space" } }send_gdb "maint space 1\n"gdb_expect { -re "Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\ { pass "maint space 1" } -re ".*$gdb_prompt $" { fail "maint space 1" } timeout { fail "(timeout) maint space 1" } }send_gdb "maint time\n"gdb_expect { -re "\"maintenance time\" takes a numeric argument\\..*Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\ { pass "maint time" } -re ".*$gdb_prompt $" { fail "maint time" } timeout { fail "(timeout) maint time" } }send_gdb "maint time 1\n"gdb_expect { -re "Command execution time: $decimal.*Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\ { pass "maint time 1" } -re ".*$gdb_prompt $" { fail "maint time 1" } timeout { fail "(timeout) maint time 1" } }send_gdb "maint time 0\n"gdb_expect { -re "Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\ { pass "maint time 0" } -re ".*$gdb_prompt $" { fail "maint time 0" } timeout { fail "(timeout) maint time 0" } }send_gdb "maint space 0\n"gdb_expect { -re "maint space 0\r\n$gdb_prompt $"\ { pass "maint space 0" } -re ".*$gdb_prompt $" { fail "maint space 0" } timeout { fail "(timeout) maint space 0" } }send_gdb "maint demangle\n"gdb_expect { -re "\"maintenance demangle\" takes an argument to demangle\\..*$gdb_prompt $"\ { pass "maint demangle" } -re ".*$gdb_prompt $" { fail "maint demangle" } timeout { fail "(timeout) maint demangle" } }send_gdb "maint demangle main\n"gdb_expect { -re "Can't demangle \"main\".*$gdb_prompt $"\ { pass "maint demangle" } -re ".*$gdb_prompt $" { fail "maint demangle" } timeout { fail "(timeout) maint demangle" } }send_gdb "maint print statistics\n"gdb_expect { -re "Statistics for.*break.*Number of \"minimal\" symbols read.*Number of \"partial\" symbols read.*Number of \"types\" defined.*Number of psym tables \\(not yet expanded\\).*Number of symbol tables.*Number of symbol tables with line tables.*Number of symbol tables with blockvectors.*Total memory used for psymbol obstack.*Total memory used for psymbol cache.*Total memory used for symbol obstack.*Total memory used for type obstack.*$gdb_prompt $"\ { # Old output for gdb 6.0 and earlier pass "maint print statistics" } -re "Statistics for.*break.*Number of \"minimal\" symbols read.*Number of \"partial\" symbols read.*Number of \"types\" defined.*Number of psym tables \\(not yet expanded\\).*Number of symbol tables.*Number of symbol tables with line tables.*Number of symbol tables with blockvectors.*Total memory used for objfile obstack.*Total memory used for psymbol cache.*Total memory used for macro cache.*$gdb_prompt $"\ { pass "maint print statistics" } -re ".*$gdb_prompt $" { fail "maint print statistics" } timeout { fail "(timeout) maint print statistics" } }# There aren't any ...gdb_test "maint print dummy-frames" ""send_gdb "maint print objfiles\n"# To avoid timeouts, we avoid expects with many .* patterns that match# many lines. Instead, we keep track of which milestones we've seen# in the output, and stop when we've seen all of them.set header 0set psymtabs 0set symtabs 0set keep_looking 1while {$keep_looking} { gdb_expect { -re ".*Object file.*break($EXEEXT)?: Objfile at $hex, bfd at $hex, \[0-9\]* minsyms\[\r\t \]+\n" { set header 1 } -re ".*Psymtabs:\[\r\t \]+\n" { set psymtabs 1 } -re ".*Symtabs:\[\r\t \]+\n" { set symtabs 1 } -re ".*$gdb_prompt $" { set keep_looking 0 } timeout { fail "(timeout) maint print objfiles" set keep_looking 0 } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -