mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-20 01:50:24 +08:00
Change spu-tdep.c to use type-safe registry
This changes spu-tdep.c to use the type-safe registry. 2019-07-10 Tom Tromey <tromey@adacore.com> * spu-tdep.c (spu_overlay_data): Change type. (spu_get_overlay_table, spu_overlay_new_objfile) (_initialize_spu_tdep): Update.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2019-07-10 Tom Tromey <tromey@adacore.com>
|
||||||
|
|
||||||
|
* spu-tdep.c (spu_overlay_data): Change type.
|
||||||
|
(spu_get_overlay_table, spu_overlay_new_objfile)
|
||||||
|
(_initialize_spu_tdep): Update.
|
||||||
|
|
||||||
2019-07-10 Tom Tromey <tromey@adacore.com>
|
2019-07-10 Tom Tromey <tromey@adacore.com>
|
||||||
|
|
||||||
* gdb-stabs.h (struct dbx_symfile_info): Add initializers and
|
* gdb-stabs.h (struct dbx_symfile_info): Add initializers and
|
||||||
|
@ -1767,14 +1767,15 @@ gdb_print_insn_spu (bfd_vma memaddr, struct disassemble_info *info)
|
|||||||
a target address. The overlay section is mapped iff the target
|
a target address. The overlay section is mapped iff the target
|
||||||
integer at this location equals MAPPED_VAL. */
|
integer at this location equals MAPPED_VAL. */
|
||||||
|
|
||||||
static const struct objfile_data *spu_overlay_data;
|
|
||||||
|
|
||||||
struct spu_overlay_table
|
struct spu_overlay_table
|
||||||
{
|
{
|
||||||
CORE_ADDR mapped_ptr;
|
CORE_ADDR mapped_ptr;
|
||||||
CORE_ADDR mapped_val;
|
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
|
/* Retrieve the overlay table for OBJFILE. If not already cached, read
|
||||||
the _ovly_table data structure from the target and initialize the
|
the _ovly_table data structure from the target and initialize the
|
||||||
spu_overlay_table data structure from it. */
|
spu_overlay_table data structure from it. */
|
||||||
@ -1791,7 +1792,7 @@ spu_get_overlay_table (struct objfile *objfile)
|
|||||||
gdb_byte *ovly_table;
|
gdb_byte *ovly_table;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
tbl = (struct spu_overlay_table *) objfile_data (objfile, spu_overlay_data);
|
tbl = spu_overlay_data.get (objfile);
|
||||||
if (tbl)
|
if (tbl)
|
||||||
return tbl;
|
return tbl;
|
||||||
|
|
||||||
@ -1843,7 +1844,7 @@ spu_get_overlay_table (struct objfile *objfile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
xfree (ovly_table);
|
xfree (ovly_table);
|
||||||
set_objfile_data (objfile, spu_overlay_data, tbl);
|
spu_overlay_data.set (objfile, tbl);
|
||||||
return tbl;
|
return tbl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1901,7 +1902,7 @@ spu_overlay_new_objfile (struct objfile *objfile)
|
|||||||
struct obj_section *osect;
|
struct obj_section *osect;
|
||||||
|
|
||||||
/* If we've already touched this file, do nothing. */
|
/* 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;
|
return;
|
||||||
|
|
||||||
/* Consider only SPU objfiles. */
|
/* Consider only SPU objfiles. */
|
||||||
@ -2765,7 +2766,6 @@ _initialize_spu_tdep (void)
|
|||||||
|
|
||||||
/* Add ourselves to objfile event chain. */
|
/* Add ourselves to objfile event chain. */
|
||||||
gdb::observers::new_objfile.attach (spu_overlay_new_objfile);
|
gdb::observers::new_objfile.attach (spu_overlay_new_objfile);
|
||||||
spu_overlay_data = register_objfile_data ();
|
|
||||||
|
|
||||||
/* Install spu stop-on-load handler. */
|
/* Install spu stop-on-load handler. */
|
||||||
gdb::observers::new_objfile.attach (spu_catch_start);
|
gdb::observers::new_objfile.attach (spu_catch_start);
|
||||||
|
Reference in New Issue
Block a user