public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFC] Don't immediately SIGTERM the child of "target remote |".
@ 2011-11-24  0:01 Doug Evans
  2011-11-24  0:09 ` Doug Evans
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Doug Evans @ 2011-11-24  0:01 UTC (permalink / raw)
  To: gdb-patches

Hi.

While testing a patch to allow gdbserver to communicate over stdio
(e.g. target remote | gdbserver ...)
I found that several tests from the testsuite were left running
and traced it to gdb SIGTERMing gdbserver when the connection is closed.

We could add a SIGTERM handler to gdbserver
but I'm starting with this patch.
I don't understand why gdb kills the child at all.
In a properly written child connection, closing stdin should be a
sufficient signal for the child to know to shutdown.

AFAICT The kill() call was added in cvs revision 1.2 with the log entry:
Replace ../include/wait.h with gdb_wait.h.
Blech.

Alas I can't remove this kill(SIGTERM) call
for fear of breaking something so I'm trying a
compromise and only killing the child after some timeout.

Comments?

I borrowed the SA_RESTART handling from other places in gdb.
I don't actually know that this works (i.e. the alarm call
will wake up waitpid) on systems without SA_RESTART,
and I don't know if alarm() is portable enough
(there are no current uses of it AFAICT).

2011-11-23  Doug Evans  <dje@google.com>

	* ser-pipe.c (sigalrm_handler): New function.
	(pipe_close): Don't immediately send SIGTERM to the child.
	Give it awhile to cleanly shutdown, but don't wait forever.

Index: ser-pipe.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-pipe.c,v
retrieving revision 1.32
diff -u -p -r1.32 ser-pipe.c
--- ser-pipe.c	4 Mar 2011 19:23:42 -0000	1.32
+++ ser-pipe.c	23 Nov 2011 23:46:55 -0000
@@ -154,6 +154,12 @@ pipe_open (struct serial *scb, const cha
 }
 
 static void
+sigalrm_handler (int signo)
+{
+  /* nothing to do */
+}
+
+static void
 pipe_close (struct serial *scb)
 {
   struct pipe_state *state = scb->state;
@@ -163,14 +169,45 @@ pipe_close (struct serial *scb)
 
   if (state != NULL)
     {
-      int status;
-      kill (state->pid, SIGTERM);
+      int rc, status;
+      void (*ofunc) ();	/* Previous SIGALRM handler.  */
+
+      /* Don't kill the task right away, give it a chance to shut down cleanly.
+	 But don't wait forever though.  */
+#if defined (HAVE_SIGACTION) && defined (SA_RESTART)
+      {
+	struct sigaction sa, osa;
+	sa.sa_handler = sigalrm_handler;
+	sigemptyset (&sa.sa_mask);
+	sa.sa_flags = 0;
+	sigaction (SIGALRM, &sa, &osa);
+	ofunc = osa.sa_handler;
+      }
+#else
+      ofunc = (void (*)()) signal (SIGALRM, sigalrm_handler);
+#endif
+
+#define PIPE_CLOSE_TIMEOUT 5
+      alarm (PIPE_CLOSE_TIMEOUT);
+
+      rc = -1;
 #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);
+      rc = waitpid (state->pid, &status, 0);
+#endif
+      if (rc != 0)
+	{
+	  kill (state->pid, SIGTERM);
+#ifdef HAVE_WAITPID
+	  waitpid (state->pid, &status, 0);
 #endif
+	}
+
+      alarm (0);
+      signal (SIGALRM, ofunc);
+
       if (scb->error_fd != -1)
 	close (scb->error_fd);
       scb->error_fd = -1;

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC] Don't immediately SIGTERM the child of "target remote |".
  2011-11-24  0:01 [RFC] Don't immediately SIGTERM the child of "target remote |" Doug Evans
@ 2011-11-24  0:09 ` Doug Evans
  2011-11-24  3:57 ` Eli Zaretskii
  2011-11-27 20:40 ` Jan Kratochvil
  2 siblings, 0 replies; 11+ messages in thread
From: Doug Evans @ 2011-11-24  0:09 UTC (permalink / raw)
  To: gdb-patches

Sorry for the followup.
Minor comment inline.

