From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6125 invoked by alias); 3 Dec 2002 19:33:11 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 6103 invoked from network); 3 Dec 2002 19:33:06 -0000 Received: from unknown (HELO crack.them.org) (65.125.64.184) by sources.redhat.com with SMTP; 3 Dec 2002 19:33:06 -0000 Received: from nevyn.them.org ([66.93.61.169] ident=mail) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 18JKfO-0005sH-00; Tue, 03 Dec 2002 15:33:18 -0600 Received: from drow by nevyn.them.org with local (Exim 3.36 #1 (Debian)) id 18JInK-0005HI-00; Tue, 03 Dec 2002 14:33:22 -0500 Date: Tue, 03 Dec 2002 11:33:00 -0000 From: Daniel Jacobowitz To: Andrew Cagney Cc: Mark Kettenis , msnyder@redhat.com, gdb-patches@sources.redhat.com Subject: Re: [Fwd: Re: [Fwd: Re: gdb/725: Crash using debug target and regcaches (in 5.3 branch?)]] Message-ID: <20021203193322.GA19891@nevyn.them.org> Mail-Followup-To: Andrew Cagney , Mark Kettenis , msnyder@redhat.com, gdb-patches@sources.redhat.com References: <3DE3F135.6030605@redhat.com> <3DE53144.3020502@redhat.com> <200211301613.gAUGDInq000267@elgar.kettenis.dyndns.org> <3DE8E9F8.5000902@redhat.com> <3DECE58A.6090001@redhat.com> <20021203171926.GA10631@nevyn.them.org> <3DED03F1.6070601@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3DED03F1.6070601@redhat.com> User-Agent: Mutt/1.5.1i X-SW-Source: 2002-12/txt/msg00087.txt.bz2 On Tue, Dec 03, 2002 at 02:20:17PM -0500, Andrew Cagney wrote: > > >>Er, no I wont :-( > >> > >>The attached is the refind patch. I added the comment: > >> > >>+ /* NOTE: cagney/2002-12-02: This assumes that the target code can > >>+ directly transfer the register values into the register cache. > >>+ This works fine when there is a 1:1 mapping between light weight > >>+ process (LWP) (a.k.a. process on GNU/Linux) and the thread. On > >>+ an N:1 (user-land threads), or N:M (combination of user-land and > >>+ LWP threading), this does not work. An LWP can be sitting in the > >>+ thread context switch code and hence, the LWP's registers belong > >>+ to no thread. */ > > > > > >First of all, this comment is wrong. > > Why? > > The code is assuming that the LWP registers belong to the currently > selected thread's regcache. That is a pretty scary assumption. > > [I'll use that wording] It's not an assumption at this point. proc-service.c:230 to thread_db_fetch_registers is the only path into lin_lwp_fetch_registers. And that does: inferior_ptid = BUILD_LWP (lwpid, ph->pid); So at this point we _know_ that the thread we're querying has its registers in the LWP. That's the whole point. > > > I think we're miscommunicating > >on what the patch does. At this point the fetch_inferior_registers > >code has an inferior_ptid which looks like this: > > PID = pid, LWPID = 0, TID = 0 > >or > > PID = pid, LWPID = otherpid, TID = 0 > > >Don't get confused by the use of TIDGET. Look at the definition of > >TIDGET; it gets the _LWP_ id. This's a search and destroy candidate if > >I ever saw one. > > I'll add that. > > >Some upper layer has already taken the TID, mapped it to an LWP id, and > >is asking for that LWP's registers by the time we get here. So the LWP > >is known to belong to the thread we are querying. > > > >>however, with the patch applied, I see (and consistently, well 2 out of > >>2, which is pretty amasing for the thread testsuite) the new failure: > >> > >> > >>gdb.threads/killed.exp: GDB exits after multi-threaded program exits > >>messily > >> > >>looking at the log file: > >> > >>(gdb) run > >>Starting program: /home/cagney/gdb/native/gdb/testsuite/gdb.threads/killed > >>[New Thread 1024 (LWP 6831)] > >>[New Thread 2049 (LWP 6832)] > >>[New Thread 1026 (LWP 6833)] > >>Cannot find user-level thread for LWP 6833: generic error > >>(gdb) PASS: gdb.threads/killed.exp: run program to completion > >>quit > >>The program is running. Exit anyway? (y or n) y > >>Cannot find thread 2049: generic error > >>(gdb) FAIL: gdb.threads/killed.exp: GDB exits after multi-threaded > >>program exits > >> messily (gdb/568) > >> > >>Which doesn't occure when the patch isn't applied. > > > > > >Are you sure about this last bit? I see this failure even without the > >patch, on an i386 SMP system. I just checked it moments ago. > > Yes. Not on an SMP machine though. According to Michael it already shows up in all of his configurations in current CVS... I see the same thing here. It's a little timing sensitive, I don't know why it didn't show up beforehand for you. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer