Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
To: Dominique Quatravaux <dominique.quatravaux@epfl.ch>,
	gdb-patches@sourceware.org
Subject: Re: [PATCH 3/3] [fix] Skip over WIFSTOPPED wait4 status
Date: Thu, 8 Apr 2021 15:54:00 -0400	[thread overview]
Message-ID: <3e29a651-8aeb-0702-1ab9-e43627d63ee7@polymtl.ca> (raw)
In-Reply-To: <20210408191449.27434-3-dominique.quatravaux@epfl.ch>



On 2021-04-08 3:14 p.m., Dominique Quatravaux via Gdb-patches wrote:
> On modern Darwin's, there appears to be a new circumstance in which a
> MACH_NOTIFY_DEAD_NAME message can be received, and which was not
> previously accounted for: to signal the WIFSTOPPED condition in the
> debuggee. In that case the debuggee is not dead yet (and in fact,
> counting it as dead would cause a zombie leak - A process in such a
> state reparents to PID 1, but cannot be killed).
> 
> - Read and ignore such messages (counting on the next exception
> message to let us know of the inferior's new state again)
> - Refactor logging so as to clearly distinguish between the three
> MACH_NOTIFY_DEAD_NAME cases (WIFEXITED, WIFSTOPPED, signal)
> ---
>  gdb/darwin-nat.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
> index 9c6423ceb02..cbe36eba626 100644
> --- a/gdb/darwin-nat.c
> +++ b/gdb/darwin-nat.c
> @@ -1053,7 +1053,7 @@ darwin_nat_target::decode_message (mach_msg_header_t *hdr,
>      }
>    else if (hdr->msgh_id == 0x48)
>      {
> -      /* MACH_NOTIFY_DEAD_NAME: notification for exit.  */
> +      /* MACH_NOTIFY_DEAD_NAME: notification for exit *or* WIFSTOPPED.  */
>        int res;
>  
>        res = darwin_decode_notify_message (hdr, &inf);
> @@ -1096,16 +1096,23 @@ darwin_nat_target::decode_message (mach_msg_header_t *hdr,
>  		{
>  		  status->kind = TARGET_WAITKIND_EXITED;
>  		  status->value.integer = WEXITSTATUS (wstatus);
> +		  inferior_debug (4, _("darwin_wait: pid=%d exit, status=0x%x\n"),
> +				  res_pid, wstatus);
> +		}
> +	      else if (WIFSTOPPED (wstatus))
> +		{
> +		  status->kind = TARGET_WAITKIND_IGNORE;
> +		  inferior_debug (4, _("darwin_wait: pid %d received WIFSTOPPED\n"), res_pid);
> +		  return minus_one_ptid;
>  		}
>  	      else
>  		{
>  		  status->kind = TARGET_WAITKIND_SIGNALLED;
>  		  status->value.sig = gdb_signal_from_host (WTERMSIG (wstatus));
> +		  inferior_debug (4, _("darwin_wait: pid=%d received signal %d\n"),
> +			      res_pid, status->value.sig);
>  		}
>  
> -	      inferior_debug (4, _("darwin_wait: pid=%d exit, status=0x%x\n"),
> -			      res_pid, wstatus);
> -
>  	      return ptid_t (inf->pid);
>  	    }
>  	  else
> 

Thanks, that LGTM.  Let's just way until your copyright assigment is complete.

Simon

  reply	other threads:[~2021-04-08 19:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-08 19:14 [PATCH 1/3] [fix] Unused struct Dominique Quatravaux via Gdb-patches
2021-04-08 19:14 ` [PATCH 2/3] [delete] Not-so-harmless spurious call to `wait4` Dominique Quatravaux via Gdb-patches
2021-04-08 19:26   ` Simon Marchi via Gdb-patches
2021-04-08 20:25     ` [PATCH] was " Dominique Quatravaux via Gdb-patches
2021-04-09 14:34       ` Simon Marchi via Gdb-patches
2021-07-05  2:11         ` Simon Marchi via Gdb-patches
2021-04-08 19:14 ` [PATCH 3/3] [fix] Skip over WIFSTOPPED wait4 status Dominique Quatravaux via Gdb-patches
2021-04-08 19:54   ` Simon Marchi via Gdb-patches [this message]
2021-04-08 19:23 ` [PATCH 1/3] [fix] Unused struct Simon Marchi via Gdb-patches
2022-02-16 14:15 ` [RFC][PATCH v2 0/2][PR gdb/24069] Fix GDB hang on macOS 10.14 and later (PR gdb/24609) Philippe Blain via Gdb-patches
2022-02-16 14:15   ` [RFC][PATCH v2 1/2][PR gdb/24069] [delete] Not-so-harmless spurious call to `wait4` Philippe Blain via Gdb-patches
2022-02-19 15:47     ` Simon Marchi via Gdb-patches
2022-02-19 15:57       ` Philippe Blain via Gdb-patches
2022-02-19 16:02         ` Simon Marchi via Gdb-patches
2022-02-16 14:15   ` [RFC][PATCH v2 2/2][PR gdb/24069] [fix] Skip over WIFSTOPPED wait4 status Philippe Blain via Gdb-patches
2022-02-19 15:59     ` Simon Marchi via Gdb-patches
2022-02-19 17:49       ` Philippe Blain via Gdb-patches
2022-02-16 14:23   ` [RFC][PATCH v2 0/2][PR gdb/24069] Fix GDB hang on macOS 10.14 and later (PR gdb/24609) Philippe Blain via Gdb-patches
2022-02-24 14:23   ` [RFC][PATCH v3 0/1][PR gdb/24069] Fix GDB hang on macOS 10.14 and later Philippe Blain via Gdb-patches
2022-02-24 14:23     ` [RFC][PATCH v3 1/1][PR gdb/24069] gdb/darwin: skip over WIFSTOPPED wait4 status Philippe Blain via Gdb-patches
2022-02-24 15:49       ` Simon Marchi via Gdb-patches
2022-02-28 17:52         ` Philippe Blain via Gdb-patches
2022-02-28 18:34           ` Simon Marchi via Gdb-patches
2022-02-28 18:40             ` Philippe Blain via Gdb-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3e29a651-8aeb-0702-1ab9-e43627d63ee7@polymtl.ca \
    --to=gdb-patches@sourceware.org \
    --cc=dominique.quatravaux@epfl.ch \
    --cc=simon.marchi@polymtl.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox