[RFA] Tweak in skip_prologue for rs6000
Michael Snyder
michsnyd@cisco.com
Thu Nov 11 19:18:00 GMT 2004
"Kevin Buettner" <kevinb@redhat.com> wrote:
> On Wed, 10 Nov 2004 17:11:21 -0800
> "Michael Snyder" <michsnyd@cisco.com> wrote:
>
>> If I'm right, this will prevent saving lr_offset twice. It looks like the
>> existing code intends to invalidate lr_reg, but setting it to zero is not
>> an invalid value.
>
> Yes, I agree with your analysis. Setting lr_reg to 0 will cause a
> match whenever doing a st[dw]{,u} r0, NUM(r1). While this is okay
> if the zero value comes from the mflr case, it is definitely not okay
> in the lr_reg invalidation code.
>
>> Probably the same is true for cr_reg and cr_offset...
>
> Yes, it appears so. Would you mind making the same fix for these?
> Consider such a patch to be preapproved.
OK, committed. Revised version attached below.
Thanks Kevin. Oh, and thanks to Wendy Peikes of Cisco
for her help in tracking this down.
2004-11-10 msnyder <msnyder@redhat.com>
* rs6000-tdep.c (skip_prologue): After saving lr_offset,
must invalidate lr_reg (so we don't try to save it again).
Ditto for cr_offset and cr_reg.
Index: rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.230
diff -p -r1.230 rs6000-tdep.c
*** rs6000-tdep.c 13 Oct 2004 16:38:22 -0000 1.230
--- rs6000-tdep.c 11 Nov 2004 19:14:29 -0000
*************** skip_prologue (CORE_ADDR pc, CORE_ADDR l
*** 981,987 ****
continue;
}
! else if (lr_reg != -1 &&
/* std Rx, NUM(r1) || stdu Rx, NUM(r1) */
(((op & 0xffff0000) == (lr_reg | 0xf8010000)) ||
/* stw Rx, NUM(r1) */
--- 981,987 ----
continue;
}
! else if (lr_reg >= 0 &&
/* std Rx, NUM(r1) || stdu Rx, NUM(r1) */
(((op & 0xffff0000) == (lr_reg | 0xf8010000)) ||
/* stw Rx, NUM(r1) */
*************** skip_prologue (CORE_ADDR pc, CORE_ADDR l
*** 991,997 ****
{ /* where Rx == lr */
fdata->lr_offset = offset;
fdata->nosavedpc = 0;
! lr_reg = 0;
if ((op & 0xfc000003) == 0xf8000000 || /* std */
(op & 0xfc000000) == 0x90000000) /* stw */
{
--- 991,999 ----
{ /* where Rx == lr */
fdata->lr_offset = offset;
fdata->nosavedpc = 0;
! /* Invalidate lr_reg, but don't set it to -1.
! That would mean that it had never been set. */
! lr_reg = -2;
if ((op & 0xfc000003) == 0xf8000000 || /* std */
(op & 0xfc000000) == 0x90000000) /* stw */
{
*************** skip_prologue (CORE_ADDR pc, CORE_ADDR l
*** 1001,1007 ****
continue;
}
! else if (cr_reg != -1 &&
/* std Rx, NUM(r1) || stdu Rx, NUM(r1) */
(((op & 0xffff0000) == (cr_reg | 0xf8010000)) ||
/* stw Rx, NUM(r1) */
--- 1003,1009 ----
continue;
}
! else if (cr_reg >= 0 &&
/* std Rx, NUM(r1) || stdu Rx, NUM(r1) */
(((op & 0xffff0000) == (cr_reg | 0xf8010000)) ||
/* stw Rx, NUM(r1) */
*************** skip_prologue (CORE_ADDR pc, CORE_ADDR l
*** 1010,1016 ****
((op & 0xffff0000) == (cr_reg | 0x94010000))))
{ /* where Rx == cr */
fdata->cr_offset = offset;
! cr_reg = 0;
if ((op & 0xfc000003) == 0xf8000000 ||
(op & 0xfc000000) == 0x90000000)
{
--- 1012,1020 ----
((op & 0xffff0000) == (cr_reg | 0x94010000))))
{ /* where Rx == cr */
fdata->cr_offset = offset;
! /* Invalidate cr_reg, but don't set it to -1.
! That would mean that it had never been set. */
! cr_reg = -2;
if ((op & 0xfc000003) == 0xf8000000 ||
(op & 0xfc000000) == 0x90000000)
{
More information about the Gdb-patches
mailing list