/* Target-dependent code for Hitachi Super-H, for GDB.
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of GDB.
#include "defs.h"
#include "frame.h"
-#include "obstack.h"
#include "symtab.h"
#include "symfile.h"
#include "gdbtypes.h"
#include "gdbcore.h"
#include "value.h"
#include "dis-asm.h"
-#include "inferior.h" /* for BEFORE_TEXT_END etc. */
+#include "inferior.h"
#include "gdb_string.h"
#include "arch-utils.h"
#include "floatformat.h"
#include "regcache.h"
#include "doublest.h"
+#include "osabi.h"
#include "sh-tdep.h"
int f_offset;
};
-static char *
+static const char *
sh_generic_register_name (int reg_nr)
{
static char *register_names[] =
return register_names[reg_nr];
}
-static char *
+static const char *
sh_sh_register_name (int reg_nr)
{
static char *register_names[] =
return register_names[reg_nr];
}
-static char *
+static const char *
sh_sh3_register_name (int reg_nr)
{
static char *register_names[] =
return register_names[reg_nr];
}
-static char *
+static const char *
sh_sh3e_register_name (int reg_nr)
{
static char *register_names[] =
return register_names[reg_nr];
}
-static char *
+static const char *
+sh_sh2e_register_name (int reg_nr)
+{
+ static char *register_names[] =
+ {
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+ "pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
+ "fpul", "fpscr",
+ "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7",
+ "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
+ "", "",
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "",
+ };
+ if (reg_nr < 0)
+ return NULL;
+ if (reg_nr >= (sizeof (register_names) / sizeof (*register_names)))
+ return NULL;
+ return register_names[reg_nr];
+}
+
+static const char *
sh_sh_dsp_register_name (int reg_nr)
{
static char *register_names[] =
return register_names[reg_nr];
}
-static char *
+static const char *
sh_sh3_dsp_register_name (int reg_nr)
{
static char *register_names[] =
return register_names[reg_nr];
}
-static char *
+static const char *
sh_sh4_register_name (int reg_nr)
{
static char *register_names[] =
return register_names[reg_nr];
}
-static char *
+static const char *
sh_sh64_register_name (int reg_nr)
{
static char *register_names[] =
static int
sh_use_struct_convention (int gcc_p, struct type *type)
{
+#if 0
return (TYPE_LENGTH (type) > 1);
+#else
+ int len = TYPE_LENGTH (type);
+ int nelem = TYPE_NFIELDS (type);
+ return ((len != 1 && len != 2 && len != 4 && len != 8) || nelem != 1) &&
+ (len != 8 || TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) != 4);
+#endif
}
static int
static int
gdb_print_insn_sh (bfd_vma memaddr, disassemble_info *info)
{
- if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
- return print_insn_sh (memaddr, info);
- else
- return print_insn_shl (memaddr, info);
+ info->endian = TARGET_BYTE_ORDER;
+ return print_insn_sh (memaddr, info);
}
-/* Disassemble an instruction. */
-static int
-gdb_print_insn_sh64 (bfd_vma memaddr, disassemble_info *info)
-{
- if (pc_is_isa32 (memaddr))
- {
- /* Round down the instruction address to the appropriate boundary
- before disassembling it. */
- return print_insn_sh64x_media (UNMAKE_ISA32_ADDR (memaddr), info);
- }
- else
- {
- if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
- return print_insn_sh (memaddr, info);
- else
- return print_insn_shl (memaddr, info);
- }
-}
-
-/* Given a GDB frame, determine the address of the calling function's frame.
- This will be used to create a new GDB frame struct, and then
- INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame.
+/* Given a GDB frame, determine the address of the calling function's
+ frame. This will be used to create a new GDB frame struct, and
+ then DEPRECATED_INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC
+ will be called for the new frame.
For us, the frame address is its stack pointer value, so we look up
the function prologue to determine the caller's sp value, and return it. */
static CORE_ADDR
sh_frame_chain (struct frame_info *frame)
{
- if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
- return frame->frame; /* dummy frame same as caller's frame */
- if (frame->pc && !inside_entry_file (frame->pc))
- return read_memory_integer (FRAME_FP (frame) + frame->extra_info->f_offset, 4);
+ if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame),
+ get_frame_base (frame),
+ get_frame_base (frame)))
+ return get_frame_base (frame); /* dummy frame same as caller's frame */
+ if (get_frame_pc (frame) && !inside_entry_file (get_frame_pc (frame)))
+ return read_memory_integer (get_frame_base (frame)
+ + get_frame_extra_info (frame)->f_offset, 4);
else
return 0;
}
static CORE_ADDR
sh64_frame_chain (struct frame_info *frame)
{
- if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
- return frame->frame; /* dummy frame same as caller's frame */
- if (frame->pc && !inside_entry_file (frame->pc))
+ if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame),
+ get_frame_base (frame),
+ get_frame_base (frame)))
+ return get_frame_base (frame); /* dummy frame same as caller's frame */
+ if (get_frame_pc (frame) && !inside_entry_file (get_frame_pc (frame)))
{
- int media_mode = pc_is_isa32 (frame->pc);
+ int media_mode = pc_is_isa32 (get_frame_pc (frame));
int size;
if (gdbarch_tdep (current_gdbarch)->sh_abi == SH_ABI_32)
size = 4;
else
- size = REGISTER_RAW_SIZE (translate_insn_rn (FP_REGNUM, media_mode));
- return read_memory_integer (FRAME_FP (frame) + frame->extra_info->f_offset, size);
+ size = REGISTER_RAW_SIZE (translate_insn_rn (DEPRECATED_FP_REGNUM, media_mode));
+ return read_memory_integer (get_frame_base (frame)
+ + get_frame_extra_info (frame)->f_offset,
+ size);
}
else
return 0;
static CORE_ADDR
sh_find_callers_reg (struct frame_info *fi, int regnum)
{
- for (; fi; fi = fi->next)
- if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+ for (; fi; fi = get_next_frame (fi))
+ if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi),
+ get_frame_base (fi)))
/* When the caller requests PR from the dummy frame, we return PC because
that's where the previous routine appears to have done a call from. */
- return generic_read_register_dummy (fi->pc, fi->frame, regnum);
+ return deprecated_read_register_dummy (get_frame_pc (fi),
+ get_frame_base (fi), regnum);
else
{
- FRAME_INIT_SAVED_REGS (fi);
- if (!fi->pc)
+ DEPRECATED_FRAME_INIT_SAVED_REGS (fi);
+ if (!get_frame_pc (fi))
return 0;
- if (fi->saved_regs[regnum] != 0)
- return read_memory_integer (fi->saved_regs[regnum],
+ if (get_frame_saved_regs (fi)[regnum] != 0)
+ return read_memory_integer (get_frame_saved_regs (fi)[regnum],
REGISTER_RAW_SIZE (regnum));
}
return read_register (regnum);
{
int media_mode = 0;
- for (; fi; fi = fi->next)
- if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+ for (; fi; fi = get_next_frame (fi))
+ if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi),
+ get_frame_base (fi)))
/* When the caller requests PR from the dummy frame, we return PC because
that's where the previous routine appears to have done a call from. */
- return generic_read_register_dummy (fi->pc, fi->frame, pr_regnum);
+ return deprecated_read_register_dummy (get_frame_pc (fi),
+ get_frame_base (fi), pr_regnum);
else
{
- FRAME_INIT_SAVED_REGS (fi);
- if (!fi->pc)
+ DEPRECATED_FRAME_INIT_SAVED_REGS (fi);
+ if (!get_frame_pc (fi))
return 0;
- media_mode = pc_is_isa32 (fi->pc);
+ media_mode = pc_is_isa32 (get_frame_pc (fi));
- if (fi->saved_regs[pr_regnum] != 0)
+ if (get_frame_saved_regs (fi)[pr_regnum] != 0)
{
int gdb_reg_num = translate_insn_rn (pr_regnum, media_mode);
int size = ((gdbarch_tdep (current_gdbarch)->sh_abi == SH_ABI_32)
? 4
: REGISTER_RAW_SIZE (gdb_reg_num));
- return read_memory_integer (fi->saved_regs[pr_regnum], size);
+ return read_memory_integer (get_frame_saved_regs (fi)[pr_regnum], size);
}
}
return read_register (pr_regnum);
int opc;
int insn;
int r3_val = 0;
- char *dummy_regs = generic_find_dummy_frame (fi->pc, fi->frame);
+ char *dummy_regs = deprecated_generic_find_dummy_frame (get_frame_pc (fi),
+ get_frame_base (fi));
- if (fi->saved_regs == NULL)
+ if (get_frame_saved_regs (fi) == NULL)
frame_saved_regs_zalloc (fi);
else
- memset (fi->saved_regs, 0, SIZEOF_FRAME_SAVED_REGS);
+ memset (get_frame_saved_regs (fi), 0, SIZEOF_FRAME_SAVED_REGS);
if (dummy_regs)
{
/* DANGER! This is ONLY going to work if the char buffer format of
the saved registers is byte-for-byte identical to the
CORE_ADDR regs[NUM_REGS] format used by struct frame_saved_regs! */
- memcpy (fi->saved_regs, dummy_regs, sizeof (fi->saved_regs));
+ memcpy (get_frame_saved_regs (fi), dummy_regs, SIZEOF_FRAME_SAVED_REGS);
return;
}
- fi->extra_info->leaf_function = 1;
- fi->extra_info->f_offset = 0;
+ get_frame_extra_info (fi)->leaf_function = 1;
+ get_frame_extra_info (fi)->f_offset = 0;
for (rn = 0; rn < NUM_REGS + NUM_PSEUDO_REGS; rn++)
where[rn] = -1;
that does not appear to be part of the prologue. But give up
after 20 of them, since we're getting silly then. */
- pc = get_pc_function_start (fi->pc);
+ pc = get_frame_func (fi);
if (!pc)
{
- fi->pc = 0;
+ deprecated_update_frame_pc_hack (fi, 0);
return;
}
{
where[gdbarch_tdep (current_gdbarch)->PR_REGNUM] = depth;
/* If we're storing the pr then this isn't a leaf */
- fi->extra_info->leaf_function = 0;
+ get_frame_extra_info (fi)->leaf_function = 0;
depth += 4;
}
else if (IS_MOV_R3 (insn))
{
if (where[rn] >= 0)
{
- if (rn == FP_REGNUM)
+ if (rn == DEPRECATED_FP_REGNUM)
have_fp = 1;
- fi->saved_regs[rn] = fi->frame - where[rn] + depth - 4;
+ get_frame_saved_regs (fi)[rn] = get_frame_base (fi) - where[rn] + depth - 4;
}
else
{
- fi->saved_regs[rn] = 0;
+ get_frame_saved_regs (fi)[rn] = 0;
}
}
if (have_fp)
{
- fi->saved_regs[SP_REGNUM] = read_memory_integer (fi->saved_regs[FP_REGNUM], 4);
+ get_frame_saved_regs (fi)[SP_REGNUM] = read_memory_integer (get_frame_saved_regs (fi)[DEPRECATED_FP_REGNUM], 4);
}
else
{
- fi->saved_regs[SP_REGNUM] = fi->frame - 4;
+ get_frame_saved_regs (fi)[SP_REGNUM] = get_frame_base (fi) - 4;
}
- fi->extra_info->f_offset = depth - where[FP_REGNUM] - 4;
+ get_frame_extra_info (fi)->f_offset = depth - where[DEPRECATED_FP_REGNUM] - 4;
/* Work out the return pc - either from the saved pr or the pr
value */
}
int insn_size;
int gdb_register_number;
int register_number;
- char *dummy_regs = generic_find_dummy_frame (fi->pc, fi->frame);
+ char *dummy_regs = deprecated_generic_find_dummy_frame (get_frame_pc (fi), get_frame_base (fi));
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
- if (fi->saved_regs == NULL)
+ if (get_frame_saved_regs (fi) == NULL)
frame_saved_regs_zalloc (fi);
else
- memset (fi->saved_regs, 0, SIZEOF_FRAME_SAVED_REGS);
+ memset (get_frame_saved_regs (fi), 0, SIZEOF_FRAME_SAVED_REGS);
if (dummy_regs)
{
/* DANGER! This is ONLY going to work if the char buffer format of
the saved registers is byte-for-byte identical to the
CORE_ADDR regs[NUM_REGS] format used by struct frame_saved_regs! */
- memcpy (fi->saved_regs, dummy_regs, sizeof (fi->saved_regs));
+ memcpy (get_frame_saved_regs (fi), dummy_regs, SIZEOF_FRAME_SAVED_REGS);
return;
}
- fi->extra_info->leaf_function = 1;
- fi->extra_info->f_offset = 0;
+ get_frame_extra_info (fi)->leaf_function = 1;
+ get_frame_extra_info (fi)->f_offset = 0;
for (rn = 0; rn < NUM_REGS + NUM_PSEUDO_REGS; rn++)
where[rn] = -1;
that does not appear to be part of the prologue. But give up
after 20 of them, since we're getting silly then. */
- pc = get_pc_function_start (fi->pc);
+ pc = get_frame_func (fi);
if (!pc)
{
- fi->pc = 0;
+ deprecated_update_frame_pc_hack (fi, 0);
return;
}
/* The frame pointer register is general register 14 in shmedia and
shcompact modes. In sh compact it is a pseudo register. Same goes
for the stack pointer register, which is register 15. */
- fp_regnum = translate_insn_rn (FP_REGNUM, media_mode);
+ fp_regnum = translate_insn_rn (DEPRECATED_FP_REGNUM, media_mode);
sp_regnum = translate_insn_rn (SP_REGNUM, media_mode);
for (opc = pc + (insn_size * 28); pc < opc; pc += insn_size)
int reg_nr = tdep->PR_C_REGNUM;
where[reg_nr] = depth - ((((next_insn & 0xf) ^ 0x8) - 0x8) << 2);
- fi->extra_info->leaf_function = 0;
+ get_frame_extra_info (fi)->leaf_function = 0;
pc += insn_size;
}
}
int reg_nr = tdep->PR_C_REGNUM;
where[reg_nr] = depth - (r0_val - 4);
r0_val -= 4;
- fi->extra_info->leaf_function = 0;
+ get_frame_extra_info (fi)->leaf_function = 0;
}
else if (IS_MOV_R14_R0 (insn))
{
{
where[tdep->PR_REGNUM] =
depth - (sign_extend ((insn & 0xffc00) >> 10, 9) << 3);
- fi->extra_info->leaf_function = 0;
+ get_frame_extra_info (fi)->leaf_function = 0;
}
else if (IS_STL_R18_R15 (insn))
{
where[tdep->PR_REGNUM] =
depth - (sign_extend ((insn & 0xffc00) >> 10, 9) << 2);
- fi->extra_info->leaf_function = 0;
+ get_frame_extra_info (fi)->leaf_function = 0;
}
else if (IS_STQ_R14_R15 (insn))
/* Watch out! saved_regs is only for the real registers, and
doesn't include space for the pseudo registers. */
- fi->saved_regs[register_number]= fi->frame - where[rn] + depth;
+ get_frame_saved_regs (fi)[register_number]= get_frame_base (fi) - where[rn] + depth;
}
else
- fi->saved_regs[register_number] = 0;
+ get_frame_saved_regs (fi)[register_number] = 0;
}
if (have_fp)
register r15 which still is the SP register. */
/* The place on the stack where fp is stored contains the sp of
the caller. */
- /* Again, saved_registers contains only space for the real registers,
- so we store in FP_REGNUM position. */
+ /* Again, saved_registers contains only space for the real
+ registers, so we store in DEPRECATED_FP_REGNUM position. */
int size;
if (tdep->sh_abi == SH_ABI_32)
size = 4;
else
size = REGISTER_RAW_SIZE (fp_regnum);
- fi->saved_regs[sp_regnum] = read_memory_integer (fi->saved_regs[fp_regnum], size);
+ get_frame_saved_regs (fi)[sp_regnum] = read_memory_integer (get_frame_saved_regs (fi)[fp_regnum], size);
}
else
- fi->saved_regs[sp_regnum] = fi->frame;
+ get_frame_saved_regs (fi)[sp_regnum] = get_frame_base (fi);
- fi->extra_info->f_offset = depth - where[fp_regnum];
+ get_frame_extra_info (fi)->f_offset = depth - where[fp_regnum];
}
static void
int opc;
int insn;
int r3_val = 0;
- char *dummy_regs = generic_find_dummy_frame (fi->pc, fi->frame);
+ char *dummy_regs = deprecated_generic_find_dummy_frame (get_frame_pc (fi), get_frame_base (fi));
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
- if (fi->saved_regs == NULL)
+ if (get_frame_saved_regs (fi) == NULL)
frame_saved_regs_zalloc (fi);
else
- memset (fi->saved_regs, 0, SIZEOF_FRAME_SAVED_REGS);
+ memset (get_frame_saved_regs (fi), 0, SIZEOF_FRAME_SAVED_REGS);
if (dummy_regs)
{
/* DANGER! This is ONLY going to work if the char buffer format of
the saved registers is byte-for-byte identical to the
CORE_ADDR regs[NUM_REGS] format used by struct frame_saved_regs! */
- memcpy (fi->saved_regs, dummy_regs, sizeof (fi->saved_regs));
+ memcpy (get_frame_saved_regs (fi), dummy_regs, SIZEOF_FRAME_SAVED_REGS);
return;
}
- fi->extra_info->leaf_function = 1;
- fi->extra_info->f_offset = 0;
+ get_frame_extra_info (fi)->leaf_function = 1;
+ get_frame_extra_info (fi)->f_offset = 0;
for (rn = 0; rn < NUM_REGS + NUM_PSEUDO_REGS; rn++)
where[rn] = -1;
that does not appear to be part of the prologue. But give up
after 20 of them, since we're getting silly then. */
- pc = get_pc_function_start (fi->pc);
+ pc = get_frame_func (fi);
if (!pc)
{
- fi->pc = 0;
+ deprecated_update_frame_pc_hack (fi, 0);
return;
}
{
where[tdep->PR_REGNUM] = depth;
/* If we're storing the pr then this isn't a leaf */
- fi->extra_info->leaf_function = 0;
+ get_frame_extra_info (fi)->leaf_function = 0;
depth += 4;
}
else if (IS_MOV_R3 (insn))
{
if (where[rn] >= 0)
{
- if (rn == FP_REGNUM)
+ if (rn == DEPRECATED_FP_REGNUM)
have_fp = 1;
- fi->saved_regs[rn] = fi->frame - where[rn] + depth - 4;
+ get_frame_saved_regs (fi)[rn] = get_frame_base (fi) - where[rn] + depth - 4;
}
else
{
- fi->saved_regs[rn] = 0;
+ get_frame_saved_regs (fi)[rn] = 0;
}
}
if (have_fp)
{
- fi->saved_regs[SP_REGNUM] =
- read_memory_integer (fi->saved_regs[FP_REGNUM], 4);
+ get_frame_saved_regs (fi)[SP_REGNUM] =
+ read_memory_integer (get_frame_saved_regs (fi)[DEPRECATED_FP_REGNUM], 4);
}
else
{
- fi->saved_regs[SP_REGNUM] = fi->frame - 4;
+ get_frame_saved_regs (fi)[SP_REGNUM] = get_frame_base (fi) - 4;
}
- fi->extra_info->f_offset = depth - where[FP_REGNUM] - 4;
+ get_frame_extra_info (fi)->f_offset = depth - where[DEPRECATED_FP_REGNUM] - 4;
/* Work out the return pc - either from the saved pr or the pr
value */
}
sh_init_extra_frame_info (int fromleaf, struct frame_info *fi)
{
- fi->extra_info = (struct frame_extra_info *)
- frame_obstack_alloc (sizeof (struct frame_extra_info));
+ frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info));
- if (fi->next)
- fi->pc = FRAME_SAVED_PC (fi->next);
+ if (get_next_frame (fi))
+ deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi)));
- if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+ if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi),
+ get_frame_base (fi)))
{
- /* We need to setup fi->frame here because run_stack_dummy gets it wrong
- by assuming it's always FP. */
- fi->frame = generic_read_register_dummy (fi->pc, fi->frame,
- SP_REGNUM);
- fi->extra_info->return_pc = generic_read_register_dummy (fi->pc,
- fi->frame,
- PC_REGNUM);
- fi->extra_info->f_offset = -(CALL_DUMMY_LENGTH + 4);
- fi->extra_info->leaf_function = 0;
+ /* We need to setup fi->frame here because call_function_by_hand
+ gets it wrong by assuming it's always FP. */
+ deprecated_update_frame_base_hack (fi, deprecated_read_register_dummy (get_frame_pc (fi), get_frame_base (fi),
+ SP_REGNUM));
+ get_frame_extra_info (fi)->return_pc = deprecated_read_register_dummy (get_frame_pc (fi),
+ get_frame_base (fi),
+ PC_REGNUM);
+ get_frame_extra_info (fi)->f_offset = -(DEPRECATED_CALL_DUMMY_LENGTH + 4);
+ get_frame_extra_info (fi)->leaf_function = 0;
return;
}
else
{
- FRAME_INIT_SAVED_REGS (fi);
- fi->extra_info->return_pc =
+ DEPRECATED_FRAME_INIT_SAVED_REGS (fi);
+ get_frame_extra_info (fi)->return_pc =
sh_find_callers_reg (fi, gdbarch_tdep (current_gdbarch)->PR_REGNUM);
}
}
static void
sh64_init_extra_frame_info (int fromleaf, struct frame_info *fi)
{
- int media_mode = pc_is_isa32 (fi->pc);
+ int media_mode = pc_is_isa32 (get_frame_pc (fi));
- fi->extra_info = (struct frame_extra_info *)
- frame_obstack_alloc (sizeof (struct frame_extra_info));
+ frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info));
- if (fi->next)
- fi->pc = FRAME_SAVED_PC (fi->next);
+ if (get_next_frame (fi))
+ deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi)));
- if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+ if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi),
+ get_frame_base (fi)))
{
- /* We need to setup fi->frame here because run_stack_dummy gets it wrong
- by assuming it's always FP. */
- fi->frame = generic_read_register_dummy (fi->pc, fi->frame,
- SP_REGNUM);
- fi->extra_info->return_pc =
- generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM);
- fi->extra_info->f_offset = -(CALL_DUMMY_LENGTH + 4);
- fi->extra_info->leaf_function = 0;
+ /* We need to setup fi->frame here because call_function_by_hand
+ gets it wrong by assuming it's always FP. */
+ deprecated_update_frame_base_hack (fi, deprecated_read_register_dummy (get_frame_pc (fi), get_frame_base (fi), SP_REGNUM));
+ get_frame_extra_info (fi)->return_pc =
+ deprecated_read_register_dummy (get_frame_pc (fi),
+ get_frame_base (fi), PC_REGNUM);
+ get_frame_extra_info (fi)->f_offset = -(DEPRECATED_CALL_DUMMY_LENGTH + 4);
+ get_frame_extra_info (fi)->leaf_function = 0;
return;
}
else
{
- FRAME_INIT_SAVED_REGS (fi);
- fi->extra_info->return_pc =
+ DEPRECATED_FRAME_INIT_SAVED_REGS (fi);
+ get_frame_extra_info (fi)->return_pc =
sh64_get_saved_pr (fi, gdbarch_tdep (current_gdbarch)->PR_REGNUM);
}
}
but we are in compact mode, it will become the corresponding
compact pseudo register. If there is no corresponding compact
pseudo-register what do we do?*/
- media_mode = pc_is_isa32 (frame->pc);
+ media_mode = pc_is_isa32 (get_frame_pc (frame));
live_regnum = translate_insn_rn (regnum, media_mode);
/* Note: since the current frame's registers could only have been
the current frame itself: otherwise, we would be getting the
previous frame's registers which were saved by the current frame. */
- while (frame && ((frame = frame->next) != NULL))
+ while (frame && ((frame = get_next_frame (frame)) != NULL))
{
- if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
+ if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame),
+ get_frame_base (frame),
+ get_frame_base (frame)))
{
if (lval) /* found it in a CALL_DUMMY frame */
*lval = not_lval;
if (raw_buffer)
memcpy (raw_buffer,
- generic_find_dummy_frame (frame->pc, frame->frame) +
- REGISTER_BYTE (regnum),
+ (deprecated_generic_find_dummy_frame (get_frame_pc (frame), get_frame_base (frame))
+ + REGISTER_BYTE (regnum)),
REGISTER_RAW_SIZE (regnum));
return;
}
- FRAME_INIT_SAVED_REGS (frame);
- if (frame->saved_regs != NULL
- && frame->saved_regs[regnum] != 0)
+ DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
+ if (get_frame_saved_regs (frame) != NULL
+ && get_frame_saved_regs (frame)[regnum] != 0)
{
if (lval) /* found it saved on the stack */
*lval = lval_memory;
{
if (raw_buffer) /* SP register treated specially */
store_address (raw_buffer, REGISTER_RAW_SIZE (regnum),
- frame->saved_regs[regnum]);
+ get_frame_saved_regs (frame)[regnum]);
}
else
{ /* any other register */
if (addrp)
- *addrp = frame->saved_regs[regnum];
+ *addrp = get_frame_saved_regs (frame)[regnum];
if (raw_buffer)
{
int size;
if (tdep->sh_abi == SH_ABI_32
- && (live_regnum == FP_REGNUM
+ && (live_regnum == DEPRECATED_FP_REGNUM
|| live_regnum == tdep->PR_REGNUM))
size = 4;
else
size = REGISTER_RAW_SIZE (live_regnum);
if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE)
- read_memory (frame->saved_regs[regnum], raw_buffer, size);
+ read_memory (get_frame_saved_regs (frame)[regnum], raw_buffer, size);
else
- read_memory (frame->saved_regs[regnum],
+ read_memory (get_frame_saved_regs (frame)[regnum],
raw_buffer
+ REGISTER_RAW_SIZE (live_regnum)
- size,
if (addrp)
*addrp = REGISTER_BYTE (live_regnum);
if (raw_buffer)
- read_register_gen (live_regnum, raw_buffer);
+ deprecated_read_register_gen (live_regnum, raw_buffer);
}
/* Extract from an array REGBUF containing the (raw) register state
static CORE_ADDR
sh_frame_saved_pc (struct frame_info *frame)
{
- return ((frame)->extra_info->return_pc);
+ return (get_frame_extra_info (frame)->return_pc);
}
/* Discard from the stack the innermost frame,
register CORE_ADDR fp;
register int regnum;
- if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
+ if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame),
+ get_frame_base (frame),
+ get_frame_base (frame)))
generic_pop_dummy_frame ();
else
{
- fp = FRAME_FP (frame);
- FRAME_INIT_SAVED_REGS (frame);
+ fp = get_frame_base (frame);
+ DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
/* Copy regs from where they were saved in the frame */
for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++)
- if (frame->saved_regs[regnum])
+ if (get_frame_saved_regs (frame)[regnum])
write_register (regnum,
- read_memory_integer (frame->saved_regs[regnum], 4));
+ read_memory_integer (get_frame_saved_regs (frame)[regnum], 4));
- write_register (PC_REGNUM, frame->extra_info->return_pc);
+ write_register (PC_REGNUM, get_frame_extra_info (frame)->return_pc);
write_register (SP_REGNUM, fp + 4);
}
flush_cached_frames ();
register int regnum;
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
- int media_mode = pc_is_isa32 (frame->pc);
+ int media_mode = pc_is_isa32 (get_frame_pc (frame));
- if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
+ if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame),
+ get_frame_base (frame),
+ get_frame_base (frame)))
generic_pop_dummy_frame ();
else
{
- fp = FRAME_FP (frame);
- FRAME_INIT_SAVED_REGS (frame);
+ fp = get_frame_base (frame);
+ DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
/* Copy regs from where they were saved in the frame */
for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++)
- if (frame->saved_regs[regnum])
+ if (get_frame_saved_regs (frame)[regnum])
{
int size;
if (tdep->sh_abi == SH_ABI_32
- && (regnum == FP_REGNUM
+ && (regnum == DEPRECATED_FP_REGNUM
|| regnum == tdep->PR_REGNUM))
size = 4;
else
size = REGISTER_RAW_SIZE (translate_insn_rn (regnum,
media_mode));
write_register (regnum,
- read_memory_integer (frame->saved_regs[regnum],
+ read_memory_integer (get_frame_saved_regs (frame)[regnum],
size));
}
- write_register (PC_REGNUM, frame->extra_info->return_pc);
+ write_register (PC_REGNUM, get_frame_extra_info (frame)->return_pc);
write_register (SP_REGNUM, fp + 8);
}
flush_cached_frames ();
if (len < 4)
{
/* value gets right-justified in the register or stack word */
- memcpy (valbuf + (4 - len),
- (char *) VALUE_CONTENTS (args[argnum]), len);
+ if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+ memcpy (valbuf + (4 - len),
+ (char *) VALUE_CONTENTS (args[argnum]), len);
+ else
+ memcpy (valbuf, (char *) VALUE_CONTENTS (args[argnum]), len);
val = valbuf;
}
else
if (float_arg_index <= tdep->FLOAT_ARGLAST_REGNUM)
{
/* Goes in FR0...FR11 */
- write_register_gen (FP0_REGNUM + float_arg_index, val);
+ deprecated_write_register_gen (FP0_REGNUM + float_arg_index,
+ val);
fp_args[float_arg_index] = 1;
/* Skip the corresponding general argument register. */
int_argreg ++;
}
#endif
/* Note: must use write_register_gen here instead
- of regcache_write, because regcache_write works
- only for real registers, not pseudo.
- write_register_gen will call the gdbarch
- function to do register writes, and that will
- properly know how to deal with pseudoregs. */
- write_register_gen (regnum, val);
+ of regcache_raw_write, because
+ regcache_raw_write works only for real
+ registers, not pseudo. write_register_gen will
+ call the gdbarch function to do register
+ writes, and that will properly know how to deal
+ with pseudoregs. */
+ deprecated_write_register_gen (regnum, val);
fp_args[double_arg_index] = 1;
fp_args[double_arg_index + 1] = 1;
/* Skip the corresponding general argument register. */
}
#endif
-static int
-sh_coerce_float_to_double (struct type *formal, struct type *actual)
-{
- return 1;
-}
-
/* Find a function's return value in the appropriate registers (in
regbuf), and copy it into valbuf. Extract from an array REGBUF
containing the (raw) register state a function return value of type
floatformat_to_doublest (&floatformat_ieee_double_big,
(char *) regbuf + REGISTER_BYTE (return_register),
&val);
- store_floating (valbuf, len, val);
+ deprecated_store_floating (valbuf, len, val);
}
else if (len <= 4)
{
else
floatformat_to_doublest (&floatformat_ieee_double_big,
(char *) regbuf + offset, &val);
- store_floating (valbuf, len, val);
+ deprecated_store_floating (valbuf, len, val);
}
}
else
{
/* 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));
+ if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+ memcpy (buf + REGISTER_RAW_SIZE (R0_REGNUM) - TYPE_LENGTH (type),
+ valbuf, TYPE_LENGTH (type));
+ else
+ memcpy (buf, valbuf, TYPE_LENGTH (type));
+ deprecated_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));
+ deprecated_write_register_bytes (REGISTER_BYTE (R0_REGNUM), valbuf,
+ TYPE_LENGTH (type));
}
static void
sh3e_sh4_store_return_value (struct type *type, char *valbuf)
{
if (TYPE_CODE (type) == TYPE_CODE_FLT)
- write_register_bytes (REGISTER_BYTE (FP0_REGNUM),
- valbuf, TYPE_LENGTH (type));
+ deprecated_write_register_bytes (REGISTER_BYTE (FP0_REGNUM),
+ valbuf, TYPE_LENGTH (type));
else
sh_default_store_return_value (type, valbuf);
}
if (len == 4)
{
/* Return value stored in FP0_REGNUM */
- write_register_gen (FP0_REGNUM, valbuf);
+ deprecated_write_register_gen (FP0_REGNUM, valbuf);
}
if (len == 8)
{
offset = REGISTER_RAW_SIZE (return_register) - len;
memcpy (buf + offset, valbuf, len);
- write_register_gen (return_register, buf);
+ deprecated_write_register_gen (return_register, buf);
}
else
- write_register_gen (return_register, valbuf);
+ deprecated_write_register_gen (return_register, valbuf);
}
}
}
+static void
+sh2e_show_regs (void)
+{
+ printf_filtered ("PC=%s SR=%08lx PR=%08lx MACH=%08lx MACHL=%08lx\n",
+ paddr (read_register (PC_REGNUM)),
+ (long) read_register (SR_REGNUM),
+ (long) read_register (PR_REGNUM),
+ (long) read_register (MACH_REGNUM),
+ (long) read_register (MACL_REGNUM));
+
+ printf_filtered ("GBR=%08lx VBR=%08lx",
+ (long) read_register (GBR_REGNUM),
+ (long) read_register (VBR_REGNUM));
+ printf_filtered (" FPUL=%08lx FPSCR=%08lx",
+ (long) read_register (gdbarch_tdep (current_gdbarch)->FPUL_REGNUM),
+ (long) read_register (gdbarch_tdep (current_gdbarch)->FPSCR_REGNUM));
+
+ printf_filtered ("\nR0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
+ (long) read_register (0),
+ (long) read_register (1),
+ (long) read_register (2),
+ (long) read_register (3),
+ (long) read_register (4),
+ (long) read_register (5),
+ (long) read_register (6),
+ (long) read_register (7));
+ printf_filtered ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
+ (long) read_register (8),
+ (long) read_register (9),
+ (long) read_register (10),
+ (long) read_register (11),
+ (long) read_register (12),
+ (long) read_register (13),
+ (long) read_register (14),
+ (long) read_register (15));
+
+ printf_filtered (("FP0-FP7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n"),
+ (long) read_register (FP0_REGNUM + 0),
+ (long) read_register (FP0_REGNUM + 1),
+ (long) read_register (FP0_REGNUM + 2),
+ (long) read_register (FP0_REGNUM + 3),
+ (long) read_register (FP0_REGNUM + 4),
+ (long) read_register (FP0_REGNUM + 5),
+ (long) read_register (FP0_REGNUM + 6),
+ (long) read_register (FP0_REGNUM + 7));
+ printf_filtered (("FP8-FP15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n"),
+ (long) read_register (FP0_REGNUM + 8),
+ (long) read_register (FP0_REGNUM + 9),
+ (long) read_register (FP0_REGNUM + 10),
+ (long) read_register (FP0_REGNUM + 11),
+ (long) read_register (FP0_REGNUM + 12),
+ (long) read_register (FP0_REGNUM + 13),
+ (long) read_register (FP0_REGNUM + 14),
+ (long) read_register (FP0_REGNUM + 15));
+}
+
static void
sh3e_show_regs (void)
{
static void
sh64_show_regs (void)
{
- if (pc_is_isa32 (selected_frame->pc))
+ if (pc_is_isa32 (get_frame_pc (deprecated_selected_frame)))
sh64_show_media_regs ();
else
sh64_show_compact_regs ();
{
DOUBLEST val;
floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword, from, &val);
- store_floating (to, TYPE_LENGTH (type), val);
+ deprecated_store_floating (to, TYPE_LENGTH (type), val);
}
else
error ("sh_register_convert_to_virtual called with non DR register number");
{
DOUBLEST val;
floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword, from, &val);
- store_floating(to, TYPE_LENGTH(type), val);
+ deprecated_store_floating(to, TYPE_LENGTH(type), val);
}
else
error("sh_register_convert_to_virtual called with non DR register number");
static void
sh_sh4_register_convert_to_raw (struct type *type, int regnum,
- char *from, char *to)
+ const void *from, void *to)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
if (regnum >= tdep->DR0_REGNUM
&& regnum <= tdep->DR_LAST_REGNUM)
{
- DOUBLEST val = extract_floating (from, TYPE_LENGTH(type));
+ DOUBLEST val = deprecated_extract_floating (from, TYPE_LENGTH(type));
floatformat_from_doublest (&floatformat_ieee_double_littlebyte_bigword, &val, to);
}
else
void
sh_sh64_register_convert_to_raw (struct type *type, int regnum,
- char *from, char *to)
+ const void *from, void *to)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
|| (regnum >= tdep->DR0_C_REGNUM
&& regnum <= tdep->DR_LAST_C_REGNUM))
{
- DOUBLEST val = extract_floating (from, TYPE_LENGTH(type));
+ DOUBLEST val = deprecated_extract_floating (from, TYPE_LENGTH(type));
floatformat_from_doublest (&floatformat_ieee_double_littlebyte_bigword, &val, to);
}
else
}
void
-sh_pseudo_register_read (int reg_nr, char *buffer)
+sh_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+ int reg_nr, void *buffer)
{
int base_regnum, portion;
- char *temp_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ char temp_buffer[MAX_REGISTER_SIZE];
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (reg_nr >= tdep->DR0_REGNUM
&& reg_nr <= tdep->DR_LAST_REGNUM)
/* Build the value in the provided buffer. */
/* Read the real regs for which this one is an alias. */
for (portion = 0; portion < 2; portion++)
- regcache_read (base_regnum + portion,
- temp_buffer
- + REGISTER_RAW_SIZE (base_regnum) * portion);
+ regcache_raw_read (regcache, base_regnum + portion,
+ (temp_buffer
+ + REGISTER_RAW_SIZE (base_regnum) * portion));
/* We must pay attention to the endiannes. */
sh_sh4_register_convert_to_virtual (reg_nr,
REGISTER_VIRTUAL_TYPE (reg_nr),
/* Read the real regs for which this one is an alias. */
for (portion = 0; portion < 4; portion++)
- regcache_read (base_regnum + portion,
- buffer + REGISTER_RAW_SIZE (base_regnum) * portion);
+ regcache_raw_read (regcache, base_regnum + portion,
+ ((char *) buffer
+ + REGISTER_RAW_SIZE (base_regnum) * portion));
}
}
static void
-sh4_register_read (struct gdbarch *gdbarch, int reg_nr, char *buffer)
-{
- if (reg_nr >= 0 && reg_nr < gdbarch_tdep (current_gdbarch)->DR0_REGNUM)
- /* It is a regular register. */
- regcache_read (reg_nr, buffer);
- else
- /* It is a pseudo register and we need to construct its value */
- sh_pseudo_register_read (reg_nr, buffer);
-}
-
-static void
-sh64_pseudo_register_read (int reg_nr, char *buffer)
+sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+ int reg_nr, void *buffer)
{
int base_regnum;
int portion;
int offset = 0;
- char *temp_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ char temp_buffer[MAX_REGISTER_SIZE];
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (reg_nr >= tdep->DR0_REGNUM
&& reg_nr <= tdep->DR_LAST_REGNUM)
/* DR regs are double precision registers obtained by
concatenating 2 single precision floating point registers. */
for (portion = 0; portion < 2; portion++)
- regcache_read (base_regnum + portion,
- temp_buffer
- + REGISTER_RAW_SIZE (base_regnum) * portion);
+ regcache_raw_read (regcache, base_regnum + portion,
+ (temp_buffer
+ + REGISTER_RAW_SIZE (base_regnum) * portion));
/* We must pay attention to the endiannes. */
sh_sh64_register_convert_to_virtual (reg_nr, REGISTER_VIRTUAL_TYPE (reg_nr),
/* FPP regs are pairs of single precision registers obtained by
concatenating 2 single precision floating point registers. */
for (portion = 0; portion < 2; portion++)
- regcache_read (base_regnum + portion,
- buffer + REGISTER_RAW_SIZE (base_regnum) * portion);
+ regcache_raw_read (regcache, base_regnum + portion,
+ ((char *) buffer
+ + REGISTER_RAW_SIZE (base_regnum) * portion));
}
else if (reg_nr >= tdep->FV0_REGNUM
/* FV regs are vectors of single precision registers obtained by
concatenating 4 single precision floating point registers. */
for (portion = 0; portion < 4; portion++)
- regcache_read (base_regnum + portion,
- buffer + REGISTER_RAW_SIZE (base_regnum) * portion);
+ regcache_raw_read (regcache, base_regnum + portion,
+ ((char *) buffer
+ + REGISTER_RAW_SIZE (base_regnum) * portion));
}
/* sh compact pseudo registers. 1-to-1 with a shmedia register */
base_regnum = sh64_compact_reg_base_num (reg_nr);
/* Build the value in the provided buffer. */
- regcache_read (base_regnum, temp_buffer);
+ regcache_raw_read (regcache, base_regnum, temp_buffer);
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
offset = 4;
memcpy (buffer, temp_buffer + offset, 4); /* get LOWER 32 bits only????*/
/* Build the value in the provided buffer. */
/* Floating point registers map 1-1 to the media fp regs,
they have the same size and endienness. */
- regcache_read (base_regnum, buffer);
+ regcache_raw_read (regcache, base_regnum, buffer);
}
else if (reg_nr >= tdep->DR0_C_REGNUM
/* DR_C regs are double precision registers obtained by
concatenating 2 single precision floating point registers. */
for (portion = 0; portion < 2; portion++)
- regcache_read (base_regnum + portion,
- temp_buffer
- + REGISTER_RAW_SIZE (base_regnum) * portion);
+ regcache_raw_read (regcache, base_regnum + portion,
+ (temp_buffer
+ + REGISTER_RAW_SIZE (base_regnum) * portion));
/* We must pay attention to the endiannes. */
sh_sh64_register_convert_to_virtual (reg_nr, REGISTER_VIRTUAL_TYPE (reg_nr),
/* FV_C regs are vectors of single precision registers obtained by
concatenating 4 single precision floating point registers. */
for (portion = 0; portion < 4; portion++)
- regcache_read (base_regnum + portion,
- buffer + REGISTER_RAW_SIZE (base_regnum) * portion);
+ regcache_raw_read (regcache, base_regnum + portion,
+ ((char *) buffer
+ + REGISTER_RAW_SIZE (base_regnum) * portion));
}
else if (reg_nr == tdep->FPSCR_C_REGNUM)
*/
/* *INDENT-ON* */
/* Get FPSCR into a local buffer */
- regcache_read (fpscr_base_regnum, temp_buffer);
+ regcache_raw_read (regcache, fpscr_base_regnum, temp_buffer);
/* Get value as an int. */
fpscr_value = extract_unsigned_integer (temp_buffer, 4);
/* Get SR into a local buffer */
- regcache_read (sr_base_regnum, temp_buffer);
+ regcache_raw_read (regcache, sr_base_regnum, temp_buffer);
/* Get value as an int. */
sr_value = extract_unsigned_integer (temp_buffer, 4);
/* Build the new value. */
/* FPUL_C register is floating point register 32,
same size, same endianness. */
- regcache_read (base_regnum, buffer);
+ regcache_raw_read (regcache, base_regnum, buffer);
}
}
-static void
-sh64_register_read (struct gdbarch *gdbarch, int reg_nr, char *buffer)
-{
-
- if (reg_nr >= 0 && reg_nr < gdbarch_tdep (current_gdbarch)->DR0_REGNUM)
- /* It is a regular register. */
- regcache_read (reg_nr, buffer);
- else
- /* It is a pseudo register and we need to construct its value */
- sh64_pseudo_register_read (reg_nr, buffer);
-}
-
void
-sh_pseudo_register_write (int reg_nr, char *buffer)
+sh_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
+ int reg_nr, const void *buffer)
{
int base_regnum, portion;
- char *temp_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ char temp_buffer[MAX_REGISTER_SIZE];
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (reg_nr >= tdep->DR0_REGNUM
&& reg_nr <= tdep->DR_LAST_REGNUM)
/* Write the real regs for which this one is an alias. */
for (portion = 0; portion < 2; portion++)
- regcache_write (base_regnum + portion,
- temp_buffer + REGISTER_RAW_SIZE (base_regnum) * portion);
+ regcache_raw_write (regcache, base_regnum + portion,
+ (temp_buffer
+ + REGISTER_RAW_SIZE (base_regnum) * portion));
}
else if (reg_nr >= tdep->FV0_REGNUM
&& reg_nr <= tdep->FV_LAST_REGNUM)
/* Write the real regs for which this one is an alias. */
for (portion = 0; portion < 4; portion++)
- regcache_write (base_regnum + portion,
- buffer + REGISTER_RAW_SIZE (base_regnum) * portion);
+ regcache_raw_write (regcache, base_regnum + portion,
+ ((char *) buffer
+ + REGISTER_RAW_SIZE (base_regnum) * portion));
}
}
-static void
-sh4_register_write (struct gdbarch *gdbarch, int reg_nr, char *buffer)
-{
- if (reg_nr >= 0 && reg_nr < gdbarch_tdep (current_gdbarch)->DR0_REGNUM)
- /* It is a regular register. */
- regcache_write (reg_nr, buffer);
- else
- /* It is a pseudo register and we need to construct its value */
- sh_pseudo_register_write (reg_nr, buffer);
-}
-
void
-sh64_pseudo_register_write (int reg_nr, char *buffer)
+sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
+ int reg_nr, const void *buffer)
{
int base_regnum, portion;
int offset;
- char *temp_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ char temp_buffer[MAX_REGISTER_SIZE];
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (reg_nr >= tdep->DR0_REGNUM
&& reg_nr <= tdep->DR_LAST_REGNUM)
/* Write the real regs for which this one is an alias. */
for (portion = 0; portion < 2; portion++)
- regcache_write (base_regnum + portion,
- temp_buffer + REGISTER_RAW_SIZE (base_regnum) * portion);
+ regcache_raw_write (regcache, base_regnum + portion,
+ (temp_buffer
+ + REGISTER_RAW_SIZE (base_regnum) * portion));
}
else if (reg_nr >= tdep->FPP0_REGNUM
/* Write the real regs for which this one is an alias. */
for (portion = 0; portion < 2; portion++)
- regcache_write (base_regnum + portion,
- buffer + REGISTER_RAW_SIZE (base_regnum) * portion);
+ regcache_raw_write (regcache, base_regnum + portion,
+ ((char *) buffer
+ + REGISTER_RAW_SIZE (base_regnum) * portion));
}
else if (reg_nr >= tdep->FV0_REGNUM
/* Write the real regs for which this one is an alias. */
for (portion = 0; portion < 4; portion++)
- regcache_write (base_regnum + portion,
- buffer + REGISTER_RAW_SIZE (base_regnum) * portion);
+ regcache_raw_write (regcache, base_regnum + portion,
+ ((char *) buffer
+ + REGISTER_RAW_SIZE (base_regnum) * portion));
}
/* sh compact general pseudo registers. 1-to-1 with a shmedia
/* Let's read the value of the base register into a temporary
buffer, so that overwriting the last four bytes with the new
value of the pseudo will leave the upper 4 bytes unchanged. */
- regcache_read (base_regnum, temp_buffer);
+ regcache_raw_read (regcache, base_regnum, temp_buffer);
/* Write as an 8 byte quantity */
memcpy (temp_buffer + offset, buffer, 4);
- regcache_write (base_regnum, temp_buffer);
+ regcache_raw_write (regcache, base_regnum, temp_buffer);
}
/* sh floating point compact pseudo registers. 1-to-1 with a shmedia
&& reg_nr <= tdep->FP_LAST_C_REGNUM)
{
base_regnum = sh64_compact_reg_base_num (reg_nr);
- regcache_write (base_regnum, buffer);
+ regcache_raw_write (regcache, base_regnum, buffer);
}
else if (reg_nr >= tdep->DR0_C_REGNUM
sh_sh64_register_convert_to_raw (REGISTER_VIRTUAL_TYPE (reg_nr), reg_nr,
buffer, temp_buffer);
- regcache_write (base_regnum + portion,
- temp_buffer + REGISTER_RAW_SIZE (base_regnum) * portion);
+ regcache_raw_write (regcache, base_regnum + portion,
+ (temp_buffer
+ + REGISTER_RAW_SIZE (base_regnum) * portion));
}
}
for (portion = 0; portion < 4; portion++)
{
- regcache_write (base_regnum + portion,
- buffer + REGISTER_RAW_SIZE (base_regnum) * portion);
+ regcache_raw_write (regcache, base_regnum + portion,
+ ((char *) buffer
+ + REGISTER_RAW_SIZE (base_regnum) * portion));
}
}
fpscr_value = fpscr_c_value & fpscr_mask;
sr_value = (fpscr_value & sr_mask) >> 6;
- regcache_read (fpscr_base_regnum, temp_buffer);
+ regcache_raw_read (regcache, fpscr_base_regnum, temp_buffer);
old_fpscr_value = extract_unsigned_integer (temp_buffer, 4);
old_fpscr_value &= 0xfffc0002;
fpscr_value |= old_fpscr_value;
store_unsigned_integer (temp_buffer, 4, fpscr_value);
- regcache_write (fpscr_base_regnum, temp_buffer);
+ regcache_raw_write (regcache, fpscr_base_regnum, temp_buffer);
- regcache_read (sr_base_regnum, temp_buffer);
+ regcache_raw_read (regcache, sr_base_regnum, temp_buffer);
old_sr_value = extract_unsigned_integer (temp_buffer, 4);
old_sr_value &= 0xffff8fff;
sr_value |= old_sr_value;
store_unsigned_integer (temp_buffer, 4, sr_value);
- regcache_write (sr_base_regnum, temp_buffer);
+ regcache_raw_write (regcache, sr_base_regnum, temp_buffer);
}
else if (reg_nr == tdep->FPUL_C_REGNUM)
{
base_regnum = sh64_compact_reg_base_num (reg_nr);
- regcache_write (base_regnum, buffer);
+ regcache_raw_write (regcache, base_regnum, buffer);
}
}
-static void
-sh64_register_write (struct gdbarch *gdbarch, int reg_nr, char *buffer)
-{
- if (reg_nr >= 0 && reg_nr < gdbarch_tdep (current_gdbarch)->DR0_REGNUM)
- /* It is a regular register. */
- regcache_write (reg_nr, buffer);
- else
- /* It is a pseudo register and we need to construct its value */
- sh64_pseudo_register_write (reg_nr, buffer);
-}
-
/* Floating point vector of 4 float registers. */
static void
do_fv_register_info (int fv_regnum)
raw_buffer = (char *) alloca (REGISTER_RAW_SIZE (FP0_REGNUM));
/* Get the data in raw format. */
- if (!frame_register_read (selected_frame, regnum, raw_buffer))
+ if (!frame_register_read (deprecated_selected_frame, regnum, raw_buffer))
error ("can't read register %d (%s)", regnum, REGISTER_NAME (regnum));
/* Get the register as a number */
static void
sh_do_register (int regnum)
{
- char raw_buffer[MAX_REGISTER_RAW_SIZE];
+ char *raw_buffer = alloca (max_register_size (current_gdbarch));
fputs_filtered (REGISTER_NAME (regnum), gdb_stdout);
print_spaces_filtered (15 - strlen (REGISTER_NAME (regnum)), gdb_stdout);
/* Get the data in raw format. */
- if (!frame_register_read (selected_frame, regnum, raw_buffer))
+ if (!frame_register_read (deprecated_selected_frame, regnum, raw_buffer))
printf_filtered ("*value not available*\n");
val_print (REGISTER_VIRTUAL_TYPE (regnum), raw_buffer, 0, 0,
void
sh64_do_registers_info (int regnum, int fpregs)
{
- if (pc_is_isa32 (selected_frame->pc))
+ if (pc_is_isa32 (get_frame_pc (deprecated_selected_frame)))
sh_do_registers_info (regnum, fpregs);
else
sh_compact_do_registers_info (regnum, fpregs);
#endif /* SVR4_SHARED_LIBS */
\f
-/* This table matches the indices assigned to enum sh_osabi. Keep
- them in sync. */
-static const char * const sh_osabi_names[] =
+enum
{
- "<unknown>",
- "GNU/Linux",
- "NetBSD ELF",
- NULL
+ DSP_DSR_REGNUM = 24,
+ DSP_A0G_REGNUM,
+ DSP_A0_REGNUM,
+ DSP_A1G_REGNUM,
+ DSP_A1_REGNUM,
+ DSP_M0_REGNUM,
+ DSP_M1_REGNUM,
+ DSP_X0_REGNUM,
+ DSP_X1_REGNUM,
+ DSP_Y0_REGNUM,
+ DSP_Y1_REGNUM,
+
+ DSP_MOD_REGNUM = 40,
+
+ DSP_RS_REGNUM = 43,
+ DSP_RE_REGNUM,
+
+ DSP_R0_BANK_REGNUM = 51,
+ DSP_R7_BANK_REGNUM = DSP_R0_BANK_REGNUM + 7
};
-static void
-process_note_abi_tag_sections (bfd *abfd, asection *sect, void *obj)
-{
- enum sh_osabi *os_ident_ptr = obj;
- const char *name;
- unsigned int sectsize;
-
- name = bfd_get_section_name (abfd, sect);
- sectsize = bfd_section_size (abfd, sect);
-
- if (strcmp (name, ".note.ABI-tag") == 0 && sectsize > 0)
- {
- unsigned int name_length, data_length, note_type;
- char *note;
-
- /* If the section is larger than this, it's probably not what we are
- looking for. */
- if (sectsize > 128)
- sectsize = 128;
-
- note = alloca (sectsize);
-
- bfd_get_section_contents (abfd, sect, note,
- (file_ptr) 0, (bfd_size_type) sectsize);
-
- name_length = bfd_h_get_32 (abfd, note);
- data_length = bfd_h_get_32 (abfd, note + 4);
- note_type = bfd_h_get_32 (abfd, note + 8);
-
- if (name_length == 4 && data_length == 16 && note_type == NT_GNU_ABI_TAG
- && strcmp (note + 12, "GNU") == 0)
- {
- int os_number = bfd_h_get_32 (abfd, note + 16);
-
- /* The case numbers are from abi-tags in glibc. */
- switch (os_number)
- {
- case GNU_ABI_TAG_LINUX:
- *os_ident_ptr = SH_OSABI_LINUX;
- break;
-
- case GNU_ABI_TAG_HURD:
- internal_error
- (__FILE__, __LINE__,
- "process_note_abi_sections: Hurd objects not supported");
- break;
-
- case GNU_ABI_TAG_SOLARIS:
- internal_error
- (__FILE__, __LINE__,
- "process_note_abi_sections: Solaris objects not supported");
- break;
-
- default:
- internal_error
- (__FILE__, __LINE__,
- "process_note_abi_sections: unknown OS number %d",
- os_number);
- }
- }
- }
- /* NetBSD uses a similar trick. */
- else if (strcmp (name, ".note.netbsd.ident") == 0 && sectsize > 0)
- {
- unsigned int name_length, desc_length, note_type;
- char *note;
-
- /* If the section is larger than this, it's probably not what we are
- looking for. */
- if (sectsize > 128)
- sectsize = 128;
-
- note = alloca (sectsize);
-
- bfd_get_section_contents (abfd, sect, note,
- (file_ptr) 0, (bfd_size_type) sectsize);
-
- name_length = bfd_h_get_32 (abfd, note);
- desc_length = bfd_h_get_32 (abfd, note + 4);
- note_type = bfd_h_get_32 (abfd, note + 8);
-
- if (name_length == 7 && desc_length == 4 && note_type == NT_NETBSD_IDENT
- && strcmp (note + 12, "NetBSD") == 0)
- /* XXX Should we check the version here?
- Probably not necessary yet. */
- *os_ident_ptr = SH_OSABI_NETBSD_ELF;
- }
-}
-
static int
-get_elfosabi (bfd *abfd)
-{
- int elfosabi;
- enum sh_osabi sh_osabi = SH_OSABI_UNKNOWN;
-
- elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI];
-
- switch (elfosabi)
- {
- case ELFOSABI_NONE:
- /* When elfosabi is 0 (ELFOSABI_NONE), this is supposed to indicate
- that we're on a SYSV system. However, some systems use note sections
- to record OS/ABI info, but leave e_ident[EI_OSABI] zero. So we
- have to check the note sections too. */
- bfd_map_over_sections (abfd,
- process_note_abi_tag_sections,
- &sh_osabi);
- break;
-
- case ELFOSABI_NETBSD:
- sh_osabi = SH_OSABI_NETBSD_ELF;
- break;
-
- case ELFOSABI_LINUX:
- sh_osabi = SH_OSABI_LINUX;
- break;
- }
-
- return (sh_osabi);
-}
-
-struct sh_osabi_handler
-{
- struct sh_osabi_handler *next;
- enum sh_osabi abi;
- void (*init_osabi)(struct gdbarch_info, struct gdbarch *);
-};
-
-struct sh_osabi_handler *sh_osabi_handler_list = NULL;
-
-void
-sh_gdbarch_register_os_abi (enum sh_osabi abi,
- void (*init_osabi)(struct gdbarch_info,
- struct gdbarch *))
+sh_dsp_register_sim_regno (int nr)
{
- struct sh_osabi_handler **handler_p;
-
- for (handler_p = &sh_osabi_handler_list; *handler_p != NULL;
- handler_p = &(*handler_p)->next)
- {
- if ((*handler_p)->abi == abi)
- {
- internal_error
- (__FILE__, __LINE__,
- "sh_gdbarch_register_os_abi: A handler for this ABI variant "
- "(%d) has already been registered", (int) abi);
- /* If user wants to continue, override previous definition. */
- (*handler_p)->init_osabi = init_osabi;
- return;
- }
- }
-
- (*handler_p)
- = (struct sh_osabi_handler *) xmalloc (sizeof (struct sh_osabi_handler));
- (*handler_p)->next = NULL;
- (*handler_p)->abi = abi;
- (*handler_p)->init_osabi = init_osabi;
+ if (legacy_register_sim_regno (nr) < 0)
+ return legacy_register_sim_regno (nr);
+ if (nr >= DSP_DSR_REGNUM && nr < DSP_Y1_REGNUM)
+ return nr - DSP_DSR_REGNUM + SIM_SH_DSR_REGNUM;
+ if (nr == DSP_MOD_REGNUM)
+ return SIM_SH_MOD_REGNUM;
+ if (nr == DSP_RS_REGNUM)
+ return SIM_SH_RS_REGNUM;
+ if (nr == DSP_RE_REGNUM)
+ return SIM_SH_RE_REGNUM;
+ if (nr >= DSP_R0_BANK_REGNUM && nr <= DSP_R7_BANK_REGNUM)
+ return nr - DSP_R0_BANK_REGNUM + SIM_SH_R0_BANK_REGNUM;
+ return nr;
}
-
+\f
static gdbarch_init_ftype sh_gdbarch_init;
static struct gdbarch *
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
gdbarch_register_name_ftype *sh_register_name;
- gdbarch_store_return_value_ftype *sh_store_return_value;
+ gdbarch_deprecated_store_return_value_ftype *sh_store_return_value;
gdbarch_register_virtual_type_ftype *sh_register_virtual_type;
- enum sh_osabi sh_osabi = SH_OSABI_UNKNOWN;
- struct sh_osabi_handler *osabi_handler;
-
- /* Try to determine the ABI of the object we are loading. */
- if (info.abfd != NULL)
- {
- switch (bfd_get_flavour (info.abfd))
- {
- case bfd_target_elf_flavour:
- sh_osabi = get_elfosabi (info.abfd);
- break;
-
- default:
- /* Just leave it as "unkown". */
- break;
- }
- }
-
- /* Find a candidate among the list of pre-declared architectures. */
- for (arches = gdbarch_list_lookup_by_info (arches, &info);
- arches != NULL;
- arches = gdbarch_list_lookup_by_info (arches->next, &info))
- {
- /* Make sure the ABI selection matches. */
- tdep = gdbarch_tdep (arches->gdbarch);
- if (tdep && tdep->sh_osabi == sh_osabi)
- return arches->gdbarch;
- }
+ /* If there is already a candidate, use it. */
+ arches = gdbarch_list_lookup_by_info (arches, &info);
+ if (arches != NULL)
+ return arches->gdbarch;
/* None found, create a new architecture from the information
provided. */
tdep = XMALLOC (struct gdbarch_tdep);
gdbarch = gdbarch_alloc (&info, tdep);
- tdep->sh_osabi = sh_osabi;
- if (sh_osabi < SH_OSABI_INVALID)
- tdep->osabi_name = sh_osabi_names[sh_osabi];
- else
- {
- internal_error (__FILE__, __LINE__, "Invalid setting of sh_osabi %d",
- (int) sh_osabi);
- tdep->osabi_name = "<invalid>";
- }
+ /* NOTE: cagney/2002-12-06: This can be deleted when this arch is
+ ready to unwind the PC first (see frame.c:get_prev_frame()). */
+ set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default);
/* Initialize the register numbers that are not common to all the
variants to -1, if necessary thse will be overwritten in the case
set_gdbarch_fp0_regnum (gdbarch, -1);
set_gdbarch_num_pseudo_regs (gdbarch, 0);
- set_gdbarch_max_register_raw_size (gdbarch, 4);
- set_gdbarch_max_register_virtual_size (gdbarch, 4);
+ set_gdbarch_deprecated_max_register_raw_size (gdbarch, 4);
+ set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 4);
set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
set_gdbarch_num_regs (gdbarch, SH_DEFAULT_NUM_REGS);
set_gdbarch_sp_regnum (gdbarch, 15);
- set_gdbarch_fp_regnum (gdbarch, 14);
+ set_gdbarch_deprecated_fp_regnum (gdbarch, 14);
set_gdbarch_pc_regnum (gdbarch, 16);
- set_gdbarch_register_size (gdbarch, 4);
+ set_gdbarch_deprecated_register_size (gdbarch, 4);
set_gdbarch_register_bytes (gdbarch, SH_DEFAULT_NUM_REGS * 4);
- set_gdbarch_do_registers_info (gdbarch, sh_do_registers_info);
+ set_gdbarch_deprecated_do_registers_info (gdbarch, sh_do_registers_info);
set_gdbarch_breakpoint_from_pc (gdbarch, sh_breakpoint_from_pc);
- set_gdbarch_frame_chain (gdbarch, sh_frame_chain);
- set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register);
- set_gdbarch_init_extra_frame_info (gdbarch, sh_init_extra_frame_info);
- set_gdbarch_extract_return_value (gdbarch, sh_extract_return_value);
- set_gdbarch_push_arguments (gdbarch, sh_push_arguments);
- set_gdbarch_store_struct_return (gdbarch, sh_store_struct_return);
+ set_gdbarch_deprecated_frame_chain (gdbarch, sh_frame_chain);
+ set_gdbarch_deprecated_get_saved_register (gdbarch, deprecated_generic_get_saved_register);
+ set_gdbarch_deprecated_init_extra_frame_info (gdbarch, sh_init_extra_frame_info);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, sh_extract_return_value);
+ set_gdbarch_deprecated_push_arguments (gdbarch, sh_push_arguments);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, sh_store_struct_return);
set_gdbarch_use_struct_convention (gdbarch, sh_use_struct_convention);
- set_gdbarch_extract_struct_value_address (gdbarch, sh_extract_struct_value_address);
- set_gdbarch_pop_frame (gdbarch, sh_pop_frame);
+ set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sh_extract_struct_value_address);
+ set_gdbarch_deprecated_pop_frame (gdbarch, sh_pop_frame);
set_gdbarch_print_insn (gdbarch, gdb_print_insn_sh);
+ set_gdbarch_register_sim_regno (gdbarch, legacy_register_sim_regno);
skip_prologue_hard_way = sh_skip_prologue_hard_way;
do_pseudo_register = sh_do_pseudo_register;
sh_show_regs = sh_generic_show_regs;
sh_store_return_value = sh_default_store_return_value;
sh_register_virtual_type = sh_default_register_virtual_type;
- set_gdbarch_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
+ set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
sh_show_regs = sh_generic_show_regs;
sh_store_return_value = sh_default_store_return_value;
sh_register_virtual_type = sh_default_register_virtual_type;
- set_gdbarch_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
+ set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
break;
+ case bfd_mach_sh2e:
+ sh_register_name = sh_sh2e_register_name;
+ sh_show_regs = sh2e_show_regs;
+ sh_store_return_value = sh3e_sh4_store_return_value;
+ sh_register_virtual_type = sh_sh3e_register_virtual_type;
+ set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
+ set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
+ set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
+ set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
+ set_gdbarch_fp0_regnum (gdbarch, 25);
+ tdep->FPUL_REGNUM = 23;
+ tdep->FPSCR_REGNUM = 24;
+ tdep->FP_LAST_REGNUM = 40;
+ break;
case bfd_mach_sh_dsp:
sh_register_name = sh_sh_dsp_register_name;
sh_show_regs = sh_dsp_show_regs;
sh_store_return_value = sh_default_store_return_value;
sh_register_virtual_type = sh_default_register_virtual_type;
- set_gdbarch_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
+ set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
+ set_gdbarch_register_sim_regno (gdbarch, sh_dsp_register_sim_regno);
tdep->DSR_REGNUM = 24;
tdep->A0G_REGNUM = 25;
tdep->A0_REGNUM = 26;
sh_show_regs = sh3_show_regs;
sh_store_return_value = sh_default_store_return_value;
sh_register_virtual_type = sh_default_register_virtual_type;
- set_gdbarch_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
+ set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
sh_show_regs = sh3e_show_regs;
sh_store_return_value = sh3e_sh4_store_return_value;
sh_register_virtual_type = sh_sh3e_register_virtual_type;
- set_gdbarch_frame_init_saved_regs (gdbarch, sh_fp_frame_init_saved_regs);
+ set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_fp_frame_init_saved_regs);
set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
- set_gdbarch_extract_return_value (gdbarch, sh3e_sh4_extract_return_value);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, sh3e_sh4_extract_return_value);
set_gdbarch_fp0_regnum (gdbarch, 25);
tdep->FPUL_REGNUM = 23;
tdep->FPSCR_REGNUM = 24;
sh_show_regs = sh3_dsp_show_regs;
sh_store_return_value = sh_default_store_return_value;
sh_register_virtual_type = sh_default_register_virtual_type;
- set_gdbarch_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
+ set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
sh_show_regs = sh4_show_regs;
sh_store_return_value = sh3e_sh4_store_return_value;
sh_register_virtual_type = sh_sh4_register_virtual_type;
- set_gdbarch_frame_init_saved_regs (gdbarch, sh_fp_frame_init_saved_regs);
- set_gdbarch_extract_return_value (gdbarch, sh3e_sh4_extract_return_value);
+ set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_fp_frame_init_saved_regs);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, sh3e_sh4_extract_return_value);
set_gdbarch_fp0_regnum (gdbarch, 25);
set_gdbarch_register_raw_size (gdbarch, sh_sh4_register_raw_size);
set_gdbarch_register_virtual_size (gdbarch, sh_sh4_register_raw_size);
set_gdbarch_register_byte (gdbarch, sh_sh4_register_byte);
set_gdbarch_num_pseudo_regs (gdbarch, 12);
- set_gdbarch_max_register_raw_size (gdbarch, 4 * 4);
- set_gdbarch_max_register_virtual_size (gdbarch, 4 * 4);
- set_gdbarch_register_read (gdbarch, sh4_register_read);
- set_gdbarch_register_write (gdbarch, sh4_register_write);
+ set_gdbarch_deprecated_max_register_raw_size (gdbarch, 4 * 4);
+ set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 4 * 4);
+ set_gdbarch_pseudo_register_read (gdbarch, sh_pseudo_register_read);
+ set_gdbarch_pseudo_register_write (gdbarch, sh_pseudo_register_write);
tdep->FPUL_REGNUM = 23;
tdep->FPSCR_REGNUM = 24;
tdep->FP_LAST_REGNUM = 40;
/* the number of real registers is the same whether we are in
ISA16(compact) or ISA32(media). */
set_gdbarch_num_regs (gdbarch, SIM_SH64_NR_REGS);
- set_gdbarch_register_size (gdbarch, 8); /*????*/
+ set_gdbarch_deprecated_register_size (gdbarch, 8); /*????*/
set_gdbarch_register_bytes (gdbarch,
((SIM_SH64_NR_FP_REGS + 1) * 4)
+ (SIM_SH64_NR_REGS - SIM_SH64_NR_FP_REGS -1) * 8);
sh_store_return_value = sh64_store_return_value;
skip_prologue_hard_way = sh64_skip_prologue_hard_way;
do_pseudo_register = sh64_do_pseudo_register;
- set_gdbarch_print_insn (gdbarch, gdb_print_insn_sh64);
set_gdbarch_register_raw_size (gdbarch, sh_sh64_register_raw_size);
set_gdbarch_register_virtual_size (gdbarch, sh_sh64_register_raw_size);
set_gdbarch_register_byte (gdbarch, sh_sh64_register_byte);
/* This seems awfully wrong!*/
- /*set_gdbarch_max_register_raw_size (gdbarch, 8);*/
+ /*set_gdbarch_deprecated_max_register_raw_size (gdbarch, 8);*/
/* should include the size of the pseudo regs. */
- set_gdbarch_max_register_raw_size (gdbarch, 4 * 4);
+ set_gdbarch_deprecated_max_register_raw_size (gdbarch, 4 * 4);
/* Or should that go in the virtual_size? */
- /*set_gdbarch_max_register_virtual_size (gdbarch, 8);*/
- set_gdbarch_max_register_virtual_size (gdbarch, 4 * 4);
- set_gdbarch_register_read (gdbarch, sh64_register_read);
- set_gdbarch_register_write (gdbarch, sh64_register_write);
+ /*set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 8);*/
+ set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 4 * 4);
+ set_gdbarch_pseudo_register_read (gdbarch, sh64_pseudo_register_read);
+ set_gdbarch_pseudo_register_write (gdbarch, sh64_pseudo_register_write);
- set_gdbarch_do_registers_info (gdbarch, sh64_do_registers_info);
- set_gdbarch_frame_init_saved_regs (gdbarch, sh64_nofp_frame_init_saved_regs);
+ set_gdbarch_deprecated_do_registers_info (gdbarch, sh64_do_registers_info);
+ set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh64_nofp_frame_init_saved_regs);
set_gdbarch_breakpoint_from_pc (gdbarch, sh_sh64_breakpoint_from_pc);
- set_gdbarch_init_extra_frame_info (gdbarch, sh64_init_extra_frame_info);
- set_gdbarch_frame_chain (gdbarch, sh64_frame_chain);
- set_gdbarch_get_saved_register (gdbarch, sh64_get_saved_register);
- set_gdbarch_extract_return_value (gdbarch, sh64_extract_return_value);
- set_gdbarch_push_arguments (gdbarch, sh64_push_arguments);
- /*set_gdbarch_store_struct_return (gdbarch, sh64_store_struct_return);*/
- set_gdbarch_extract_struct_value_address (gdbarch, sh64_extract_struct_value_address);
+ set_gdbarch_deprecated_init_extra_frame_info (gdbarch, sh64_init_extra_frame_info);
+ set_gdbarch_deprecated_frame_chain (gdbarch, sh64_frame_chain);
+ set_gdbarch_deprecated_get_saved_register (gdbarch, sh64_get_saved_register);
+ set_gdbarch_deprecated_extract_return_value (gdbarch, sh64_extract_return_value);
+ set_gdbarch_deprecated_push_arguments (gdbarch, sh64_push_arguments);
+ /*set_gdbarch_deprecated_store_struct_return (gdbarch, sh64_store_struct_return);*/
+ set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sh64_extract_struct_value_address);
set_gdbarch_use_struct_convention (gdbarch, sh64_use_struct_convention);
- set_gdbarch_pop_frame (gdbarch, sh64_pop_frame);
+ set_gdbarch_deprecated_pop_frame (gdbarch, sh64_pop_frame);
set_gdbarch_elf_make_msymbol_special (gdbarch,
sh64_elf_make_msymbol_special);
break;
sh_show_regs = sh_generic_show_regs;
sh_store_return_value = sh_default_store_return_value;
sh_register_virtual_type = sh_default_register_virtual_type;
- set_gdbarch_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
+ set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
set_gdbarch_read_pc (gdbarch, generic_target_read_pc);
set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
- set_gdbarch_read_fp (gdbarch, generic_target_read_fp);
set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
- set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
set_gdbarch_register_name (gdbarch, sh_register_name);
set_gdbarch_register_virtual_type (gdbarch, sh_register_virtual_type);
set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT);
set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
- set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);/*??should be 8?*/
-
- set_gdbarch_use_generic_dummy_frames (gdbarch, 1);
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); /*???*/
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_pc_in_call_dummy (gdbarch, generic_pc_in_call_dummy);
- set_gdbarch_call_dummy_words (gdbarch, sh_call_dummy_words);
- set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (sh_call_dummy_words));
- set_gdbarch_call_dummy_p (gdbarch, 1);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
- set_gdbarch_coerce_float_to_double (gdbarch,
- sh_coerce_float_to_double);
-
- set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
- set_gdbarch_push_return_address (gdbarch, sh_push_return_address);
-
- set_gdbarch_store_return_value (gdbarch, sh_store_return_value);
+ set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
+
+ set_gdbarch_deprecated_call_dummy_words (gdbarch, sh_call_dummy_words);
+ set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, sizeof (sh_call_dummy_words));
+
+ set_gdbarch_deprecated_push_return_address (gdbarch, sh_push_return_address);
+
+ set_gdbarch_deprecated_store_return_value (gdbarch, sh_store_return_value);
set_gdbarch_skip_prologue (gdbarch, sh_skip_prologue);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_decr_pc_after_break (gdbarch, 0);
set_gdbarch_frame_args_skip (gdbarch, 0);
set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue);
- 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, 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_deprecated_frame_saved_pc (gdbarch, sh_frame_saved_pc);
+ set_gdbarch_deprecated_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);
- /* Hook in ABI-specific overrides, if they have been registered. If
- the ABI is unknown, this is probably an embedded target, so we
- should not warn about this situation. */
- if (sh_osabi != SH_OSABI_UNKNOWN)
- {
- for (osabi_handler = sh_osabi_handler_list; osabi_handler != NULL;
- osabi_handler = osabi_handler->next)
- if (osabi_handler->abi == sh_osabi)
- break;
-
- if (osabi_handler)
- osabi_handler->init_osabi (info, gdbarch);
- else
- {
- /* We assume that if GDB_MULTI_ARCH is less than
- GDB_MULTI_ARCH_TM that an ABI variant can be supported by
- overriding definitions in this file. */
- if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- fprintf_filtered
- (gdb_stderr,
- "A handler for the ABI variant \"%s\" is not built into this "
- "configuration of GDB. "
- "Attempting to continue with the default SuperH settings",
- sh_osabi_names[sh_osabi]);
- }
- }
+ /* Hook in ABI-specific overrides, if they have been registered. */
+ gdbarch_init_osabi (info, gdbarch);
return gdbarch;
}
if (tdep == NULL)
return;
- if (tdep->osabi_name != NULL)
- fprintf_unfiltered (file, "sh_dump_tdep: OS ABI = %s\n", tdep->osabi_name);
- else
- internal_error (__FILE__, __LINE__,
- "sh_dump_tdep: illegal setting of tdep->sh_osabi (%d)",
- (int) tdep->sh_osabi);
+ /* FIXME: dump the rest of gdbarch_tdep. */
}
void