On Wed, Nov 23, 2011 at 4:00 PM, Doug Evans <dje@google.com> wrote:
> Hi.
>
> While testing a patch to allow gdbserver to communicate over stdio
> (e.g. target remote | gdbserver ...)
> I found that several tests from the testsuite were left running
> and traced it to gdb SIGTERMing gdbserver when the connection is closed.
>
> We could add a SIGTERM handler to gdbserver
> but I'm starting with this patch.
> I don't understand why gdb kills the child at all.
> In a properly written child connection, closing stdin should be a
> sufficient signal for the child to know to shutdown.
>
> AFAICT The kill() call was added in cvs revision 1.2 with the log entry:
> Replace ../include/wait.h with gdb_wait.h.
> Blech.
>
> Alas I can't remove this kill(SIGTERM) call
> for fear of breaking something so I'm trying a
> compromise and only killing the child after some timeout.
>
> Comments?
>
> I borrowed the SA_RESTART handling from other places in gdb.
> I don't actually know that this works (i.e. the alarm call
> will wake up waitpid) on systems without SA_RESTART,
> and I don't know if alarm() is portable enough
> (there are no current uses of it AFAICT).
>
> 2011-11-23  Doug Evans  <dje@google.com>
>
>        * ser-pipe.c (sigalrm_handler): New function.
>        (pipe_close): Don't immediately send SIGTERM to the child.
>        Give it awhile to cleanly shutdown, but don't wait forever.
>
> Index: ser-pipe.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/ser-pipe.c,v
> retrieving revision 1.32
> diff -u -p -r1.32 ser-pipe.c
> --- ser-pipe.c  4 Mar 2011 19:23:42 -0000       1.32
> +++ ser-pipe.c  23 Nov 2011 23:46:55 -0000
> @@ -154,6 +154,12 @@ pipe_open (struct serial *scb, const cha
>  }
>
>  static void
> +sigalrm_handler (int signo)
> +{
> +  /* nothing to do */
> +}
> +
> +static void
>  pipe_close (struct serial *scb)
>  {
>   struct pipe_state *state = scb->state;
> @@ -163,14 +169,45 @@ pipe_close (struct serial *scb)
>
>   if (state != NULL)
>     {
> -      int status;
> -      kill (state->pid, SIGTERM);
> +      int rc, status;
> +      void (*ofunc) ();        /* Previous SIGALRM handler.  */
> +
> +      /* Don't kill the task right away, give it a chance to shut down cleanly.
> +        But don't wait forever though.  */
> +#if defined (HAVE_SIGACTION) && defined (SA_RESTART)
> +      {
> +       struct sigaction sa, osa;
> +       sa.sa_handler = sigalrm_handler;
> +       sigemptyset (&sa.sa_mask);
> +       sa.sa_flags = 0;
> +       sigaction (SIGALRM, &sa, &osa);
> +       ofunc = osa.sa_handler;
> +      }
> +#else
> +      ofunc = (void (*)()) signal (SIGALRM, sigalrm_handler);
> +#endif
> +
> +#define PIPE_CLOSE_TIMEOUT 5
> +      alarm (PIPE_CLOSE_TIMEOUT);
> +
> +      rc = -1;
>  #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);
> +      rc = waitpid (state->pid, &status, 0);
> +#endif
> +      if (rc != 0)
> +       {
> +         kill (state->pid, SIGTERM);
> +#ifdef HAVE_WAITPID

Hmmm, in order to be compatible with the previous code the alarm
should be cancelled before this call to waitpid.
OTOH, having an alarm could be a useful thing anyway.

> +         waitpid (state->pid, &status, 0);
>  #endif
> +       }
> +
> +      alarm (0);
> +      signal (SIGALRM, ofunc);
> +
>       if (scb->error_fd != -1)
>        close (scb->error_fd);
>       scb->error_fd = -1;
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC] Don't immediately SIGTERM the child of "target remote |".
  2011-11-24  0:01 [RFC] Don't immediately SIGTERM the child of "target remote |" Doug Evans
  2011-11-24  0:09 ` Doug Evans
@ 2011-11-24  3:57 ` Eli Zaretskii
  2011-11-24  6:20   ` Doug Evans
  2011-11-27 20:40 ` Jan Kratochvil
  2 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2011-11-24  3:57 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

> Date: Wed, 23 Nov 2011 16:00:51 -0800 (PST)
> From: dje@google.com (Doug Evans)
> 
> +#if defined (HAVE_SIGACTION) && defined (SA_RESTART)
> +      {
> +	struct sigaction sa, osa;
> +	sa.sa_handler = sigalrm_handler;
> +	sigemptyset (&sa.sa_mask);
> +	sa.sa_flags = 0;
> +	sigaction (SIGALRM, &sa, &osa);
> +	ofunc = osa.sa_handler;
> +      }
> +#else
> +      ofunc = (void (*)()) signal (SIGALRM, sigalrm_handler);
> +#endif

SIGALRM may not be defined (e.g., on MS-Windows).

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC] Don't immediately SIGTERM the child of "target remote |".
  2011-11-24  3:57 ` Eli Zaretskii
@ 2011-11-24  6:20   ` Doug Evans
  0 siblings, 0 replies; 11+ messages in thread
