Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [Patch, moxie] Handle new prologue sequences
@ 2009-09-10 21:10 Anthony Green
  0 siblings, 0 replies; only message in thread
From: Anthony Green @ 2009-09-10 21:10 UTC (permalink / raw)
  To: gdb-patches

This patch was developed in response to this recent GCC patch:

http://gcc.gnu.org/ml/gcc-patches/2009-09/msg00652.html

The GCC patch modifies moxie function prologues. This patch tweaks the
prologue recognizer accordingly.  I am checking it in.

AG

2009-09-10  Anthony Green  <green@moxielogic.com>

	* moxie-tdep.c (moxie_analyze_prologue): Recognize new prologue
	sequences.


Index: gdb/moxie-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/moxie-tdep.c,v
retrieving revision 1.6
diff -u -r1.6 moxie-tdep.c
--- gdb/moxie-tdep.c	18 Jul 2009 13:52:02 -0000	1.6
+++ gdb/moxie-tdep.c	10 Sep 2009 20:44:43 -0000
@@ -174,23 +174,37 @@
 	  cache->saved_regs[regnum] = cache->framesize;
 	  next_addr += 2;
 	}
+    }
 
-      /* Optional stack allocation for args and local vars <= 4
-	 byte.  */
-      else if (inst == 0x01f0)           /* ldi.l $r12, X */
-	{
-	  offset = read_memory_integer (next_addr + 2, 4, byte_order);
-	  inst2 = read_memory_unsigned_integer (next_addr + 6, 2, byte_order);
+  inst = read_memory_unsigned_integer (next_addr, 2, byte_order);
 
-	  if (inst2 == 0x051f)           /* add.l $sp, $r12 */
-	    {
-	      cache->framesize += offset;
-	    }
+  /* Optional stack allocation for args and local vars <= 4
+     byte.  */
+  if (inst == 0x0170)           /* ldi.l $r5, X */
+    {
+      offset = read_memory_integer (next_addr + 2, 4, byte_order);
+      inst2 = read_memory_unsigned_integer (next_addr + 6, 2, byte_order);
+      
+      if (inst2 == 0x0517)           /* add.l $sp, $r5 */
+	{
+	  cache->framesize += offset;
+	}
+      
+      return (next_addr + 8);
+    }
+  else if ((inst & 0xff00) == 0x91)   /* dec $sp, X */
+    {
+      cache->framesize += (inst & 0x00ff);
+      next_addr += 2;
 
-	  return (next_addr + 8);
+      while (next_addr < end_addr)
+	{
+	  inst = read_memory_unsigned_integer (next_addr, 2, byte_order);
+	  if ((inst & 0xff00) != 0x91) /* no more dec $sp, X */
+	    break;
+	  cache->framesize += (inst & 0x00ff);
+	  next_addr += 2;
 	}
-      else  /* This is not a prologue instruction.  */
-	break;
     }
 
   return next_addr;



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-09-10 21:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-10 21:10 [Patch, moxie] Handle new prologue sequences Anthony Green

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