#include "arch-utils.h"
#include "gdb_string.h"
#include "disasm.h"
+#include "dis-asm.h"
static CORE_ADDR mcore_analyze_prologue (struct frame_info *fi, CORE_ADDR pc,
int skip_prologue);
static struct frame_info *
analyze_dummy_frame (CORE_ADDR pc, CORE_ADDR frame)
{
- static struct frame_info *dummy = NULL;
-
- if (dummy == NULL)
- {
- struct frame_extra_info *extra_info;
- CORE_ADDR *saved_regs;
- dummy = deprecated_frame_xmalloc ();
- saved_regs = (CORE_ADDR *) xmalloc (SIZEOF_FRAME_SAVED_REGS);
- deprecated_set_frame_saved_regs_hack (dummy, saved_regs);
- extra_info = XMALLOC (struct frame_extra_info);
- deprecated_set_frame_extra_info_hack (dummy, extra_info);
- }
-
- deprecated_set_frame_next_hack (dummy, NULL);
- deprecated_set_frame_prev_hack (dummy, NULL);
+ struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
+ struct frame_info *dummy
+ = deprecated_frame_xmalloc_with_cleanup (SIZEOF_FRAME_SAVED_REGS,
+ sizeof (struct frame_extra_info));
deprecated_update_frame_pc_hack (dummy, pc);
deprecated_update_frame_base_hack (dummy, frame);
get_frame_extra_info (dummy)->status = 0;
get_frame_extra_info (dummy)->framesize = 0;
- memset (get_frame_saved_regs (dummy), '\000', SIZEOF_FRAME_SAVED_REGS);
mcore_analyze_prologue (dummy, 0, 0);
+ do_cleanups (old_chain);
return dummy;
}
{
if (register_offsets[rn] >= 0)
{
- get_frame_saved_regs (fi)[rn] = get_frame_base (fi) - register_offsets[rn];
+ deprecated_get_frame_saved_regs (fi)[rn] = get_frame_base (fi) - register_offsets[rn];
mcore_insn_debug (("Saved register %s stored at 0x%08x, value=0x%08x\n",
mcore_register_names[rn], fi->saved_regs[rn],
read_memory_integer (fi->saved_regs[rn], 4)));
int fp = get_frame_extra_info (dummy)->fp_regnum;
/* Our caller has a frame pointer. */
- if (get_frame_saved_regs (fi)[fp] != 0)
+ if (deprecated_get_frame_saved_regs (fi)[fp] != 0)
{
/* The "FP" was saved on the stack. Don't forget to adjust
the "FP" with the framesize to get a real FP. */
- callers_addr = read_memory_integer (get_frame_saved_regs (fi)[fp],
+ callers_addr = read_memory_integer (deprecated_get_frame_saved_regs (fi)[fp],
DEPRECATED_REGISTER_SIZE)
+ get_frame_extra_info (dummy)->framesize;
}
get_frame_base (fi)))
return deprecated_read_register_dummy (get_frame_pc (fi),
get_frame_base (fi), regnum);
- else if (get_frame_saved_regs (fi)[regnum] != 0)
- return read_memory_integer (get_frame_saved_regs (fi)[regnum],
+ else if (deprecated_get_frame_saved_regs (fi)[regnum] != 0)
+ return read_memory_integer (deprecated_get_frame_saved_regs (fi)[regnum],
DEPRECATED_REGISTER_SIZE);
}
/* Restore any saved registers. */
for (rn = 0; rn < NUM_REGS; rn++)
{
- if (get_frame_saved_regs (fi)[rn] != 0)
+ if (deprecated_get_frame_saved_regs (fi)[rn] != 0)
{
ULONGEST value;
- value = read_memory_unsigned_integer (get_frame_saved_regs (fi)[rn],
+ value = read_memory_unsigned_integer (deprecated_get_frame_saved_regs (fi)[rn],
DEPRECATED_REGISTER_SIZE);
write_register (rn, value);
}
return sp;
}
-/* Store the return address for the call dummy. For MCore, we've
- opted to use generic call dummies, so we simply store the
- CALL_DUMMY_ADDRESS into the PR register (r15). */
+/* Store the return address for the call dummy. For MCore, we've opted
+ to use generic call dummies, so we simply store the entry-point
+ address into the PR register (r15). */
static CORE_ADDR
mcore_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
{
- write_register (PR_REGNUM, CALL_DUMMY_ADDRESS ());
+ write_register (PR_REGNUM, entry_point_address ());
return sp;
}
static CORE_ADDR
mcore_extract_struct_value_address (char *regbuf)
{
- return extract_unsigned_integer (regbuf + REGISTER_BYTE (FIRST_ARGREG), DEPRECATED_REGISTER_SIZE);
+ return extract_unsigned_integer (regbuf + DEPRECATED_REGISTER_BYTE (FIRST_ARGREG), DEPRECATED_REGISTER_SIZE);
}
/* Given a function which returns a value of type TYPE, extract the
/* Copy the return value (starting) in RETVAL_REGNUM to VALBUF. */
/* Only getting the first byte! if len = 1, we need the last byte of
the register, not the first. */
- memcpy (valbuf, regbuf + REGISTER_BYTE (RETVAL_REGNUM) +
+ memcpy (valbuf, regbuf + DEPRECATED_REGISTER_BYTE (RETVAL_REGNUM) +
(TYPE_LENGTH (type) < 4 ? 4 - TYPE_LENGTH (type) : 0), TYPE_LENGTH (type));
}
/* Return value fits into registers. */
return_size = (value_size + DEPRECATED_REGISTER_SIZE - 1) & ~(DEPRECATED_REGISTER_SIZE - 1);
- offset = REGISTER_BYTE (RETVAL_REGNUM) + (return_size - value_size);
+ offset = DEPRECATED_REGISTER_BYTE (RETVAL_REGNUM) + (return_size - value_size);
zeros = alloca (return_size);
memset (zeros, 0, return_size);
- deprecated_write_register_bytes (REGISTER_BYTE (RETVAL_REGNUM), zeros,
+ deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (RETVAL_REGNUM), zeros,
return_size);
deprecated_write_register_bytes (offset, valbuf, value_size);
}
/* 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);
+ set_gdbarch_deprecated_init_frame_pc (gdbarch, deprecated_init_frame_pc_default);
/* Registers: */
set_gdbarch_deprecated_call_dummy_words (gdbarch, call_dummy_words);
set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, 0);
- set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
+ set_gdbarch_deprecated_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
set_gdbarch_deprecated_saved_pc_after_call (gdbarch, mcore_saved_pc_after_call);
set_gdbarch_function_start_offset (gdbarch, 0);
set_gdbarch_decr_pc_after_break (gdbarch, 0);
mcore_extract_struct_value_address);
set_gdbarch_skip_prologue (gdbarch, mcore_skip_prologue);
set_gdbarch_frame_args_skip (gdbarch, 0);
- set_gdbarch_frame_args_address (gdbarch, mcore_frame_args_address);
- set_gdbarch_frame_locals_address (gdbarch, mcore_frame_locals_address);
+ set_gdbarch_deprecated_frame_args_address (gdbarch, mcore_frame_args_address);
+ set_gdbarch_deprecated_frame_locals_address (gdbarch, mcore_frame_locals_address);
set_gdbarch_deprecated_pop_frame (gdbarch, mcore_pop_frame);
set_gdbarch_virtual_frame_pointer (gdbarch, mcore_virtual_frame_pointer);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
/* MCore will never pass a sturcture by reference. It will always be split
between registers and stack. */
- set_gdbarch_reg_struct_has_addr (gdbarch, mcore_reg_struct_has_addr);
+ set_gdbarch_deprecated_reg_struct_has_addr
+ (gdbarch, mcore_reg_struct_has_addr);
/* Should be using push_dummy_call. */
set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp);
+ set_gdbarch_print_insn (gdbarch, print_insn_mcore);
+
return gdbarch;
}
void
_initialize_mcore_tdep (void)
{
- extern int print_insn_mcore (bfd_vma, disassemble_info *);
gdbarch_register (bfd_arch_mcore, mcore_gdbarch_init, mcore_dump_tdep);
- deprecated_tm_print_insn = print_insn_mcore;
#ifdef MCORE_DEBUG
add_show_from_set (add_set_cmd ("mcoredebug", no_class,