From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17158 invoked by alias); 29 Jun 2008 02:40:55 -0000 Received: (qmail 17149 invoked by uid 22791); 29 Jun 2008 02:40:54 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 29 Jun 2008 02:40:34 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id D841F98366; Sun, 29 Jun 2008 02:40:32 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 7A8AA98011; Sun, 29 Jun 2008 02:40:32 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1KCmq7-0006xG-8I; Sat, 28 Jun 2008 22:40:31 -0400 Date: Sun, 29 Jun 2008 05:37:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sourceware.org Cc: Orjan Friberg , Hans-Peter Nilsson Subject: [rfc] Delay slots on cris Message-ID: <20080629024031.GA26670@caradoc.them.org> Mail-Followup-To: gdb-patches@sourceware.org, Orjan Friberg , Hans-Peter Nilsson MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.17 (2008-05-11) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-06/txt/msg00569.txt.bz2 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 * 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) {