* mips-tdep.c (mips_insn16_frame_cache, mips_insn32_frame_sniffer):
[deliverable/binutils-gdb.git] / gdb / spu-tdep.c
index 09a43cfabb8efd0251bf4ac4a5019c29a2913245..f749ecebb19e091b037662ecf2b2936a91ef8ce5 100644 (file)
@@ -1,5 +1,5 @@
 /* SPU target-dependent code for GDB, the GNU debugger.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
 
    Contributed by Ulrich Weigand <uweigand@de.ibm.com>.
    Based on a port by Sid Manning <sid@us.ibm.com>.
@@ -145,37 +145,20 @@ spu_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
 
 /* Value conversion -- access scalar values at the preferred slot.  */
 
-static int
-spu_convert_register_p (int regno, struct type *type)
-{
-  return regno < SPU_NUM_GPRS && TYPE_LENGTH (type) < 16;
-}
-
-static void
-spu_register_to_value (struct frame_info *frame, int regnum,
-                       struct type *valtype, gdb_byte *out)
+static struct value *
+spu_value_from_register (struct type *type, int regnum,
+                        struct frame_info *frame)
 {
-  gdb_byte in[16];
-  int len = TYPE_LENGTH (valtype);
-  int preferred_slot = len < 4 ? 4 - len : 0;
-  gdb_assert (len < 16);
+  struct value *value = default_value_from_register (type, regnum, frame);
+  int len = TYPE_LENGTH (type);
 
-  get_frame_register (frame, regnum, in);
-  memcpy (out, in + preferred_slot, len);
-}
+  if (regnum < SPU_NUM_GPRS && len < 16)
+    {
+      int preferred_slot = len < 4 ? 4 - len : 0;
+      set_value_offset (value, preferred_slot);
+    }
 
-static void
-spu_value_to_register (struct frame_info *frame, int regnum,
-                       struct type *valtype, const gdb_byte *in)
-{
-  gdb_byte out[16];
-  int len = TYPE_LENGTH (valtype);
-  int preferred_slot = len < 4 ? 4 - len : 0;
-  gdb_assert (len < 16);
-
-  memset (out, 0, 16);
-  memcpy (out + preferred_slot, in, len);
-  put_frame_register (frame, regnum, out);
+  return value;
 }
 
 /* Register groups.  */
@@ -495,11 +478,17 @@ spu_analyze_prologue (CORE_ADDR start_pc, CORE_ADDR end_pc,
       else if (is_ri16 (insn, op_il, &rt, &immed))
        {
          reg_immed[rt] = immed;
+
+         if (rt == SPU_RAW_SP_REGNUM && !found_sp)
+           found_sp = 1;
        }
 
       else if (is_ri18 (insn, op_ila, &rt, &immed))
        {
          reg_immed[rt] = immed & 0x3ffff;
+
+         if (rt == SPU_RAW_SP_REGNUM && !found_sp)
+           found_sp = 1;
        }
 
       /* STQD is used to save registers to the stack.  */
@@ -598,7 +587,7 @@ spu_frame_unwind_cache (struct frame_info *next_frame,
   info->local_base = 0;
 
   /* Find the start of the current function, and analyze its prologue.  */
-  info->func = frame_func_unwind (next_frame);
+  info->func = frame_func_unwind (next_frame, NORMAL_FRAME);
   if (info->func == 0)
     {
       /* Fall back to using the current PC as frame ID.  */
@@ -1050,9 +1039,7 @@ spu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_type (gdbarch, spu_register_type);
   set_gdbarch_pseudo_register_read (gdbarch, spu_pseudo_register_read);
   set_gdbarch_pseudo_register_write (gdbarch, spu_pseudo_register_write);
-  set_gdbarch_convert_register_p (gdbarch, spu_convert_register_p);
-  set_gdbarch_register_to_value (gdbarch, spu_register_to_value);
-  set_gdbarch_value_to_register (gdbarch, spu_value_to_register);
+  set_gdbarch_value_from_register (gdbarch, spu_value_from_register);
   set_gdbarch_register_reggroup_p (gdbarch, spu_register_reggroup_p);
 
   /* Data types.  */
@@ -1066,9 +1053,9 @@ spu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_float_bit (gdbarch, 32);
   set_gdbarch_double_bit (gdbarch, 64);
   set_gdbarch_long_double_bit (gdbarch, 64);
-  set_gdbarch_float_format (gdbarch, &floatformat_ieee_single_big);
-  set_gdbarch_double_format (gdbarch, &floatformat_ieee_double_big);
-  set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
+  set_gdbarch_float_format (gdbarch, floatformats_ieee_single);
+  set_gdbarch_double_format (gdbarch, floatformats_ieee_double);
+  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
 
   /* Inferior function calls.  */
   set_gdbarch_push_dummy_call (gdbarch, spu_push_dummy_call);
This page took 0.024847 seconds and 4 git commands to generate.