From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13670 invoked by alias); 6 Aug 2007 20:27:07 -0000 Received: (qmail 13536 invoked by uid 22791); 6 Aug 2007 20:27:06 -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 20:26:56 +0000 Received: from mailhub1.br.ibm.com (mailhub1 [9.18.232.109]) by igw2.br.ibm.com (Postfix) with ESMTP id 4A3BB5BF24 for ; Mon, 6 Aug 2007 17:15:50 -0300 (BRT) Received: from d24av02.br.ibm.com (d24av02.br.ibm.com [9.18.232.47]) by mailhub1.br.ibm.com (8.13.8/8.13.8/NCO v8.5) with ESMTP id l76KQoUE1757354 for ; Mon, 6 Aug 2007 17:26:51 -0300 Received: from d24av02.br.ibm.com (loopback [127.0.0.1]) by d24av02.br.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l76KQoF5026169 for ; Mon, 6 Aug 2007 17:26:50 -0300 Received: from [9.18.238.45] (dyn531778.br.ibm.com [9.18.238.45]) by d24av02.br.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id l76KQiZg026115 for ; Mon, 6 Aug 2007 17:26:50 -0300 Message-ID: <46B78405.9000706@linux.vnet.ibm.com> Date: Mon, 06 Aug 2007 20:27:00 -0000 From: Carlos Eduardo Seo User-Agent: Thunderbird 2.0.0.6 (X11/20070802) MIME-Version: 1.0 To: gdb@sourceware.org Subject: GDB doesn't display thread_id while debugging a core file 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/msg00063.txt.bz2 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello While debugging a core file from a multi-threaded application, I noticed that GDB doesn't show the thread_id: (gdb) thread [Current thread is 4 (process 8466)] instead of something like this: (gdb) thread [Current thread is 5 (Thread 2199033284976 (LWP 4124))] As far as I'm aware of, this big number is actually the thread pointer minus an offset value. For ppc64, I can get the thread pointer from register r13 (which is in the core file) and then subtract (TLS_PRE_TCB_SIZE + 0x7000) to get the thread_id. 0x7000 is fixed per the ABI and TLS_PRE_TCB_SIZE can be calculated from the size of two structs defined in GLIBC (so, I must assume that the user has a GLIBC with debug information in order to get the size of those structs). I know this is an issue that has a solution which is arch-dependent, so my concern here is to make a fix that's easily extensible to other archs. Is a solution like this acceptable? Thanks and regards, - -- Carlos Eduardo Seo Software Engineer IBM Linux Technology Center 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 iD8DBQFGt4QFqvq7Aov/qQARAt12AJ9szUdI05rLYuJ+r+oiCwPKZjI+BwCfaHpz YUp9BcgLXvfsoWJ7Id9DDBk= =ayr3 -----END PGP SIGNATURE-----