Set uses_fp for frames with a valid FP register explicitly.
authorJohn Baldwin <jhb@FreeBSD.org>
Sat, 11 Jun 2016 14:43:46 +0000 (07:43 -0700)
committerJohn Baldwin <jhb@FreeBSD.org>
Wed, 6 Jul 2016 13:08:43 +0000 (06:08 -0700)
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
gdb/sh64-tdep.c

index 9957227..c9ad9cc 100644 (file)
@@ -1,5 +1,10 @@
 2016-07-06  John Baldwin  <jhb@FreeBSD.org>
 
+       * sh64-tdep.c (sh64_analyze_prologue): Set "uses_fp" when setting
+       the MEDIA_FP_REGNUM register.
+
+2016-07-06  John Baldwin  <jhb@FreeBSD.org>
+
        * score-tdep.c (score7_malloc_and_get_memblock): Remove check for
        negative size.
 
index e6b1e27..ee8d19c 100644 (file)
@@ -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