From 0a4f61e3e4c32971615274aed323a1be06117551 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Thu, 2 Sep 2010 17:12:38 +0000 Subject: [PATCH] * config.in, configure: Regenerated. * configure.ac: Check for waitpid. * ser-pipe.c (pipe_close): Wait for the program to exit. --- gdb/ChangeLog | 6 ++++++ gdb/config.in | 3 +++ gdb/configure | 2 +- gdb/configure.ac | 2 +- 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 + + * 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 * 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 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 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 #include #include "gdb_string.h" +#include "gdb_wait.h" #include @@ -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; -- 2.7.4