Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sourceware.org
Cc: sakamoto.kei@renesas.com
Subject: [RFC] m32r-tdep.c: Fix sign extension problem during prologue  analysis
Date: Thu, 11 Oct 2007 01:29:00 -0000	[thread overview]
Message-ID: <20071010170252.65259f1a@ironwood.lan> (raw)

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)


             reply	other threads:[~2007-10-11  0:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-11  1:29 Kevin Buettner [this message]
2007-10-11  7:26 ` Daniel Jacobowitz
2007-10-16  7:53   ` Kevin Buettner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071010170252.65259f1a@ironwood.lan \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sakamoto.kei@renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox