diff options
author | Pedro Alves <palves@redhat.com> | 2012-11-02 18:10:29 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2012-11-02 18:10:29 +0000 |
commit | 71ce889da907b11ec88efa3ddc93ee1f0371f8e9 (patch) | |
tree | 99df49bba46623161516f369601149d15d26e3f4 /gdb/testsuite/gdb.base/foll-vfork-exit.c | |
parent | 1e35b1a94e55f79e3ae629dd2237224f3e230867 (diff) |
2012-11-02 Pedro Alves <palves@redhat.com>
* gdb.base/foll-vfork-exit.c: New file.
* gdb.base/foll-vfork.exp (top level): New file-describing
comment.
(vfork_child_follow_to_exit): New procedure.
(tcatch_vfork_then_child_follow): Rename as ...
(tcatch_vfork_then_child_follow_exec): ... this.
(tcatch_vfork_then_child_follow_exit): New procedure.
(do_vfork_and_follow_parent_tests): New procedure, factored out
from do_vfork_and_exec_tests.
(do_vfork_and_follow_child_tests_exec): Ditto.
(do_vfork_and_exec_tests): Delete.
(do_vfork_and_follow_child_tests_exit): New procedure.
(top level): Run tests with both the program that has the vfork
child execing, and the program has the vfork child exiting.
Diffstat (limited to 'gdb/testsuite/gdb.base/foll-vfork-exit.c')
-rw-r--r-- | gdb/testsuite/gdb.base/foll-vfork-exit.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/foll-vfork-exit.c b/gdb/testsuite/gdb.base/foll-vfork-exit.c new file mode 100644 index 0000000000..6aa8a5ccc6 --- /dev/null +++ b/gdb/testsuite/gdb.base/foll-vfork-exit.c @@ -0,0 +1,38 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 1997, 1999, 2007-2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <stdio.h> +#include <unistd.h> + +int +main () +{ + int pid; + + pid = vfork (); + if (pid == 0) + { + printf ("I'm the child!\n"); + _exit (0); + } + else + { + printf ("I'm the proud parent of child #%d!\n", pid); + } + + return 0; +} |