Update copyright year range in all GDB files.
[binutils-gdb.git] / gdb / testsuite / gdb.base / pie-fork.exp
blob06764e5b26546cce01c0d84c3f5dc8001d5942c1
1 # Copyright 2018-2020 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 # Test that we can follow forks properly when the executable is
17 # position-independent.
19 standard_testfile
21 set opts [list debug additional_flags=-fPIE ldflags=-pie]
23 if [prepare_for_testing "failed to prepare" $testfile $srcfile $opts] {
24     return
27 proc setup_test {detach_on_fork {follow_fork_mode "parent"}} {
28     global binfile
30     clean_restart ${binfile}
32     if ![runto_main] {
33         fail "can't run to main"
34         return
35     }
37     gdb_test_no_output "set detach-on-fork ${detach_on_fork}"
38     gdb_test_no_output "set follow-fork-mode ${follow_fork_mode}"
40     gdb_breakpoint "break_here"
43 proc_with_prefix test_detach_on_fork_follow_parent {} {
44     setup_test "on" "parent"
46     gdb_test "continue" "\r\nBreakpoint 2, break_here.*"
49 proc_with_prefix test_detach_on_fork_follow_child {} {
50     setup_test "on" "child"
52     gdb_test "continue" "\r\nThread 2.1 .* hit Breakpoint 2, break_here.*"
55 proc_with_prefix test_no_detach_on_fork {} {
56     setup_test "off"
58     gdb_test "continue" "\r\nThread 1.1 .* hit Breakpoint 2, break_here.*"
59     gdb_test "thread 2.1"
60     gdb_test "continue" "\r\nThread 2.1 .* hit Breakpoint 2, break_here.*"
63 test_detach_on_fork_follow_parent
64 test_detach_on_fork_follow_child
65 test_no_detach_on_fork