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: Always run the PTRACE_O_TRACESYSGOOD tests even if PTRACE_O_TRACEFORK is not supported. (was: Re: RFA [PATCH v4] Implement 'catch syscall' for gdbserver)


On Wed, 2013-10-02 at 20:41 +0100, Pedro Alves wrote:
> On 09/29/2013 04:04 PM, Philippe Waroquiers wrote:
> 
> > Index: common/linux-ptrace.c
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/common/linux-ptrace.c,v
> > retrieving revision 1.12
> > diff -u -p -r1.12 linux-ptrace.c
> > --- common/linux-ptrace.c	28 Aug 2013 14:09:31 -0000	1.12
> > +++ common/linux-ptrace.c	29 Sep 2013 14:20:29 -0000
> > @@ -361,16 +361,18 @@ linux_check_ptrace_features (void)
> >        return;
> >      }
> >  
> > -#ifdef GDBSERVER
> > -  /* gdbserver does not support PTRACE_O_TRACESYSGOOD or
> > -     PTRACE_O_TRACEVFORKDONE yet.  */
> > -#else
> > -  /* Check if the target supports PTRACE_O_TRACESYSGOOD.  */
> > +  /* Check if the target supports PTRACE_O_TRACESYSGOOD.
> > +     We keep PTRACE_O_TRACEFORK option activated as a fork
> > +     event notification is expected after my_waitpid below.  */
> >    ret = ptrace (PTRACE_SETOPTIONS, child_pid, (PTRACE_TYPE_ARG3) 0,
> > -		(PTRACE_TYPE_ARG4) PTRACE_O_TRACESYSGOOD);
> > +		(PTRACE_TYPE_ARG4) (PTRACE_O_TRACEFORK
> > +				    | PTRACE_O_TRACESYSGOOD));
> 
> This coupling looks unfortunate.  Actually why wasn't this a
> problem for the native target, even without GDBserver in the picture?
> It just looks like a bug fix?  
Yes I think there is already a similar coupling problem in the
native code:
if PTRACE_O_TRACESYSGOOD is supported but PTRACE_O_TRACEVFORKDONE
is not, then the PTRACE_O_TRACESYSGOOD verification has removed
the flag PTRACE_O_TRACEFORK and so the following my_waitpid will
fail.

The patch you give looks to solve all that.

Philippe



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