[gdb/testsuite] Factor out lib/valgrind.exp
[external/binutils.git] / gdb / testsuite / gdb.base / step-over-vfork.c
1 /* This testcase is part of GDB, the GNU debugger.
2
3    Copyright 2011-2018 Free Software Foundation, Inc.
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3 of the License, or
8    (at your option) any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17
18 #include <unistd.h>
19
20 static void
21 marker () {}
22
23 int
24 main (void)
25 {
26   int pid;
27
28   pid = vfork ();
29   if (pid == -1)
30     {
31       return 1;
32     }
33   else if (pid != 0)
34     {
35     }
36   else
37     {
38       _exit (0);
39     }
40
41   pid = vfork ();
42   if (pid == -1)
43     {
44       return 1;
45     }
46   else if (pid != 0)
47     {
48     }
49   else
50     {
51       _exit (0);
52     }
53
54   pid = vfork ();
55   if (pid == -1)
56     {
57       return 1;
58     }
59   else if (pid != 0)
60     {
61     }
62   else
63     {
64       _exit (0);
65     }
66
67   marker ();
68   return 0;
69
70 }