From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5044 invoked by alias); 29 Jun 2003 02:16:14 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 5028 invoked from network); 29 Jun 2003 02:16:11 -0000 Received: from unknown (HELO crack.them.org) (146.82.138.56) by sources.redhat.com with SMTP; 29 Jun 2003 02:16:11 -0000 Received: from dsl093-172-017.pit1.dsl.speakeasy.net ([66.93.172.17] helo=nevyn.them.org ident=mail) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 19WRkY-0007rk-00; Sat, 28 Jun 2003 21:17:06 -0500 Received: from drow by nevyn.them.org with local (Exim 3.36 #1 (Debian)) id 19WRja-0004z8-00; Sat, 28 Jun 2003 22:16:06 -0400 Date: Sun, 29 Jun 2003 07:51:00 -0000 From: Daniel Jacobowitz To: Andrew Cagney Cc: gdb@sources.redhat.com Subject: Re: RFC: Two small remote protocol extensions Message-ID: <20030629021605.GA18990@nevyn.them.org> Mail-Followup-To: Andrew Cagney , gdb@sources.redhat.com References: <20020816143040.GA22041@nevyn.them.org> <3D5D0F62.4010207@ges.redhat.com> <20020816145306.GA24002@nevyn.them.org> <3D65B53D.8050603@ges.redhat.com> <20020823124453.GA12257@nevyn.them.org> <3D6692AE.90601@ges.redhat.com> <20020823201549.GB26809@nevyn.them.org> <3D6C4C4E.4050409@ges.redhat.com> <20020828133445.GA16642@nevyn.them.org> <3D93B6E6.8030805@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3D93B6E6.8030805@redhat.com> User-Agent: Mutt/1.5.1i X-SW-Source: 2003-06/txt/msg00539.txt.bz2 Going back through my inbox, I definitely dropped the ball on this one. Oops! Here's a test case I just wrote, if you want to experiment with the issue: #include void foo (void) { } void *thread_func (void *arg) { int x; for (x = 0; x < 10; x++) foo (); return 0; } int main() { pthread_t thr; void *ret; int x; pthread_create (&thr, NULL, thread_func, NULL); pthread_join (thr, &ret); for (x = 0; x < 10; x++) foo (); } Compile, debug. Set breakpoint on thread_func. Say "next". Native GDB will do the obvious thing and step into the for loop. Gdbserver will switch to the first thread and report that we're stopped in sigsuspend, one single-step off of the syscall. My premise is that GDB's behavior is correct. On Thu, Sep 26, 2002 at 09:39:50PM -0400, Andrew Cagney wrote: > > >OK, I suppose that makes sense. It's pretty much where I was to begin > >with: if Hc is non-zero, lock to that thread; if Hc is 0, resume all > >threads, but where do we step? How would you like to see us specify > >this - I used Hs, a new step packet taking a thread argument might work > >too... etc. > > Yes, to come full circle, I can see two choices: > > - (me back down) and Hg be made as per your proposal - as well as the > registers, it also specify the thread to step when there isn't thread > locking. For the record, since I had to go look it up: this was the suggestion that we use Hg to communicate the "selected" thread before doing a non-scheduler-locked single step. > - we define something properly And this defining some other way to convey that information. > > There's also the question of whether any other simulators or targets > > handle this, and how they behave; I'm not familiar with them. Do they > > treat "HcTID, s" as single-step-one-thread-only? I guess they probably > > do. > > I really don't know. (For ``s'', should you be stepping all threads?) > > Anyway, I think, to do this right, we're left needing a new packet. Try: > > > >> > step one, stop others > > > >> > >> Hardware single-step off of breakpoint. > >> TPID, STEP, !OTH > >> HcTID, s > > HtTID;s HtTID;s - single step just this thread. > >> > step one, continue others > > > >> > >> Hardware single-step. > >> TPID, STEP, OTH > >> H???, s > > HtPID,0;s > or even: > Ht0;s > I.e., step all threads. Let GDB sort out the mess. What happened to step-one-continue-others? I don't think step-all is particularly useful. Step-one-continue-others has its issues, but I can see definite times when it is useful - for instance when one thread makes a syscall which waits on a mutex. The HtTID approach doesn't seem to say how other threads should be treated. Do we want: HtTIDs step one HtTIDs;0c step one cont others HtTIDc cont one et cetera? Maybe allow: HtTID,TID,TIDs;0c [Is 0 a valid TID?] Could we deprecate Hg/Hc in favor of this, to avoid specifying all the interactions? And is there any hope of fixing this in 6.0? :((( -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer