From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18467 invoked by alias); 6 Aug 2004 05:39:55 -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 18457 invoked from network); 6 Aug 2004 05:39:53 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 6 Aug 2004 05:39:53 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i765dhe3013670 for ; Fri, 6 Aug 2004 01:39:48 -0400 Received: from localhost.redhat.com (porkchop.devel.redhat.com [172.16.58.2]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i765dga07321; Fri, 6 Aug 2004 01:39:42 -0400 Received: from gnu.org (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 940FD2B9D; Fri, 6 Aug 2004 01:39:36 -0400 (EDT) Message-ID: <41131998.2030003@gnu.org> Date: Fri, 06 Aug 2004 05:39:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-GB; rv:1.4.1) Gecko/20040801 MIME-Version: 1.0 To: "Nathan J. Williams" , Joel Brobecker Cc: gdb-patches@sources.redhat.com Subject: Re: thread ptids when debugging from core file (x86-linux) References: <20040806040959.GL1192@gnat.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-08/txt/msg00149.txt.bz2 > Joel Brobecker writes: > > >>> According to corelow.c:add_to_thread_list(), the thread PTID >>> is a degenerated {pid, 0, 0} where pid is just the number in the section >>> name where the thread has been dumped (ie section ".reg/1234" => thread >>> ptid = {1234, 0, 0}). > > > I've always assumed that corelow.c's mapping between .reg sections and > threads was intended as a minimal fallback. The module I wrote for > NetBSD's threads (which I'll get into shape for the FSF tree Real Soon > Now) punts that list and generates its own list of threads from the > memory structures of libpthread in the core file, just as it would for > a live process. Yes. Joel, this observation of yours is the key: > Unfortunately, that doesn't work when debugging from a core file, > because the PTID of the threads are not the same as when debugging > live. The best way to appreciate this is to consider: (gdb) attach program (gdb) info threads thread output #1 (gdb) info lwp -- yes ok, that cmd doesn't exist :-) lwp output #1 (different to the thread output) (gdb) gcore program.gcore (gdb) detach Segmentation fault core dumped to program.core (gdb) corefile program.core (gdb) info threads identical thread output #2 (gdb) info lwp identical lwp output #2 (gdb) corefile program.gcore (gdb) info threads also identical output #3 (gdb) info lwp also identical lwp output #3 Andrew