* [RFA] Tweak in skip_prologue for rs6000
@ 2004-11-11 1:11 Michael Snyder
2004-11-11 17:04 ` Kevin Buettner
0 siblings, 1 reply; 3+ messages in thread
From: Michael Snyder @ 2004-11-11 1:11 UTC (permalink / raw)
To: gdb-patches; +Cc: kevinb
Kevin,
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.
Probably the same is true for cr_reg and cr_offset...
Michael
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).
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 01:04:40 -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 */
{
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [RFA] Tweak in skip_prologue for rs6000 2004-11-11 1:11 [RFA] Tweak in skip_prologue for rs6000 Michael Snyder @ 2004-11-11 17:04 ` Kevin Buettner 2004-11-11 19:18 ` Michael Snyder 0 siblings, 1 reply; 3+ messages in thread From: Kevin Buettner @ 2004-11-11 17:04 UTC (permalink / raw) To: Michael Snyder; +Cc: gdb-patches 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. > * rs6000-tdep.c (skip_prologue): After saving lr_offset, > must invalidate lr_reg (so we don't try to save it again). Definitely okay. Thanks for fixing this, Kevin ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] Tweak in skip_prologue for rs6000 2004-11-11 17:04 ` Kevin Buettner @ 2004-11-11 19:18 ` Michael Snyder 0 siblings, 0 replies; 3+ messages in thread From: Michael Snyder @ 2004-11-11 19:18 UTC (permalink / raw) To: Kevin Buettner; +Cc: gdb-patches, Wendy Peikes "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) { ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-11-11 19:18 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2004-11-11 1:11 [RFA] Tweak in skip_prologue for rs6000 Michael Snyder 2004-11-11 17:04 ` Kevin Buettner 2004-11-11 19:18 ` Michael Snyder
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox