From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27836 invoked by alias); 10 Mar 2006 20:06:11 -0000 Received: (qmail 27823 invoked by uid 22791); 10 Mar 2006 20:06:10 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 10 Mar 2006 20:06:08 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id k2AK65VS016225; Fri, 10 Mar 2006 15:06:05 -0500 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id k2AK5t105602; Fri, 10 Mar 2006 15:05:55 -0500 Received: from [172.16.24.50] (bluegiant.sfbay.redhat.com [172.16.24.50]) by potter.sfbay.redhat.com (8.12.8/8.12.8) with ESMTP id k2AK5rmG020940; Fri, 10 Mar 2006 15:05:54 -0500 Message-ID: <4411DC21.2040305@redhat.com> Date: Sat, 11 Mar 2006 01:44:00 -0000 From: Michael Snyder User-Agent: Mozilla Thunderbird 1.0.7-1.4.1 (X11/20050929) MIME-Version: 1.0 To: Daniel Jacobowitz CC: gdb-patches@sourceware.org Subject: Re: RFC: Unify the GNU/Linux native targets References: <20060227192807.GA25537@nevyn.them.org> In-Reply-To: <20060227192807.GA25537@nevyn.them.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-03/txt/msg00167.txt.bz2 Daniel Jacobowitz wrote: > A wart I've been meaning to come back to for ages; I have some fixes for > thread debugging in static binaries that would have been quite ugly > without this, so I took a day to do it. > > There are two target vectors in the current incarnation of linux-nat.c. The > one returned by linux_target () and inherited by target-specific files is > used for non-threaded applications; it handles basic operations including > target-specific extensions to them. The one built in linux_nat_ops > handles clone and can be used with libthread_db, and delegates to the > single-threaded variant for basic tasks. > > This is a bit silly :-) We still need the separation between single and > multi-threaded vectors for the moment, because targets want to override > the single-threaded primitives rather than the complex multi-threaded > layer. However, that's all we need the single-threaded vector for. We > don't ever need to _use_ it. > > This patch kills most of the single-threaded vector and arranges to > use the multi-threaded version in all cases. Some duplicated code > goes away, and it is suddenly much easier to switch back and forth > between "threaded" and "non-threaded" debugging. > > One oddity: the Linux native target remains at process_stratum even > though it supports threads. I think this is right; the thread_stratum > gets used for linux-thread-db.c support which delegates to the process > stratum. If we had arbitrary stacking instead of strata I might > stack the linux multithreaded bits above the linux single-threaded > bits, but I think this is more natural. > > Tested on x86_64-pc-linux-gnu. Any comments? Seems like progress? > > Depends on my previous linux-fork.c patch, but only trivially. > Daniel, this seems fairly sane, at least with respect to forks. It does touch code that is also touched by my recent patch, though, so merge carefully. ;-) This, for instance, + + /* First cut -- let's crudely do everything inline. */ + if (forks_exist_p ()) + { + linux_fork_killall (); + pop_target (); + generic_mourn_inferior (); + return; + } + /* Kill all LWP's ... */ would want to be modified so as to read something like: linux_fork_killall (); target_mourn_inferior (); return; (I think...)