| 1 | # Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. |
| 2 | |
| 3 | # This program is free software; you can redistribute it and/or modify |
| 4 | # it under the terms of the GNU General Public License as published by |
| 5 | # the Free Software Foundation; either version 2 of the License, or |
| 6 | # (at your option) any later version. |
| 7 | # |
| 8 | # This program is distributed in the hope that it will be useful, |
| 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | # GNU General Public License for more details. |
| 12 | # |
| 13 | # You should have received a copy of the GNU General Public License |
| 14 | # along with this program; if not, write to the Free Software |
| 15 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 16 | |
| 17 | # Please email any bugs, comments, and/or additions to this file to: |
| 18 | # bug-gdb@prep.ai.mit.edu |
| 19 | |
| 20 | # This file was written by Elena Zannoni (ezannoni@cygnus.com) |
| 21 | |
| 22 | # this file tests maintenance commands and help on those. |
| 23 | |
| 24 | # source file used is break.c |
| 25 | |
| 26 | |
| 27 | #maintenance check-symtabs -- Check consistency of psymtabs and symtabs |
| 28 | #maintenance space -- Set the display of space usage |
| 29 | #maintenance set -- Set GDB internal variables used by the GDB maintainer |
| 30 | #maintenance show -- Show GDB internal variables used by the GDB maintainer |
| 31 | #maintenance time -- Set the display of time usage |
| 32 | #maintenance demangle -- Demangle a C++ mangled name |
| 33 | #maintenance dump-me -- Get fatal error; make debugger dump its core |
| 34 | #maintenance print -- Maintenance command for printing GDB internal state |
| 35 | #maintenance info -- Commands for showing internal info about the program being debugged |
| 36 | #maintenance internal-error -- Give GDB an internal error. |
| 37 | # |
| 38 | #maintenance print dummy-frames -- Print the dummy frame stack |
| 39 | #maintenance print statistics -- Print statistics about internal gdb state |
| 40 | #maintenance print objfiles -- Print dump of current object file definitions |
| 41 | #maintenance print psymbols -- Print dump of current partial symbol definitions |
| 42 | #maintenance print msymbols -- Print dump of current minimal symbol definitions |
| 43 | #maintenance print symbols -- Print dump of current symbol definitions |
| 44 | #maintenance print type -- Print a type chain for a given symbol |
| 45 | #maintenance print unwind -- Print unwind table entry at given address |
| 46 | # |
| 47 | # |
| 48 | #maintenance info sections -- List the BFD sections of the exec and core files |
| 49 | #maintenance info breakpoints -- Status of all breakpoints |
| 50 | # |
| 51 | |
| 52 | |
| 53 | |
| 54 | if $tracelevel then { |
| 55 | strace $tracelevel |
| 56 | } |
| 57 | |
| 58 | global usestubs |
| 59 | |
| 60 | # |
| 61 | # test running programs |
| 62 | # |
| 63 | set prms_id 0 |
| 64 | set bug_id 0 |
| 65 | |
| 66 | set testfile "break" |
| 67 | set srcfile ${testfile}.c |
| 68 | set binfile ${objdir}/${subdir}/${testfile} |
| 69 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" |
| 70 | } { |
| 71 | gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." |
| 72 | } |
| 73 | |
| 74 | |
| 75 | gdb_exit |
| 76 | gdb_start |
| 77 | gdb_reinitialize_dir $srcdir/$subdir |
| 78 | gdb_load ${binfile} |
| 79 | |
| 80 | if ![runto_main] then { |
| 81 | perror "tests suppressed" |
| 82 | } |
| 83 | |
| 84 | |
| 85 | # The commands we test here produce many lines of output; disable "press |
| 86 | # <return> to continue" prompts. |
| 87 | send_gdb "set height 0\n" |
| 88 | gdb_expect -re "$gdb_prompt $" |
| 89 | |
| 90 | # use a larger expect input buffer for long help outputs. |
| 91 | match_max 6000 |
| 92 | |
| 93 | # |
| 94 | # this command does not produce any output |
| 95 | # unless there is some problem with the symtabs and psymtabs |
| 96 | # so that branch will really never be covered in this tests here!! |
| 97 | # |
| 98 | |
| 99 | # guo: on linux this command output is huge. for some reason splitting up |
| 100 | # the regexp checks works. |
| 101 | # |
| 102 | send_gdb "maint check-symtabs\n" |
| 103 | gdb_expect { |
| 104 | -re "^maint check-symtabs" { |
| 105 | gdb_expect { |
| 106 | -re "$gdb_prompt $" \ |
| 107 | { pass "maint check-symtabs" } |
| 108 | timeout { fail "(timeout) maint check-symtabs" } |
| 109 | } |
| 110 | } |
| 111 | -re ".*$gdb_prompt $" { fail "maint check-symtabs" } |
| 112 | timeout { fail "(timeout) maint check-symtabs" } |
| 113 | } |
| 114 | |
| 115 | send_gdb "maint space\n" |
| 116 | gdb_expect { |
| 117 | -re "\"maintenance space\" takes a numeric argument\\..*$gdb_prompt $"\ |
| 118 | { pass "maint space" } |
| 119 | -re ".*$gdb_prompt $" { fail "maint space" } |
| 120 | timeout { fail "(timeout) maint space" } |
| 121 | } |
| 122 | |
| 123 | send_gdb "maint space 1\n" |
| 124 | gdb_expect { |
| 125 | -re "Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\ |
| 126 | { pass "maint space 1" } |
| 127 | -re ".*$gdb_prompt $" { fail "maint space 1" } |
| 128 | timeout { fail "(timeout) maint space 1" } |
| 129 | } |
| 130 | |
| 131 | |
| 132 | send_gdb "maint time\n" |
| 133 | gdb_expect { |
| 134 | -re "\"maintenance time\" takes a numeric argument\\..*Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\ |
| 135 | { pass "maint time" } |
| 136 | -re ".*$gdb_prompt $" { fail "maint time" } |
| 137 | timeout { fail "(timeout) maint time" } |
| 138 | } |
| 139 | |
| 140 | send_gdb "maint time 1\n" |
| 141 | gdb_expect { |
| 142 | -re "Command execution time: $decimal.*Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\ |
| 143 | { pass "maint time 1" } |
| 144 | -re ".*$gdb_prompt $" { fail "maint time 1" } |
| 145 | timeout { fail "(timeout) maint time 1" } |
| 146 | } |
| 147 | |
| 148 | send_gdb "maint time 0\n" |
| 149 | gdb_expect { |
| 150 | -re "Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\ |
| 151 | { pass "maint time 0" } |
| 152 | -re ".*$gdb_prompt $" { fail "maint time 0" } |
| 153 | timeout { fail "(timeout) maint time 0" } |
| 154 | } |
| 155 | |
| 156 | |
| 157 | send_gdb "maint space 0\n" |
| 158 | gdb_expect { |
| 159 | -re "maint space 0\r\n$gdb_prompt $"\ |
| 160 | { pass "maint space 0" } |
| 161 | -re ".*$gdb_prompt $" { fail "maint space 0" } |
| 162 | timeout { fail "(timeout) maint space 0" } |
| 163 | } |
| 164 | |
| 165 | send_gdb "maint demangle\n" |
| 166 | gdb_expect { |
| 167 | -re "\"maintenance demangle\" takes an argument to demangle\\..*$gdb_prompt $"\ |
| 168 | { pass "maint demangle" } |
| 169 | -re ".*$gdb_prompt $" { fail "maint demangle" } |
| 170 | timeout { fail "(timeout) maint demangle" } |
| 171 | } |
| 172 | |
| 173 | send_gdb "maint demangle main\n" |
| 174 | gdb_expect { |
| 175 | -re "Can't demangle \"main\".*$gdb_prompt $"\ |
| 176 | { pass "maint demangle" } |
| 177 | -re ".*$gdb_prompt $" { fail "maint demangle" } |
| 178 | timeout { fail "(timeout) maint demangle" } |
| 179 | } |
| 180 | |
| 181 | |
| 182 | send_gdb "maint print statistics\n" |
| 183 | gdb_expect { |
| 184 | -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 $"\ |
| 185 | { pass "maint print statistics" } |
| 186 | -re ".*$gdb_prompt $" { fail "maint print statistics" } |
| 187 | timeout { fail "(timeout) maint print statistics" } |
| 188 | } |
| 189 | |
| 190 | # There aren't any ... |
| 191 | gdb_test "maint print dummy-frames" "" |
| 192 | |
| 193 | send_gdb "maint print objfiles\n" |
| 194 | |
| 195 | # To avoid timeouts, we avoid expects with many .* patterns that match |
| 196 | # many lines. Instead, we keep track of which milestones we've seen |
| 197 | # in the output, and stop when we've seen all of them. |
| 198 | |
| 199 | set header 0 |
| 200 | set psymtabs 0 |
| 201 | set symtabs 0 |
| 202 | set keep_looking 1 |
| 203 | |
| 204 | while {$keep_looking} { |
| 205 | gdb_expect { |
| 206 | |
| 207 | -re ".*Object file.*break($EXEEXT)?: Objfile at $hex, bfd at $hex, \[0-9\]* minsyms\[\r\t \]+\n" { set header 1 } |
| 208 | -re ".*Psymtabs:\[\r\t \]+\n" { set psymtabs 1 } |
| 209 | -re ".*Symtabs:\[\r\t \]+\n" { set symtabs 1 } |
| 210 | |
| 211 | -re ".*$gdb_prompt $" { |
| 212 | set keep_looking 0 |
| 213 | } |
| 214 | timeout { |
| 215 | fail "(timeout) maint print objfiles" |
| 216 | set keep_looking 0 |
| 217 | } |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | proc maint_pass_if {val name} { |
| 222 | if $val { pass $name } else { fail $name } |
| 223 | } |
| 224 | |
| 225 | maint_pass_if $header "maint print objfiles: header" |
| 226 | maint_pass_if $psymtabs "maint print objfiles: psymtabs" |
| 227 | maint_pass_if $symtabs "maint print objfiles: symtabs" |
| 228 | |
| 229 | send_gdb "maint print psymbols\n" |
| 230 | gdb_expect { |
| 231 | -re "print-psymbols takes an output file name and optional symbol file name.*$gdb_prompt $"\ |
| 232 | { pass "maint print psymbols w/o args" } |
| 233 | -re ".*$gdb_prompt $" { fail "maint print psymbols w/o args" } |
| 234 | timeout { fail "(timeout) maint print psymbols w/o args" } |
| 235 | } |
| 236 | |
| 237 | send_gdb "maint print psymbols psymbols_output ${srcdir}/${subdir}/${srcfile}\n" |
| 238 | gdb_expect { |
| 239 | -re "^maint print psymbols psymbols_output \[^\n\]*\r\n$gdb_prompt $"\ |
| 240 | { |
| 241 | send_gdb "shell ls psymbols_output\n" |
| 242 | gdb_expect { |
| 243 | -re "psymbols_output\r\n$gdb_prompt $"\ |
| 244 | { |
| 245 | # We want this grep to be as specific as possible, |
| 246 | # so it's less likely to match symbol file names in |
| 247 | # psymbols_output. Yes, this actually happened; |
| 248 | # poor expect got tons of output, and timed out |
| 249 | # trying to match it. --- Jim Blandy <jimb@cygnus.com> |
| 250 | send_gdb "shell grep 'main.*function' psymbols_output\n" |
| 251 | gdb_expect { |
| 252 | -re ".main., function, $hex.*$gdb_prompt $"\ |
| 253 | { pass "maint print psymbols 1" } |
| 254 | -re ".*main. .., function, $hex.*$gdb_prompt $"\ |
| 255 | { pass "maint print psymbols 2" } |
| 256 | -re ".*$gdb_prompt $" { fail "maint print psymbols" } |
| 257 | timeout { fail "(timeout) maint print psymbols" } |
| 258 | } |
| 259 | gdb_test "shell rm -f psymbols_output" "" |
| 260 | |
| 261 | } |
| 262 | -re ".*$gdb_prompt $" { fail "maint print psymbols" } |
| 263 | timeout { fail "(timeout) maint print psymbols" } |
| 264 | } |
| 265 | } |
| 266 | -re ".*$gdb_prompt $" { fail "maint print psymbols" } |
| 267 | timeout { fail "(timeout) maint print psymbols" } |
| 268 | } |
| 269 | |
| 270 | |
| 271 | send_gdb "maint print msymbols\n" |
| 272 | gdb_expect { |
| 273 | -re "print-msymbols takes an output file name and optional symbol file name.*$gdb_prompt $"\ |
| 274 | { pass "maint print msymbols w/o args" } |
| 275 | -re ".*$gdb_prompt $" { fail "maint print msymbols w/o args" } |
| 276 | timeout { fail "(timeout) maint print msymbols w/o args" } |
| 277 | } |
| 278 | |
| 279 | send_gdb "maint print msymbols msymbols_output ${binfile}\n" |
| 280 | gdb_expect { |
| 281 | -re "^maint print msymbols msymbols_output \[^\n\]*\r\n$gdb_prompt $"\ |
| 282 | { |
| 283 | send_gdb "shell ls msymbols_output\n" |
| 284 | gdb_expect { |
| 285 | -re "msymbols_output\r\n$gdb_prompt $"\ |
| 286 | { |
| 287 | send_gdb "shell grep factorial msymbols_output\n" |
| 288 | gdb_expect { |
| 289 | -re "\\\[ *$decimal\\\] T\[ \t\]+$hex factorial.*$gdb_prompt $"\ |
| 290 | { pass "maint print msymbols" } |
| 291 | -re ".*$gdb_prompt $" { fail "maint print msymbols" } |
| 292 | timeout { fail "(timeout) maint print msymbols" } |
| 293 | } |
| 294 | gdb_test "shell rm -f msymbols_output" "" |
| 295 | |
| 296 | } |
| 297 | -re ".*$gdb_prompt $" { fail "maint print msymbols" } |
| 298 | timeout { fail "(timeout) maint print msymbols" } |
| 299 | } |
| 300 | } |
| 301 | -re ".*$gdb_prompt $" { fail "maint print msymbols" } |
| 302 | timeout { fail "(timeout) maint print msymbols" } |
| 303 | } |
| 304 | |
| 305 | |
| 306 | send_gdb "maint print symbols\n" |
| 307 | gdb_expect { |
| 308 | -re "Arguments missing: an output file name and an optional symbol file name.*$gdb_prompt $"\ |
| 309 | { pass "maint print symbols w/o args" } |
| 310 | -re ".*$gdb_prompt $" { fail "maint print symbols w/o args" } |
| 311 | timeout { fail "(timeout) maint print symbols w/o args" } |
| 312 | } |
| 313 | |
| 314 | # Request symbols for one particular source file so that we don't try to |
| 315 | # dump the symbol information for the entire C library - over 500MB nowadays |
| 316 | # for GNU libc. |
| 317 | |
| 318 | send_gdb "maint print symbols symbols_output ${srcdir}/${subdir}/${srcfile}\n" |
| 319 | gdb_expect { |
| 320 | -re "^maint print symbols symbols_output \[^\n\]*\r\n$gdb_prompt $"\ |
| 321 | { |
| 322 | send_gdb "shell ls symbols_output\n" |
| 323 | gdb_expect { |
| 324 | -re "symbols_output\r\n$gdb_prompt $"\ |
| 325 | { |
| 326 | # See comments for `maint print psymbols'. |
| 327 | send_gdb "shell grep 'main(.*block' symbols_output\n" |
| 328 | gdb_expect { |
| 329 | -re "int main\\(int, char \\*\\*, char \\*\\*\\); block.*$gdb_prompt $"\ |
| 330 | { pass "maint print symbols" } |
| 331 | -re ".*$gdb_prompt $" { fail "maint print symbols" } |
| 332 | timeout { fail "(timeout) maint print symbols" } |
| 333 | } |
| 334 | gdb_test "shell rm -f symbols_output" "" |
| 335 | |
| 336 | } |
| 337 | -re ".*$gdb_prompt $" { fail "maint print symbols" } |
| 338 | timeout { fail "(timeout) maint print symbols" } |
| 339 | } |
| 340 | } |
| 341 | -re ".*$gdb_prompt $" { fail "maint print symbols" } |
| 342 | timeout { fail "(timeout) maint print symbols" } |
| 343 | } |
| 344 | |
| 345 | send_gdb "maint print type argc\n" |
| 346 | gdb_expect { |
| 347 | -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 $"\ |
| 348 | { pass "maint print type" } |
| 349 | -re ".*$gdb_prompt $" { fail "maint print type" } |
| 350 | timeout { fail "(timeout) maint print type" } |
| 351 | } |
| 352 | |
| 353 | if [istarget "hppa*-*-11*"] { |
| 354 | setup_xfail hppa*-*-*11* CLLbs14860 |
| 355 | send "maint print unwind &main\n" |
| 356 | expect { |
| 357 | -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 $"\ |
| 358 | { pass "maint print unwind" } |
| 359 | -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 $"\ |
| 360 | { xfail "maint print unwind" } |
| 361 | -re ".*$gdb_prompt $" { xfail "maint info unwind" } |
| 362 | timeout { fail "(timeout) maint print unwind" } |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | set oldtimeout $timeout |
| 367 | set timeout [expr $timeout + 300] |
| 368 | |
| 369 | # It'd be nice to check for every possible section. However, that's |
| 370 | # problematic, since the relative ordering wanders from release to |
| 371 | # release of the compilers. Instead, we'll just check for two |
| 372 | # sections which appear to always come out in the same relative |
| 373 | # order. (If that changes, then we should just check for one |
| 374 | # section.) |
| 375 | # |
| 376 | # And by the way: This testpoint will break for PA64, where a.out's |
| 377 | # are ELF files. |
| 378 | # |
| 379 | send_gdb "maint info sections\n" |
| 380 | gdb_expect { |
| 381 | -re "Exec file:\r\n.*break($EXEEXT)?., file type.*$gdb_prompt $"\ |
| 382 | { pass "maint info sections" } |
| 383 | -re ".*$gdb_prompt $" { fail "maint info sections" } |
| 384 | timeout { fail "(timeout) maint info sections" } |
| 385 | } |
| 386 | |
| 387 | # Test for new option: maint info sections <section name> |
| 388 | # If you don't have a .text section, this will require tweaking. |
| 389 | send_gdb "maint info sections .text\n" |
| 390 | gdb_expect { |
| 391 | -re ".*bss.*$gdb_prompt $" { fail "maint info sections .text" } |
| 392 | -re ".*data.*$gdb_prompt $" { fail "maint info sections .text" } |
| 393 | -re ".* .text .*$gdb_prompt $" { pass "maint info sections .text" } |
| 394 | timeout { fail "(timeout) maint info sections .text" } |
| 395 | } |
| 396 | |
| 397 | # Test for new option: CODE section flag |
| 398 | # If your data section is tagged CODE, xfail this test. |
| 399 | send_gdb "maint info sections CODE\n" |
| 400 | gdb_expect { |
| 401 | -re ".* .data .*$gdb_prompt $" { fail "maint info sections CODE" } |
| 402 | -re ".* .text .*$gdb_prompt $" { pass "maint info sections CODE" } |
| 403 | timeout { fail "(timeout) maint info sections CODE" } |
| 404 | } |
| 405 | |
| 406 | # Test for new option: DATA section flag |
| 407 | # If your text section is tagged DATA, xfail this test. |
| 408 | send_gdb "maint info sections DATA\n" |
| 409 | gdb_expect { |
| 410 | -re ".* .text .*$gdb_prompt $" { fail "maint info sections DATA" } |
| 411 | -re ".* .data .*$gdb_prompt $" { pass "maint info sections DATA" } |
| 412 | timeout { fail "(timeout) maint info sections DATA" } |
| 413 | } |
| 414 | |
| 415 | send_gdb "maint info breakpoints\n" |
| 416 | gdb_expect { |
| 417 | -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:75\r\n\[ \t\]+breakpoint already hit 1 time\r\n.*$gdb_prompt $"\ |
| 418 | { pass "maint info breakpoints" } |
| 419 | -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:75\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 $"\ |
| 420 | { pass "maint info breakpoints (with shlib events)" } |
| 421 | -re ".*$gdb_prompt $" { fail "maint info breakpoints" } |
| 422 | timeout { fail "(timeout) maint info breakpoints" } |
| 423 | } |
| 424 | |
| 425 | send_gdb "maint print\n" |
| 426 | gdb_expect { |
| 427 | -re "\"maintenance print\" must be followed by the name of a print command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\ |
| 428 | { pass "maint print w/o args" } |
| 429 | -re ".*$gdb_prompt $" { fail "maint print w/o args" } |
| 430 | timeout { fail "(timeout) maint print w/o args" } |
| 431 | } |
| 432 | |
| 433 | send_gdb "maint info\n" |
| 434 | gdb_expect { |
| 435 | -re "\"maintenance info\" must be followed by the name of an info command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\ |
| 436 | { pass "maint info w/o args" } |
| 437 | -re ".*$gdb_prompt $" { fail "maint info w/o args" } |
| 438 | timeout { fail "(timeout) maint info w/o args" } |
| 439 | } |
| 440 | |
| 441 | send_gdb "maint\n" |
| 442 | gdb_expect { |
| 443 | -re "\"maintenance\" must be followed by the name of a maintenance command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\ |
| 444 | { pass "maint w/o args" } |
| 445 | -re ".*$gdb_prompt $" { fail "maint w/o args" } |
| 446 | timeout { fail "(timeout) maint w/o args" } |
| 447 | } |
| 448 | |
| 449 | |
| 450 | set timeout $oldtimeout |
| 451 | |
| 452 | #============test help on maint commands |
| 453 | |
| 454 | send_gdb "help maint\n" |
| 455 | gdb_expect { |
| 456 | -re "Commands for use by GDB maintainers\\..*Includes commands to dump specific internal GDB structures in.*a human readable form, to cause GDB to deliberately dump core,.*to test internal functions such as the C../ObjC demangler, etc\\..*List of maintenance subcommands:.*maintenance check-symtabs.*maintenance demangle.*(maintenance dump-me.*)?maintenance info.*maintenance internal-error.*maintenance print.*maintenance set.*maintenance show.*maintenance space.*maintenance time.*Type.*help maintenance.*followed by maintenance subcommand name for full documentation\\..*Command name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\ |
| 457 | { pass "help maint" } |
| 458 | -re ".*$gdb_prompt $" { fail "help maint" } |
| 459 | timeout { fail "(timeout) help maint" } |
| 460 | } |
| 461 | |
| 462 | |
| 463 | send_gdb "help maint check-symtabs\n" |
| 464 | gdb_expect { |
| 465 | -re "Check consistency of psymtabs and symtabs\\..*$gdb_prompt $"\ |
| 466 | { pass "help maint check-symtabs" } |
| 467 | -re ".*$gdb_prompt $" { fail "help maint check-symtabs" } |
| 468 | timeout { fail "(timeout) help maint check-symtabs" } |
| 469 | } |
| 470 | |
| 471 | send_gdb "help maint space\n" |
| 472 | gdb_expect { |
| 473 | -re "Set the display of space usage\\.\r\nIf nonzero, will cause the execution space for each command to be\r\ndisplayed, following the command's output\\..*$gdb_prompt $"\ |
| 474 | { pass "help maint space" } |
| 475 | -re ".*$gdb_prompt $" { fail "help maint space" } |
| 476 | timeout { fail "(timeout) help maint space" } |
| 477 | } |
| 478 | |
| 479 | send_gdb "help maint time\n" |
| 480 | gdb_expect { |
| 481 | -re "Set the display of time usage\\.\r\nIf nonzero, will cause the execution time for each command to be\r\ndisplayed, following the command's output\\..*$gdb_prompt $"\ |
| 482 | { pass "help maint time" } |
| 483 | -re ".*$gdb_prompt $" { fail "help maint time" } |
| 484 | timeout { fail "(timeout) help maint time" } |
| 485 | } |
| 486 | |
| 487 | send_gdb "help maint demangle\n" |
| 488 | gdb_expect { |
| 489 | -re "Demangle a C\\+\\+/ObjC mangled name\\.\r\nCall internal GDB demangler routine to demangle a C\\+\\+ link name\r\nand prints the result\\..*$gdb_prompt $"\ |
| 490 | { pass "help maint demangle" } |
| 491 | -re ".*$gdb_prompt $" { fail "help maint demangle" } |
| 492 | timeout { fail "(timeout) help maint demangle" } |
| 493 | } |
| 494 | |
| 495 | # dump-me is disabled ifdef _WIN32. |
| 496 | if [ishost *cygwin*] { |
| 497 | setup_xfail "*-*-*" |
| 498 | } |
| 499 | send_gdb "help maint dump-me\n" |
| 500 | gdb_expect { |
| 501 | -re "Get fatal error; make debugger dump its core\\.\r\nGDB sets its handling of SIGQUIT back to SIG_DFL and then sends\r\nitself a SIGQUIT signal\\..*$gdb_prompt $"\ |
| 502 | { pass "help maint dump-me" } |
| 503 | -re ".*$gdb_prompt $" { fail "help maint dump-me" } |
| 504 | timeout { fail "(timeout) help maint dump-me" } |
| 505 | } |
| 506 | |
| 507 | send_gdb "help maint internal-error\n" |
| 508 | gdb_expect { |
| 509 | -re "Give GDB an internal error\\.\r\nCause GDB to behave as if an internal error was detected\\..*$gdb_prompt $"\ |
| 510 | { pass "help maint internal-error" } |
| 511 | -re ".*$gdb_prompt $" { fail "help maint internal-error" } |
| 512 | timeout { fail "(timeout) help maint internal-error" } |
| 513 | } |
| 514 | |
| 515 | send_gdb "help maint internal-warning\n" |
| 516 | gdb_expect { |
| 517 | -re "Give GDB an internal warning\\.\r\nCause GDB to behave as if an internal warning was reported\\..*$gdb_prompt $"\ |
| 518 | { pass "help maint internal-warning" } |
| 519 | -re ".*$gdb_prompt $" { fail "help maint internal-warning" } |
| 520 | timeout { fail "(timeout) help maint internal-warning" } |
| 521 | } |
| 522 | |
| 523 | send_gdb "help maint print statistics\n" |
| 524 | gdb_expect { |
| 525 | -re "Print statistics about internal gdb state\\..*$gdb_prompt $"\ |
| 526 | { pass "help maint print statistics" } |
| 527 | -re ".*$gdb_prompt $" { fail "help maint print statistics" } |
| 528 | timeout { fail "(timeout) help maint print statistics" } |
| 529 | } |
| 530 | |
| 531 | gdb_test "help maint print dummy-frames" \ |
| 532 | "Print the contents of the internal dummy-frame stack." |
| 533 | |
| 534 | send_gdb "help maint print objfiles\n" |
| 535 | gdb_expect { |
| 536 | -re "Print dump of current object file definitions\\..*$gdb_prompt $"\ |
| 537 | { pass "help maint print objfiles" } |
| 538 | -re ".*$gdb_prompt $" { fail "help maint print objfiles" } |
| 539 | timeout { fail "(timeout) help maint print objfiles" } |
| 540 | } |
| 541 | |
| 542 | send_gdb "help maint print psymbols\n" |
| 543 | gdb_expect { |
| 544 | -re "Print dump of current partial symbol definitions\\.\r\nEntries in the partial symbol table are dumped to file OUTFILE\\.\r\nIf a SOURCE file is specified, dump only that file's partial symbols\\..*$gdb_prompt $"\ |
| 545 | { pass "help maint print psymbols" } |
| 546 | -re ".*$gdb_prompt $" { fail "help maint print psymbols" } |
| 547 | timeout { fail "(timeout) help maint print psymbols" } |
| 548 | } |
| 549 | |
| 550 | send_gdb "help maint print msymbols\n" |
| 551 | gdb_expect { |
| 552 | -re "Print dump of current minimal symbol definitions\\.\r\nEntries in the minimal symbol table are dumped to file OUTFILE\\.\r\nIf a SOURCE file is specified, dump only that file's minimal symbols\\..*$gdb_prompt $"\ |
| 553 | { pass "help maint print msymbols" } |
| 554 | -re ".*$gdb_prompt $" { fail "help maint print msymbols" } |
| 555 | timeout { fail "(timeout) help maint print msymbols" } |
| 556 | } |
| 557 | |
| 558 | send_gdb "help maint print symbols\n" |
| 559 | gdb_expect { |
| 560 | -re "Print dump of current symbol definitions\\.\r\nEntries in the full symbol table are dumped to file OUTFILE\\.\r\nIf a SOURCE file is specified, dump only that file's symbols\\..*$gdb_prompt $"\ |
| 561 | { pass "help maint print symbols" } |
| 562 | -re ".*$gdb_prompt $" { fail "help maint print symbols" } |
| 563 | timeout { fail "(timeout) help maint print symbols" } |
| 564 | } |
| 565 | |
| 566 | |
| 567 | send_gdb "help maint print type\n" |
| 568 | gdb_expect { |
| 569 | -re "Print a type chain for a given symbol\\.\r\nFor each node in a type chain, print the raw data for each member of\r\nthe type structure, and the interpretation of the data\\..*$gdb_prompt $"\ |
| 570 | { pass "help maint print type" } |
| 571 | -re ".*$gdb_prompt $" { fail "help maint print type" } |
| 572 | timeout { fail "(timeout) help maint print type" } |
| 573 | } |
| 574 | |
| 575 | if [istarget "hppa*-*-*"] { |
| 576 | send_gdb "help maint print unwind\n" |
| 577 | gdb_expect { |
| 578 | -re "Print unwind table entry at given address\\..*$gdb_prompt $"\ |
| 579 | { pass "help maint print unwind" } |
| 580 | -re ".*$gdb_prompt $" { fail "help maint print unwind" } |
| 581 | timeout { fail "(timeout) help maint print unwind" } |
| 582 | } |
| 583 | } |
| 584 | |
| 585 | send_gdb "help maint info sections\n" |
| 586 | gdb_expect { |
| 587 | -re "List the BFD sections of the exec and core files\\..*$gdb_prompt $"\ |
| 588 | { pass "help maint info sections" } |
| 589 | -re ".*$gdb_prompt $" { fail "help maint info sections" } |
| 590 | timeout { fail "(timeout) help maint info sections" } |
| 591 | } |
| 592 | |
| 593 | |
| 594 | send_gdb "help maint info breakpoints\n" |
| 595 | gdb_expect { |
| 596 | -re "Status of all breakpoints, or breakpoint number NUMBER.*$gdb_prompt $" { pass "help maint info breakpoints" } |
| 597 | -re ".*$gdb_prompt $" { fail "help maint info breakpoints" } |
| 598 | timeout { fail "(timeout) help maint info breakpoints" } |
| 599 | } |
| 600 | |
| 601 | #send_gdb "help maint info breakpoints\n" |
| 602 | #expect { |
| 603 | # -re "Status of all breakpoints, or breakpoint number NUMBER\\.\[ \r\n\t\]+The \"Type\" column indicates one of:\[ \r\n\t\]+breakpoint\[ \t\]+- normal breakpoint\[ \r\n\t\]+watchpoint\[ \t\]+- watchpoint\[ \r\n\t\]+longjmp\[ \t\]+- internal breakpoint used to step through longjmp\\(\\)\[ \r\n\t\]+longjmp resume - internal breakpoint at the target of longjmp\\(\\)\[ \r\n\t\]+until\[ \t\]+- internal breakpoint used by the \"until\" command\[ \r\n\t\]+finish\[ \t\]+- internal breakpoint used by the \"finish\" command\[ \r\n\t\]+The \"Disp\" column contains one of \"keep\", \"del\", or \"dis\" to indicate\[ \r\n\t\]+the disposition of the breakpoint after it gets hit\\. \"dis\" means that the\[ \r\n\t\]+breakpoint will be disabled\\. The \"Address\" and \"What\" columns indicate the\[ \r\n\t\]+address and file.line number respectively\\.\[ \r\n\t\]+Convenience variable \".*\" and default examine address for \"x\"\[ \r\n\t\]+are set to the address of the last breakpoint listed\\.\[ \r\n\t\]+Convenience variable \".bpnum\" contains the number of the last\[ \r\n\t\]+breakpoint set\\..*$gdb_prompt $"\ |
| 604 | # { pass "help maint info breakpoints" } |
| 605 | # -re ".*$gdb_prompt $" { fail "help maint info breakpoints" } |
| 606 | # timeout { fail "(timeout) help maint info breakpoints" } |
| 607 | # } |
| 608 | |
| 609 | send_gdb "help maint info\n" |
| 610 | gdb_expect { |
| 611 | -re "Commands for showing internal info about the program being debugged.*unambiguous\\..*$gdb_prompt $"\ |
| 612 | { pass "help maint info" } |
| 613 | -re ".*$gdb_prompt $" { fail "help maint info" } |
| 614 | timeout { fail "(timeout) help maint info" } |
| 615 | } |
| 616 | |
| 617 | send_gdb "help maint print\n" |
| 618 | gdb_expect { |
| 619 | -re "Maintenance command for printing GDB internal state\\.\[\r\n\]+List of maintenance print subcommands:\[\r\n\]+maintenance print architecture -- Print the internal architecture configuration.*maintenance print msymbols -- Print dump of current minimal symbol definitions.*maintenance print objfiles -- Print dump of current object file definitions.*maintenance print psymbols -- Print dump of current partial symbol definitions.*maintenance print statistics -- Print statistics about internal gdb state.*maintenance print symbols -- Print dump of current symbol definitions.*maintenance print type -- Print a type chain for a given symbol.*Type .help maintenance print. followed by maintenance print subcommand name for full documentation\\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\ |
| 620 | { pass "help maint print" } |
| 621 | -re ".*$gdb_prompt $" { fail "help maint print" } |
| 622 | timeout { fail "(timeout) help maint print" } |
| 623 | } |
| 624 | |
| 625 | send_gdb "help maint\n" |
| 626 | gdb_expect { |
| 627 | -re "Commands for use by GDB maintainers\\.\[\r\n\]+Includes commands to dump specific internal GDB structures in\[\r\n\]+a human readable form, to cause GDB to deliberately dump core,\[\r\n\]+to test internal functions such as the C\\+\\+/ObjC demangler, etc\\..*Type.*help maintenance.*followed by maintenance subcommand name for full documentation\\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\ |
| 628 | { pass "help maint" } |
| 629 | -re ".*$gdb_prompt $" { fail "help maint" } |
| 630 | timeout { fail "(timeout) help maint" } |
| 631 | } |
| 632 | |
| 633 | #set oldtimeout $timeout |
| 634 | #set timeout [expr $timeout + 300] |
| 635 | |
| 636 | if [ishost *cygwin*] { |
| 637 | setup_xfail "*-*-*" |
| 638 | } |
| 639 | send_gdb "maint dump-me\n" |
| 640 | gdb_expect { |
| 641 | -re "Should GDB dump core.*\\(y or n\\) $"\ |
| 642 | { send_gdb "n\n" |
| 643 | gdb_expect { |
| 644 | -re ".*$gdb_prompt $" { pass "maint dump-me" } |
| 645 | timeout { fail "(timeout) maint dump-me" } |
| 646 | } |
| 647 | } |
| 648 | -re ".*$gdb_prompt $" { fail "maint dump-me" } |
| 649 | timeout { fail "(timeout) maint dump-me" } |
| 650 | } |
| 651 | |
| 652 | send_gdb "maint internal-error\n" |
| 653 | gdb_expect { |
| 654 | -re "Quit this debugging session.*\\(y or n\\) $" { |
| 655 | send_gdb "n\n" |
| 656 | gdb_expect { |
| 657 | -re "Create a core file.*\\(y or n\\) $" { |
| 658 | send_gdb "n\n" |
| 659 | gdb_expect { |
| 660 | -re ".*$gdb_prompt $" { |
| 661 | pass "maint internal-error" |
| 662 | } |
| 663 | timeout { |
| 664 | fail "(timeout) maint internal-error" |
| 665 | } |
| 666 | } |
| 667 | } |
| 668 | -re ".*$gdb_prompt $" { |
| 669 | fail "maint internal-error" |
| 670 | } |
| 671 | timeout { |
| 672 | fail "(timeout) maint internal-error" |
| 673 | } |
| 674 | } |
| 675 | } |
| 676 | -re ".*$gdb_prompt $" { |
| 677 | fail "maint internal-error" |
| 678 | } |
| 679 | timeout { |
| 680 | fail "(timeout) maint internal-error" |
| 681 | } |
| 682 | } |
| 683 | |
| 684 | #set timeout $oldtimeout |
| 685 | |
| 686 | |
| 687 | gdb_exit |
| 688 | return 0 |