mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-03 13:23:00 +08:00
Convert fbsd-tdep.c to type-safe registry API
This changes fbsd-tdep.c to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * fbsd-tdep.c (struct fbsd_pspace_data): Add initializers. (fbsd_pspace_data_handle): Move lower. Change type. (get_fbsd_pspace_data): Update. (fbsd_pspace_data_cleanup): Remove. (_initialize_fbsd_tdep): Update.
This commit is contained in:
@ -1,3 +1,11 @@
|
|||||||
|
2019-05-08 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* fbsd-tdep.c (struct fbsd_pspace_data): Add initializers.
|
||||||
|
(fbsd_pspace_data_handle): Move lower. Change type.
|
||||||
|
(get_fbsd_pspace_data): Update.
|
||||||
|
(fbsd_pspace_data_cleanup): Remove.
|
||||||
|
(_initialize_fbsd_tdep): Update.
|
||||||
|
|
||||||
2019-05-08 Tom Tromey <tom@tromey.com>
|
2019-05-08 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* ada-tasks.c (ada_tasks_pspace_data_handle): Change type.
|
* ada-tasks.c (ada_tasks_pspace_data_handle): Change type.
|
||||||
|
@ -445,41 +445,30 @@ get_fbsd_gdbarch_data (struct gdbarch *gdbarch)
|
|||||||
gdbarch_data (gdbarch, fbsd_gdbarch_data_handle));
|
gdbarch_data (gdbarch, fbsd_gdbarch_data_handle));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Per-program-space data for FreeBSD architectures. */
|
|
||||||
static const struct program_space_data *fbsd_pspace_data_handle;
|
|
||||||
|
|
||||||
struct fbsd_pspace_data
|
struct fbsd_pspace_data
|
||||||
{
|
{
|
||||||
/* Offsets in the runtime linker's 'Obj_Entry' structure. */
|
/* Offsets in the runtime linker's 'Obj_Entry' structure. */
|
||||||
LONGEST off_linkmap;
|
LONGEST off_linkmap = 0;
|
||||||
LONGEST off_tlsindex;
|
LONGEST off_tlsindex = 0;
|
||||||
bool rtld_offsets_valid;
|
bool rtld_offsets_valid = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Per-program-space data for FreeBSD architectures. */
|
||||||
|
static const struct program_space_key<fbsd_pspace_data>
|
||||||
|
fbsd_pspace_data_handle;
|
||||||
|
|
||||||
static struct fbsd_pspace_data *
|
static struct fbsd_pspace_data *
|
||||||
get_fbsd_pspace_data (struct program_space *pspace)
|
get_fbsd_pspace_data (struct program_space *pspace)
|
||||||
{
|
{
|
||||||
struct fbsd_pspace_data *data;
|
struct fbsd_pspace_data *data;
|
||||||
|
|
||||||
data = ((struct fbsd_pspace_data *)
|
data = fbsd_pspace_data_handle.get (pspace);
|
||||||
program_space_data (pspace, fbsd_pspace_data_handle));
|
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
{
|
data = fbsd_pspace_data_handle.emplace (pspace);
|
||||||
data = XCNEW (struct fbsd_pspace_data);
|
|
||||||
set_program_space_data (pspace, fbsd_pspace_data_handle, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The cleanup callback for FreeBSD architecture per-program-space data. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
fbsd_pspace_data_cleanup (struct program_space *pspace, void *data)
|
|
||||||
{
|
|
||||||
xfree (data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This is how we want PTIDs from core files to be printed. */
|
/* This is how we want PTIDs from core files to be printed. */
|
||||||
|
|
||||||
static std::string
|
static std::string
|
||||||
@ -2100,6 +2089,4 @@ _initialize_fbsd_tdep (void)
|
|||||||
{
|
{
|
||||||
fbsd_gdbarch_data_handle =
|
fbsd_gdbarch_data_handle =
|
||||||
gdbarch_data_register_post_init (init_fbsd_gdbarch_data);
|
gdbarch_data_register_post_init (init_fbsd_gdbarch_data);
|
||||||
fbsd_pspace_data_handle
|
|
||||||
= register_program_space_data_with_cleanup (NULL, fbsd_pspace_data_cleanup);
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user