/* Target-dependent code for HP-UX on PA-RISC.
- Copyright (C) 2002-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of GDB.
#include "solib-pa64.h"
#include "regset.h"
#include "regcache.h"
-#include "exceptions.h"
-
-#include "gdb_string.h"
#define IS_32BIT_TARGET(_gdbarch) \
((gdbarch_tdep (_gdbarch))->bytes_per_address == 4)
extern void _initialize_hppa_hpux_tdep (void);
extern initialize_file_ftype _initialize_hppa_hpux_tdep;
-static int
-in_opd_section (CORE_ADDR pc)
-{
- struct obj_section *s;
- int retval = 0;
-
- s = find_pc_section (pc);
-
- retval = (s != NULL
- && s->the_bfd_section->name != NULL
- && strcmp (s->the_bfd_section->name, ".opd") == 0);
- return (retval);
-}
-
/* Return one if PC is in the call path of a trampoline, else return zero.
Note we return one for *any* call trampoline (long-call, arg-reloc), not
just shared library trampolines (import, export). */
static int
-hppa32_hpux_in_solib_call_trampoline (struct gdbarch *gdbarch,
- CORE_ADDR pc, char *name)
+hppa32_hpux_in_solib_call_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct bound_minimal_symbol minsym;
minsym = lookup_minimal_symbol_by_pc (pc);
if (minsym.minsym
- && strcmp (SYMBOL_LINKAGE_NAME (minsym.minsym), ".stub") == 0)
+ && strcmp (MSYMBOL_LINKAGE_NAME (minsym.minsym), ".stub") == 0)
return 1;
/* Get the unwind descriptor corresponding to PC, return zero
}
static int
-hppa64_hpux_in_solib_call_trampoline (struct gdbarch *gdbarch,
- CORE_ADDR pc, char *name)
+hppa64_hpux_in_solib_call_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
if (! minsym.minsym)
return 0;
- sec = SYMBOL_OBJ_SECTION (minsym.objfile, minsym.minsym)->the_bfd_section;
+ sec = MSYMBOL_OBJ_SECTION (minsym.objfile, minsym.minsym)->the_bfd_section;
if (bfd_get_section_vma (sec->owner, sec) <= pc
&& pc < (bfd_get_section_vma (sec->owner, sec)
ALL_MSYMBOLS (objfile, msymbol)
{
if (MSYMBOL_TYPE (msymbol) == mst_text
- && strcmp (SYMBOL_LINKAGE_NAME (msymbol),
- SYMBOL_LINKAGE_NAME (msym.minsym)) == 0)
+ && strcmp (MSYMBOL_LINKAGE_NAME (msymbol),
+ MSYMBOL_LINKAGE_NAME (msym.minsym)) == 0)
{
function_found = 1;
break;
(curr_inst == 0xeaa0d002))
{
struct bound_minimal_symbol stubsym;
- struct minimal_symbol *libsym;
+ struct bound_minimal_symbol libsym;
stubsym = lookup_minimal_symbol_by_pc (loc);
if (stubsym.minsym == NULL)
return orig_pc == pc ? 0 : pc & ~0x3;
}
- libsym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (stubsym.minsym),
+ libsym = lookup_minimal_symbol (MSYMBOL_LINKAGE_NAME (stubsym.minsym),
NULL, NULL);
- if (libsym == NULL)
+ if (libsym.minsym == NULL)
{
warning (_("Unable to find library symbol for %s."),
- SYMBOL_PRINT_NAME (stubsym.minsym));
+ MSYMBOL_PRINT_NAME (stubsym.minsym));
return orig_pc == pc ? 0 : pc & ~0x3;
}
- return SYMBOL_VALUE (libsym);
+ return MSYMBOL_VALUE (libsym.minsym);
}
/* Does it look like bl X,%rp or bl X,%r0? Another way to do a
faddr = value_as_address (function);
- if (in_opd_section (faddr))
+ if (pc_in_section (faddr, ".opd"))
{
target_read_memory (faddr, buf, sizeof (buf));
return extract_unsigned_integer (&buf[24], 8, byte_order);
gdb_byte buf[2 * HPPA_INSN_SIZE];
int offset;
- find_pc_partial_function (SYMBOL_VALUE_ADDRESS (msym), &name,
+ find_pc_partial_function (MSYMBOL_VALUE_ADDRESS (obj, msym), &name,
&begin, &end);
if (name == NULL || begin == 0 || end == 0)
{
struct objfile *objfile;
struct bound_minimal_symbol funsym;
- struct minimal_symbol *stubsym;
+ struct bound_minimal_symbol stubsym;
CORE_ADDR stubaddr;
funsym = lookup_minimal_symbol_by_pc (funcaddr);
ALL_OBJFILES (objfile)
{
stubsym = lookup_minimal_symbol_solib_trampoline
- (SYMBOL_LINKAGE_NAME (funsym.minsym), objfile);
+ (MSYMBOL_LINKAGE_NAME (funsym.minsym), objfile);
- if (stubsym)
+ if (stubsym.minsym)
{
struct unwind_table_entry *u;
- u = find_unwind_entry (SYMBOL_VALUE (stubsym));
+ u = find_unwind_entry (MSYMBOL_VALUE (stubsym.minsym));
if (u == NULL
|| (u->stub_unwind.stub_type != IMPORT
&& u->stub_unwind.stub_type != IMPORT_SHLIB))
continue;
- stubaddr = SYMBOL_VALUE (stubsym);
+ stubaddr = MSYMBOL_VALUE (stubsym.minsym);
/* If we found an IMPORT stub, then we can stop searching;
if we found an IMPORT_SHLIB, we want to continue the search
find_pc_partial_function (addr, NULL, &func, NULL);
ALL_OBJFILE_MSYMBOLS (sec->objfile, msym)
{
- u = find_unwind_entry (SYMBOL_VALUE_ADDRESS (msym));
- if (func != SYMBOL_VALUE_ADDRESS (msym)
+ u = find_unwind_entry (MSYMBOL_VALUE_ADDRESS (sec->objfile, msym));
+ if (func != MSYMBOL_VALUE_ADDRESS (sec->objfile, msym)
&& (!u || u->stub_unwind.stub_type == 0))
- return SYMBOL_VALUE_ADDRESS (msym);
+ return MSYMBOL_VALUE_ADDRESS (sec->objfile, msym);
}
}
static void
hppa_hpux_supply_ss_narrow (struct regcache *regcache,
- int regnum, const char *save_state)
+ int regnum, const gdb_byte *save_state)
{
- const char *ss_narrow = save_state + HPPA_HPUX_SS_NARROW_OFFSET;
+ const gdb_byte *ss_narrow = save_state + HPPA_HPUX_SS_NARROW_OFFSET;
int i, offset = 0;
for (i = HPPA_R1_REGNUM; i < HPPA_FP0_REGNUM; i++)
static void
hppa_hpux_supply_ss_fpblock (struct regcache *regcache,
- int regnum, const char *save_state)
+ int regnum, const gdb_byte *save_state)
{
- const char *ss_fpblock = save_state + HPPA_HPUX_SS_FPBLOCK_OFFSET;
+ const gdb_byte *ss_fpblock = save_state + HPPA_HPUX_SS_FPBLOCK_OFFSET;
int i, offset = 0;
/* FIXME: We view the floating-point state as 64 single-precision
static void
hppa_hpux_supply_ss_wide (struct regcache *regcache,
- int regnum, const char *save_state)
+ int regnum, const gdb_byte *save_state)
{
- const char *ss_wide = save_state + HPPA_HPUX_SS_WIDE_OFFSET;
+ const gdb_byte *ss_wide = save_state + HPPA_HPUX_SS_WIDE_OFFSET;
int i, offset = 8;
if (register_size (get_regcache_arch (regcache), HPPA_R1_REGNUM) == 4)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- const char *proc_info = regs;
- const char *save_state = proc_info + 8;
+ const gdb_byte *proc_info = regs;
+ const gdb_byte *save_state = proc_info + 8;
ULONGEST flags;
flags = extract_unsigned_integer (save_state + HPPA_HPUX_SS_FLAGS_OFFSET,
/* HP-UX register set. */
-static struct regset hppa_hpux_regset =
+static const struct regset hppa_hpux_regset =
{
NULL,
hppa_hpux_supply_save_state
};
-static const struct regset *
-hppa_hpux_regset_from_core_section (struct gdbarch *gdbarch,
- const char *sect_name, size_t sect_size)
+static void
+hppa_hpux_iterate_over_regset_sections (struct gdbarch *gdbarch,
+ iterate_over_regset_sections_cb *cb,
+ void *cb_data,
+ const struct regcache *regcache)
{
- if (strcmp (sect_name, ".reg") == 0
- && sect_size >= HPPA_HPUX_PA89_SAVE_STATE_SIZE + 8)
- return &hppa_hpux_regset;
-
- return NULL;
+ cb (".reg", HPPA_HPUX_PA89_SAVE_STATE_SIZE + 8, &hppa_hpux_regset,
+ NULL, cb_data);
}
\f
set_gdbarch_skip_permanent_breakpoint
(gdbarch, hppa_skip_permanent_breakpoint);
- set_gdbarch_regset_from_core_section
- (gdbarch, hppa_hpux_regset_from_core_section);
+ set_gdbarch_iterate_over_regset_sections
+ (gdbarch, hppa_hpux_iterate_over_regset_sections);
frame_unwind_append_unwinder (gdbarch, &hppa_hpux_sigtramp_frame_unwind);
}