2011-05-26 Pedro Alves <pedro@codesourcery.com>
[deliverable/binutils-gdb.git] / gdb / mips-tdep.c
index a2ca1ca5565b34c1ab1200a7245f2ff04d11adbe..47d9182b02da46dee53f7e0a9fc7cec9ca0ced69 100644 (file)
@@ -564,7 +564,7 @@ mips_tdesc_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
    gdbarch_num_regs .. 2 * gdbarch_num_regs) back onto the corresponding raw
    registers.  Take care of alignment and size problems.  */
 
-static void
+static enum register_status
 mips_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
                           int cookednum, gdb_byte *buf)
 {
@@ -572,18 +572,22 @@ mips_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
   gdb_assert (cookednum >= gdbarch_num_regs (gdbarch)
              && cookednum < 2 * gdbarch_num_regs (gdbarch));
   if (register_size (gdbarch, rawnum) == register_size (gdbarch, cookednum))
-    regcache_raw_read (regcache, rawnum, buf);
+    return regcache_raw_read (regcache, rawnum, buf);
   else if (register_size (gdbarch, rawnum) >
           register_size (gdbarch, cookednum))
     {
       if (gdbarch_tdep (gdbarch)->mips64_transfers_32bit_regs_p)
-       regcache_raw_read_part (regcache, rawnum, 0, 4, buf);
+       return regcache_raw_read_part (regcache, rawnum, 0, 4, buf);
       else
        {
          enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
          LONGEST regval;
-         regcache_raw_read_signed (regcache, rawnum, &regval);
-         store_signed_integer (buf, 4, byte_order, regval);
+         enum register_status status;
+
+         status = regcache_raw_read_signed (regcache, rawnum, &regval);
+         if (status == REG_VALID)
+           store_signed_integer (buf, 4, byte_order, regval);
+         return status;
        }
     }
   else
@@ -733,9 +737,10 @@ mips_convert_register_p (struct gdbarch *gdbarch,
       || mips_convert_register_gpreg_case_p (gdbarch, regnum, type);
 }
 
-static void
+static int
 mips_register_to_value (struct frame_info *frame, int regnum,
-                       struct type *type, gdb_byte *to)
+                       struct type *type, gdb_byte *to,
+                       int *optimizedp, int *unavailablep)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
 
@@ -743,14 +748,29 @@ mips_register_to_value (struct frame_info *frame, int regnum,
     {
       get_frame_register (frame, regnum + 0, to + 4);
       get_frame_register (frame, regnum + 1, to + 0);
+
+      if (!get_frame_register_bytes (frame, regnum + 0, 0, 4, to + 4,
+                                    optimizedp, unavailablep))
+       return 0;
+
+      if (!get_frame_register_bytes (frame, regnum + 1, 0, 4, to + 0,
+                                    optimizedp, unavailablep))
+       return 0;
+      *optimizedp = *unavailablep = 0;
+      return 1;
     }
   else if (mips_convert_register_gpreg_case_p (gdbarch, regnum, type))
     {
       int len = TYPE_LENGTH (type);
-      if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
-       get_frame_register_bytes (frame, regnum, 8 - len, len, to);
-      else
-       get_frame_register_bytes (frame, regnum, 0, len, to);
+      CORE_ADDR offset;
+
+      offset = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 8 - len : 0;
+      if (!get_frame_register_bytes (frame, regnum, offset, len, to,
+                                    optimizedp, unavailablep))
+       return 0;
+
+      *optimizedp = *unavailablep = 0;
+      return 1;
     }
   else
     {
@@ -2008,6 +2028,7 @@ mips_insn16_frame_sniffer (const struct frame_unwind *self,
 static const struct frame_unwind mips_insn16_frame_unwind =
 {
   NORMAL_FRAME,
+  default_frame_unwind_stop_reason,
   mips_insn16_frame_this_id,
   mips_insn16_frame_prev_register,
   NULL,
@@ -2361,6 +2382,7 @@ mips_insn32_frame_sniffer (const struct frame_unwind *self,
 static const struct frame_unwind mips_insn32_frame_unwind =
 {
   NORMAL_FRAME,
+  default_frame_unwind_stop_reason,
   mips_insn32_frame_this_id,
   mips_insn32_frame_prev_register,
   NULL,
@@ -2485,6 +2507,7 @@ mips_stub_frame_sniffer (const struct frame_unwind *self,
 static const struct frame_unwind mips_stub_frame_unwind =
 {
   NORMAL_FRAME,
+  default_frame_unwind_stop_reason,
   mips_stub_frame_this_id,
   mips_stub_frame_prev_register,
   NULL,
@@ -3138,8 +3161,8 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
              len -= partial_len;
              val += partial_len;
 
-             /* Compute the the offset into the stack at which we
-                will copy the next parameter.
+             /* Compute the offset into the stack at which we will
+                copy the next parameter.
 
                 In the new EABI (and the NABI32), the stack_offset
                 only needs to be adjusted when it has been used.  */
@@ -3530,8 +3553,8 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
              len -= partial_len;
              val += partial_len;
 
-             /* Compute the the offset into the stack at which we
-                will copy the next parameter.
+             /* Compute the offset into the stack at which we will
+                copy the next parameter.
 
                 In N32 (N64?), the stack_offset only needs to be
                 adjusted when it has been used.  */
@@ -4010,8 +4033,8 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
              len -= partial_len;
              val += partial_len;
 
-             /* Compute the the offset into the stack at which we
-                will copy the next parameter.
+             /* Compute the offset into the stack at which we will
+                copy the next parameter.
 
                 In older ABIs, the caller reserved space for
                 registers that contained arguments.  This was loosely
@@ -4418,8 +4441,8 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
              len -= partial_len;
              val += partial_len;
 
-             /* Compute the the offset into the stack at which we
-                will copy the next parameter.
+             /* Compute the offset into the stack at which we will
+                copy the next parameter.
 
                 In older ABIs, the caller reserved space for
                 registers that contained arguments.  This was loosely
@@ -5312,7 +5335,7 @@ mips_breakpoint_from_pc (struct gdbarch *gdbarch,
    and the target PC is in $2.
    * If the PC at the start of __mips16_call_stub_{s,d}f_{0..10}, i.e.
    before the jal instruction, this is effectively a call stub
-   and the the target PC is in $2.  Otherwise this is effectively
+   and the target PC is in $2.  Otherwise this is effectively
    a return stub and the target PC is in $18.
 
    See the source code for the stubs in gcc/config/mips/mips16.S for
@@ -5344,7 +5367,7 @@ mips_skip_mips16_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
 
       /* If the PC at the start of __mips16_call_stub_{s,d}f_{0..10}, i.e.
          before the jal instruction, this is effectively a call stub
-         and the the target PC is in $2.  Otherwise this is effectively
+         and the target PC is in $2.  Otherwise this is effectively
          a return stub and the target PC is in $18.  */
       else if (name[19] == 's' || name[19] == 'd')
        {
This page took 0.025883 seconds and 4 git commands to generate.