From: Daniel Jacobowitz <drow@false.org>
To: Jim Blandy <jimb@red-bean.com>
Cc: pgilliam@us.ibm.com, gdb-patches@sourceware.org,
gdb-patches@sources.redhat.com
Subject: Re: [PATCH] add 'rs6000_in_function_epilogue_p()'
Date: Sun, 04 Dec 2005 20:19:00 -0000 [thread overview]
Message-ID: <20051203030533.GA23195@nevyn.them.org> (raw)
In-Reply-To: <8f2776cb0512021419w5af03946je07634a4400417fd@mail.gmail.com>
On Fri, Dec 02, 2005 at 02:19:07PM -0800, Jim Blandy wrote:
> On 12/2/05, Paul Gilliam <pgilliam@us.ibm.com> wrote:
> > This patch does *not* assume that the exit of the function is near the end of the function.
> >
> > It's more/less of a hack than that!
> >
> > Here is the 'algorithm':
> > 1) scan forward from the point of execution:
> > a) If you find an instruction that modifies the stack pointer, execution is not in an epilogue, return.
> > b) Stop scanning if you find a return instruction or reach the end of the function.
> > 2) scan backward from the point of execution:
> > a) If you find an instruction that modifies the stack pointer, execution *is* in an epilogue, return.
> > b) Stop scanning if you reach the beginning of the function.
> (That text belongs in a comment, else Daniel wouldn't have got it wrong!)
For all sorts of reasons, this isn't a safe algorithm; just a guess.
- A forward scan really has to stop at any control flow instruction.
- A backward scan, in general, is just not possible. GCC does
agressive basic block reordering and tail merging, and will do
more so in the future; who knows where you came from...
It may be a useful guess though.
> You know, there's no reason this logic wouldn't be equally useful in
> the skip_prologue function. If the prologue scan doesn't make it to
> the PC, then we could do the above, and use it to provide an accurate
> frame ID. That would fix the bug, and backtraces too.
I don't think I follow...
Anyway, there is exactly this one user of the method. It occured to me
that there may be a better way to figure out what we _really_ want to
check there. We want to know "is this watchpoint in a stack frame that
isn't there any more". A gdbarch method that knows whether we're above
or below the stack pointer...
But this all gets tangled up in what we're _really_ watching. We want
to watch the local variable, which may move around - we get the
"multiple locations" (loclist) case completely wrong today.
--
Daniel Jacobowitz
CodeSourcery, LLC
WARNING: multiple messages have this Message-ID
From: Daniel Jacobowitz <drow@false.org>
To: Jim Blandy <jimb@red-bean.com>
Cc: pgilliam@us.ibm.com, gdb-patches@sourceware.org,
gdb-patches@sources.redhat.com
Subject: Re: [PATCH] add 'rs6000_in_function_epilogue_p()'
Date: Sun, 04 Dec 2005 18:59:00 -0000 [thread overview]
Message-ID: <20051203030533.GA23195@nevyn.them.org> (raw)
Message-ID: <20051204185900.4HFRrucp3Z7BnPBr30b4QHu-2_-Pp2y7E0CLL8lMxwQ@z> (raw)
In-Reply-To: <8f2776cb0512021419w5af03946je07634a4400417fd@mail.gmail.com>
On Fri, Dec 02, 2005 at 02:19:07PM -0800, Jim Blandy wrote:
> On 12/2/05, Paul Gilliam <pgilliam@us.ibm.com> wrote:
> > This patch does *not* assume that the exit of the function is near the end of the function.
> >
> > It's more/less of a hack than that!
> >
> > Here is the 'algorithm':
> > 1) scan forward from the point of execution:
> > a) If you find an instruction that modifies the stack pointer, execution is not in an epilogue, return.
> > b) Stop scanning if you find a return instruction or reach the end of the function.
> > 2) scan backward from the point of execution:
> > a) If you find an instruction that modifies the stack pointer, execution *is* in an epilogue, return.
> > b) Stop scanning if you reach the beginning of the function.
> (That text belongs in a comment, else Daniel wouldn't have got it wrong!)
For all sorts of reasons, this isn't a safe algorithm; just a guess.
- A forward scan really has to stop at any control flow instruction.
- A backward scan, in general, is just not possible. GCC does
agressive basic block reordering and tail merging, and will do
more so in the future; who knows where you came from...
It may be a useful guess though.
> You know, there's no reason this logic wouldn't be equally useful in
> the skip_prologue function. If the prologue scan doesn't make it to
> the PC, then we could do the above, and use it to provide an accurate
> frame ID. That would fix the bug, and backtraces too.
I don't think I follow...
Anyway, there is exactly this one user of the method. It occured to me
that there may be a better way to figure out what we _really_ want to
check there. We want to know "is this watchpoint in a stack frame that
isn't there any more". A gdbarch method that knows whether we're above
or below the stack pointer...
But this all gets tangled up in what we're _really_ watching. We want
to watch the local variable, which may move around - we get the
"multiple locations" (loclist) case completely wrong today.
--
Daniel Jacobowitz
CodeSourcery, LLC
next prev parent reply other threads:[~2005-12-03 3:05 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-30 23:56 Paul Gilliam
2005-12-01 5:21 ` Jim Blandy
2005-12-01 18:27 ` Paul Gilliam
2005-12-01 20:14 ` Paul Gilliam
2005-12-02 1:13 ` Jim Blandy
2005-12-02 1:23 ` Daniel Jacobowitz
2005-12-02 20:12 ` Paul Gilliam
2005-12-02 20:17 ` Paul Gilliam
2005-12-03 3:05 ` Jim Blandy
2005-12-02 23:38 ` Jim Blandy
2005-12-04 20:19 ` Daniel Jacobowitz [this message]
2005-12-04 18:59 ` Daniel Jacobowitz
2005-12-04 20:48 ` Jim Blandy
2005-12-04 21:12 ` Jim Blandy
2005-12-04 21:16 ` Daniel Jacobowitz
2005-12-04 21:22 ` Jim Blandy
2005-12-02 4:02 ` Joel Brobecker
2005-12-02 18:44 ` Mark Kettenis
2005-12-02 19:15 ` [PATCH] add 'rs6000_in_function_epilogue_p()' (Revised) Paul Gilliam
2005-12-02 20:28 ` Mark Kettenis
2005-12-02 21:19 ` Daniel Jacobowitz
2005-12-02 21:21 ` Mark Kettenis
2005-12-03 4:53 ` [PATCH] add 'rs6000_in_function_epilogue_p()' (Revised, again) Paul Gilliam
2005-12-03 5:43 ` Paul Gilliam
2005-12-02 21:44 ` [PATCH] add 'rs6000_in_function_epilogue_p()' (Revised) Kevin Buettner
2005-12-06 15:20 ` Paul Gilliam
2005-12-06 15:15 ` Paul Gilliam
2005-12-08 4:42 ` Kevin Buettner
2006-01-11 17:44 ` Paul Gilliam
2006-01-12 0:12 ` Paul Gilliam
2006-01-12 23:53 ` Paul Gilliam
2006-01-13 21:05 ` Mark Kettenis
2006-01-17 3:46 ` Paul Gilliam
2006-01-17 19:29 ` Mark Kettenis
2006-02-09 17:46 ` Kevin Buettner
2005-12-02 22:19 ` Jim Blandy
2005-12-02 22:28 ` Daniel Jacobowitz
2005-12-02 23:20 ` Jim Blandy
2005-12-03 12:48 ` Paul Gilliam
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=20051203030533.GA23195@nevyn.them.org \
--to=drow@false.org \
--cc=gdb-patches@sources.redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=jimb@red-bean.com \
--cc=pgilliam@us.ibm.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