[rfc] Delay slots on cris

Daniel Jacobowitz drow@false.org
Sun Jun 29 05:37:00 GMT 2008


I've been auditing all uses of the frame unwind methods and this one
seems wrong.  If I understand correctly, ERP/NRP have the low bit set
when the program was interrupted in the midst of a delay slot.  While
ERP is rarely saved - so by default frame_unwind_register and
get_frame_register will find the same value - I believe the copy we
want is the current frame's (i.e. the one whose current PC is pointing
at the branch).  Right?

If so, this patch fixes it.

[The cris target has no listed maintainers and has had no
non-mechanical changes in just over three years.  Knowing the likely
culprits, CC'd, I assume that means it works fine :-)]

-- 
Daniel Jacobowitz
CodeSourcery

2008-06-28  Daniel Jacobowitz  <dan@codesourcery.com>

	* cris-tdep.c (crisv32_single_step_through_delay): Get this frame's
	register, not the previous frame's.

---
 gdb/cris-tdep.c |   11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

Index: src/gdb/cris-tdep.c
===================================================================
--- src.orig/gdb/cris-tdep.c	2008-06-28 22:32:08.000000000 -0400
+++ src/gdb/cris-tdep.c	2008-06-28 22:34:02.000000000 -0400
@@ -474,18 +474,11 @@ crisv32_single_step_through_delay (struc
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   ULONGEST erp;
   int ret = 0;
-  char buf[4];
 
   if (cris_mode () == cris_mode_guru)
-    {
-      frame_unwind_register (this_frame, NRP_REGNUM, buf);
-    }
+    erp = get_frame_register_unsigned (this_frame, NRP_REGNUM);
   else
-    {
-      frame_unwind_register (this_frame, ERP_REGNUM, buf);
-    }
-
-  erp = extract_unsigned_integer (buf, 4);
+    erp = get_frame_register_unsigned (this_frame, ERP_REGNUM);
 
   if (erp & 0x1)
     {



More information about the Gdb-patches mailing list