Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC] m32r-tdep.c: Fix sign extension problem during prologue  analysis
@ 2007-10-11  1:29 Kevin Buettner
  2007-10-11  7:26 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Buettner @ 2007-10-11  1:29 UTC (permalink / raw)
  To: gdb-patches; +Cc: sakamoto.kei

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)


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

end of thread, other threads:[~2007-10-16  6:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-11  1:29 [RFC] m32r-tdep.c: Fix sign extension problem during prologue analysis Kevin Buettner
2007-10-11  7:26 ` Daniel Jacobowitz
2007-10-16  7:53   ` Kevin Buettner

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