From: Doug Evans @ 2011-11-24  6:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

On Wed, Nov 23, 2011 at 7:57 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Wed, 23 Nov 2011 16:00:51 -0800 (PST)
>> From: dje@google.com (Doug Evans)
>>
>> +#if defined (HAVE_SIGACTION) && defined (SA_RESTART)
>> +      {
>> +     struct sigaction sa, osa;
>> +     sa.sa_handler = sigalrm_handler;
>> +     sigemptyset (&sa.sa_mask);
>> +     sa.sa_flags = 0;
>> +     sigaction (SIGALRM, &sa, &osa);
>> +     ofunc = osa.sa_handler;
>> +      }
>> +#else
>> +      ofunc = (void (*)()) signal (SIGALRM, sigalrm_handler);
>> +#endif
>
> SIGALRM may not be defined (e.g., on MS-Windows).
>

Thanks.  That's easy enough to #ifdef around.
[Things could work as they do today #ifndef SIGALRM.]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC] Don't immediately SIGTERM the child of "target remote |".
  2011-11-24  0:01 [RFC] Don't immediately SIGTERM the child of "target remote |" Doug Evans
  2011-11-24  0:09 ` Doug Evans
  2011-11-24  3:57 ` Eli Zaretskii
@ 2011-11-27 20:40 ` Jan Kratochvil
  2011-11-27 22:23   ` Doug Evans
  2 siblings, 1 reply; 11+ messages in thread
From: Jan Kratochvil @ 2011-11-27 20:40 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

On Thu, 24 Nov 2011 01:00:51 +0100, Doug Evans wrote:
[...]
> -      int status;
> -      kill (state->pid, SIGTERM);
> +      int rc, status;
> +      void (*ofunc) ();	/* Previous SIGALRM handler.  */
                        ^int (or void)
> +
> +      /* Don't kill the task right away, give it a chance to shut down cleanly.
> +	 But don't wait forever though.  */
> +#if defined (HAVE_SIGACTION) && defined (SA_RESTART)
> +      {
> +	struct sigaction sa, osa;
> +	sa.sa_handler = sigalrm_handler;
> +	sigemptyset (&sa.sa_mask);
> +	sa.sa_flags = 0;
> +	sigaction (SIGALRM, &sa, &osa);
> +	ofunc = osa.sa_handler;
> +      }
> +#else
> +      ofunc = (void (*)()) signal (SIGALRM, sigalrm_handler);
> +#endif
[...]
> +      alarm (0);
> +      signal (SIGALRM, ofunc);

You should restore OSA, not just OFUNC.


Thanks,
Jan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC] Don't immediately SIGTERM the child of "target remote |".
  2011-11-27 20:40 ` Jan Kratochvil
@ 2011-11-27 22:23   ` Doug Evans
  2011-12-01 19:46     ` [RFA] " Doug Evans
  0 siblings, 1 reply; 11+ messages in thread
From: Doug Evans @ 2011-11-27 22:23 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

On Sun, Nov 27, 2011 at 12:40 PM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> On Thu, 24 Nov 2011 01:00:51 +0100, Doug Evans wrote:
> [...]
>> -      int status;
>> -      kill (state->pid, SIGTERM);
>> +      int rc, status;
>> +      void (*ofunc) ();      /* Previous SIGALRM handler.  */
>                        ^int (or void)
>> +
>> +      /* Don't kill the task right away, give it a chance to shut down cleanly.
>> +      But don't wait forever though.  */
>> +#if defined (HAVE_SIGACTION) && defined (SA_RESTART)
>> +      {
>> +     struct sigaction sa, osa;
>> +     sa.sa_handler = sigalrm_handler;
>> +     sigemptyset (&sa.sa_mask);
>> +     sa.sa_flags = 0;
>> +     sigaction (SIGALRM, &sa, &osa);
>> +     ofunc = osa.sa_handler;
>> +      }
>> +#else
>> +      ofunc = (void (*)()) signal (SIGALRM, sigalrm_handler);
>> +#endif
> [...]
>> +      alarm (0);
>> +      signal (SIGALRM, ofunc);
>
> You should restore OSA, not just OFUNC.

The code was borrowed from remote-sim.c.
In this case I suspect it doesn't matter, but it's just as well to restore osa.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [RFA] Don't immediately SIGTERM the child of "target remote |".
  2011-11-27 22:23   ` Doug Evans
