From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1184 invoked by alias); 3 Dec 2002 19:20:32 -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 1168 invoked from network); 3 Dec 2002 19:20:25 -0000 Received: from unknown (HELO localhost.redhat.com) (216.138.202.10) by sources.redhat.com with SMTP; 3 Dec 2002 19:20:25 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id CEF123E4B; Tue, 3 Dec 2002 14:20:17 -0500 (EST) Message-ID: <3DED03F1.6070601@redhat.com> Date: Tue, 03 Dec 2002 11:20:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.0) Gecko/20020824 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Daniel Jacobowitz 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?)]] 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> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-12/txt/msg00084.txt.bz2 >> 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] > 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. Andrew