test suite update - gdb.base/[h-m]
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / save-bp.exp
1 # Copyright (C) 2011-2013 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 3 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, see <http://www.gnu.org/licenses/>.
15
16 set testfile save-bp
17 set srcfile ${testfile}.c
18
19 if { [prepare_for_testing ${testfile}.exp ${testfile}] } {
20 return -1
21 }
22
23 if ![runto_main] {
24 untested ${testfile}.exp
25 return -1
26 }
27 # Delete all breakpoints so that the "runto_main" breakpoint above
28 # does not interfere with our testing.
29 delete_breakpoints
30
31 # Insert a bunch of breakpoints... The goal is to create breakpoints
32 # that we are going to try to save in a file and then reload. So
33 # try to create a good variety of them.
34 gdb_breakpoint "break_me"
35
36 set loc_bp2 [gdb_get_line_number "BREAK HERE"]
37 gdb_breakpoint ${srcfile}:${loc_bp2}
38
39 set loc_bp3 [gdb_get_line_number "thread-specific"]
40 gdb_breakpoint "${srcfile}:${loc_bp3} thread 1"
41
42 set loc_bp4 [gdb_get_line_number "condition"]
43 gdb_breakpoint "${srcfile}:${loc_bp4} if i == 1"
44
45 set loc_bp5 [gdb_get_line_number "with commands"]
46 gdb_breakpoint ${srcfile}:${loc_bp5}
47 gdb_test "commands\nsilent\nend" "End with.*" "add breakpoint commands"
48
49 gdb_test "dprintf ${srcfile}:${loc_bp5},\"At foo entry\\n\"" "Dprintf .*"
50
51 # Now, save the breakpoints into a file...
52 remote_file host delete "bps"
53 gdb_test "save breakpoint bps"
54
55 # Now start a new debugger session...
56 clean_restart $testfile
57 if ![runto_main] {
58 fail "cannot restart program"
59 return -1
60 }
61 # Delete all breakpoints so that the "runto_main" breakpoint above
62 # does not interfere with our testing.
63 delete_breakpoints
64
65 # ... and restore the breakpoints.
66 gdb_test "source bps"
67
68 # Now, verify that all breakpoints have been created correctly...
69 set bp_row_start "\[0-9\]+ +breakpoint +keep +y +0x\[0-9a-f\]+ +in"
70 set dprintf_row_start "\[0-9\]+ +dprintf +keep +y +0x\[0-9a-f\]+ +in"
71 gdb_test "info break" \
72 " *Num +Type +Disp +Enb +Address +What\r\n$bp_row_start break_me at .*$srcfile:\[0-9\]+\r\n$bp_row_start main at .*$srcfile:$loc_bp2\r\n$bp_row_start main at .*$srcfile:$loc_bp3 +thread 1\r\n\[ \t]+stop only in thread 1\r\n$bp_row_start main at .*$srcfile:$loc_bp4\r\n\[ \t\]+stop only if i == 1( \\((host|target) evals\\))?\r\n$bp_row_start main at .*$srcfile:$loc_bp5\r\n\[ \t\]+silent\r\n$dprintf_row_start main at .*$srcfile:$loc_bp5\r\n\[ \t\]+printf.*"
This page took 0.048209 seconds and 4 git commands to generate.