This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PING][PATCH] Fix for prologue processing on PowerPC


Hi Kevin,

lr_reg could be also set to -2 in part of code which is reachable after shifting removal.

      /* Invalidate lr_reg, but don't set it to -1.
         That would mean that it had never been set.  */
      lr_reg = -2;

This part of the code which depends of non shifted lr_reg, and the part where shifting is removed are only two places where lr_reg is changed. As so, I've added last condition to set fdata->lr_register on -1 if lim_pc is not reached.

If it seems fine now could you pleas commit it because I don't have rights to do it.

Thanks,

Nikola Prica


From: Prica <nprica@rt-rk.com>
Date: Thu, 9 Nov 2017 13:10:48 +0100
Subject: Fix for prologue processing on PowerPC

One of conditions in skip_prologue() is never visited because it
expects non shifted `lr_reg`.  That condition is supposed to set PC
offset.  When body of this condition is visited PC offset is set and
there will be no need to look for it in next frames nor to use frame
unwind directives.

gdb/ChangeLog:

	*rs6000-tdep.c (skip_prologue): Remove shifting for lr_reg
  	and assign shifted lr_reg to fdata->lr_register when lr_reg is
  	set. If iteration do not hit lim_pc lr_register is set as -1.
---
 gdb/rs6000-tdep.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 6c44995..6f05ef5 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -1655,9 +1655,12 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
 	     remember just the first one, but skip over additional
 	     ones.  */
 	  if (lr_reg == -1)
-	    lr_reg = (op & 0x03e00000) >> 21;
-          if (lr_reg == 0)
-            r0_contains_arg = 0;
+      {
+        lr_reg = (op & 0x03e00000);
+        fdata->lr_register = lr_reg >> 21;
+        if (lr_reg == 0)
+          r0_contains_arg = 0;
+      }
 	  continue;
 	}
       else if ((op & 0xfc1fffff) == 0x7c000026)
@@ -2180,8 +2183,8 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
     }
 #endif /* 0 */

-  if (pc == lim_pc && lr_reg >= 0)
-    fdata->lr_register = lr_reg;
+  if (pc != lim_pc)
+    fdata->lr_register = -1;

   fdata->offset = -fdata->offset;
   return last_prologue_pc;
--
2.7.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]