diff options
author | Tom Tromey <tom@tromey.com> | 2019-05-01 15:31:10 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-05-08 16:01:54 -0600 |
commit | 91d3055d8b77d56cf64f85ace4237a0ccca98a4a (patch) | |
tree | df8fe47cc1437e34f812e9730c100655711812e5 | |
parent | 31930bd34d15dd22c5ef47b46d8bc95a5ec34d0e (diff) | |
download | gdb-91d3055d8b77d56cf64f85ace4237a0ccca98a4a.zip gdb-91d3055d8b77d56cf64f85ace4237a0ccca98a4a.tar.gz gdb-91d3055d8b77d56cf64f85ace4237a0ccca98a4a.tar.bz2 |
Convert mdebugread.c to type-safe registry API
This changes mdebugread.c to use the type-safe registry API.
gdb/ChangeLog
2019-05-08 Tom Tromey <tom@tromey.com>
* mdebugread.c (basic_type_data): Change type.
(basic_type, _initialize_mdebugread): Update.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/mdebugread.c | 11 |
2 files changed, 10 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index edda8c9..4f1859c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2019-05-08 Tom Tromey <tom@tromey.com> + * mdebugread.c (basic_type_data): Change type. + (basic_type, _initialize_mdebugread): Update. + +2019-05-08 Tom Tromey <tom@tromey.com> + * common/gdb_unique_ptr.h (struct noop_deleter): New. 2019-05-08 Tom Tromey <tom@tromey.com> diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 35e7890..2b54fef 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -1358,14 +1358,15 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, /* Basic types. */ -static const struct objfile_data *basic_type_data; +static const struct objfile_key<struct type *, + gdb::noop_deleter<struct type *>> + basic_type_data; static struct type * basic_type (int bt, struct objfile *objfile) { struct gdbarch *gdbarch = get_objfile_arch (objfile); - struct type **map_bt - = (struct type **) objfile_data (objfile, basic_type_data); + struct type **map_bt = basic_type_data.get (objfile); struct type *tp; if (bt >= btMax) @@ -1375,7 +1376,7 @@ basic_type (int bt, struct objfile *objfile) { map_bt = OBSTACK_CALLOC (&objfile->objfile_obstack, btMax, struct type *); - set_objfile_data (objfile, basic_type_data, map_bt); + basic_type_data.set (objfile, map_bt); } if (map_bt[bt]) @@ -4811,8 +4812,6 @@ elfmdebug_build_psymtabs (struct objfile *objfile, void _initialize_mdebugread (void) { - basic_type_data = register_objfile_data (); - mdebug_register_index = register_symbol_register_impl (LOC_REGISTER, &mdebug_register_funcs); mdebug_regparm_index |