that separately and make this static. The solib data is probably hpux-
specific, so we can create a separate extern objfile_data that is registered
by hppa-hpux-tdep.c and shared with pa64solib.c and somsolib.c. */
that separately and make this static. The solib data is probably hpux-
specific, so we can create a separate extern objfile_data that is registered
by hppa-hpux-tdep.c and shared with pa64solib.c and somsolib.c. */
-static const struct objfile_data *hppa_objfile_priv_data = NULL;
+static const struct objfile_key<hppa_objfile_private,
+ gdb::noop_deleter<hppa_objfile_private>>
+ hppa_objfile_priv_data;
- priv = (struct hppa_objfile_private *)
- obstack_alloc (&objfile->objfile_obstack,
- sizeof (struct hppa_objfile_private));
- set_objfile_data (objfile, hppa_objfile_priv_data, priv);
- memset (priv, 0, sizeof (*priv));
+ hppa_objfile_priv_data.set (objfile, priv);
- const struct unwind_table_entry *a = arg1;
- const struct unwind_table_entry *b = arg2;
+ const struct unwind_table_entry *a = (const struct unwind_table_entry *) arg1;
+ const struct unwind_table_entry *b = (const struct unwind_table_entry *) arg2;
ui = (struct hppa_unwind_info *) obstack_alloc (&objfile->objfile_obstack,
sizeof (struct hppa_unwind_info));
ui = (struct hppa_unwind_info *) obstack_alloc (&objfile->objfile_obstack,
sizeof (struct hppa_unwind_info));
/* For reasons unknown the HP PA64 tools generate multiple unwinder
sections in a single executable. So we just iterate over every
/* For reasons unknown the HP PA64 tools generate multiple unwinder
sections in a single executable. So we just iterate over every
to do a lookup with bfd_get_section_by_name.
First determine the total size of the unwind tables so that we
to do a lookup with bfd_get_section_by_name.
First determine the total size of the unwind tables so that we
if (strcmp (unwind_sec->name, "$UNWIND_START$") == 0
|| strcmp (unwind_sec->name, ".PARISC.unwind") == 0)
{
if (strcmp (unwind_sec->name, "$UNWIND_START$") == 0
|| strcmp (unwind_sec->name, ".PARISC.unwind") == 0)
{
if (strcmp (unwind_sec->name, "$UNWIND_START$") == 0
|| strcmp (unwind_sec->name, ".PARISC.unwind") == 0)
{
if (strcmp (unwind_sec->name, "$UNWIND_START$") == 0
|| strcmp (unwind_sec->name, ".PARISC.unwind") == 0)
{
unwind_entries = unwind_size / UNWIND_ENTRY_SIZE;
internalize_unwinds (objfile, &ui->table[index], unwind_sec,
unwind_entries = unwind_size / UNWIND_ENTRY_SIZE;
internalize_unwinds (objfile, &ui->table[index], unwind_sec,
- ALL_OBJFILES (objfile)
- {
- struct hppa_unwind_info *ui;
- ui = NULL;
- priv = objfile_data (objfile, hppa_objfile_priv_data);
- if (priv)
- ui = ((struct hppa_objfile_private *) priv)->unwind_info;
+ for (objfile *objfile : current_program_space->objfiles ())
+ {
+ struct hppa_unwind_info *ui;
+ ui = NULL;
+ priv = hppa_objfile_priv_data.get (objfile);
+ if (priv)
+ ui = ((struct hppa_objfile_private *) priv)->unwind_info;
- if (!ui)
- {
- read_unwind_info (objfile);
- priv = objfile_data (objfile, hppa_objfile_priv_data);
- if (priv == NULL)
- error (_("Internal error reading unwind information."));
- ui = ((struct hppa_objfile_private *) priv)->unwind_info;
- }
+ if (!ui)
+ {
+ read_unwind_info (objfile);
+ priv = hppa_objfile_priv_data.get (objfile);
+ if (priv == NULL)
+ error (_("Internal error reading unwind information."));
+ ui = ((struct hppa_objfile_private *) priv)->unwind_info;
+ }
- if (ui->cache
- && pc >= ui->cache->region_start
- && pc <= ui->cache->region_end)
- {
- if (hppa_debug)
- fprintf_unfiltered (gdb_stdlog, "%s (cached) }\n",
- hex_string ((uintptr_t) ui->cache));
- return ui->cache;
- }
+ if (ui->cache
+ && pc >= ui->cache->region_start
+ && pc <= ui->cache->region_end)
+ {
+ if (hppa_debug)
+ fprintf_unfiltered (gdb_stdlog, "%s (cached) }\n",
+ hex_string ((uintptr_t) ui->cache));
+ return ui->cache;
+ }
- while (first <= last)
- {
- middle = (first + last) / 2;
- if (pc >= ui->table[middle].region_start
- && pc <= ui->table[middle].region_end)
- {
- ui->cache = &ui->table[middle];
- if (hppa_debug)
- fprintf_unfiltered (gdb_stdlog, "%s }\n",
- hex_string ((uintptr_t) ui->cache));
- return &ui->table[middle];
- }
+ while (first <= last)
+ {
+ middle = (first + last) / 2;
+ if (pc >= ui->table[middle].region_start
+ && pc <= ui->table[middle].region_end)
+ {
+ ui->cache = &ui->table[middle];
+ if (hppa_debug)
+ fprintf_unfiltered (gdb_stdlog, "%s }\n",
+ hex_string ((uintptr_t) ui->cache));
+ return &ui->table[middle];
+ }
-static const unsigned char *
-hppa_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pc, int *len)
-{
- static const unsigned char breakpoint[] = {0x00, 0x01, 0x00, 0x04};
- (*len) = sizeof (breakpoint);
- return breakpoint;
-}
+constexpr gdb_byte hppa_break_insn[] = {0x00, 0x01, 0x00, 0x04};
+
+typedef BP_MANIPULATION (hppa_break_insn) hppa_breakpoint;
/* Return the name of a register. */
static const char *
hppa32_register_name (struct gdbarch *gdbarch, int i)
{
/* Return the name of a register. */
static const char *
hppa32_register_name (struct gdbarch *gdbarch, int i)
{
"flags", "r1", "rp", "r3",
"r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11",
"flags", "r1", "rp", "r3",
"r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11",
"flags", "r1", "rp", "r3",
"r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11",
"flags", "r1", "rp", "r3",
"r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11",
hppa64_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
{
/* The general registers and the sar are the same in both sets. */
hppa64_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
{
/* The general registers and the sar are the same in both sets. */
return reg;
/* fr4-fr31 are mapped from 72 in steps of 2. */
if (reg >= 72 && reg < 72 + 28 * 2 && !(reg & 1))
return HPPA64_FP4_REGNUM + (reg - 72) / 2;
return reg;
/* fr4-fr31 are mapped from 72 in steps of 2. */
if (reg >= 72 && reg < 72 + 28 * 2 && !(reg & 1))
return HPPA64_FP4_REGNUM + (reg - 72) / 2;
hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct regcache *regcache, CORE_ADDR bp_addr,
int nargs, struct value **args, CORE_ADDR sp,
hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct regcache *regcache, CORE_ADDR bp_addr,
int nargs, struct value **args, CORE_ADDR sp,
/* Two passes. First pass computes the location of everything,
second pass writes the bytes out. */
int write_pass;
/* Two passes. First pass computes the location of everything,
second pass writes the bytes out. */
int write_pass;
- regcache_cooked_write (regcache, grreg, param_val);
- regcache_cooked_write (regcache, fpLreg, param_val);
+ regcache->cooked_write (grreg, param_val);
+ regcache->cooked_write (fpLreg, param_val);
- regcache_cooked_write (regcache, fpreg, param_val);
- regcache_cooked_write (regcache, fpreg + 1,
- param_val + 4);
+ regcache->cooked_write (fpreg, param_val);
+ regcache->cooked_write (fpreg + 1, param_val + 4);
regcache_cooked_write_unsigned (regcache, 28, struct_addr);
gp = tdep->find_global_pointer (gdbarch, function);
regcache_cooked_write_unsigned (regcache, 28, struct_addr);
gp = tdep->find_global_pointer (gdbarch, function);
hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct regcache *regcache, CORE_ADDR bp_addr,
int nargs, struct value **args, CORE_ADDR sp,
hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct regcache *regcache, CORE_ADDR bp_addr,
int nargs, struct value **args, CORE_ADDR sp,
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
passed in floating-point registers, are passed in
the right halves of the floating point registers;
the left halves are unused." */
passed in floating-point registers, are passed in
the right halves of the floating point registers;
the left halves are unused." */
- regcache_cooked_write_part (regcache, regnum, offset % 8,
- len, value_contents (arg));
+ regcache->cooked_write_part (regnum, offset % 8, len,
+ value_contents (arg));
- regcache_cooked_write_part (regcache, regnum,
- offset % 8, min (len, 8), valbuf);
- offset += min (len, 8);
- valbuf += min (len, 8);
- len -= min (len, 8);
+ regcache->cooked_write_part (regnum, offset % 8, std::min (len, 8),
+ valbuf);
+ offset += std::min (len, 8);
+ valbuf += std::min (len, 8);
+ len -= std::min (len, 8);
/* Allocate the outgoing parameter area. Make sure the outgoing
parameter area is multiple of 16 bytes in length. */
/* Allocate the outgoing parameter area. Make sure the outgoing
parameter area is multiple of 16 bytes in length. */
/* Allocate 32-bytes of scratch space. The documentation doesn't
mention this, but it seems to be needed. */
/* Allocate 32-bytes of scratch space. The documentation doesn't
mention this, but it seems to be needed. */
regcache_cooked_write_unsigned (regcache, HPPA_RET0_REGNUM, struct_addr);
/* Set up GR27 (%dp) to hold the global pointer (gp). */
regcache_cooked_write_unsigned (regcache, HPPA_RET0_REGNUM, struct_addr);
/* Set up GR27 (%dp) to hold the global pointer (gp). */
- regcache_cooked_read_part (regcache, reg, 4 - part,
- part, readbuf);
+ regcache->cooked_read_part (reg, 4 - part, part, readbuf);
- regcache_cooked_write_part (regcache, reg, 4 - part,
- part, writebuf);
+ regcache->cooked_write_part (reg, 4 - part, part, writebuf);
- regcache_cooked_read_part (regcache, regnum, offset,
- min (len, 8), readbuf);
- readbuf += min (len, 8);
- len -= min (len, 8);
+ regcache->cooked_read_part (regnum, offset, std::min (len, 8),
+ readbuf);
+ readbuf += std::min (len, 8);
+ len -= std::min (len, 8);
- regcache_cooked_write_part (regcache, regnum, offset,
- min (len, 8), writebuf);
- writebuf += min (len, 8);
- len -= min (len, 8);
+ regcache->cooked_write_part (regnum, offset, std::min (len, 8),
+ writebuf);
+ writebuf += std::min (len, 8);
+ len -= std::min (len, 8);
- regcache_cooked_read_unsigned (regcache, HPPA_IPSW_REGNUM, &ipsw);
- regcache_cooked_read_unsigned (regcache, HPPA_PCOQ_HEAD_REGNUM, &pc);
+ regcache->cooked_read (HPPA_IPSW_REGNUM, &ipsw);
+ regcache->cooked_read (HPPA_PCOQ_HEAD_REGNUM, &pc);
/* If the current instruction is nullified, then we are effectively
still executing the previous instruction. Pretend we are still
/* If the current instruction is nullified, then we are effectively
still executing the previous instruction. Pretend we are still
/* addil high21,%r30; ldo low11,(%r1),%r30)
save high bits in save_high21 for later use. */
/* addil high21,%r30; ldo low11,(%r1),%r30)
save high bits in save_high21 for later use. */
- stw: 0x1a, store a word from a general register.
- stwm: 0x1b, store a word from a general register and perform base
- stw: 0x1a, store a word from a general register.
- stwm: 0x1b, store a word from a general register and perform base
its prologue and make prologue instructions available for delay slot
filling. The end result is user code gets mixed in with the prologue
and a prologue instruction may be in the delay slot of the first branch
its prologue and make prologue instructions available for delay slot
filling. The end result is user code gets mixed in with the prologue
and a prologue instruction may be in the delay slot of the first branch
because of limitations in the unwind descriptor mechanism we may
have went too far into user code looking for the save of a register
that does not exist. So, if there registers we expected to be saved
because of limitations in the unwind descriptor mechanism we may
have went too far into user code looking for the save of a register
that does not exist. So, if there registers we expected to be saved
may be the first instruction of the prologue. If that happens, then
the instruction skipping code has a bug that needs to be fixed. */
if (post_prologue_pc != 0)
may be the first instruction of the prologue. If that happens, then
the instruction skipping code has a bug that needs to be fixed. */
if (post_prologue_pc != 0)
if (hppa_debug)
fprintf_unfiltered (gdb_stdlog, "base=%s (cached) }",
paddress (gdbarch, ((struct hppa_frame_cache *)*this_cache)->base));
if (hppa_debug)
fprintf_unfiltered (gdb_stdlog, "base=%s (cached) }",
paddress (gdbarch, ((struct hppa_frame_cache *)*this_cache)->base));
| (((inst >> 4) & 0x3ff) << 3);
else if ((inst >> 26) == 0x03)
offset = hppa_low_hppa_sign_extend (inst & 0x1f, 5);
| (((inst >> 4) & 0x3ff) << 3);
else if ((inst >> 26) == 0x03)
offset = hppa_low_hppa_sign_extend (inst & 0x1f, 5);
if (hppa_debug)
fprintf_unfiltered (gdb_stdlog, "base=%s }",
paddress (gdbarch, ((struct hppa_frame_cache *)*this_cache)->base));
if (hppa_debug)
fprintf_unfiltered (gdb_stdlog, "base=%s }",
paddress (gdbarch, ((struct hppa_frame_cache *)*this_cache)->base));
struct unwind_table_entry *u;
info = hppa_frame_cache (this_frame, this_cache);
struct unwind_table_entry *u;
info = hppa_frame_cache (this_frame, this_cache);
- if (gdbarch_osabi (gdbarch) == GDB_OSABI_HPUX_SOM)
- {
- /* HPUX uses export stubs in function calls; the export stub clobbers
- the return value of the caller, and, later restores it from the
- stack. */
- u = find_unwind_entry (get_frame_pc (this_frame));
-
- if (u && u->stub_unwind.stub_type == EXPORT)
- {
- info->saved_regs[HPPA_PCOQ_HEAD_REGNUM].addr = info->base - 24;
-
- return info;
- }
- }
-
/* By default we assume that stubs do not change the rp. */
info->saved_regs[HPPA_PCOQ_HEAD_REGNUM].realreg = HPPA_RP_REGNUM;
/* By default we assume that stubs do not change the rp. */
info->saved_regs[HPPA_PCOQ_HEAD_REGNUM].realreg = HPPA_RP_REGNUM;
hppa_lookup_stub_minimal_symbol (const char *name,
enum unwind_stub_types stub_type)
{
hppa_lookup_stub_minimal_symbol (const char *name,
enum unwind_stub_types stub_type)
{
- if (strcmp (MSYMBOL_LINKAGE_NAME (msym), name) == 0)
- {
- struct unwind_table_entry *u;
-
- u = find_unwind_entry (MSYMBOL_VALUE (msym));
- if (u != NULL && u->stub_unwind.stub_type == stub_type)
+ for (minimal_symbol *msym : objfile->msymbols ())
+ {
+ if (strcmp (msym->linkage_name (), name) == 0)
- result.objfile = objfile;
- result.minsym = msym;
- return result;
+ struct unwind_table_entry *u;
+
+ u = find_unwind_entry (MSYMBOL_VALUE (msym));
+ if (u != NULL && u->stub_unwind.stub_type == stub_type)
+ {
+ result.objfile = objfile;
+ result.minsym = msym;
+ return result;
+ }
printf_unfiltered ("unwind_table_entry (%s):\n", host_address_to_string (u));
printf_unfiltered ("\tregion_start = %s\n", hex_string (u->region_start));
printf_unfiltered ("unwind_table_entry (%s):\n", host_address_to_string (u));
printf_unfiltered ("\tregion_start = %s\n", hex_string (u->region_start));
int regnum, gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST tmp;
enum register_status status;
int regnum, gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST tmp;
enum register_status status;
-
- /* Try to determine the ABI of the object we are loading. */
- if (info.abfd != NULL && info.osabi == GDB_OSABI_UNKNOWN)
- {
- /* If it's a SOM file, assume it's HP/UX SOM. */
- if (bfd_get_flavour (info.abfd) == bfd_target_som_flavour)
- info.osabi = GDB_OSABI_HPUX_SOM;
- }
/* find a candidate among the list of pre-declared architectures. */
arches = gdbarch_list_lookup_by_info (arches, &info);
/* find a candidate among the list of pre-declared architectures. */
arches = gdbarch_list_lookup_by_info (arches, &info);
/* Helper for function argument information. */
set_gdbarch_fetch_pointer_argument (gdbarch, hppa_fetch_pointer_argument);
/* Helper for function argument information. */
set_gdbarch_fetch_pointer_argument (gdbarch, hppa_fetch_pointer_argument);
/* When a hardware watchpoint triggers, we'll move the inferior past
it by removing all eventpoints; stepping past the instruction
that caused the trigger; reinserting eventpoints; and checking
/* When a hardware watchpoint triggers, we'll move the inferior past
it by removing all eventpoints; stepping past the instruction
that caused the trigger; reinserting eventpoints; and checking
- set_gdbarch_breakpoint_from_pc (gdbarch, hppa_breakpoint_from_pc);
+ set_gdbarch_breakpoint_kind_from_pc (gdbarch, hppa_breakpoint::kind_from_pc);
+ set_gdbarch_sw_breakpoint_from_kind (gdbarch, hppa_breakpoint::bp_from_kind);
set_gdbarch_pseudo_register_read (gdbarch, hppa_pseudo_register_read);
/* Frame unwind methods. */
set_gdbarch_pseudo_register_read (gdbarch, hppa_pseudo_register_read);
/* Frame unwind methods. */
set_gdbarch_unwind_pc (gdbarch, hppa_unwind_pc);
/* Hook in ABI-specific overrides, if they have been registered. */
set_gdbarch_unwind_pc (gdbarch, hppa_unwind_pc);
/* Hook in ABI-specific overrides, if they have been registered. */
add_cmd ("unwind", class_maintenance, unwind_command,
_("Print unwind table entry at given address."),
&maintenanceprintlist);
add_cmd ("unwind", class_maintenance, unwind_command,
_("Print unwind table entry at given address."),
&maintenanceprintlist);