From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10357 invoked by alias); 19 Mar 2008 12:49:56 -0000 Received: (qmail 10349 invoked by uid 22791); 19 Mar 2008 12:49:56 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 19 Mar 2008 12:49:36 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 2DFFD98149; Wed, 19 Mar 2008 12:49:35 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id E5BE398119; Wed, 19 Mar 2008 12:49:34 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1JbxjZ-0003Ik-SV; Wed, 19 Mar 2008 08:49:33 -0400 Date: Wed, 19 Mar 2008 12:49:00 -0000 From: Daniel Jacobowitz To: Vladimir Prus Cc: gdb-patches@sources.redhat.com Subject: Re: [linux] fix stepping over fork in follow-child mode. Message-ID: <20080319124933.GA12197@caradoc.them.org> Mail-Followup-To: Vladimir Prus , gdb-patches@sources.redhat.com References: <200803182046.46420.pedro@codesourcery.com> <20080318234805.GA14989@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-12-11) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-03/txt/msg00277.txt.bz2 On Wed, Mar 19, 2008 at 10:57:27AM +0300, Vladimir Prus wrote: > 1. Your patch seem to remove thread_db_resume, including this > bit of code in it: > > if (GET_PID (ptid) == -1) > inferior_ptid = lwp_from_thread (inferior_ptid); > else if (is_thread (ptid)) > ptid = lwp_from_thread (ptid); > > What was the code, and in particular the last line, trying to do, > and why we don't actually have to do this? This converts "ptid known by thread_db and the rest of gdb" to "ptid known by linux-nat". A ptid is (PID, LWP, TID). linux-thread-db.c's ptids used to look like (PID, 0, TID) and the above call converted it to (PID, LWP, 0). A few years ago, I changed linux-thread-db to use (PID, LWP, TID) - in other words to assume that each TID was permanently assigned to a single LWP. That simplified things a lot. This is not true on some platforms. On Solaris, for instance, you may end up with M light-weight processes, and N threads, with N > M. Each process grabs a thread to execute as its previous thread goes to sleep. So the LWP can change. > 2. It seems that some other modules use tid. In particular, > aix-thread.c makes use of the ptid_get_tid call. What to do about that? We're fixing a Linux-specific problem, caused by not knowing the tid right away - so there isn't a single TID for the entire life of the application. If other platforms have the same problem, they can fix it locally. I think having a thread at all times is something that we're going to have to do in platform-specific code :-( -- Daniel Jacobowitz CodeSourcery