1 /* PSPP - computes sample statistics.
2 Copyright (C) 2006 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 #if HAVE_SYS_TYPES_H && HAVE_SYS_WAIT_H
25 #include <sys/types.h>
31 /* Fork, start gdb and connect to the parent process.
32 If that happens successfully, then this function does not return,
33 but exits with EXIT_FAILURE. Otherwise it returns.
36 connect_debugger (void)
41 snprintf (pidstr, 20, "%d", getpid ());
45 perror ("Cannot fork");
51 execlp ("gdb", "gdb", "-p", pidstr, NULL);
52 perror ("Cannot exec debugger");
59 if ( EXIT_SUCCESS != WEXITSTATUS (status) )
66 #else /* !(HAVE_SYS_TYPES_H && HAVE_SYS_WAIT_H) */
67 /* Don't know how to connect to gdb.
71 connect_debugger (void)
74 #endif /* !(HAVE_SYS_TYPES_H && HAVE_SYS_WAIT_H) */