if (regno < 0)
return NULL;
- if (regno >= (sizeof(register_names) / sizeof(*register_names)))
+ if (regno >= ARRAY_SIZE(register_names))
return NULL;
return register_names[regno];
}
unsigned int
alpha_read_insn (CORE_ADDR pc)
{
- gdb_byte buf[4];
+ gdb_byte buf[ALPHA_INSN_SIZE];
int status;
- status = read_memory_nobpt (pc, buf, 4);
+ status = read_memory_nobpt (pc, buf, sizeof (buf));
if (status)
memory_error (status, pc);
- return extract_unsigned_integer (buf, 4);
+ return extract_unsigned_integer (buf, sizeof (buf));
}
/* To skip prologues, I use this predicate. Returns either PC itself
unsigned long inst;
int offset;
CORE_ADDR post_prologue_pc;
- gdb_byte buf[4];
+ gdb_byte buf[ALPHA_INSN_SIZE];
/* Silently return the unaltered pc upon memory errors.
This could happen on OSF/1 if decode_line_1 tries to skip the
Reading target memory is slow over serial lines, so we perform
this check only if the target has shared libraries (which all
Alpha targets do). */
- if (target_read_memory (pc, buf, 4))
+ if (target_read_memory (pc, buf, sizeof (buf)))
return pc;
/* See if we can determine the end of the prologue via the symbol table.
/* Skip the typical prologue instructions. These are the stack adjustment
instruction and the instructions that save registers on the stack
or in the gcc frame. */
- for (offset = 0; offset < 100; offset += 4)
+ for (offset = 0; offset < 100; offset += ALPHA_INSN_SIZE)
{
inst = alpha_read_insn (pc + offset);
/* Search back for previous return; also stop at a 0, which might be
seen for instance before the start of a code section. Don't include
nops, since this usually indicates padding between functions. */
- for (pc -= 4; pc >= fence; pc -= 4)
+ for (pc -= ALPHA_INSN_SIZE; pc >= fence; pc -= ALPHA_INSN_SIZE)
{
unsigned int insn = alpha_read_insn (pc);
switch (insn)
if (start_pc + 200 < limit_pc)
limit_pc = start_pc + 200;
- for (cur_pc = start_pc; cur_pc < limit_pc; cur_pc += 4)
+ for (cur_pc = start_pc; cur_pc < limit_pc; cur_pc += ALPHA_INSN_SIZE)
{
unsigned int word = alpha_read_insn (cur_pc);
break;
}
- cur_pc += 4;
+ cur_pc += ALPHA_INSN_SIZE;
}
}
}
int regno;
int offset;
LONGEST rav;
- gdb_byte reg[8];
+ gdb_byte reg[ALPHA_REGISTER_SIZE];
insn = alpha_read_insn (pc);
offset = (insn & 0x001fffff);
if (offset & 0x00100000)
offset |= 0xffe00000;
- offset *= 4;
- return (pc + 4 + offset);
+ offset *= ALPHA_INSN_SIZE;
+ return (pc + ALPHA_INSN_SIZE + offset);
}
/* Need to determine if branch is taken; read RA. */
}
regcache_cooked_read (current_regcache, regno, reg);
- rav = extract_signed_integer (reg, 8);
+ rav = extract_signed_integer (reg, ALPHA_REGISTER_SIZE);
switch (op)
{
/* Not a branch or branch not taken; target PC is:
pc + 4 */
- return (pc + 4);
+ return (pc + ALPHA_INSN_SIZE);
}
void
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
set_gdbarch_breakpoint_from_pc (gdbarch, alpha_breakpoint_from_pc);
- set_gdbarch_decr_pc_after_break (gdbarch, 4);
+ set_gdbarch_decr_pc_after_break (gdbarch, ALPHA_INSN_SIZE);
set_gdbarch_cannot_step_breakpoint (gdbarch, 1);
/* Hook in ABI-specific overrides, if they have been registered. */