diff mbox

[v2,2/4] Set uses_fp for frames with a valid FP register explicitly.

Message ID 20160701174036.90598-3-jhb@FreeBSD.org
State New
Headers show

Commit Message

John Baldwin July 1, 2016, 5:40 p.m. UTC
Since CORE_ADDR is unsigned, the saved FP register is always greater than
or equal to zero.  Replace the comparison by explicitly setting uses_fp to
1 for frames with a valid FP register.

gdb/ChangeLog:

	* sh64-tdep.c (sh64_analyze_prologue): Set "uses_fp" when setting
	the MEDIA_FP_REGNUM register.
---
 gdb/ChangeLog   |  5 +++++
 gdb/sh64-tdep.c | 29 ++++++++++++++++++-----------
 2 files changed, 23 insertions(+), 11 deletions(-)

Comments

Yao Qi July 6, 2016, 7:55 a.m. UTC | #1
On Fri, Jul 1, 2016 at 6:40 PM, John Baldwin <jhb@freebsd.org> wrote:
> Since CORE_ADDR is unsigned, the saved FP register is always greater than
> or equal to zero.  Replace the comparison by explicitly setting uses_fp to
> 1 for frames with a valid FP register.
>
> gdb/ChangeLog:
>
>         * sh64-tdep.c (sh64_analyze_prologue): Set "uses_fp" when setting
>         the MEDIA_FP_REGNUM register.

Patch is OK.
diff mbox

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fef34e2..727cf37 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@ 
 2016-07-01  John Baldwin  <jhb@FreeBSD.org>
 
+	* sh64-tdep.c (sh64_analyze_prologue): Set "uses_fp" when setting
+	the MEDIA_FP_REGNUM register.
+
+2016-07-01  John Baldwin  <jhb@FreeBSD.org>
+
 	* score-tdep.c (score7_malloc_and_get_memblock): Remove check for
 	negative size.
 
diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c
index e6b1e27..ee8d19c 100644
--- a/gdb/sh64-tdep.c
+++ b/gdb/sh64-tdep.c
@@ -901,8 +901,11 @@  sh64_analyze_prologue (struct gdbarch *gdbarch,
 	    }
 
 	  else if (IS_MOV_R14 (insn))
-	    cache->saved_regs[MEDIA_FP_REGNUM] =
-	      cache->sp_offset - ((((insn & 0xf) ^ 0x8) - 0x8) << 2);
+	    {
+	      cache->saved_regs[MEDIA_FP_REGNUM] =
+		cache->sp_offset - ((((insn & 0xf) ^ 0x8) - 0x8) << 2);
+	      cache->uses_fp = 1;
+	    }
 
 	  else if (IS_MOV_R0 (insn))
 	    {
@@ -931,6 +934,7 @@  sh64_analyze_prologue (struct gdbarch *gdbarch,
 	      /* Store R14 at r0_val-4 from SP.  Decrement r0 by 4.  */
 	      cache->saved_regs[MEDIA_FP_REGNUM] = cache->sp_offset
 	      					   - (r0_val - 4);
+	      cache->uses_fp = 1;
 	      r0_val -= 4;
 	    }
 
@@ -957,22 +961,25 @@  sh64_analyze_prologue (struct gdbarch *gdbarch,
 						 9) << 2);
 
 	  else if (IS_STQ_R14_R15 (insn))
-	    cache->saved_regs[MEDIA_FP_REGNUM]
-	      = cache->sp_offset - (sign_extend ((insn & 0xffc00) >> 10,
-						 9) << 3);
+	    {
+	      cache->saved_regs[MEDIA_FP_REGNUM]
+		= cache->sp_offset - (sign_extend ((insn & 0xffc00) >> 10,
+						   9) << 3);
+	      cache->uses_fp = 1;
+	    }
 
 	  else if (IS_STL_R14_R15 (insn))
-	    cache->saved_regs[MEDIA_FP_REGNUM]
-	      = cache->sp_offset - (sign_extend ((insn & 0xffc00) >> 10,
-						 9) << 2);
+	    {
+	      cache->saved_regs[MEDIA_FP_REGNUM]
+		= cache->sp_offset - (sign_extend ((insn & 0xffc00) >> 10,
+						   9) << 2);
+	      cache->uses_fp = 1;
+	    }
 
 	  else if (IS_MOV_SP_FP_MEDIA (insn))
 	    break;
 	}
     }
-
-  if (cache->saved_regs[MEDIA_FP_REGNUM] >= 0)
-    cache->uses_fp = 1;
 }
 
 static CORE_ADDR