This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v6 5/6] Remote follow vfork


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]