public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Don Breazeal <donb@codesourcery.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v6 5/6] Remote follow vfork
Date: Tue, 24 Mar 2015 12:28:00 -0000	[thread overview]
Message-ID: <55115851.6070201@redhat.com> (raw)
In-Reply-To: <1426625788-4469-6-git-send-email-donb@codesourcery.com>

On 03/17/2015 08:56 PM, Don Breazeal wrote:

> diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
> index dc43e38..42c3ec5 100644
> --- a/gdb/gdbserver/remote-utils.c
> +++ b/gdb/gdbserver/remote-utils.c
> @@ -1115,15 +1115,19 @@ prepare_resume_reply (char *buf, ptid_t ptid,
>      {
>      case TARGET_WAITKIND_STOPPED:
>      case TARGET_WAITKIND_FORKED:
> +    case TARGET_WAITKIND_VFORKED:
>        {
>  	struct thread_info *saved_thread;
>  	const char **regp;
>  	struct regcache *regcache;
>  
> -	if (status->kind == TARGET_WAITKIND_FORKED && report_fork_events)
> +	if ((status->kind == TARGET_WAITKIND_FORKED && report_fork_events)
> +	     || (status->kind == TARGET_WAITKIND_VFORKED
> +		 && report_vfork_events))
>  	  {
>  	    enum gdb_signal signal = GDB_SIGNAL_TRAP;
> -	    const char *event = "xfork";
> +	    const char *event = (status->kind == TARGET_WAITKIND_FORKED
> +				 ? "xfork" : "vfork");
>  
>  	    sprintf (buf, "T%02x%s:", signal, event);
>  	    buf += strlen (buf);
> @@ -1245,6 +1249,15 @@ prepare_resume_reply (char *buf, ptid_t ptid,
>        else
>  	sprintf (buf, "X%02x", status->value.sig);
>        break;
> +    case TARGET_WAITKIND_VFORK_DONE:
> +      if (multi_process)
> +	{
> +	  enum gdb_signal signal = GDB_SIGNAL_TRAP;
> +	  const char *event = "vforkdone";
> +

Should only include vforkdone if report_vfork_events is true, I'd think.

> +	  sprintf (buf, "T%02x%s:;", signal, event);
> +	}
> +      break;
>      default:
>        error ("unhandled waitkind");
>        break;
> diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
> index 696a24e..09a5624 100644
> --- a/gdb/gdbserver/server.h
> +++ b/gdb/gdbserver/server.h
> @@ -85,6 +85,7 @@ extern int disable_packet_qfThreadInfo;
>  extern int run_once;
>  extern int multi_process;
>  extern int report_fork_events;
> +extern int report_vfork_events;
>  extern int non_stop;
>  
>  /* True if the "swbreak+" feature is active.  In that case, GDB wants
> diff --git a/gdb/remote.c b/gdb/remote.c
> index 899c7a2..d1ba62d 100644
> --- a/gdb/remote.c
> +++ b/gdb/remote.c
> @@ -4526,15 +4526,20 @@ remote_follow_fork (struct target_ops *ops, int follow_child,
>  {
>    struct remote_state *rs = get_remote_state ();
>  
> +  /* If fork events aren't supported, then return.  We know that if
> +     fork events are supported, then so are vfork events, since they
> +     were both introduced in the same version of the linux kernel.  */

"Linux", caps.

But this really doesn't make sense -- if we define different
qSupported features for fork and vfork, then we should check
them separately.  We don't know (and shouldn't care) whether
we're debugging against a Linux target here.  The packets/features
should work with other OSs.

>    if (remote_fork_event_p (rs))
>      {
>        if (detach_fork && !follow_child)
>  	{
>  	  ptid_t parent_ptid;
>  	  ptid_t child_ptid;
> +	  enum target_waitkind kind;
>  

Thanks,
Pedro Alves

  reply	other threads:[~2015-03-24 12:28 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201501252151.t0PLo3jE018308@mx0b-0013c101.pphosted.com>
2015-01-26  4:43 ` [PATCH v4 0/7] Remote fork events Breazeal, Don
2015-02-06 20:02   ` Breazeal, Don
2015-02-27  0:46   ` [PATCH v5 0/6] " Don Breazeal
2015-02-27  0:46     ` [PATCH v5 01/06] Identify remote fork event support Don Breazeal
2015-02-27  0:47     ` [PATCH v5 03/06] Extended-remote Linux follow fork Don Breazeal
2015-02-27  0:47     ` [PATCH v5 05/06] Remote follow vfork Don Breazeal
2015-02-27  0:47     ` [PATCH v5 02/06] Clone remote breakpoints Don Breazeal
2015-02-27  0:47     ` [PATCH v5 04/06] Arch-specific remote follow fork Don Breazeal
2015-02-27  7:37       ` Eli Zaretskii
2015-02-27  0:48     ` [PATCH v5 06/06] Remote fork catch Don Breazeal
2015-03-02 18:29     ` [PATCH v5 0/6] Remote fork events Pedro Alves
2015-03-02 20:18     ` [PATCH] Tighten gdb.base/disp-step-syscall.exp (was: Re: [PATCH v5 0/6] Remote fork events) Pedro Alves
2015-03-03  6:20       ` [PATCH] Tighten gdb.base/disp-step-syscall.exp Breazeal, Don
2015-03-03 15:01         ` Pedro Alves
2015-03-17 21:18       ` Breazeal, Don
2015-03-18 19:37         ` Pedro Alves
2015-03-17 20:56     ` [PATCH v6 0/6] Remote fork events Don Breazeal
2015-03-17 20:56       ` [PATCH v6 1/6] Identify remote fork event support Don Breazeal
2015-03-24 10:57         ` Pedro Alves
2015-03-26 19:00           ` [PATCH v5 01/06] " Don Breazeal
2015-03-27 11:14             ` Pedro Alves
2015-03-17 20:57       ` [PATCH v6 3/6] Extended-remote Linux follow fork Don Breazeal
2015-03-24 12:17         ` Pedro Alves
2015-04-07 17:35           ` Pedro Alves
2015-03-17 20:57       ` [PATCH v6 4/6] Arch-specific remote " Don Breazeal
2015-03-17 20:57       ` [PATCH v6 2/6] Clone remote breakpoints Don Breazeal
2015-03-17 20:58       ` [PATCH v6 5/6] Remote follow vfork Don Breazeal
2015-03-24 12:28         ` Pedro Alves [this message]
2015-03-17 20:58       ` [PATCH v6 6/6] Remote fork catch Don Breazeal
2015-03-24 12:47         ` Pedro Alves

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=55115851.6070201@redhat.com \
    --to=palves@redhat.com \
    --cc=donb@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).