@ 2011-12-01 19:46     ` Doug Evans
  2011-12-01 19:50       ` Jan Kratochvil
  0 siblings, 1 reply; 11+ messages in thread
From: Doug Evans @ 2011-12-01 19:46 UTC (permalink / raw)
  To: Jan Kratochvil, Eli Zaretskii; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1669 bytes --]

On Sun, Nov 27, 2011 at 2:23 PM, Doug Evans <dje@google.com> wrote:
> On Sun, Nov 27, 2011 at 12:40 PM, Jan Kratochvil
> <jan.kratochvil@redhat.com> wrote:
>> On Thu, 24 Nov 2011 01:00:51 +0100, Doug Evans wrote:
>> [...]
>>> -      int status;
>>> -      kill (state->pid, SIGTERM);
>>> +      int rc, status;
>>> +      void (*ofunc) ();      /* Previous SIGALRM handler.  */
>>                        ^int (or void)
>>> +
>>> +      /* Don't kill the task right away, give it a chance to shut down cleanly.
>>> +      But don't wait forever though.  */
>>> +#if defined (HAVE_SIGACTION) && defined (SA_RESTART)
>>> +      {
>>> +     struct sigaction sa, osa;
>>> +     sa.sa_handler = sigalrm_handler;
>>> +     sigemptyset (&sa.sa_mask);
>>> +     sa.sa_flags = 0;
>>> +     sigaction (SIGALRM, &sa, &osa);
>>> +     ofunc = osa.sa_handler;
>>> +      }
>>> +#else
>>> +      ofunc = (void (*)()) signal (SIGALRM, sigalrm_handler);
>>> +#endif
>> [...]
>>> +      alarm (0);
>>> +      signal (SIGALRM, ofunc);
>>
>> You should restore OSA, not just OFUNC.
>
> The code was borrowed from remote-sim.c.
> In this case I suspect it doesn't matter, but it's just as well to restore osa.
>

I will check this in on Monday if there are no objections.

2011-12-01  Doug Evans  <dje@google.com>

        * defs.h (wait_to_die_with_timeout): Declare.
        * utils.c: #include "gdb_wait.h".
        (sigalrm_handler, wait_to_die_with_timeout): New functions.
        * ser-pipe.c: Don't #include "gdb_wait.h".
        (pipe_close): Give child a chance to die on its own after closing
        its stdin before SIGTERM'ing it.

