1 # Copyright
(C
) 2015-2019 Free Software Foundation
, Inc.
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.
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.
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
/>.
16 # Check that forking a process after a previous process was attached to unsets
17 # attach_flag. This is done indirectly by inspecting GDB
's quit prompt.
19 if ![can_spawn_for_attach] {
24 set executable $testfile
26 if [prepare_for_testing "failed to prepare" $executable] {
30 set test_spawn_id [spawn_wait_for_attach $binfile]
31 set test_pid [spawn_id_get_pid $test_spawn_id]
33 set test "attach to process"
34 gdb_test "attach $test_pid" "Attaching to program.*" $test
36 set test "kill process"
37 gdb_test "kill" "" $test \
38 "Kill the program being debugged.*y or n. $" "y"
40 set test "restart process"
41 gdb_test "start" "Starting program.*Temporary breakpoint .*" $test
43 set test "attempt kill via quit"
44 # The quit prompt should warn about killing the process, not about detaching the
45 # process, since this process was not attached to.
47 gdb_test_multiple "quit" $test {
48 -re "will be killed.*.y or n. $" {
53 -re "will be detached.*.y or n. $" {
62 kill_wait_spawned_process $test_spawn_id