diff options
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/config.in | 3 | ||||
-rwxr-xr-x | gdb/configure | 2 | ||||
-rw-r--r-- | gdb/configure.ac | 2 | ||||
-rw-r--r-- | gdb/ser-pipe.c | 12 |
5 files changed, 19 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cf7f2bd..7019523 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2010-09-02 Daniel Jacobowitz <dan@codesourcery.com> + + * config.in, configure: Regenerated. + * configure.ac: Check for waitpid. + * ser-pipe.c (pipe_close): Wait for the program to exit. + 2010-09-02 Jan Kratochvil <jan.kratochvil@redhat.com> * cli-logging.c: Include gdb_assert.h. diff --git a/gdb/config.in b/gdb/config.in index 7659181..173cd3d 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -676,6 +676,9 @@ /* Define to 1 if you have the <vfork.h> header file. */ #undef HAVE_VFORK_H +/* Define to 1 if you have the `waitpid' function. */ +#undef HAVE_WAITPID + /* Define to 1 if you have the <wait.h> header file. */ #undef HAVE_WAIT_H diff --git a/gdb/configure b/gdb/configure index 5563bae..2c7db68 100755 --- a/gdb/configure +++ b/gdb/configure @@ -12550,7 +12550,7 @@ for ac_func in canonicalize_file_name realpath getrusage getuid \ getgid pipe poll pread64 resize_term sbrk setpgid setpgrp setsid \ sigaction sigprocmask sigsetmask socketpair syscall \ ttrace wborder wresize setlocale iconvlist libiconvlist btowc \ - setrlimit getrlimit posix_madvise + setrlimit getrlimit posix_madvise waitpid do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/gdb/configure.ac b/gdb/configure.ac index 4b779aa..2f8090e 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -962,7 +962,7 @@ AC_CHECK_FUNCS([canonicalize_file_name realpath getrusage getuid \ getgid pipe poll pread64 resize_term sbrk setpgid setpgrp setsid \ sigaction sigprocmask sigsetmask socketpair syscall \ ttrace wborder wresize setlocale iconvlist libiconvlist btowc \ - setrlimit getrlimit posix_madvise]) + setrlimit getrlimit posix_madvise waitpid]) AM_LANGINFO_CODESET # Check the return and argument types of ptrace. No canned test for diff --git a/gdb/ser-pipe.c b/gdb/ser-pipe.c index d26dc4f..5b439f7 100644 --- a/gdb/ser-pipe.c +++ b/gdb/ser-pipe.c @@ -31,6 +31,7 @@ #include <sys/time.h> #include <fcntl.h> #include "gdb_string.h" +#include "gdb_wait.h" #include <signal.h> @@ -162,11 +163,14 @@ pipe_close (struct serial *scb) if (state != NULL) { + int status; kill (state->pid, SIGTERM); - /* Might be useful to check that the child does die, - and while we're waiting for it to die print any remaining - stderr output. */ - +#ifdef HAVE_WAITPID + /* Assume the program will exit after SIGTERM. Might be + useful to print any remaining stderr output from + scb->error_fd while waiting. */ + waitpid (state->pid, &status, 0); +#endif if (scb->error_fd != -1) close (scb->error_fd); scb->error_fd = -1; |