From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1266 invoked by alias); 6 Aug 2007 21:21:09 -0000 Received: (qmail 1128 invoked by uid 22791); 6 Aug 2007 21:21:07 -0000 X-Spam-Check-By: sourceware.org Received: from igw2.br.ibm.com (HELO igw2.br.ibm.com) (32.104.18.25) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 06 Aug 2007 21:21:00 +0000 Received: from mailhub3.br.ibm.com (mailhub3 [9.18.232.110]) by igw2.br.ibm.com (Postfix) with ESMTP id 576755BF97 for ; Mon, 6 Aug 2007 18:09:55 -0300 (BRT) Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.18.232.46]) by mailhub3.br.ibm.com (8.13.8/8.13.8/NCO v8.4) with ESMTP id l76LKvBa1376298 for ; Mon, 6 Aug 2007 18:20:57 -0300 Received: from d24av01.br.ibm.com (loopback [127.0.0.1]) by d24av01.br.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l76LKuZS010723 for ; Mon, 6 Aug 2007 18:20:56 -0300 Received: from [9.18.238.45] (dyn531778.br.ibm.com [9.18.238.45]) by d24av01.br.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id l76LKulY010720; Mon, 6 Aug 2007 18:20:56 -0300 Message-ID: <46B790BA.2040805@linux.vnet.ibm.com> Date: Mon, 06 Aug 2007 21:21:00 -0000 From: Carlos Eduardo Seo User-Agent: Thunderbird 2.0.0.6 (X11/20070802) MIME-Version: 1.0 To: Daniel Jacobowitz CC: gdb@sourceware.org Subject: Re: GDB doesn't display thread_id while debugging a core file References: <46B78405.9000706@linux.vnet.ibm.com> <20070806203310.GA17519@caradoc.them.org> In-Reply-To: <20070806203310.GA17519@caradoc.them.org> OpenPGP: id=8BFFA900 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-08/txt/msg00066.txt.bz2 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Daniel Jacobowitz wrote: > The thread ID is produced by NPTL's libthread_db library, Yes, and this number is also an address, the thread pointer used to access the TCB, as it is defined in the TLS definitions in the ABI. So, there's no magic involved. :) I can read that value from the register and get the thread ID from there. I know that this approach works on ppc32, ppc64 and s390. Don't know about other archs, though. That's why I'm worried about providing a fix that can be extended to other archs. > Now that most platforms have moved from LinuxThreads to NPTL, this > might be worth another look. Opportunistically, sometimes we can use > libthread_db and get sensible answers. This may be a silly question, but, how can we use libthread_db in order to get the thread ID from threads within a core file? Regards, - -- Carlos Eduardo Seo Software Engineer IBM Linux Technology Center Brazil Phone: +55 19-2132-4339 T/L: 839-4339 E-Mail: cseo@linux.vnet.ibm.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.5 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGt5C5qvq7Aov/qQARAuYjAJ4nx36Jm1Ix2Mgmz3KlIsTptvBRlACgjIQT vjdq9KtChupvNmrtxHloKAQ= =/E52 -----END PGP SIGNATURE-----