Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Rich Felker <dalias@libc.org>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: libc-alpha@sourceware.org, gdb-patches@sourceware.org
Subject: Re: [libc patch] __tls_get_addr with link_map * instead of modid
Date: Sat, 18 Oct 2014 21:20:00 -0000	[thread overview]
Message-ID: <20141018212048.GH32028@brightrain.aerifal.cx> (raw)
In-Reply-To: <20141018201540.GA26252@host2.jankratochvil.net>

On Sat, Oct 18, 2014 at 10:15:40PM +0200, Jan Kratochvil wrote:
> Hi,
> 
> https://sourceware.org/glibc/wiki/Tools%20Interface%20NG
> 	From within the inferior: Functions that are inserted into a process's
> 	address space by the debugger need to be able to access the TLS area
> 	for that thread. GDB can use DWARF to to find the offset within the
> 	TLS of a variable and pass that in as a compile time offset into the
> 	function being inserted into the traced process's address space.
> 	However, to be able to get to the address of the TLS area for
> 	a particular thread, it needs to know the module id to make a call to
> 	__tls_get_addr(). This module id is burried in a private area of the
> 	link_map data structure which is subject to change. It is therefore
> 	proposed that we add a new function to libthread_db which extracts the
> 	module id from the link map. 
> 
> Other option suggested by Tom Tromey is implemented by this patch:
> 
> * A new glibc function like __tls_get_addr that takes a link_map address
>   rather than a module id.

This sounds more appealing. I don't know how much interest you have in
non-glibc systems, but from our side with musl libc, we presently
don't have a libthread_db and don't plan to, so anything that makes
gdb work better without it (or even just preserves current
functionality without it) is preferable.

> I expect I will have to also implement this Tom Tromey's suggestion to GDB but
> I haven't tried to implement it yet:
> 
> * Bake more information about struct link_map into gdb (least preferred
>   IMO).

I think this is the worst option.

> Additionally one could also fetch the module id from R_X86_64_DTPMOD64 but that
> would require arch specific code in GDB.  I do not plan to implement this way.

I don't see how this would work; how would you request the dynamic
linker to resolve that for you?

Rich


  reply	other threads:[~2014-10-18 21:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-18 20:15 Jan Kratochvil
2014-10-18 21:20 ` Rich Felker [this message]
2014-10-18 21:27   ` Jan Kratochvil
2014-10-18 21:44     ` Rich Felker
2014-10-23 10:03 ` Alexandre Oliva
2014-10-23 12:52   ` Jan Kratochvil
2014-10-24  1:47 ` Mike Frysinger
2014-10-24  2:21 ` Carlos O'Donell
     [not found]   ` <20141024093834.GA24090@host2.jankratochvil.net>
2014-10-24 14:22     ` Carlos O'Donell
2014-10-24 14:40       ` Jan Kratochvil
2014-10-24 15:00         ` Carlos O'Donell
2014-10-25  5:55         ` Rich Felker
2014-10-25  6:14           ` Jan Kratochvil
2014-10-25  6:26             ` Rich Felker
2014-10-24 15:56       ` 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=20141018212048.GH32028@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=libc-alpha@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