Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: libc-alpha@sourceware.org, gdb@sourceware.org
Subject: Re: tcbhead_t gdb access for nonthreaded, gdb for longjmp()
Date: Wed, 13 Sep 2006 18:37:00 -0000	[thread overview]
Message-ID: <20060913183705.GA1443@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <20060913131948.GA8624@nevyn.them.org>

Hi,

also regarding making `__libc_version' public - it would be even useful to
check matching version of libc vs. libpthread as currently mixing various
versions has unpolite results.


On Wed, 13 Sep 2006 15:19:48 +0200, Daniel Jacobowitz wrote:
...
> GDB shouldn't access TLS the same way the application does (by calling
> __tls_get_addr, which might e.g. cause allocation of a new TLS block).

glibc nptl_db already accesses inferior TLS IMO in a safe unmodifying way.
Everything through td_thr_tls_get_addr() ...
Without libthread_db support the TLS base can be queried by
ps_get_thread_area(), using read_register() etc., done in the patch for TCB
`pointer_guard'. Accessing DTV fields is just some indirection, the problem
is mapping the module address to module id as you describe below.


> But it could find the DTV directly and perform its own
> lookup, based on knowledge of the platform ABI.

(Probably described above...)


> The symbol value's easily available in the symbol table.  The module
> number is harder.  It's in the result from dl_iterate_phdr, which is
> workable but very awkward for GDB to use.  And it's in the link_map,
> but not at a public offset, so we can't find it there.
> 
> Options I see:
>   - Make GDB call dl_iterate_phdr to get the module numbers.

It would be needed to be called remotely in the inferior process, wouldn't be?

>   - Provide them in the public portion of the link map.

`libpthread.so' already contains public `_thread_db_link_map_l_tls_modid',
doesn't it just mean moving (or appropriately providing) this public symbol
from `libpthread.so' to `libc.so'?

>   - Provide a function in ld.so to translate a link map into its TLS
>     module ID, for gdb use.

I hope you intend function callable from the gdb process; I hope it is clear
calling inferior's function (using dummy frame?) is not suitable.

...
> >  * Providing full custom TLS resolving for gdb - no glibc change needed.
> 
> I think this is what I described above.

Partially, in this case I would choose "link map" access with providing
target-dependent gdb-side link map offset (ugly, I know).


On Wed, 13 Sep 2006 15:19:48 +0200, Daniel Jacobowitz wrote:
> On Wed, Sep 13, 2006 at 03:05:32PM +0200, Jan Kratochvil wrote:
...
> > Besides longjmp() target PTR_DEMANGLE()ing there is also need to access glibc
> > TLS symbol `errno' but - in fact - AFAIK no other TLS symbol.
> 
> You're combining two different problems here,

[
Sincerely thanks for pointing out my possible mistake.
Just in general - I know the differences, my patches would not work otherwise;
I know DTV, I just did not remember that acronym it is that structure before.
]



Regards,
Jan


  reply	other threads:[~2006-09-13 18:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-08 10:29 Jan Kratochvil
2006-09-10 14:27 ` Daniel Jacobowitz
2006-09-13 13:05   ` Jan Kratochvil
2006-09-13 13:20     ` Daniel Jacobowitz
2006-09-13 18:37       ` Jan Kratochvil [this message]
2006-09-13 18:49         ` 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=20060913183705.GA1443@host0.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb@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