From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26155 invoked by alias); 1 May 2009 18:40:03 -0000 Received: (qmail 26092 invoked by uid 22791); 1 May 2009 18:40:00 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from imr1.ericy.com (HELO imr1.ericy.com) (198.24.6.9) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 May 2009 18:39:52 +0000 Received: from eusrcmw750.eamcs.ericsson.se (eusrcmw750.exu.ericsson.se [138.85.77.50]) by imr1.ericy.com (8.13.1/8.13.1) with ESMTP id n41InaGe011826; Fri, 1 May 2009 13:49:36 -0500 Received: from ecamlmw720.eamcs.ericsson.se ([142.133.1.72]) by eusrcmw750.eamcs.ericsson.se with Microsoft SMTPSVC(6.0.3790.1830); Fri, 1 May 2009 13:39:46 -0500 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Subject: RE: Does HEAD support non-stop with 'gdbserver --multi' on Linux? Date: Fri, 01 May 2009 18:40:00 -0000 Message-ID: <6D19CA8D71C89C43A057926FE0D4ADAA075CB54C@ecamlmw720.eamcs.ericsson.se> In-Reply-To: <200904302245.11843.pedro@codesourcery.com> References: <6D19CA8D71C89C43A057926FE0D4ADAA075CAD65@ecamlmw720.eamcs.ericsson.se> <200904302049.49881.pedro@codesourcery.com> <6D19CA8D71C89C43A057926FE0D4ADAA075CAE22@ecamlmw720.eamcs.ericsson.se> <200904302245.11843.pedro@codesourcery.com> From: "Marc Khouzam" To: "Pedro Alves" Cc: X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-05/txt/msg00001.txt.bz2 =20 > -----Original Message----- > From: Pedro Alves [mailto:pedro@codesourcery.com]=20 > Sent: Thursday, April 30, 2009 5:45 PM > To: Marc Khouzam > Cc: gdb@sourceware.org > Subject: Re: Does HEAD support non-stop with 'gdbserver=20 > --multi' on Linux? >=20 > On Thursday 30 April 2009 21:18:58, Marc Khouzam wrote: >=20 > > > What exactly are you seeing? I just run a few non-stop test > > > (mi-nonstop.exp, mi-nsintrall.exp and ns-nsmoribund.exp tests) > > > against linux x86-64 gdbserver head, and they passed cleanly for > > > me, so *something* is working. :-) > >=20 > > It seems no new thread is listed by GDB. >=20 > Hmmm, that should work. This looks like another manifestation > of PR threads/10048. Does this make a difference? Yes, this fixed the problem. My Eclipse is still mis-behaving a bit, but that is probably my code. The 'info thread' does show all threads. Heads up on a breakpoint mis-behavior coming in a separate mail :-) Thanks! >=20 > --=20 > Pedro Alves >=20 > 2009-04-30 Pedro Alves >=20 > * linux-low.c (must_set_ptrace_flags): Delete. > (linux_create_inferior): Set=20 > `lwp->must_set_ptrace_flags' instead > of the global. > (linux_attach_lwp_1): Don't set PTRACE_SETOPTIONS here. Set > `lwp->must_set_ptrace_flags' instead. > (linux_wait_for_event_1): Set ptrace options here. > (linux_wait_1): ... not here. >=20 > --- > gdb/gdbserver/linux-low.c | 27 ++++++++++++++------------- > gdb/gdbserver/linux-low.h | 4 ++++ > 2 files changed, 18 insertions(+), 13 deletions(-) >=20 > Index: src/gdb/gdbserver/linux-low.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- src.orig/gdb/gdbserver/linux-low.c 2009-04-12=20 > 22:44:01.000000000 +0100 > +++ src/gdb/gdbserver/linux-low.c 2009-04-30=20 > 22:38:20.000000000 +0100 > @@ -109,8 +109,6 @@ int stopping_threads; > /* FIXME make into a target method? */ > int using_threads =3D 1; >=20=20 > -static int must_set_ptrace_flags; > - > /* This flag is true iff we've just created or attached to our first > inferior but it has not stopped yet. As soon as it does, we need > to call the low target's arch_setup callback. Doing this only on > @@ -309,7 +307,7 @@ add_lwp (ptid_t ptid) > static int > linux_create_inferior (char *program, char **allargs) > { > - void *new_lwp; > + struct lwp_info *new_lwp; > int pid; > ptid_t ptid; >=20=20 > @@ -344,7 +342,7 @@ linux_create_inferior (char *program, ch > ptid =3D ptid_build (pid, pid, 0); > new_lwp =3D add_lwp (ptid); > add_thread (ptid, new_lwp); > - must_set_ptrace_flags =3D 1; > + new_lwp->must_set_ptrace_flags =3D 1; >=20=20 > return pid; > } > @@ -373,10 +371,6 @@ linux_attach_lwp_1 (unsigned long lwpid, > strerror (errno), errno); > } >=20=20 > - /* FIXME: This intermittently fails. > - We need to wait for SIGSTOP first. */ > - ptrace (PTRACE_SETOPTIONS, lwpid, 0, PTRACE_O_TRACECLONE); > - > if (initial) > /* NOTE/FIXME: This lwp might have not been the tgid. */ > ptid =3D ptid_build (lwpid, lwpid, 0); > @@ -392,6 +386,11 @@ linux_attach_lwp_1 (unsigned long lwpid, > new_lwp =3D (struct lwp_info *) add_lwp (ptid); > add_thread (ptid, new_lwp); >=20=20 > + > + /* We need to wait for SIGSTOP before being able to make the next > + ptrace call on this LWP. */ > + new_lwp->must_set_ptrace_flags =3D 1; > + > /* The next time we wait for this LWP we'll see a SIGSTOP=20 > as PTRACE_ATTACH > brings it to a halt. >=20=20 > @@ -986,6 +985,13 @@ linux_wait_for_event_1 (ptid_t ptid, int > continue; > } >=20=20 > + if (event_child->must_set_ptrace_flags) > + { > + ptrace (PTRACE_SETOPTIONS, lwpid_of (event_child), > + 0, PTRACE_O_TRACECLONE); > + event_child->must_set_ptrace_flags =3D 0; > + } > + > if (WIFSTOPPED (*wstat) > && WSTOPSIG (*wstat) =3D=3D SIGSTOP > && event_child->stop_expected) > @@ -1248,11 +1254,6 @@ retry: >=20=20 > lwp =3D get_thread_lwp (current_inferior); >=20=20 > - if (must_set_ptrace_flags) > - { > - ptrace (PTRACE_SETOPTIONS, lwpid_of (lwp), 0,=20 > PTRACE_O_TRACECLONE); > - must_set_ptrace_flags =3D 0; > - } > /* If we are waiting for a particular child, and it exited, > linux_wait_for_event will return its exit status. Similarly if > the last child exited. If this is not the last child, however, > Index: src/gdb/gdbserver/linux-low.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- src.orig/gdb/gdbserver/linux-low.h 2009-04-12=20 > 22:44:01.000000000 +0100 > +++ src/gdb/gdbserver/linux-low.h 2009-04-30=20 > 22:33:09.000000000 +0100 > @@ -146,6 +146,10 @@ struct lwp_info > was a single-step. */ > int stepping; >=20=20 > + /* If this flag is set, we need to set the event request flags the > + next time we see this LWP stop. */ > + int must_set_ptrace_flags; > + > /* If this is non-zero, it points to a chain of signals=20 > which need to > be delivered to this process. */ > struct pending_signals *pending_signals; >=20 >=20