Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Daniel Jacobowitz <dan@codesourcery.com>
Cc: Pedro Alves <pedro@codesourcery.com>, gdb-patches@sourceware.org
Subject: Re: [patch] STT_GNU_IFUNC support
Date: Wed, 17 Feb 2010 17:45:00 -0000	[thread overview]
Message-ID: <20100217174450.GB32328@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <20100217144614.GI9493@caradoc.them.org>

On Wed, 17 Feb 2010 15:46:15 +0100, Daniel Jacobowitz wrote:
> On Wed, Feb 17, 2010 at 03:19:12PM +0100, Jan Kratochvil wrote:
> > (C) Print just the bare ifunc-resolver address for "p strcmp".
> > 
> > +(CACHE) = + possibility: Cache the pointer in GDB.
> > 
> > "Regular users" just print "strcmp (...)" and do not print "strcmp" which
> > possibly makes (C) a viable option.
> 
> I don't know.  What about "disassemble strcmp" - I think it should
> disassemble the same thing that will show up in the assembly as "call
> 0x$hex <strcmp>".  But maybe automatically disassembling strcmp_sse is
> more useful.

According to the reply to Pedro Alves
	http://sourceware.org/ml/gdb-patches/2010-02/msg00428.html
I will follow now that "strcmp" means the unresolved gnu-ifunc resolver.
(and "disassemble strcmp" disassembles just the gnu-ifunc resolver)


> Hmm.  I guess that leaves "break strcmp" in a weird place since strcmp
> will only be called once.  Maybe a breakpoint on an indirect function
> should also set a breakpoint on the target of the indirect function?
> This is slightly awkward to implement because there's no debug hook
> after the indirect function returns; we'd have to do that
> automatically to set the second breakpoint, or risk missing calls.

OK, nice catch.

GDB automatically calls "strcmp" from glibc (which is the resolver), not the
'glibc@plt' (which acts as a regular function hiding gnu-ifunc at all)..

Probably to break at the "strcmp" resolver and when it is hit the first time
then GDB can easily move the breakpoint to the resolved "strcmp_sse" function
by internally executing GDB "finish" call and using the returned address.

It would contradict that GDB should deal only with the gnu-ifunc resolver for
"strcmp", though.


> Inferior calls are hundreds of times slower than symbol lookups.  GDB
> can do a lot of symbol lookups behind the scenes, for instance "info
> func" will do a lookup_symbol for every function.  Since native x86_64
> Linux inferior calls are only hundreds of times slower, you may not
> notice this as much.  On a slower target, or a remote target, it may
> be thousands of times slower.

What if GDB prefers to use "strcmp@plt" instead of "strcmp" when GDB finds
"strcmp" is a gnu-ifunc symbol.  It will save the new GDB framework to deal
with the .got.plt addresses.


Thanks,
Jan


  reply	other threads:[~2010-02-17 17:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-14 20:35 Jan Kratochvil
2010-02-14 21:43 ` Mark Kettenis
2010-02-14 21:59   ` Jan Kratochvil
2010-02-15 18:40 ` Daniel Jacobowitz
2010-02-15 18:49   ` Jan Kratochvil
2010-02-17 12:34   ` Pedro Alves
2010-02-17 14:19     ` Jan Kratochvil
2010-02-17 14:46       ` Daniel Jacobowitz
2010-02-17 17:45         ` Jan Kratochvil [this message]
2010-02-17 14:52       ` Pedro Alves
2010-02-17 17:33         ` Jan Kratochvil
2010-02-17 17:55           ` Pedro Alves
2010-02-17 18:12             ` Jan Kratochvil

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=20100217174450.GB32328@host0.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=dan@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@codesourcery.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