Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Alexandre Oliva <aoliva@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: Thu, 23 Oct 2014 12:52:00 -0000	[thread overview]
Message-ID: <20141023125208.GA4845@host2.jankratochvil.net> (raw)
In-Reply-To: <ork33rw1c5.fsf@free.home>

On Thu, 23 Oct 2014 12:02:34 +0200, Alexandre Oliva wrote:
> dlinfo offers operations to both map a link_map (AKA dlopen handle) to
> the modid, and to get the TLS base address for that link_map.  I suppose
> calling dlinfo directly is not an option, since there's no guarantee
> that libdl will have been linked in.

Thanks for the dlinfo() information; but I agree libdl is not an option for
the "GDB JIT" purpose.


> However, the implementat of dlinfo RTLD_DI_TLS_DATA relies on
> _dl_tls_get_addr_soft, that not only takes a struct link_map*, but also
> refrains from assigning a TLS segment for the module in the running
> thread when one isn't allocated already.  I think this would be
> preferrable behavior for a debugger, to avoid heisenbugs.

OK, I will try to use _dl_tls_get_addr_soft for GDB as is.

Although I think the TLS segment allocation would be better for the "GDB JIT"
purpose.  Imagine an inferior shared library:
	__thread int tlsvar;
And user asking for:
(gdb) compile code tlsvar = 5;

I think it is better to do the TLS segment allocation than to refuse the
command to the user.  But someone may have an opposite opinion.


> This symbol is not exported by ld.so, but this shouldn't stop GDB from
> using it, since it is present in the symbol table as a local (hidden)
> symbol.

It is OK although when we talk about it it is not perfect.  Some distros strip
all shared libraries and then they have problem libthread_db cannot find
libpthread .symtab-only _thread_db_* symbols.  _dl_tls_get_addr_soft() will
have the same problem.  But that is mostly off-topic here now.


Thanks,
Jan


  reply	other threads:[~2014-10-23 12:52 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
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 [this message]
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=20141023125208.GA4845@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=aoliva@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --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