/* Frame unwinder for frames with DWARF Call Frame Information.
- Copyright (C) 2003-2015 Free Software Foundation, Inc.
+ Copyright (C) 2003-2016 Free Software Foundation, Inc.
Contributed by Mark Kettenis.
static void
dwarf2_frame_state_free (void *p)
{
- struct dwarf2_frame_state *fs = p;
+ struct dwarf2_frame_state *fs = (struct dwarf2_frame_state *) p;
dwarf2_frame_state_free_regs (fs->initial.prev);
dwarf2_frame_state_free_regs (fs->regs.prev);
{
struct frame_info *this_frame = (struct frame_info *) baton;
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- int regnum = gdbarch_dwarf2_reg_to_regnum (gdbarch, reg);
+ int regnum = dwarf_reg_to_regnum_or_error (gdbarch, reg);
return address_from_register (regnum, this_frame);
}
{
struct frame_info *this_frame = (struct frame_info *) baton;
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- int regnum = gdbarch_dwarf2_reg_to_regnum (gdbarch, reg);
+ int regnum = dwarf_reg_to_regnum_or_error (gdbarch, reg);
return value_from_register (type, regnum, this_frame);
}
fs->regs.reg[reg].how = DWARF2_FRAME_REG_UNSPECIFIED;
if (fs->regs.reg[reg].how == DWARF2_FRAME_REG_UNSPECIFIED)
- complaint (&symfile_complaints, _("\
+ {
+ int regnum = dwarf_reg_to_regnum (gdbarch, reg);
+
+ complaint (&symfile_complaints, _("\
incomplete CFI data; DW_CFA_restore unspecified\n\
register %s (#%d) at %s"),
- gdbarch_register_name
- (gdbarch, gdbarch_dwarf2_reg_to_regnum (gdbarch, reg)),
- gdbarch_dwarf2_reg_to_regnum (gdbarch, reg),
- paddress (gdbarch, fs->pc));
+ gdbarch_register_name (gdbarch, regnum), regnum,
+ paddress (gdbarch, fs->pc));
+ }
}
/* Virtual method table for execute_stack_op below. */
struct dwarf2_frame_state_reg *,
struct frame_info *))
{
- struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data);
+ struct dwarf2_frame_ops *ops
+ = (struct dwarf2_frame_ops *) gdbarch_data (gdbarch, dwarf2_frame_data);
ops->init_reg = init_reg;
}
struct dwarf2_frame_state_reg *reg,
struct frame_info *this_frame)
{
- struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data);
+ struct dwarf2_frame_ops *ops
+ = (struct dwarf2_frame_ops *) gdbarch_data (gdbarch, dwarf2_frame_data);
ops->init_reg (gdbarch, regnum, reg, this_frame);
}
int (*signal_frame_p) (struct gdbarch *,
struct frame_info *))
{
- struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data);
+ struct dwarf2_frame_ops *ops
+ = (struct dwarf2_frame_ops *) gdbarch_data (gdbarch, dwarf2_frame_data);
ops->signal_frame_p = signal_frame_p;
}
dwarf2_frame_signal_frame_p (struct gdbarch *gdbarch,
struct frame_info *this_frame)
{
- struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data);
+ struct dwarf2_frame_ops *ops
+ = (struct dwarf2_frame_ops *) gdbarch_data (gdbarch, dwarf2_frame_data);
if (ops->signal_frame_p == NULL)
return 0;
int (*adjust_regnum) (struct gdbarch *,
int, int))
{
- struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data);
+ struct dwarf2_frame_ops *ops
+ = (struct dwarf2_frame_ops *) gdbarch_data (gdbarch, dwarf2_frame_data);
ops->adjust_regnum = adjust_regnum;
}
dwarf2_frame_adjust_regnum (struct gdbarch *gdbarch,
int regnum, int eh_frame_p)
{
- struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data);
+ struct dwarf2_frame_ops *ops
+ = (struct dwarf2_frame_ops *) gdbarch_data (gdbarch, dwarf2_frame_data);
if (ops->adjust_regnum == NULL)
return regnum;
{
case CFA_REG_OFFSET:
{
- int regnum = gdbarch_dwarf2_reg_to_regnum (gdbarch, fs.regs.cfa_reg);
-
- if (regnum == -1)
- error (_("Unable to access DWARF register number %d"),
- (int) fs.regs.cfa_reg); /* FIXME */
+ int regnum = dwarf_reg_to_regnum_or_error (gdbarch, fs.regs.cfa_reg);
*regnum_out = regnum;
if (fs.armcc_cfa_offsets_reversed)
static void
clear_pointer_cleanup (void *arg)
{
- void **ptr = arg;
+ void **ptr = (void **) arg;
*ptr = NULL;
}
const gdb_byte *instr;
if (*this_cache)
- return *this_cache;
+ return (struct dwarf2_frame_cache *) *this_cache;
/* Allocate a new cache. */
cache = FRAME_OBSTACK_ZALLOC (struct dwarf2_frame_cache);
entry_pc, fs);
if (fs->regs.cfa_how == CFA_REG_OFFSET
- && (gdbarch_dwarf2_reg_to_regnum (gdbarch, fs->regs.cfa_reg)
+ && (dwarf_reg_to_regnum (gdbarch, fs->regs.cfa_reg)
== gdbarch_sp_regnum (gdbarch)))
{
cache->entry_cfa_sp_offset = fs->regs.cfa_offset;
/* Go through the DWARF2 CFI generated table and save its register
location information in the cache. Note that we don't skip the
return address column; it's perfectly all right for it to
- correspond to a real register. If it doesn't correspond to a
- real register, or if we shouldn't treat it as such,
- gdbarch_dwarf2_reg_to_regnum should be defined to return a number outside
- the range [0, gdbarch_num_regs). */
+ correspond to a real register. */
{
int column; /* CFI speak for "register number". */
for (column = 0; column < fs->regs.num_regs; column++)
{
/* Use the GDB register number as the destination index. */
- int regnum = gdbarch_dwarf2_reg_to_regnum (gdbarch, column);
+ int regnum = dwarf_reg_to_regnum (gdbarch, column);
- /* If there's no corresponding GDB register, ignore it. */
+ /* Protect against a target returning a bad register. */
if (regnum < 0 || regnum >= num_regs)
continue;
return frame_unwind_got_memory (this_frame, regnum, addr);
case DWARF2_FRAME_REG_SAVED_REG:
- realnum
- = gdbarch_dwarf2_reg_to_regnum (gdbarch, cache->reg[regnum].loc.reg);
+ realnum = dwarf_reg_to_regnum_or_error
+ (gdbarch, cache->reg[regnum].loc.reg);
return frame_unwind_got_register (this_frame, regnum, realnum);
case DWARF2_FRAME_REG_SAVED_EXP:
case DWARF2_FRAME_REG_RA_OFFSET:
addr = cache->reg[regnum].loc.offset;
- regnum = gdbarch_dwarf2_reg_to_regnum
+ regnum = dwarf_reg_to_regnum_or_error
(gdbarch, cache->retaddr_reg.loc.reg);
addr += get_frame_register_unsigned (this_frame, regnum);
return frame_unwind_got_address (this_frame, regnum, addr);
return NULL;
}
- p_cie = bsearch (&cie_pointer, cie_table->entries, cie_table->num_entries,
- sizeof (cie_table->entries[0]), bsearch_cie_cmp);
+ p_cie = ((struct dwarf2_cie **)
+ bsearch (&cie_pointer, cie_table->entries, cie_table->num_entries,
+ sizeof (cie_table->entries[0]), bsearch_cie_cmp));
if (p_cie != NULL)
return *p_cie;
return NULL;
CORE_ADDR offset;
CORE_ADDR seek_pc;
- fde_table = objfile_data (objfile, dwarf2_frame_objfile_data);
+ fde_table = ((struct dwarf2_fde_table *)
+ objfile_data (objfile, dwarf2_frame_objfile_data));
if (fde_table == NULL)
{
dwarf2_build_frame_info (objfile);
- fde_table = objfile_data (objfile, dwarf2_frame_objfile_data);
+ fde_table = ((struct dwarf2_fde_table *)
+ objfile_data (objfile, dwarf2_frame_objfile_data));
}
gdb_assert (fde_table != NULL);
continue;
seek_pc = *pc - offset;
- p_fde = bsearch (&seek_pc, fde_table->entries, fde_table->num_entries,
- sizeof (fde_table->entries[0]), bsearch_fde_cmp);
+ p_fde = ((struct dwarf2_fde **)
+ bsearch (&seek_pc, fde_table->entries, fde_table->num_entries,
+ sizeof (fde_table->entries[0]), bsearch_fde_cmp));
if (p_fde != NULL)
{
*pc = (*p_fde)->initial_location + offset;