Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfc] Delay slots on cris
@ 2008-06-29  5:37 Daniel Jacobowitz
  2008-06-30 14:00 ` Hans-Peter Nilsson
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2008-06-29  5:37 UTC (permalink / raw)
  To: gdb-patches; +Cc: Orjan Friberg, Hans-Peter Nilsson

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)
     {


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-06-30 14:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-29  5:37 [rfc] Delay slots on cris Daniel Jacobowitz
2008-06-30 14:00 ` Hans-Peter Nilsson
2008-06-30 14:01   ` Orjan Friberg
2008-06-30 14:25     ` drow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox