From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10016 invoked by alias); 26 Apr 2010 08:38:23 -0000 Received: (qmail 10002 invoked by uid 22791); 26 Apr 2010 08:38:21 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,TW_DB,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from relay-pt1.poste.it (HELO relay-pt1.poste.it) (62.241.4.164) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 26 Apr 2010 08:38:15 +0000 Received: from ssabatini.reitek.com (93.63.174.176) by relay-pt1.poste.it (8.5.121.01) (authenticated as stefano.sabatini-lala@poste.it) id 4BD4D7D10000AD7D for gdb@sources.redhat.com; Mon, 26 Apr 2010 10:38:13 +0200 Received: from stefano by ssabatini.reitek.com with local (Exim 4.71) (envelope-from ) id 1O6JpR-0002T8-JM for gdb@sources.redhat.com; Mon, 26 Apr 2010 10:38:09 +0200 Date: Mon, 26 Apr 2010 08:38:00 -0000 From: Stefano Sabatini To: gdb Mailing List Subject: Re: pthread_t ids of threads not showed by "thread info" Message-ID: <20100426083809.GA5767@geppetto> Mail-Followup-To: gdb Mailing List References: <20100422151855.GA3128@geppetto> <20100422154404.GB3128@geppetto> <20100422165924.GA1109@host0.dyn.jankratochvil.net> <20100423075135.GA3297@geppetto> <20100423102506.GA21618@host0.dyn.jankratochvil.net> <20100423142115.GA4538@geppetto> <20100423142511.GA6385@host0.dyn.jankratochvil.net> <20100423153554.GB4719@geppetto> <20100423154629.GA10463@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100423154629.GA10463@host0.dyn.jankratochvil.net> User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2010-04/txt/msg00136.txt.bz2 On Friday 2010-04-23 17:46:29 +0200, Jan Kratochvil wrote: > On Fri, 23 Apr 2010 17:35:54 +0200, Stefano Sabatini wrote: > > On date Friday 2010-04-23 16:25:11 +0200, Jan Kratochvil wrote: > > > You must have debug symbols from glibc. On Fedora `debuginfo-install glibc', > > > some similar command on other distros. > > > > OK now I have this problem: > > > > (gdb) threads __stack_user > > Attempt to extract a component of a value that is not a structure. > > (gdb) threads stack_used > > > (gdb) p __stack_user > > $1 = -1221236944 > $1 = {next = 0x7ffff7fd19c0, prev = 0x7ffff7fd19c0} > > > (gdb) p &__stack_user > > $4 = ( *) 0xb7970160 > $4 = (list_t *) 0x379501b280 > > > (gdb) p (void *)&__stack_user > > $5 = (void *) 0xb7970160 > $5 = (void *) 0x379501b280 > > > (gdb) p (void *)&__stack_user.next > > Attempt to extract a component of a value that is not a structure. > $6 = (void *) 0x379501b280 > > > > I have debug symbols installed (installed libc6-dbg on Debian). > > You should bugreport it to libc6-dbg, __stack_user must have its type. $ cat thrids.c #include #include void *fn(void *p) { sleep(180); return 0; } int main(void) { char *str = 0; pthread_t pth1, pth2; pthread_create(&pth1, 0, fn, 0); pthread_create(&pth2, 0, fn, 0); *str = 0; pthread_join(pth1, 0); return 0; } $ make thrids gcc -I/home/stefano/include -g -O0 -pg -D_ISOC9X_SOURCE -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -fno-math-errno -lm -I/home/stefano/include -L/home/stefano/lib -pthread thrids.c -o thrids $ ldd thrids linux-gate.so.1 => (0xb78c6000) libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb788b000) libpthread.so.0 => /lib/i686/cmov/libpthread.so.0 (0xb7872000) libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb772a000) /lib/ld-linux.so.2 (0xb78c7000) $ gdb thrids GNU gdb (GDB) 7.0.1-debian Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i486-linux-gnu". For bug reporting instructions, please see: ... Reading symbols from /home/stefano/src/Sandbox/C/thrids...done. (gdb) b main Breakpoint 1 at 0x8048630: file thrids.c, line 12. (gdb) r [Thread debugging using libthread_db enabled] Breakpoint 1, main () at thrids.c:12 12 char *str = 0; (gdb) p stack_user No symbol "stack_user" in current context. (gdb) p __stack_user $1 = -1209776352 (gdb) p &__stack_user $2 = ( *) 0xb7fa5160 (gdb) quit $ cd /usr/lib/debug/lib $ cd $ nm -S libpthread-2.10.2.so | grep __stack_user 00017160 00000008 b __GI___stack_user 00017160 00000008 b __stack_user $ nm -S libpthread-2.10.2.so | grep stack_used 0001511c 00000008 d stack_used I'm currently stucked with this, I really cannot say if it is a problem with what I'm doing or with some debian specific issue. I'll be grateful for any advice. > One could hack it more using just offsets without any struct definitions but > it was just a proof-of-concept hack the info is in the core file. One should > just apply libthread_db even on the core files. Best regards.