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

On Wednesday 17 February 2010 14:19:12, Jan Kratochvil wrote:
> On Wed, 17 Feb 2010 13:34:15 +0100, Pedro Alves wrote:
> > On Monday 15 February 2010 18:40:50, Daniel Jacobowitz wrote:
> > > Do you mean that "print strcmp" or "break strcmp" is now going to do
> > > an inferior call?  That doesn't seem like a good idea to me.  I would
> > > like for some other maintainers to comment though.
> > > 
> > > Inferior calls are very slow, and they can go wrong (pending signals,
> > > misbehaving programs, etc).  I believe we should make an effort to
> > > minimize them.
> > 
> > Yeah, agreed, we should avoid them the best we can.
> 
> Possibilities known to me:
> 
> (A) Call ifunc-resolver any time it is needed.
>     = currently implemented.
> (B) Pick out the resolver result from .got.plt - if it is already there;
>     otherwise (A).
> (C) Print just the bare ifunc-resolver address for "p strcmp".
> 
> "Regular users" just print "strcmp (...)" and do not print "strcmp" which
> possibly makes (C) a viable option.

> +(CACHE) = + possibility: Cache the pointer in GDB.

Yes.  If possible, I'd pick C, maybe B -> C.  The thing that
ends up calling the resolver or strcmp_optimized_for_foo really
_is_ strcmp, no?  Isn't that what objdump/nm, etc. would show
as well for address of strcmp?  And B -> C is all that you'll be
able to do when debugging a core file.

> 
> When an inferior call of "strcmp (...)" is being made I do not find a problem
> doing also the ifunc-resolver call that time, do you?

> I would choose (A) + (CACHE) myself.  I did not find (CACHE) to be such
> a concern to implement it.  Inferior calls may be slow on embedded targets?

Yes, they can be slow, but, the fact that random bad things can happen
that when you set the inferior running behind the scenes, is what
 troublesme the most.  It's really a last resort.

> > [ Not to mention that the scheduler-locking setting also applies to
> > them, meaning, in a multi-threaded environment, without more
> > care, these behind the scenes infcalls resume more than
> > you'd want (all-threads), which can be surprising, and make other
> > threads easily hit events while handling the infcall.  Something
> > that IWBN to fix. ]
> 
> If you are concerned about other threads running you should already use at
> least "set scheduler-locking step".  

Say I'm hard headed and I want scheduler locking off.  I'd still be
surprised when my threads get resumed when I do "b foo".

> It should be default anyway.

That's another story.

> 
> What about making this GNU-IFUNC inferior call scheduling follow the "step"
> policy?  Maybe the whole inferior calls should follow the "step" policy?

Or "on", should be the same.  But that's not enough, fully fixing
means removing breakpoints as well:  e.g., what if the user has
a breakpoint on (the ifunc-resolver of) "strcmp", or one of its
callees? -- "p strcmp" or "b strcmp" can stop working mysteriously
then, no?  Also, if ifunc-resolving takes locks internally, then
we _can't_ make that inferior call sched-locked --- we may
deadlock the inferior, and the infcall never ends.  Does
it (takes locks internally), or ever will?

-- 
Pedro Alves


  parent reply	other threads:[~2010-02-17 14:52 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
2010-02-17 14:52       ` Pedro Alves [this message]
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=201002171452.36043.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=dan@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.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