X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fdebugger.c;h=f3f678461f932f14074ee7f5d093b34d8250adfe;hb=83477e8021833536509416fc98179546e4cfb6a7;hp=7d7b0cce5845249c0b85aeb76dd06f7f1a9fc9e8;hpb=164d1274fcb70c54897f2a03fc7c27152ed4821a;p=pspp-builds.git diff --git a/src/ui/debugger.c b/src/ui/debugger.c index 7d7b0cce..f3f67846 100644 --- a/src/ui/debugger.c +++ b/src/ui/debugger.c @@ -1,23 +1,24 @@ -/* PSPP - computes sample statistics. +/* PSPP - a program for statistical analysis. Copyright (C) 2006 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 2 of the - License, or (at your option) any later version. + 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. + 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. */ + along with this program. If not, see . */ #include +#include "debugger.h" + +#if HAVE_FORK && HAVE_EXECLP #include #include #include @@ -25,14 +26,10 @@ #include #include - -#include "debugger.h" - -/* Fork, start gdb and connect to the parent process. +/* Fork, start gdb and connect to the parent process. If that happens successfully, then this function does not return, but exits with EXIT_FAILURE. Otherwise it returns. */ - void connect_debugger (void) { @@ -41,12 +38,12 @@ connect_debugger (void) snprintf (pidstr, 20, "%d", getpid ()); pid = fork (); - if ( pid == -1 ) + if ( pid == -1 ) { perror ("Cannot fork"); return ; } - if ( pid == 0 ) + if ( pid == 0 ) { /* child */ execlp ("gdb", "gdb", "-p", pidstr, NULL); @@ -57,10 +54,19 @@ connect_debugger (void) { int status; wait (&status); - if ( EXIT_SUCCESS != WEXITSTATUS (status) ) + if ( EXIT_SUCCESS != WEXITSTATUS (status) ) return ; } - + exit (EXIT_FAILURE); } +#else /* !(HAVE_FORK && HAVE_EXECLP) */ +/* Don't know how to connect to gdb. + Just return. + */ +void +connect_debugger (void) +{ +} +#endif /* !(HAVE_FORK && HAVE_EXECLP) */