Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* mips-tdep.c (heuristic_proc_start): Recognise MIPS16 "save"
@ 2007-07-20 17:18 Maciej W. Rozycki
  2007-07-20 17:37 ` Daniel Jacobowitz
  0 siblings, 1 reply; 2+ messages in thread
From: Maciej W. Rozycki @ 2007-07-20 17:18 UTC (permalink / raw)
  To: gdb-patches; +Cc: Chris Dearman, Maciej W. Rozycki

Hello,

 The MIPS16e ASE adds "save" to the list of MIPS16 instructions, which is 
typically used in a function's prologue.  It is therefore useful to have 
it recognised by our heuristic analyser.

 Tested for mipsisa32-sde-elf, with the mips-sim-sde32/-mips16/-EB and 
mips-sim-sde32/-mips16/-EL target boards with no regressions.

2004-07-20  Chris Dearman  <chris@mips.com>

	* mips-tdep.c (heuristic_proc_start): Add more MIPS16 function
	prologue instructions.

 OK to apply?

  Maciej

12271-6.diff
Index: binutils-quilt/src/gdb/mips-tdep.c
===================================================================
--- binutils-quilt.orig/src/gdb/mips-tdep.c	2007-05-22 19:11:41.000000000 +0100
+++ binutils-quilt/src/gdb/mips-tdep.c	2007-05-22 19:11:51.000000000 +0100
@@ -2363,15 +2363,28 @@
 
 	/* On MIPS16, any one of the following is likely to be the
 	   start of a function:
+  	   extend save
+	   save
 	   entry
 	   addiu sp,-n
 	   daddiu sp,-n
 	   extend -n followed by 'addiu sp,+n' or 'daddiu sp,+n'  */
 	inst = mips_fetch_instruction (start_pc);
-	if (((inst & 0xf81f) == 0xe809 && (inst & 0x700) != 0x700)	/* entry */
-	    || (inst & 0xff80) == 0x6380	/* addiu sp,-n */
-	    || (inst & 0xff80) == 0xfb80	/* daddiu sp,-n */
-	    || ((inst & 0xf810) == 0xf010 && seen_adjsp))	/* extend -n */
+	if ((inst & 0xff80) == 0x6480)		/* save */
+	  {
+	    if (start_pc - instlen >= fence)
+	      {
+		inst = mips_fetch_instruction (start_pc - instlen);
+		if ((inst & 0xf800) == 0xf000)	/* extend */
+		  start_pc -= instlen;
+	      }
+	    break;
+	  }
+	else if (((inst & 0xf81f) == 0xe809
+		  && (inst & 0x700) != 0x700)	/* entry */
+		 || (inst & 0xff80) == 0x6380	/* addiu sp,-n */
+		 || (inst & 0xff80) == 0xfb80	/* daddiu sp,-n */
+		 || ((inst & 0xf810) == 0xf010 && seen_adjsp))	/* extend -n */
 	  break;
 	else if ((inst & 0xff00) == 0x6300	/* addiu sp */
 		 || (inst & 0xff00) == 0xfb00)	/* daddiu sp */


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

* Re: mips-tdep.c (heuristic_proc_start): Recognise MIPS16 "save"
  2007-07-20 17:18 mips-tdep.c (heuristic_proc_start): Recognise MIPS16 "save" Maciej W. Rozycki
@ 2007-07-20 17:37 ` Daniel Jacobowitz
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2007-07-20 17:37 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: gdb-patches, Chris Dearman, Maciej W. Rozycki

On Fri, Jul 20, 2007 at 05:49:13PM +0100, Maciej W. Rozycki wrote:
> Hello,
> 
>  The MIPS16e ASE adds "save" to the list of MIPS16 instructions, which is 
> typically used in a function's prologue.  It is therefore useful to have 
> it recognised by our heuristic analyser.
> 
>  Tested for mipsisa32-sde-elf, with the mips-sim-sde32/-mips16/-EB and 
> mips-sim-sde32/-mips16/-EL target boards with no regressions.
> 
> 2004-07-20  Chris Dearman  <chris@mips.com>
> 
> 	* mips-tdep.c (heuristic_proc_start): Add more MIPS16 function
> 	prologue instructions.
> 
>  OK to apply?
> 

OK.

-- 
Daniel Jacobowitz
CodeSourcery


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

end of thread, other threads:[~2007-07-20 17:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-20 17:18 mips-tdep.c (heuristic_proc_start): Recognise MIPS16 "save" Maciej W. Rozycki
2007-07-20 17:37 ` Daniel Jacobowitz

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