From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9891 invoked by alias); 11 Oct 2007 00:03:14 -0000 Received: (qmail 9882 invoked by uid 22791); 11 Oct 2007 00:03:13 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 11 Oct 2007 00:03:10 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.1) with ESMTP id l9B0361b029232; Wed, 10 Oct 2007 20:03:06 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l9B035OO009986; Wed, 10 Oct 2007 20:03:05 -0400 Received: from ironwood.lan (vpn-15-127.rdu.redhat.com [10.11.15.127]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l9B035ma026469; Wed, 10 Oct 2007 20:03:05 -0400 Date: Thu, 11 Oct 2007 01:29:00 -0000 From: Kevin Buettner To: gdb-patches@sourceware.org Cc: sakamoto.kei@renesas.com Subject: [RFC] m32r-tdep.c: Fix sign extension problem during prologue analysis Message-ID: <20071010170252.65259f1a@ironwood.lan> X-Mailer: Sylpheed-Claws 2.6.0 (GTK+ 2.10.4; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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: 2007-10/txt/msg00258.txt.bz2 I recently learned that there were far too many testsuite failures for the m32r-elf target. I found that backtraces (among other things) were badly broken and traced the problem to a lack of sign extension for a particular instruction pattern during prologue analysis. Comments? (Is there a better way to do the sign extension?) Kevin * m32r-tdep.c (decode_prologue): Sign extend offset for "addi sp, xx" case. (m32r_frame_unwind_cache): Likewise. Index: m32r-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/m32r-tdep.c,v retrieving revision 1.48 diff -u -p -r1.48 m32r-tdep.c --- m32r-tdep.c 23 Aug 2007 18:08:35 -0000 1.48 +++ m32r-tdep.c 10 Oct 2007 23:35:12 -0000 @@ -349,7 +349,7 @@ decode_prologue (CORE_ADDR start_pc, COR if ((insn >> 8) == 0x4f) /* addi sp, xx */ /* add 8 bit sign-extended offset */ { - int stack_adjust = (gdb_byte) (insn & 0xff); + int stack_adjust = (signed char) (insn & 0xff); /* there are probably two of these stack adjustments: 1) A negative one in the prologue, and @@ -578,7 +578,7 @@ m32r_frame_unwind_cache (struct frame_in else if ((op & 0xff00) == 0x4f00) { /* addi sp, xx */ - int n = (gdb_byte) (op & 0xff); + int n = (signed char) (op & 0xff); info->sp_offset += n; } else if (op == 0x1d8f)