#include "frame.h"
#include "obstack.h"
#include "symtab.h"
+#include <dis-asm.h>
+#undef NUM_REGS
+#define NUM_REGS 11
+
#define UNSIGNED_SHORT(X) ((X) & 0xffff)
/* an easy to debug H8 stack frame looks like:
{
short int w;
- w = read_memory_short (start_pc);
+ w = read_memory_unsigned_integer (start_pc, 2);
/* Skip past all push insns */
while (IS_PUSH_FP (w))
{
start_pc += 2;
- w = read_memory_short (start_pc);
+ w = read_memory_unsigned_integer (start_pc, 2);
}
/* Skip past a move to FP */
if (IS_MOVE_FP (w))
{
start_pc += 2;
- w = read_memory_short (start_pc);
+ w = read_memory_unsigned_integer (start_pc, 2);
}
/* Skip the stack adjust */
if (IS_MOVK_R5 (w))
{
start_pc += 2;
- w = read_memory_short (start_pc);
+ w = read_memory_unsigned_integer (start_pc, 2);
}
if (IS_SUB_R5SP (w))
{
start_pc += 2;
- w = read_memory_short (start_pc);
+ w = read_memory_unsigned_integer (start_pc, 2);
}
while (IS_SUB2_SP (w))
{
start_pc += 2;
- w = read_memory_short (start_pc);
+ w = read_memory_unsigned_integer (start_pc, 2);
}
return start_pc;
CORE_ADDR memaddr;
FILE *stream;
{
- /* Nothing is bigger than 8 bytes */
- char data[8];
-
- read_memory (memaddr, data, sizeof (data));
- return print_insn_h8300 (memaddr, data, stream);
+ disassemble_info info;
+ GDB_INIT_DISASSEMBLE_INFO(info, stream);
+ return print_insn_h8300 (memaddr, &info);
}
/* Given a GDB frame, determine the address of the calling function's frame.
register struct pic_prologue_code *pcode;
INSN_WORD insn_word;
int size, offset;
- unsigned int reg_save_depth = 2; /* Number of things pushed onto
+ unsigned int reg_save_depth = 2; /* Number of things pushed onto
stack, starts at 2, 'cause the
PC is already there */
unsigned int auto_depth = 0; /* Number of bytes of autos */
- char in_frame[NUM_REGS]; /* One for each reg */
+ char in_frame[11]; /* One for each reg */
- memset (in_frame, 1, NUM_REGS);
- for (r = 0; r < NUM_REGS; r++)
+ memset (in_frame, 1, 11);
+ for (r = 0; r < 8; r++)
{
fsr->regs[r] = 0;
}
/* Locals are always reffed based from the fp */
fi->locals_pointer = after_prolog_fp;
/* The PC is at a known place */
- fi->from_pc = read_memory_short (after_prolog_fp + 2);
+ fi->from_pc = read_memory_unsigned_integer (after_prolog_fp + 2, BINWORD);
/* Rememeber any others too */
in_frame[PC_REGNUM] = 0;
if (have_fp)
/* We keep the old FP in the SP spot */
- fsr->regs[SP_REGNUM] = (read_memory_short (fsr->regs[6]));
+ fsr->regs[SP_REGNUM] = (read_memory_unsigned_integer
+ (fsr->regs[6]), BINWORD);
else
fsr->regs[SP_REGNUM] = after_prolog_fp + auto_depth;
fi = get_frame_info (frame);
get_frame_saved_regs (fi, &fsr);
- for (regnum = 0; regnum < NUM_REGS; regnum++)
+ for (regnum = 0; regnum < 8; regnum++)
{
if (fsr.regs[regnum])
{
- write_register (regnum, read_memory_short (fsr.regs[regnum]));
+ write_register (regnum, read_memory_integer(fsr.regs[regnum]), BINWORD);
}
flush_cached_frames ();