/* 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>.
/* 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. */
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. */
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. */
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. */
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);