1 # Copyright
(C
) 2015-2024 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 require can_spawn_for_attach
22 set executable $testfile
24 if [prepare_for_testing "failed to prepare" $executable] {
28 set test_spawn_id [spawn_wait_for_attach $binfile]
29 set test_pid [spawn_id_get_pid $test_spawn_id]
31 set test "attach to process"
32 gdb_test "attach $test_pid" "Attaching to program.*" $test
34 set test "kill process"
35 gdb_test "kill" "" $test \
36 "Kill the program being debugged.*y or n. $" "y"
38 set test "restart process"
39 gdb_test "start" "Starting program.*Temporary breakpoint .*" $test
41 set test "attempt kill via quit"
42 # The quit prompt should warn about killing the process, not about detaching the
43 # process, since this process was not attached to.
45 gdb_test_multiple "quit" $test {
46 -re "will be killed.*.y or n. $" {
51 -re "will be detached.*.y or n. $" {
60 kill_wait_spawned_process $test_spawn_id