This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
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)
- From: Philippe Waroquiers <philippe dot waroquiers at skynet dot be>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Sergio Durigan Junior <sergiodj at redhat dot com>, gdb-patches at sourceware dot org
- Date: Thu, 03 Oct 2013 00:08:42 +0200
- Subject: 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)
- Authentication-results: sourceware.org; auth=none
- References: <1379796907 dot 5980 dot 20 dot camel at soleil> <m3bo3ec7cp dot fsf at redhat dot com> <1380467062 dot 3567 dot 52 dot camel at soleil> <524C76D4 dot 1010301 at redhat dot com>
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