Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Stefano Sabatini <stefano.sabatini-lala@poste.it>
To: gdb Mailing List <gdb@sources.redhat.com>
Subject: Re: pthread_t ids of threads not showed by "thread info"
Date: Mon, 26 Apr 2010 08:38:00 -0000	[thread overview]
Message-ID: <20100426083809.GA5767@geppetto> (raw)
In-Reply-To: <20100423154629.GA10463@host0.dyn.jankratochvil.net>

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 = (<data variable, no debug info> *) 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 <pthread.h>
#include <unistd.h>

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 <http://gnu.org/licenses/gpl.html>
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:
<http://www.gnu.org/software/gdb/bugs/>...
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 = (<data variable, no debug info> *) 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.


  reply	other threads:[~2010-04-26  8:38 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-22 15:19 Stefano Sabatini
2010-04-22 15:44 ` Stefano Sabatini
2010-04-22 16:59   ` Jan Kratochvil
2010-04-23  7:51     ` Stefano Sabatini
2010-04-23 10:25       ` Jan Kratochvil
2010-04-23 14:21         ` Stefano Sabatini
2010-04-23 14:25           ` Jan Kratochvil
2010-04-23 15:36             ` Stefano Sabatini
2010-04-23 15:46               ` Jan Kratochvil
2010-04-26  8:38                 ` Stefano Sabatini [this message]
2010-04-26  9:04                   ` Jan Kratochvil
2010-04-26 11:07                     ` Stefano Sabatini
2010-04-26 11:25                       ` Jan Kratochvil
2010-04-23 14:29           ` Stefano Sabatini
2010-04-23 11:50   ` Pedro Alves
2010-04-23 12:31     ` Mark Kettenis
2010-04-23 12:47       ` Pedro Alves
2010-04-23 15:37         ` Mark Kettenis
2010-04-23 15:51           ` Pedro Alves
2010-08-04 14:36             ` Pedro Alves
2010-08-04 14:57               ` Mark Kettenis
2010-08-04 15:29                 ` Pedro Alves
2010-08-04 16:53               ` Ulrich Weigand
2010-08-04 17:14                 ` Pedro Alves
2010-08-04 17:40                   ` Pedro Alves
2010-08-04 17:44                     ` Ulrich Weigand
2010-08-04 18:20                       ` Pedro Alves
2010-08-04 18:34                         ` Ulrich Weigand
2010-08-04 20:41                           ` Pedro Alves
2010-08-04 17:45                     ` Ulrich Weigand
2010-04-22 20:52 ` Petr Hluzín
2010-04-22 20:56   ` Daniel Jacobowitz
2010-08-18 14:17 ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100426083809.GA5767@geppetto \
    --to=stefano.sabatini-lala@poste.it \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox