From: Yao Qi <yao@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: Re: [rfa] Fix software-watchpoint failures by adding epilogue detection
Date: Wed, 29 Sep 2010 14:43:00 -0000 [thread overview]
Message-ID: <20100929024358.GA598@codesourcery.com> (raw)
In-Reply-To: <201009281604.o8SG4Eng031035@d12av02.megacenter.de.ibm.com>
On Tue, Sep 28, 2010 at 06:04:14PM +0200, Ulrich Weigand wrote:
> Daniel Jacobowitz wrote:
>
> > On Fri, Sep 24, 2010 at 02:39:05PM +0200, Ulrich Weigand wrote:
> > > - I'm accepting more diverse sequences due to forward-scanning for multiple
> > > instructions, and not requiring backward-scanning.
> >
> > This I'm worried about. From my patch:
> >
> > + /* We are in the epilogue if the previous instruction was a stack
> > + adjustment and the next instruction is a possible return (bx, mov
> > + pc, or pop).
> >
> > This is definitely an epilogue:
> >
> > pop { r4, r5, r6, lr }
> > bx lr
> >
> > This could be an epilogue, but it could also be an indirect call:
> >
> > bx lr
> >
> > If it's an indirect call there would be a mov lr, pc before it.
> > If it's an indirect tail call, then it's an epilogue, and the return
> > address won't be saved.
>
> I'm wondering how "bx lr" could be an indirect call; for a call,
> lr would have to point to the return address, so it couldn't also
> contain the target address ... Am I missing something here?
>
> My original patch accepted only specifically "bx lr"; yours also
> accepts different registers for bx. If we have a bx with a
> different register, this may of course well be an indirect call.
>
> As far as I can see, GCC never uses bx with any other register but
> lr to implement a return instruction. Do you know whether this is
> also true for other compilers? If so, maybe the easiest fix would
> be to change this back to only accepting "bx lr".
>
I haven't seen any examples GCC uses bx with other registers so far,
but I noticed that some one is thinking of use 'bx r3' for
optimization purpose.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40887
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19599
The patch for PR19599 hasn't been committed yet, so I still can't find a
real example that using 'bx r3' to return.
In short, there *might* be some cases now or in the future, that
registers other than lr are used with bx for return.
--
Yao Qi
CodeSourcery
yao@codesourcery.com
(650) 331-3385 x739
prev parent reply other threads:[~2010-09-29 2:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-22 19:20 Ulrich Weigand
2010-09-22 20:01 ` Daniel Jacobowitz
2010-09-23 16:13 ` Ulrich Weigand
2010-09-24 16:11 ` Ulrich Weigand
2010-09-28 20:23 ` Daniel Jacobowitz
2010-09-28 21:47 ` Ulrich Weigand
2010-09-28 21:49 ` Daniel Jacobowitz
2010-09-29 15:24 ` Richard Earnshaw
2010-10-07 16:12 ` [rfa, v3] Fix software-watchpoint failures on ARM " Ulrich Weigand
2010-10-08 13:01 ` Richard Earnshaw
2010-10-08 13:27 ` Ulrich Weigand
2010-09-29 14:43 ` Yao Qi [this message]
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=20100929024358.GA598@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@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