From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1739 invoked by alias); 12 May 2009 15:23:08 -0000 Received: (qmail 1722 invoked by uid 22791); 12 May 2009 15:23:07 -0000 X-SWARE-Spam-Status: No, hits=-2.3 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; Tue, 12 May 2009 15:23:01 +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 n4CFXA0q007599; Tue, 12 May 2009 10:33:14 -0500 Received: from ecamlmw720.eamcs.ericsson.se ([142.133.1.72]) by eusrcmw750.eamcs.ericsson.se with Microsoft SMTPSVC(6.0.3790.1830); Tue, 12 May 2009 10:21:49 -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: Tue, 12 May 2009 15:23:00 -0000 Message-ID: <6D19CA8D71C89C43A057926FE0D4ADAA076CB70C@ecamlmw720.eamcs.ericsson.se> In-Reply-To: <6D19CA8D71C89C43A057926FE0D4ADAA075CB54C@ecamlmw720.eamcs.ericsson.se> References: <6D19CA8D71C89C43A057926FE0D4ADAA075CAD65@ecamlmw720.eamcs.ericsson.se> <200904302049.49881.pedro@codesourcery.com> <6D19CA8D71C89C43A057926FE0D4ADAA075CAE22@ecamlmw720.eamcs.ericsson.se> <200904302245.11843.pedro@codesourcery.com> <6D19CA8D71C89C43A057926FE0D4ADAA075CB54C@ecamlmw720.eamcs.ericsson.se> 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/msg00066.txt.bz2 =20 > -----Original Message----- > From: gdb-owner@sourceware.org=20 > [mailto:gdb-owner@sourceware.org] On Behalf Of Marc Khouzam > Sent: Friday, May 01, 2009 2:40 PM > To: Pedro Alves > Cc: gdb@sourceware.org > Subject: RE: Does HEAD support non-stop with 'gdbserver=20 > --multi' on Linux? >=20 >=20=20 >=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? >=20 > 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. I just noticed that after this fix, although the threads are properly listed, the creation events only happen when the info thread command is given. I saw that with non-stop, when doing native linux debugging, there is a conscious decision to trigger thread events as soon as possible (from a comment of linux-nat.c:linux_handle_extended_wait()). However, this does not happen when using gdbserver. Is this something that is not ready yet, or a bug, or ... ? Thanks Marc =20 > Thanks! >=20 > >=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=20 > our first > > inferior but it has not stopped yet. As soon as it=20 > does, we need > > to call the low target's arch_setup callback. Doing=20 > 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.=20=20 > Similarly if > > the last child exited. If this is not the last=20 > 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=20 > 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 >=20