Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: msnyder@sonic.net
To: gdb@sourceware.org
Cc: cseo@linux.vnet.ibm.com, drow@false.org
Subject: Re: GDB doesn't display thread_id while debugging a core file
Date: Wed, 08 Aug 2007 19:13:00 -0000	[thread overview]
Message-ID: <12156.12.7.175.2.1186600376.squirrel@webmail.sonic.net> (raw)

Daniel writes:
> On Mon, Aug 06, 2007 at 06:20:58PM -0300, Carlos Eduardo Seo 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. :)
>
> That's incorrect.  The fact that pthread_self, and thus libthread_db,
> use a pointer to the "struct pthread" as their thread ID is an
> internal implementation detail of NPTL, i.e. subject to change.  That
> means it's the province of libthread_db.

Agree with Daniel.  This is an abi spec.  We are not allowed
to presume that we know the internal details of implementation.
That is what the libthread_db API is for.

> > 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?
>
> If we assume that the host's libthread_db will either recognize the
> core file and do the right thing, or reject the core file, then we can
> write a small target layer that uses it on top of corelow.c in a
> similar way to how linux-thread-db.c / proc-service.c use linux-nat.c.

Daniel, I think it's even simpler than that.

libthread_db works via callbacks to gdb that do nothing more
complicated than read memory.  GDB can read memory from the corefile.

The only question is whether the versions of libthread and
libthread_db match, on the host and (corefile-generating) target.

If they do, "it should just work" (tm).

And if there is a version string somewhere in the library's read/write
memory sections, it should also exist in the corefile.

Michael





             reply	other threads:[~2007-08-08 19:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-08 19:13 msnyder [this message]
2007-08-08 19:21 ` Daniel Jacobowitz
  -- strict thread matches above, loose matches on Subject: below --
2008-04-15  3:05 Icarus Sparry
2008-04-15  3:10 ` Michael Snyder
2008-04-15  6:54   ` Icarus Sparry
2008-04-15  8:12     ` Daniel Jacobowitz
2008-04-15 18:17       ` Michael Snyder
2008-04-15 20:46         ` Icarus Sparry
2008-04-15 23:48           ` Daniel Jacobowitz
2007-08-06 20:27 Carlos Eduardo Seo
2007-08-06 20:33 ` Daniel Jacobowitz
2007-08-06 21:21   ` Carlos Eduardo Seo
2007-08-07 11:31     ` Daniel Jacobowitz

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=12156.12.7.175.2.1186600376.squirrel@webmail.sonic.net \
    --to=msnyder@sonic.net \
    --cc=cseo@linux.vnet.ibm.com \
    --cc=drow@false.org \
    --cc=gdb@sourceware.org \
    /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