aboutsummaryrefslogtreecommitdiff
path: root/gdb/hppa-tdep.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-05-01 15:44:00 -0600
committerTom Tromey <tom@tromey.com>2019-05-08 16:01:54 -0600
commit9a73f0ad6ca2a9c027f30fca3d79fa958784dcbf (patch)
tree32155ad7b1ccf2fdd080a271f8d320c22e0cfbc2 /gdb/hppa-tdep.c
parent8127a2fab5780f27a1c9998b0be4d8b5c28c1603 (diff)
downloadgdb-9a73f0ad6ca2a9c027f30fca3d79fa958784dcbf.zip
gdb-9a73f0ad6ca2a9c027f30fca3d79fa958784dcbf.tar.gz
gdb-9a73f0ad6ca2a9c027f30fca3d79fa958784dcbf.tar.bz2
Convert hppa-tdep.c to type-safe registry API
This changes hppa-tdep.c to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * hppa-tdep.c (hppa_objfile_priv_data): Change type. (hppa_init_objfile_priv_data, read_unwind_info) (find_unwind_entry, _initialize_hppa_tdep): Update.
Diffstat (limited to 'gdb/hppa-tdep.c')
-rw-r--r--gdb/hppa-tdep.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index d2b3336..be30359 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -84,7 +84,9 @@ struct hppa_objfile_private
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;
/* Get at various relevent fields of an instruction word. */
#define MASK_5 0x1f
@@ -208,7 +210,7 @@ hppa_init_objfile_priv_data (struct objfile *objfile)
hppa_objfile_private *priv
= OBSTACK_ZALLOC (&objfile->objfile_obstack, hppa_objfile_private);
- set_objfile_data (objfile, hppa_objfile_priv_data, priv);
+ hppa_objfile_priv_data.set (objfile, priv);
return priv;
}
@@ -466,8 +468,7 @@ read_unwind_info (struct objfile *objfile)
compare_unwind_entries);
/* Keep a pointer to the unwind information. */
- obj_private = (struct hppa_objfile_private *)
- objfile_data (objfile, hppa_objfile_priv_data);
+ obj_private = hppa_objfile_priv_data.get (objfile);
if (obj_private == NULL)
obj_private = hppa_init_objfile_priv_data (objfile);
@@ -501,16 +502,14 @@ find_unwind_entry (CORE_ADDR pc)
{
struct hppa_unwind_info *ui;
ui = NULL;
- priv = ((struct hppa_objfile_private *)
- objfile_data (objfile, hppa_objfile_priv_data));
+ priv = hppa_objfile_priv_data.get (objfile);
if (priv)
ui = ((struct hppa_objfile_private *) priv)->unwind_info;
if (!ui)
{
read_unwind_info (objfile);
- priv = ((struct hppa_objfile_private *)
- objfile_data (objfile, hppa_objfile_priv_data));
+ priv = hppa_objfile_priv_data.get (objfile);
if (priv == NULL)
error (_("Internal error reading unwind information."));
ui = ((struct hppa_objfile_private *) priv)->unwind_info;
@@ -3174,8 +3173,6 @@ _initialize_hppa_tdep (void)
{
gdbarch_register (bfd_arch_hppa, hppa_gdbarch_init, hppa_dump_tdep);
- hppa_objfile_priv_data = register_objfile_data ();
-
add_cmd ("unwind", class_maintenance, unwind_command,
_("Print unwind table entry at given address."),
&maintenanceprintlist);