static gdbarch_init_extra_frame_info_ftype sh_init_extra_frame_info;
static gdbarch_pop_frame_ftype sh_pop_frame;
static gdbarch_saved_pc_after_call_ftype sh_saved_pc_after_call;
-static gdbarch_frame_args_address_ftype sh_frame_args_address;
-static gdbarch_frame_locals_address_ftype sh_frame_locals_address;
/* Function call related functions. */
static gdbarch_extract_return_value_ftype sh_extract_return_value;
return ((frame)->extra_info->return_pc);
}
-static CORE_ADDR
-sh_frame_args_address (struct frame_info *fi)
-{
- return (fi)->frame;
-}
-
-static CORE_ADDR
-sh_frame_locals_address (struct frame_info *fi)
-{
- return (fi)->frame;
-}
-
/* Discard from the stack the innermost frame,
restoring all saved registers. */
static void
static void
sh_default_store_return_value (struct type *type, char *valbuf)
{
- write_register_bytes (REGISTER_BYTE (0),
- valbuf, TYPE_LENGTH (type));
+ char buf[32]; /* more than enough... */
+
+ if (TYPE_LENGTH (type) < REGISTER_RAW_SIZE (R0_REGNUM))
+ {
+ /* Add leading zeros to the value. */
+ memset (buf, 0, REGISTER_RAW_SIZE (R0_REGNUM));
+ memcpy (buf + REGISTER_RAW_SIZE (R0_REGNUM) - TYPE_LENGTH (type),
+ valbuf, TYPE_LENGTH (type));
+ write_register_bytes (REGISTER_BYTE (R0_REGNUM), buf,
+ REGISTER_RAW_SIZE (R0_REGNUM));
+ }
+ else
+ write_register_bytes (REGISTER_BYTE (R0_REGNUM), valbuf,
+ TYPE_LENGTH (type));
}
static void
write_register_bytes (REGISTER_BYTE (FP0_REGNUM),
valbuf, TYPE_LENGTH (type));
else
- write_register_bytes (REGISTER_BYTE (0),
- valbuf, TYPE_LENGTH (type));
+ sh_default_store_return_value (type, valbuf);
}
if (regnum < 0 || regnum >= NUM_REGS + NUM_PSEUDO_REGS)
internal_error ("Invalid register number %d\n", regnum);
- else if (regnum > 0 && regnum < NUM_REGS)
+ else if (regnum >= 0 && regnum < NUM_REGS)
{
if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT)
sh_do_fp_register (regnum); /* FP regs */
set_gdbarch_fetch_pseudo_register (gdbarch, sh_fetch_pseudo_register);
set_gdbarch_store_pseudo_register (gdbarch, sh_store_pseudo_register);
set_gdbarch_do_registers_info (gdbarch, sh_do_registers_info);
+ set_gdbarch_breakpoint_from_pc (gdbarch, sh_breakpoint_from_pc);
print_sh_insn = gdb_print_insn_sh;
switch (info.bfd_arch_info->mach)
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_decr_pc_after_break (gdbarch, 0);
set_gdbarch_function_start_offset (gdbarch, 0);
- set_gdbarch_breakpoint_from_pc (gdbarch, sh_breakpoint_from_pc);
set_gdbarch_frame_args_skip (gdbarch, 0);
set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue);
set_gdbarch_frame_chain (gdbarch, sh_frame_chain);
set_gdbarch_frame_chain_valid (gdbarch, generic_file_frame_chain_valid);
set_gdbarch_frame_saved_pc (gdbarch, sh_frame_saved_pc);
- set_gdbarch_frame_args_address (gdbarch, sh_frame_args_address);
- set_gdbarch_frame_locals_address (gdbarch, sh_frame_locals_address);
+ set_gdbarch_frame_args_address (gdbarch, default_frame_address);
+ set_gdbarch_frame_locals_address (gdbarch, default_frame_address);
set_gdbarch_saved_pc_after_call (gdbarch, sh_saved_pc_after_call);
set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);