#include "gdbcore.h"
#include "symfile.h"
-char *mn10300_generic_register_names[] = REGISTER_NAMES;
+static char *mn10300_generic_register_names[] =
+{ "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
+ "sp", "pc", "mdr", "psw", "lir", "lar", "", "",
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "fp" };
+char **mn10300_register_names = mn10300_generic_register_names;
/* start-sanitize-am33 */
-char *am33_register_names [] =
+static char *am33_register_names [] =
{ "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
"sp", "pc", "mdr", "psw", "lir", "lar", "",
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"ssp", "msp", "usp", "mcrh", "mcrl", "mcvf", "", "", ""};
-int am33_mode;
+static int am33_mode;
/* end-sanitize-am33 */
static CORE_ADDR mn10300_analyze_prologue PARAMS ((struct frame_info *fi,
#define NO_MORE_FRAMES 0x4
+/* Should call_function allocate stack space for a struct return? */
+int
+mn10300_use_struct_convention (gcc_p, type)
+ int gcc_p;
+ struct type *type;
+{
+ return (TYPE_NFIELDS (type) > 1 || TYPE_LENGTH (type) > 8);
+}
+
+/* The breakpoint instruction must be the same size as the smallest
+ instruction in the instruction set.
+
+ The Matsushita mn10x00 processors have single byte instructions
+ so we need a single byte breakpoint. Matsushita hasn't defined
+ one, so we defined it ourselves. */
+
+unsigned char *
+mn10300_breakpoint_from_pc (bp_addr, bp_size)
+ CORE_ADDR *bp_addr;
+ int *bp_size;
+{
+ static char breakpoint[] = {0xff};
+ *bp_size = 1;
+ return breakpoint;
+}
+
+
/* Fix fi->frame if it's bogus at this point. This is a helper
function for mn10300_analyze_prologue. */
/* If we're in start, then give up. */
if (strcmp (name, "start") == 0)
{
- fi->status = NO_MORE_FRAMES;
+ if (fi != NULL)
+ fi->status = NO_MORE_FRAMES;
return pc;
}
mn10300_analyze_prologue (fi, 0);
}
+/* Function: mn10300_virtual_frame_pointer
+ Return the register that the function uses for a frame pointer,
+ plus any necessary offset to be applied to the register before
+ any frame pointer offsets. */
+
+void
+mn10300_virtual_frame_pointer (pc, reg, offset)
+ CORE_ADDR pc;
+ long *reg;
+ long *offset;
+{
+ struct frame_info fi;
+
+ /* Set up a dummy frame_info. */
+ fi.next = NULL;
+ fi.prev = NULL;
+ fi.frame = 0;
+ fi.pc = pc;
+
+ /* Analyze the prolog and fill in the extra info. */
+ mn10300_init_extra_frame_info (&fi);
+
+ /* Results will tell us which type of frame it uses. */
+ if (fi.status & MY_FRAME_IN_SP)
+ {
+ *reg = SP_REGNUM;
+ *offset = -(fi.stack_size);
+ }
+ else
+ {
+ *reg = A3_REGNUM;
+ *offset = 0;
+ }
+}
+
/* This can be made more generic later. */
static void
set_machine_hook (filename)
if (bfd_get_mach (exec_bfd) == bfd_mach_mn10300
|| bfd_get_mach (exec_bfd) == 0)
{
- for (i = 0; i < NUM_REGS; i++)
- reg_names[i] = mn10300_generic_register_names[i];
+ mn10300_register_names = mn10300_generic_register_names;
}
/* start-sanitize-am33 */
am33_mode = 0;
if (bfd_get_mach (exec_bfd) == bfd_mach_am33)
{
- for (i = 0; i < NUM_REGS; i++)
- reg_names[i] = am33_register_names[i];
+
+ mn10300_register_names = am33_register_names;
am33_mode = 1;
}
/* end-sanitize-am33 */