Re: [PATCH] add 'rs6000_in_function_epilogue_p()'

Paul Gilliam
2005-12-02T19:15:27Z

On Thursday 01 December 2005 17:17, Daniel Jacobowitz wrote:
> On Thu, Dec 01, 2005 at 05:07:24PM -0800, Jim Blandy wrote:
> > Paul wanted to fast-track this patch, in hopes it could get into the
> > 6.4 release. Joel, what are your thoughts?
>
> I'm opposed. The patch is a serious hack - it assumes that the exit of
> the function is near the end of the function - and I think we need to
> think about the underlying issues a bit. It's also for a very minor
> bug.
>

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.

Some other points:

* The PowerPC would not be the only architecture that uses 'gdbarch_in_function_epilogue_p()'.

* Danial may characterize the inability to watch a local variable as a very minor bug, but if a user (we have one) is
so desperate with a bug of their own that they see *software* watchpoints as a needed tool, I don't think they would
characterize this is "very minor". 8-)

* I know that this is a hack. It really is a fall-back-hack, as Jim Blandly aluded to in his posting:
http://sourceware.org/ml/gdb-patches/2005-12/msg00028.html

* If the 'underlying cause' Jim refers to gets fixed, the hack will no longer be executed and it
could be removed, or it could stay.

* I would prefer the 'right' fix and will presue it, but for right now, this patch 'fixes' a bug and all though
it's a hack, it is isolated and easly addressed once the 'right' fix is found.