[-- Attachment #2: gdb-111201-ser-pipe-sigterm-2.patch.txt --]
[-- Type: text/plain, Size: 4446 bytes --]

2011-12-01  Doug Evans  <dje@google.com>

	* defs.h (wait_to_die_with_timeout): Declare.
	* utils.c: #include "gdb_wait.h".
	(sigalrm_handler, wait_to_die_with_timeout): New functions.
	* ser-pipe.c: Don't #include "gdb_wait.h".
	(pipe_close): Give child a chance to die on its own after closing
	its stdin before SIGTERM'ing it.

Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.305
diff -u -p -r1.305 defs.h
--- defs.h	10 Nov 2011 20:21:27 -0000	1.305
+++ defs.h	1 Dec 2011 19:41:30 -0000
@@ -439,6 +439,10 @@ extern struct cleanup *make_bpstat_clear
 
 extern int producer_is_gcc_ge_4 (const char *producer);
 
+#ifdef HAVE_WAITPID
+extern int wait_to_die_with_timeout (int pid, int *status, int timeout);
+#endif
+
 \f
 /* Annotation stuff.  */
 
Index: ser-pipe.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-pipe.c,v
retrieving revision 1.32
diff -u -p -r1.32 ser-pipe.c
--- ser-pipe.c	4 Mar 2011 19:23:42 -0000	1.32
+++ ser-pipe.c	1 Dec 2011 19:41:30 -0000
@@ -31,7 +31,6 @@
 #include <sys/time.h>
 #include <fcntl.h>
 #include "gdb_string.h"
-#include "gdb_wait.h"
 
 #include <signal.h>
 
@@ -163,14 +162,30 @@ pipe_close (struct serial *scb)
 
   if (state != NULL)
     {
-      int status;
-      kill (state->pid, SIGTERM);
-#ifdef HAVE_WAITPID
+      int wait_result, status;
+
+      /* Don't kill the task right away, give it a chance to shut down cleanly.
+	 But don't wait forever though.  */
+#define PIPE_CLOSE_TIMEOUT 5
+
       /* 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);
+#define SIGTERM_TIMEOUT INT_MAX
+
+      wait_result = -1;
+#ifdef HAVE_WAITPID
+      wait_result = wait_to_die_with_timeout (state->pid, &status,
+					      PIPE_CLOSE_TIMEOUT);
 #endif
+      if (wait_result == -1)
+	{
+	  kill (state->pid, SIGTERM);
+#ifdef HAVE_WAITPID
+	  wait_to_die_with_timeout (state->pid, &status, SIGTERM_TIMEOUT);
+#endif
+	}
+
       if (scb->error_fd != -1)
 	close (scb->error_fd);
       scb->error_fd = -1;
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.267
diff -u -p -r1.267 utils.c
--- utils.c	16 Nov 2011 18:14:52 -0000	1.267
+++ utils.c	1 Dec 2011 19:41:30 -0000
@@ -24,6 +24,7 @@
 #include "gdb_assert.h"
 #include <ctype.h>
 #include "gdb_string.h"
+#include "gdb_wait.h"
 #include "event-top.h"
 #include "exceptions.h"
 #include "gdbthread.h"
@@ -3773,6 +3774,78 @@ producer_is_gcc_ge_4 (const char *produc
   return minor;
 }
 
+#ifdef HAVE_WAITPID
+
+#ifdef SIGALRM
+
+/* SIGALRM handler for waitpid_with_timeout.  */
+
+static void
+sigalrm_handler (int signo)
+{
+  /* Nothing to do.  */
+}
+
+#endif
+
+/* Wrapper to wait for child PID to die with TIMEOUT.
+   TIMEOUT is the time to stop waiting in seconds.
+   If TIMEOUT is zero, pass WNOHANG to waitpid.
+   Returns PID if it was successfully waited for, otherwise -1.
+
+   Timeouts are currently implemented with alarm and SIGALRM.
+   If the host does not support them, this waits "forever".
+   It would be odd though for a host to have waitpid and not SIGALRM.  */
+
+int
+wait_to_die_with_timeout (int pid, int *status, int timeout)
+{
+  int waitpid_result;
+
+  gdb_assert (pid > 0);
+  gdb_assert (timeout >= 0);
+
+  if (timeout > 0)
+    {
+#ifdef SIGALRM
+#if defined (HAVE_SIGACTION) && defined (SA_RESTART)
+      struct sigaction sa, old_sa;
+
+      sa.sa_handler = sigalrm_handler;
+      sigemptyset (&sa.sa_mask);
+      sa.sa_flags = 0;
+      sigaction (SIGALRM, &sa, &old_sa);
+#else
+      void (*ofunc) ();
+
+      ofunc = (void (*)()) signal (SIGALRM, sigalrm_handler);
+#endif
+
+      alarm (timeout);
+#endif
+
+      waitpid_result = waitpid (pid, status, 0);
+
+#ifdef SIGALRM
+      alarm (0);
+#if defined (HAVE_SIGACTION) && defined (SA_RESTART)
+      sigaction (SIGALRM, &old_sa, NULL);
+#else
+      signal (SIGALRM, ofunc);
+#endif
+#endif
+    }
+  else
+    waitpid_result = waitpid (pid, status, WNOHANG);
+
+  if (waitpid_result == pid)
+    return pid;
+  else
+    return -1;
+}
+
+#endif /* HAVE_WAITPID */
+
 /* Provide a prototype to silence -Wmissing-prototypes.  */
 extern initialize_file_ftype _initialize_utils;
 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFA] Don't immediately SIGTERM the child of "target remote |".
  2011-12-01 19:46     ` [RFA] " Doug Evans
@ 2011-12-01 19:50       ` Jan Kratochvil
  2011-12-01 20:13         ` Doug Evans
  0 siblings, 1 reply; 11+ messages in thread
From: Jan Kratochvil @ 2011-12-01 19:50 UTC (permalink / raw)
  To: Doug Evans; +Cc: Eli Zaretskii, gdb-patches

On Thu, 01 Dec 2011 20:46:35 +0100, Doug Evans wrote:
> +extern int wait_to_die_with_timeout (int pid, int *status, int timeout);
                                        pid_t pid
just a nitpick


Thanks,
Jan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFA] Don't immediately SIGTERM the child of "target remote |".
  2011-12-01 19:50       ` Jan Kratochvil
@ 2011-12-01 20:13         ` Doug Evans
  2011-12-01 20:20           ` Jan Kratochvil
  0 siblings, 1 reply; 11+ messages in thread
From: Doug Evans @ 2011-12-01 20:13 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: Eli Zaretskii, gdb-patches

On Thu, Dec 1, 2011 at 11:49 AM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> On Thu, 01 Dec 2011 20:46:35 +0100, Doug Evans wrote:
>> +extern int wait_to_die_with_timeout (int pid, int *status, int timeout);
>                                        pid_t pid
> just a nitpick

I thought of that but punted on portability grounds.
There are lots of places in gdb that still use int.

It *would* be preferable.
And the code does live inside #ifdef HAVE_WAITPID.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFA] Don't immediately SIGTERM the child of "target remote |".
  2011-12-01 20:13         ` Doug Evans
@ 2011-12-01 20:20           ` Jan Kratochvil
  2011-12-14 21:17             ` Doug Evans
  0 siblings, 1 reply; 11+ messages in thread
From: Jan Kratochvil @ 2011-12-01 20:20 UTC (permalink / raw)
  To: Doug Evans; +Cc: Eli Zaretskii, gdb-patches

On Thu, 01 Dec 2011 21:12:57 +0100, Doug Evans wrote:
> I thought of that but punted on portability grounds.
> There are lots of places in gdb that still use int.

Yes but pid_t is also already in use and configure already checks and defines
pid_t when needed (AC_TYPE_PID_T probably).  Although just indirectly via some
other macro.
/* Define to `int' if <sys/types.h> does not define. */
/* #undef pid_t */

Anyway not much worth a discussion.


Regards,
Jan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFA] Don't immediately SIGTERM the child of "target remote |".
  2011-12-01 20:20           ` Jan Kratochvil
@ 2011-12-14 21:17             ` Doug Evans
  0 siblings, 0 replies; 11+ messages in thread
