/* SPU target-dependent code for GDB, the GNU debugger.
- Copyright (C) 2006-2018 Free Software Foundation, Inc.
+ Copyright (C) 2006-2019 Free Software Foundation, Inc.
Contributed by Ulrich Weigand <uweigand@de.ibm.com>.
Based on a port by Sid Manning <sid@us.ibm.com>.
a target address. The overlay section is mapped iff the target
integer at this location equals MAPPED_VAL. */
-static const struct objfile_data *spu_overlay_data;
-
struct spu_overlay_table
{
CORE_ADDR mapped_ptr;
CORE_ADDR mapped_val;
};
+static objfile_key<spu_overlay_table,
+ gdb::noop_deleter<spu_overlay_table>> spu_overlay_data;
+
/* Retrieve the overlay table for OBJFILE. If not already cached, read
the _ovly_table data structure from the target and initialize the
spu_overlay_table data structure from it. */
gdb_byte *ovly_table;
int i;
- tbl = (struct spu_overlay_table *) objfile_data (objfile, spu_overlay_data);
+ tbl = spu_overlay_data.get (objfile);
if (tbl)
return tbl;
}
xfree (ovly_table);
- set_objfile_data (objfile, spu_overlay_data, tbl);
+ spu_overlay_data.set (objfile, tbl);
return tbl;
}
/* All sections. */
else
{
- struct objfile *objfile;
-
- ALL_OBJSECTIONS (objfile, osect)
- if (section_is_overlay (osect))
- spu_overlay_update_osect (osect);
+ for (objfile *objfile : current_program_space->objfiles ())
+ ALL_OBJFILE_OSECTIONS (objfile, osect)
+ if (section_is_overlay (osect))
+ spu_overlay_update_osect (osect);
}
}
struct obj_section *osect;
/* If we've already touched this file, do nothing. */
- if (!objfile || objfile_data (objfile, spu_overlay_data) != NULL)
+ if (!objfile || spu_overlay_data.get (objfile) != NULL)
return;
/* Consider only SPU objfiles. */
if (cust != NULL)
{
const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (cust);
- struct block *block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+ const struct block *block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
struct symbol *sym;
struct symtab_and_line sal;
{
struct gdbarch *gdbarch = get_frame_arch (frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- struct objfile *obj;
if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu)
return NULL;
- ALL_OBJFILES (obj)
+ for (objfile *obj : current_program_space->objfiles ())
{
if (obj->sections != obj->sections_end
&& SPUADDR_SPU (obj_section_addr (obj->sections)) == tdep->id)
if (current_uiout->is_mi_like_p ())
{
- current_uiout->field_int ("signal1_pending", signal1_pending);
+ current_uiout->field_signed ("signal1_pending", signal1_pending);
current_uiout->field_fmt ("signal1", "0x%s", phex_nz (signal1, 4));
- current_uiout->field_int ("signal1_type", signal1_type);
- current_uiout->field_int ("signal2_pending", signal2_pending);
+ current_uiout->field_signed ("signal1_type", signal1_type);
+ current_uiout->field_signed ("signal2_pending", signal2_pending);
current_uiout->field_fmt ("signal2", "0x%s", phex_nz (signal2, 4));
- current_uiout->field_int ("signal2_type", signal2_type);
+ current_uiout->field_signed ("signal2_type", signal2_type);
}
else
{
if (spu_mfc_opcode[mfc_cmd_opcode])
current_uiout->field_string ("opcode", spu_mfc_opcode[mfc_cmd_opcode]);
else
- current_uiout->field_int ("opcode", mfc_cmd_opcode);
+ current_uiout->field_signed ("opcode", mfc_cmd_opcode);
- current_uiout->field_int ("tag", mfc_cmd_tag);
- current_uiout->field_int ("tid", tclass_id);
- current_uiout->field_int ("rid", rclass_id);
+ current_uiout->field_signed ("tag", mfc_cmd_tag);
+ current_uiout->field_signed ("tid", tclass_id);
+ current_uiout->field_signed ("rid", rclass_id);
if (ea_valid_p)
current_uiout->field_fmt ("ea", "0x%s", phex (mfc_ea, 8));
/* Add ourselves to objfile event chain. */
gdb::observers::new_objfile.attach (spu_overlay_new_objfile);
- spu_overlay_data = register_objfile_data ();
/* Install spu stop-on-load handler. */
gdb::observers::new_objfile.attach (spu_catch_start);
/* Add various "info spu" commands. */
add_cmd ("event", class_info, info_spu_event_command,
- _("Display SPU event facility status.\n"),
+ _("Display SPU event facility status."),
&infospucmdlist);
add_cmd ("signal", class_info, info_spu_signal_command,
- _("Display SPU signal notification facility status.\n"),
+ _("Display SPU signal notification facility status."),
&infospucmdlist);
add_cmd ("mailbox", class_info, info_spu_mailbox_command,
- _("Display SPU mailbox facility status.\n"),
+ _("Display SPU mailbox facility status."),
&infospucmdlist);
add_cmd ("dma", class_info, info_spu_dma_command,
- _("Display MFC DMA status.\n"),
+ _("Display MFC DMA status."),
&infospucmdlist);
add_cmd ("proxydma", class_info, info_spu_proxydma_command,
- _("Display MFC Proxy-DMA status.\n"),
+ _("Display MFC Proxy-DMA status."),
&infospucmdlist);
}