Fix test names starting with uppercase output by basic functions
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.multi / watchpoint-multi-exit.exp
CommitLineData
63000888
PA
1# Copyright 2016 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# Make sure that if an inferior exits or is detached/killed, its
17# watchpoints don't end up with stale locations, preventing resumption
18# of other inferiors.
19
20standard_testfile
21
22if {[build_executable "failed to build" $testfile $srcfile {debug}]} {
23 return -1
24}
25
26# The test proper. DISPOSE indicates how to dispose of the fork
27# child. Can be either "kill", "detach", or "exit" (to continue it to
28# normal exit).
29proc do_test {dispose} {
30 global binfile
31
32 clean_restart $binfile
33
34 gdb_test_no_output "set follow-fork child"
35 gdb_test_no_output "set detach-on-fork off"
36
37 if ![runto "child_function"] {
bc6c7af4 38 fail "can't run to child_function"
63000888
PA
39 return
40 }
41
42 gdb_test "watch globalvar" "atchpoint \[0-9\]+: globalvar" \
43 "set watchpoint on inferior 2"
44
45 # Dispose of the inferior. This should get rid of this inferior's
46 # watchpoint locations.
47 if {$dispose == "kill"} {
48 gdb_test "kill" "" "kill inferior 2" \
49 "Kill the program being debugged.*y or n. $" "y"
50 } elseif {$dispose == "detach"} {
51 gdb_test "detach" ".*" "detach inferior 2"
52 } elseif {$dispose == "exit"} {
53 gdb_test "continue" ".*exited normally.*" "run to exit inferior 2"
54 } else {
55 perror "unhandled dispose: $dispose"
56 }
57
58 gdb_test "inferior 1" "witching to inferior 1 .*" \
59 "switch back to inferior 1"
60
61 if {$dispose == "kill"} {
62 gdb_test "print expect_signaled = 1" " = 1"
63 }
64
65 gdb_breakpoint "marker"
66
67 # Now continue inferior 1. Before GDB was fixed, watchpoints for
68 # inferior 2 managed to be left behind. When GDB realized that
69 # they hadn't been inserted, the continue command was aborted:
70 #
71 # (gdb) continue
72 # Continuing.
73 # Warning:
74 # Could not insert hardware watchpoint 2.
75 # Could not insert hardware breakpoints:
76 # You may have requested too many hardware breakpoints/watchpoints.
77 #
78 # Command aborted.
79 # (gdb)
80 #
81 gdb_test "continue" "Breakpoint \[0-9\]+, marker .*" \
82 "continue in inferior 1"
83}
84
85foreach_with_prefix dispose {"kill" "detach" "exit"} {
86 do_test $dispose
87}
This page took 0.059659 seconds and 4 git commands to generate.