From: Doug Evans @ 2011-12-14 21:17 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: Eli Zaretskii, gdb-patches

On Thu, Dec 1, 2011 at 12:19 PM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> On Thu, 01 Dec 2011 21:12:57 +0100, Doug Evans wrote:
>> I thought of that but punted on portability grounds.
>> There are lots of places in gdb that still use int.
>
> Yes but pid_t is also already in use and configure already checks and defines
> pid_t when needed (AC_TYPE_PID_T probably).  Although just indirectly via some
> other macro.
> /* Define to `int' if <sys/types.h> does not define. */
> /* #undef pid_t */
>
> Anyway not much worth a discussion.

Committed with pid_t.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-12-14 21:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-24  0:01 [RFC] Don't immediately SIGTERM the child of "target remote |" Doug Evans
2011-11-24  0:09 ` Doug Evans
2011-11-24  3:57 ` Eli Zaretskii
2011-11-24  6:20   ` Doug Evans
2011-11-27 20:40 ` Jan Kratochvil
2011-11-27 22:23   ` Doug Evans
2011-12-01 19:46     ` [RFA] " Doug Evans
2011-12-01 19:50       ` Jan Kratochvil
2011-12-01 20:13         ` Doug Evans
2011-12-01 20:20           ` Jan Kratochvil
2011-12-14 21:17             ` Doug Evans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).