| OLD | NEW |
| 1 # Copyright 2003-2012 Free Software Foundation, Inc. | 1 # Copyright 2003-2012 Free Software Foundation, Inc. |
| 2 | 2 |
| 3 # This program is free software; you can redistribute it and/or modify | 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 | 4 # it under the terms of the GNU General Public License as published by |
| 5 # the Free Software Foundation; either version 3 of the License, or | 5 # the Free Software Foundation; either version 3 of the License, or |
| 6 # (at your option) any later version. | 6 # (at your option) any later version. |
| 7 # | 7 # |
| 8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
| 12 # | 12 # |
| 13 # You should have received a copy of the GNU General Public License | 13 # You should have received a copy of the GNU General Public License |
| 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | 15 |
| 16 # This file was written by Elena Zannoni (ezannoni@cygnus.com) | 16 # This file was written by Elena Zannoni (ezannoni@cygnus.com) |
| 17 | 17 |
| 18 if $tracelevel then { | |
| 19 strace $tracelevel | |
| 20 } | |
| 21 | |
| 22 | 18 |
| 23 # are we on a target board? If so, don't run these tests. | 19 # are we on a target board? If so, don't run these tests. |
| 24 # note: this is necessary because we cannot use runto_main (which would | 20 # note: this is necessary because we cannot use runto_main (which would |
| 25 # work for remote targets too) because of the different prompt we get | 21 # work for remote targets too) because of the different prompt we get |
| 26 # when using annotation level 2. | 22 # when using annotation level 2. |
| 27 # | 23 # |
| 28 if [is_remote target] then { | 24 if [is_remote target] then { |
| 29 return 0 | 25 return 0 |
| 30 } | 26 } |
| 31 | 27 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 42 untested annota3.exp | 38 untested annota3.exp |
| 43 return -1 | 39 return -1 |
| 44 } | 40 } |
| 45 | 41 |
| 46 | 42 |
| 47 gdb_exit | 43 gdb_exit |
| 48 gdb_start | 44 gdb_start |
| 49 gdb_reinitialize_dir $srcdir/$subdir | 45 gdb_reinitialize_dir $srcdir/$subdir |
| 50 gdb_load ${binfile} | 46 gdb_load ${binfile} |
| 51 | 47 |
| 52 if [target_info exists gdb_stub] { | |
| 53 gdb_step_for_stub; | |
| 54 } | |
| 55 | |
| 56 # | |
| 57 # the line at which break main will put the breakpoint | |
| 58 # | |
| 59 set main_line 32 | |
| 60 | |
| 61 # The commands we test here produce many lines of output; disable "press | 48 # The commands we test here produce many lines of output; disable "press |
| 62 # <return> to continue" prompts. | 49 # <return> to continue" prompts. |
| 63 gdb_test_no_output "set height 0" | 50 gdb_test_no_output "set height 0" |
| 64 | 51 |
| 65 # | 52 # |
| 66 # break at main | 53 # break at main |
| 67 # | 54 # |
| 55 |
| 56 set main_line [gdb_get_line_number "break main"] |
| 57 |
| 68 gdb_test "break main" \ | 58 gdb_test "break main" \ |
| 69 "Breakpoint.*at.* file .*$srcfile, line.*" \ | 59 "Breakpoint.*at.* file .*$srcfile, line $main_line\\." \ |
| 70 "breakpoint main" | 60 "breakpoint main" |
| 71 | 61 |
| 72 | 62 |
| 73 # NOTE: this prompt is OK only when the annotation level is > 1 | 63 # NOTE: this prompt is OK only when the annotation level is > 1 |
| 74 | 64 |
| 75 # NOTE: When this prompt is in use the gdb_test procedure cannot be | 65 # NOTE: When this prompt is in use the gdb_test procedure cannot be |
| 76 # used because it assumes that the last char after the gdb_prompt is a | 66 # used because it assumes that the last char after the gdb_prompt is a |
| 77 # white space. This is not true with this annotated prompt. So we must | 67 # white space. This is not true with this annotated prompt. So we must |
| 78 # use send_gdb and gdb_expect or gdb_expect_list. | 68 # use send_gdb and gdb_expect or gdb_expect_list. |
| 79 | 69 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 107 gdb_test_multiple "end" "end if construct" { | 97 gdb_test_multiple "end" "end if construct" { |
| 108 -re "^end\r\n\r\n\032\032post-commands\r\n$gdb_prompt$" { | 98 -re "^end\r\n\r\n\032\032post-commands\r\n$gdb_prompt$" { |
| 109 pass "end if construct" | 99 pass "end if construct" |
| 110 } | 100 } |
| 111 } | 101 } |
| 112 | 102 |
| 113 # | 103 # |
| 114 # info break: | 104 # info break: |
| 115 # | 105 # |
| 116 send_gdb "info break\n" | 106 send_gdb "info break\n" |
| 117 gdb_expect_list "breakpoint info" "$gdb_prompt$" { | 107 gdb_expect_list "breakpoint info" "$gdb_prompt$" [concat { |
| 118 "\r\n\032\032post-prompt\r\n" | 108 "\r\n\032\032post-prompt\r\n" |
| 119 "Num Type Disp Enb Address +What\r\n" | 109 "Num Type Disp Enb Address +What\r\n" } [list \ |
| 120 "1 breakpoint keep y 0x\[0-9a-zA-Z\]+ +in main at .*annota3.c:32
\r\n" | 110 "1 breakpoint keep y 0x\[0-9a-zA-Z\]+ +in main at .*annota3.c:$m
ain_line\r\n"]] |
| 121 } | |
| 122 | 111 |
| 123 | 112 |
| 124 # | 113 # |
| 125 # run to a break point will test: | 114 # run to a break point will test: |
| 126 # | 115 # |
| 127 #exp_internal 1 | 116 #exp_internal 1 |
| 128 send_gdb "run\n" | 117 send_gdb "run\n" |
| 129 gdb_expect_list "run until main breakpoint" "$gdb_prompt$" { | 118 gdb_expect_list "run until main breakpoint" "$gdb_prompt$" [concat { |
| 130 "\r\n\032\032post-prompt\r\n" | 119 "\r\n\032\032post-prompt\r\n" |
| 131 "Starting program: .*annota3(|\.exe) \r\n" | 120 "Starting program: .*annota3(|\.exe) \r\n" |
| 132 "\r\n\032\032starting\r\n" | 121 "\r\n\032\032starting\r\n" |
| 133 "\r\n\032\032breakpoint 1\r\n" | 122 "\r\n\032\032breakpoint 1\r\n" |
| 134 "\r\n" | 123 "\r\n" |
| 135 "Breakpoint 1, " | 124 "Breakpoint 1, " |
| 136 "\r\n\032\032frame-begin 0 0x\[0-9a-z\]+\r\n" | 125 "\r\n\032\032frame-begin 0 0x\[0-9a-z\]+\r\n" } [list \ |
| 137 "main \\(\\) at .*annota3.c:32\r\n" | 126 "main \\(\\) at .*annota3.c:$main_line\r\n"] [list \ |
| 138 "\r\n\032\032source.*annota3.c:32:.*:beg:0x\[0-9a-z\]+\r\n" | 127 "\r\n\032\032source.*annota3.c:$main_line:.*:beg:0x\[0-9a-z\]+\r\n"] { |
| 139 "\r\n\032\032stopped\r\n" | 128 "\r\n\032\032stopped\r\n" |
| 140 } | 129 }] |
| 141 #exp_internal 0 | 130 #exp_internal 0 |
| 142 #exit 0 | 131 #exit 0 |
| 143 | 132 |
| 144 # | 133 # |
| 145 # Let's do a next, to get to a point where the array is initialized | 134 # Let's do a next, to get to a point where the array is initialized |
| 146 # We don't care about the annotated output for this operation, it is the same as | 135 # We don't care about the annotated output for this operation, it is the same as |
| 147 # the one produced by run above | 136 # the one produced by run above |
| 148 # | 137 # |
| 149 send_gdb "next\n" | 138 send_gdb "next\n" |
| 150 gdb_expect_list "go after array init line" "$gdb_prompt$" { | 139 gdb_expect_list "go after array init line" "$gdb_prompt$" { |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 send_gdb "delete 3\n" | 260 send_gdb "delete 3\n" |
| 272 gdb_expect_list "delete bp 3" "$gdb_prompt$" { | 261 gdb_expect_list "delete bp 3" "$gdb_prompt$" { |
| 273 "\r\n\032\032post-prompt\r\n" | 262 "\r\n\032\032post-prompt\r\n" |
| 274 } | 263 } |
| 275 | 264 |
| 276 # | 265 # |
| 277 # break at main, after value is initialized. This is in preparation | 266 # break at main, after value is initialized. This is in preparation |
| 278 # to test the annotate output for the display command. | 267 # to test the annotate output for the display command. |
| 279 # | 268 # |
| 280 send_gdb "break main\n" | 269 send_gdb "break main\n" |
| 281 gdb_expect_list "break at 28" "$gdb_prompt$" { | 270 gdb_expect_list "break at main" "$gdb_prompt$" [concat { |
| 282 "\r\n\032\032post-prompt\r\n" | 271 "\r\n\032\032post-prompt\r\n" } [list \ |
| 283 "Breakpoint 4 at 0x\[0-9a-z\]+: file .*annota3.c, line 32.\r\n" | 272 "Breakpoint 4 at 0x\[0-9a-z\]+: file .*annota3.c, line $main_line.\r\n"]] |
| 284 } | |
| 285 | 273 |
| 286 # | 274 # |
| 287 # display the value | 275 # display the value |
| 288 # | 276 # |
| 289 send_gdb "display value\n" | 277 send_gdb "display value\n" |
| 290 gdb_expect_list "set up display" "$gdb_prompt$" { | 278 gdb_expect_list "set up display" "$gdb_prompt$" { |
| 291 "\r\n\032\032post-prompt\r\n" | 279 "\r\n\032\032post-prompt\r\n" |
| 292 "1: value = 7\r\n" | 280 "1: value = 7\r\n" |
| 293 } | 281 } |
| 294 | 282 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 310 -re ".*$gdb_prompt$" { fail "re-run" } | 298 -re ".*$gdb_prompt$" { fail "re-run" } |
| 311 timeout { fail "re-run (timeout)" } | 299 timeout { fail "re-run (timeout)" } |
| 312 } | 300 } |
| 313 | 301 |
| 314 # | 302 # |
| 315 # Test that breakpoints-invalid is issued once and only once for | 303 # Test that breakpoints-invalid is issued once and only once for |
| 316 # breakpoint ignore count changes, after annotation stopped. | 304 # breakpoint ignore count changes, after annotation stopped. |
| 317 # NOTE: breakpoints-invalid annotations have been removed from | 305 # NOTE: breakpoints-invalid annotations have been removed from |
| 318 # level 3 but keep these tests for continuity and comparison | 306 # level 3 but keep these tests for continuity and comparison |
| 319 # with annota1.exp. | 307 # with annota1.exp. |
| 320 send_gdb "break 46\n" | 308 |
| 321 gdb_expect_list "break at 46" "$gdb_prompt$" { | 309 set value_inc_line [gdb_get_line_number "increment value"] |
| 322 "\r\n\032\032post-prompt\r\n" | 310 |
| 323 "Breakpoint 5 at 0x\[0-9a-z\]+: file .*annota3.c, line 46.\r\n" | 311 send_gdb "break $value_inc_line\n" |
| 324 } | 312 gdb_expect_list "break at value++" "$gdb_prompt$" [concat { |
| 313 "\r\n\032\032post-prompt\r\n" } [list \ |
| 314 "Breakpoint 5 at 0x\[0-9a-z\]+: file .*annota3.c, line $value_inc_line.\r\n"
]] |
| 325 | 315 |
| 326 send_gdb "ignore 5 4\n" | 316 send_gdb "ignore 5 4\n" |
| 327 gdb_expect_list "ignore 5 4" "$gdb_prompt$" { | 317 gdb_expect_list "ignore 5 4" "$gdb_prompt$" { |
| 328 "\r\n\032\032post-prompt\r\n" | 318 "\r\n\032\032post-prompt\r\n" |
| 329 "Will ignore next 4 crossings of breakpoint 5" | 319 "Will ignore next 4 crossings of breakpoint 5" |
| 330 "\r\n" | 320 "\r\n" |
| 331 } | 321 } |
| 332 | 322 |
| 333 send_gdb "continue\n" | 323 send_gdb "continue\n" |
| 334 gdb_expect_list "annotate ignore count change" "$gdb_prompt$" { | 324 gdb_expect_list "annotate ignore count change" "$gdb_prompt$" [concat { |
| 335 "\r\n\032\032post-prompt\r\n" | 325 "\r\n\032\032post-prompt\r\n" |
| 336 "\r\n\032\032breakpoint 5\r\n" | 326 "\r\n\032\032breakpoint 5\r\n" |
| 337 "\r\n" | 327 "\r\n" |
| 338 "Breakpoint 5, " | 328 "Breakpoint 5, " |
| 339 "\r\n\032\032frame-begin 0 0x\[0-9a-z\]+\r\n" | 329 "\r\n\032\032frame-begin 0 0x\[0-9a-z\]+\r\n" } [list \ |
| 340 "main \\(\\) at .*annota3.c:46\r\n" | 330 "main \\(\\) at .*annota3.c:$value_inc_line\r\n"] [list \ |
| 341 "\r\n\032\032source .*annota3.c:46:\[0-9\]+:beg:0x\[0-9a-z\]+\r\n" | 331 "\r\n\032\032source .*annota3.c:$value_inc_line:\[0-9\]+:beg:0x\[0-9a-z\]+\r
\n"] { |
| 342 "1: value = 11\r\n" | 332 "1: value = 11\r\n" |
| 343 "\r\n\032\032stopped\r\n" | 333 "\r\n\032\032stopped\r\n" |
| 344 } | 334 }] |
| 345 | 335 |
| 346 # check that ignore command is working, or the above can provide | 336 # check that ignore command is working, or the above can provide |
| 347 # misleading assurance ... | 337 # misleading assurance ... |
| 348 | 338 |
| 349 send_gdb "next\n" | 339 send_gdb "next\n" |
| 350 gdb_expect_list "next to exit loop" "$gdb_prompt$" { | 340 gdb_expect_list "next to exit loop" "$gdb_prompt$" { |
| 351 "\r\n\032\032post-prompt\r\n" | 341 "\r\n\032\032post-prompt\r\n" |
| 352 "\r\n\032\032starting\r\n" | 342 "\r\n\032\032starting\r\n" |
| 353 "\r\n\032\032source.*annota3.c:\[0-9\]+:\[0-9\]+:beg:0x\[0-9a-z\]+\r\n" | 343 "\r\n\032\032source.*annota3.c:\[0-9\]+:\[0-9\]+:beg:0x\[0-9a-z\]+\r\n" |
| 354 "1: value = 12\r\n" | 344 "1: value = 12\r\n" |
| 355 "\r\n\032\032stopped\r\n" | 345 "\r\n\032\032stopped\r\n" |
| 356 } | 346 } |
| 357 | 347 |
| 348 set after_loop_line [gdb_get_line_number "after loop"] |
| 349 |
| 358 send_gdb "next\n" | 350 send_gdb "next\n" |
| 359 gdb_expect_list "breakpoint ignore count" "$gdb_prompt$" { | 351 gdb_expect_list "breakpoint ignore count" "$gdb_prompt$" [concat { |
| 360 "\r\n\032\032post-prompt\r\n" | 352 "\r\n\032\032post-prompt\r\n" |
| 361 "\r\n\032\032starting\r\n" | 353 "\r\n\032\032starting\r\n" } [list \ |
| 362 "\r\n\032\032source.*annota3.c:49:\[0-9\]+:beg:0x\[0-9a-z\]+\r\n" | 354 "\r\n\032\032source.*annota3.c:$after_loop_line:\[0-9\]+:beg:0x\[0-9a-z\]+\r
\n"] { |
| 363 "1: value = 12\r\n" | 355 "1: value = 12\r\n" |
| 364 "\r\n\032\032stopped\r\n" | 356 "\r\n\032\032stopped\r\n" |
| 365 } | 357 }] |
| 366 | 358 |
| 367 # Get the inferior's PID for later. | 359 # Get the inferior's PID for later. |
| 368 | 360 |
| 369 set test "get inferior pid" | 361 set test "get inferior pid" |
| 370 set pid -1 | 362 set pid -1 |
| 371 gdb_test_multiple "info inferior 1" "$test" { | 363 gdb_test_multiple "info inferior 1" "$test" { |
| 372 -re "process (\[0-9\]*).*$gdb_prompt$" { | 364 -re "process (\[0-9\]*).*$gdb_prompt$" { |
| 373 set pid $expect_out(1,string) | 365 set pid $expect_out(1,string) |
| 374 pass "$test" | 366 pass "$test" |
| 375 } | 367 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 } elseif { $pid != -1 && [remote_file host exists core.$pid] } { | 405 } elseif { $pid != -1 && [remote_file host exists core.$pid] } { |
| 414 remote_file host delete core.$pid | 406 remote_file host delete core.$pid |
| 415 pass "$test (removed)" | 407 pass "$test (removed)" |
| 416 } else { | 408 } else { |
| 417 pass "$test (not dumped)" | 409 pass "$test (not dumped)" |
| 418 } | 410 } |
| 419 | 411 |
| 420 # restore the original prompt for the rest of the testsuite | 412 # restore the original prompt for the rest of the testsuite |
| 421 | 413 |
| 422 set gdb_prompt $old_gdb_prompt | 414 set gdb_prompt $old_gdb_prompt |
| OLD | NEW |