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

* Re: [rfc] Delay slots on cris
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Hans-Peter Nilsson @ 2008-06-30 14:00 UTC (permalink / raw)
  To: drow; +Cc: gdb-patches, orjan.friberg, hans-peter.nilsson, ricard.wanderlof

> Date: Sat, 28 Jun 2008 22:40:31 -0400
> From: Daniel Jacobowitz <drow@false.org>

> 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.

Right.

> 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?

That certainly sounds reasonable, but I think better Orjan chime
in here.

> [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 :-)]

So I've heard; I haven't tested it myself.

I'm listed under "Authorized Committers" as
CRIS                    Hans-Peter Nilsson hp@axis.com
(I just fixed the email address address).

Apparently someone pruned me from the target-maintainer section,
but that's fine.  I guess we can and should find someone to put
there; I'll look into it.

brgds, H-P


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

* Re: [rfc] Delay slots on cris
  2008-06-30 14:00 ` Hans-Peter Nilsson
@ 2008-06-30 14:01   ` Orjan Friberg
  2008-06-30 14:25     ` drow
  0 siblings, 1 reply; 4+ messages in thread
From: Orjan Friberg @ 2008-06-30 14:01 UTC (permalink / raw)
  To: Hans-Peter Nilsson, drow; +Cc: gdb-patches, Ricard Wanderlöf

Hans-Peter Nilsson wrote:
>> Date: Sat, 28 Jun 2008 22:40:31 -0400
>> From: Daniel Jacobowitz <drow@false.org>
> 
>> 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?
> 
> That certainly sounds reasonable

Agreed.

-- 
Orjan Friberg
Axis Communications AB


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

* Re: [rfc] Delay slots on cris
  2008-06-30 14:01   ` Orjan Friberg
@ 2008-06-30 14:25     ` drow
  0 siblings, 0 replies; 4+ messages in thread
From: drow @ 2008-06-30 14:25 UTC (permalink / raw)
  To: Orjan Friberg; +Cc: Hans-Peter Nilsson, gdb-patches, Ricard Wanderlöf

On Mon, Jun 30, 2008 at 02:20:59PM +0200, Orjan Friberg wrote:
> Hans-Peter Nilsson wrote:
>>> Date: Sat, 28 Jun 2008 22:40:31 -0400
>>> From: Daniel Jacobowitz <drow@false.org>
>>
>>> 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?
>>
>> That certainly sounds reasonable
>
> Agreed.

Thanks - I checked in the patch.

-- 
Daniel Jacobowitz
CodeSourcery


^ 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