From 4fccbbeb39ff17365903fba2c81ff76f339ee4b4 Mon Sep 17 00:00:00 2001 From: cagney Date: Mon, 4 Aug 2003 22:24:43 +0000 Subject: [PATCH] 2003-08-04 Andrew Cagney * gdbarch.sh (gdbarch_data_free_ftype): Delete declaration. (register_gdbarch_data): Delete "free" parameter. Update comments. * gdbarch.h, gdbarch.c: Re-generate. * reggroups.c (_initialize_reggroup): Update. * gnu-v3-abi.c (init_gnuv3_ops): Update. * frame-base.c (_initialize_frame_base): Update. * frame-unwind.c (_initialize_frame_unwind): Update. * user-regs.c (_initialize_user_regs): Update. * remote.c (_initialize_remote): Update. * regcache.c (_initialize_regcache): Update. --- gdb/ChangeLog | 12 ++++++++++++ gdb/frame-base.c | 2 +- gdb/frame-unwind.c | 2 +- gdb/gdbarch.c | 3 +-- gdb/gdbarch.h | 11 ++++++----- gdb/gdbarch.sh | 14 +++++++------- gdb/gnu-v3-abi.c | 2 +- gdb/regcache.c | 2 +- gdb/reggroups.c | 2 +- gdb/remote.c | 2 +- gdb/user-regs.c | 2 +- 11 files changed, 33 insertions(+), 21 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 45c139799c..ed376c0257 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,17 @@ 2003-08-04 Andrew Cagney + * gdbarch.sh (gdbarch_data_free_ftype): Delete declaration. + (register_gdbarch_data): Delete "free" parameter. Update + comments. + * gdbarch.h, gdbarch.c: Re-generate. + * reggroups.c (_initialize_reggroup): Update. + * gnu-v3-abi.c (init_gnuv3_ops): Update. + * frame-base.c (_initialize_frame_base): Update. + * frame-unwind.c (_initialize_frame_unwind): Update. + * user-regs.c (_initialize_user_regs): Update. + * remote.c (_initialize_remote): Update. + * regcache.c (_initialize_regcache): Update. + * regcache.c (xfree_regcache_descr): Delete function. (_initialize_regcache): Update call to register_gdbarch_data. (init_regcache_descr, init_legacy_regcache_descr): Use diff --git a/gdb/frame-base.c b/gdb/frame-base.c index ad2d7b895c..66a0106aa0 100644 --- a/gdb/frame-base.c +++ b/gdb/frame-base.c @@ -146,5 +146,5 @@ extern initialize_file_ftype _initialize_frame_base; /* -Wmissing-prototypes */ void _initialize_frame_base (void) { - frame_base_data = register_gdbarch_data (frame_base_init, NULL); + frame_base_data = register_gdbarch_data (frame_base_init); } diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c index dda92b03c7..fc5a82122e 100644 --- a/gdb/frame-unwind.c +++ b/gdb/frame-unwind.c @@ -95,5 +95,5 @@ extern initialize_file_ftype _initialize_frame_unwind; /* -Wmissing-prototypes * void _initialize_frame_unwind (void) { - frame_unwind_data = register_gdbarch_data (frame_unwind_init, NULL); + frame_unwind_data = register_gdbarch_data (frame_unwind_init); } diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 9d34aa5a76..b9aea09b84 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -5646,8 +5646,7 @@ struct gdbarch_data_registry gdbarch_data_registry = }; struct gdbarch_data * -register_gdbarch_data (gdbarch_data_init_ftype *init, - gdbarch_data_free_ftype *free) +register_gdbarch_data (gdbarch_data_init_ftype *init) { struct gdbarch_data_registration **curr; /* Append the new registraration. */ diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 7753022a64..3850c4b045 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -3257,7 +3257,11 @@ extern int gdbarch_update_p (struct gdbarch_info info); The per-architecture data-pointer is either initialized explicitly (set_gdbarch_data()) or implicitly (by INIT() via a call to - gdbarch_data()). FREE() is ignored. + gdbarch_data()). + + Memory for the per-architecture data shall be allocated using + gdbarch_obstack_zalloc. That memory will be deleted when the + corresponding architecture object is deleted. When a previously created architecture is re-selected, the per-architecture data-pointer for that previous architecture is @@ -3269,10 +3273,7 @@ extern int gdbarch_update_p (struct gdbarch_info info); struct gdbarch_data; typedef void *(gdbarch_data_init_ftype) (struct gdbarch *gdbarch); -typedef void (gdbarch_data_free_ftype) (struct gdbarch *gdbarch, - void *pointer); -extern struct gdbarch_data *register_gdbarch_data (gdbarch_data_init_ftype *init, - gdbarch_data_free_ftype *free); +extern struct gdbarch_data *register_gdbarch_data (gdbarch_data_init_ftype *init); extern void set_gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data, void *pointer); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index fc72ce2980..9a633482a0 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -1175,7 +1175,11 @@ extern int gdbarch_update_p (struct gdbarch_info info); The per-architecture data-pointer is either initialized explicitly (set_gdbarch_data()) or implicitly (by INIT() via a call to - gdbarch_data()). FREE() is ignored. + gdbarch_data()). + + Memory for the per-architecture data shall be allocated using + gdbarch_obstack_zalloc. That memory will be deleted when the + corresponding architecture object is deleted. When a previously created architecture is re-selected, the per-architecture data-pointer for that previous architecture is @@ -1187,10 +1191,7 @@ extern int gdbarch_update_p (struct gdbarch_info info); struct gdbarch_data; typedef void *(gdbarch_data_init_ftype) (struct gdbarch *gdbarch); -typedef void (gdbarch_data_free_ftype) (struct gdbarch *gdbarch, - void *pointer); -extern struct gdbarch_data *register_gdbarch_data (gdbarch_data_init_ftype *init, - gdbarch_data_free_ftype *free); +extern struct gdbarch_data *register_gdbarch_data (gdbarch_data_init_ftype *init); extern void set_gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data, void *pointer); @@ -1890,8 +1891,7 @@ struct gdbarch_data_registry gdbarch_data_registry = }; struct gdbarch_data * -register_gdbarch_data (gdbarch_data_init_ftype *init, - gdbarch_data_free_ftype *free) +register_gdbarch_data (gdbarch_data_init_ftype *init) { struct gdbarch_data_registration **curr; /* Append the new registraration. */ diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index bbfd118520..d9947f9f87 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -433,7 +433,7 @@ gnuv3_baseclass_offset (struct type *type, int index, char *valaddr, static void init_gnuv3_ops (void) { - vtable_type_gdbarch_data = register_gdbarch_data (build_gdb_vtable_type, 0); + vtable_type_gdbarch_data = register_gdbarch_data (build_gdb_vtable_type); gnu_v3_abi_ops.shortname = "gnu-v3"; gnu_v3_abi_ops.longname = "GNU G++ Version 3 ABI"; diff --git a/gdb/regcache.c b/gdb/regcache.c index 74b98d932e..5c7f0ca916 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -1662,7 +1662,7 @@ extern initialize_file_ftype _initialize_regcache; /* -Wmissing-prototype */ void _initialize_regcache (void) { - regcache_descr_handle = register_gdbarch_data (init_regcache_descr, NULL); + regcache_descr_handle = register_gdbarch_data (init_regcache_descr); REGISTER_GDBARCH_SWAP (current_regcache); register_gdbarch_swap (&deprecated_registers, sizeof (deprecated_registers), NULL); register_gdbarch_swap (&deprecated_register_valid, sizeof (deprecated_register_valid), NULL); diff --git a/gdb/reggroups.c b/gdb/reggroups.c index a4e940ef2c..791ec0abd5 100644 --- a/gdb/reggroups.c +++ b/gdb/reggroups.c @@ -259,7 +259,7 @@ extern initialize_file_ftype _initialize_reggroup; /* -Wmissing-prototypes */ void _initialize_reggroup (void) { - reggroups_data = register_gdbarch_data (reggroups_init, NULL); + reggroups_data = register_gdbarch_data (reggroups_init); /* The pre-defined list of groups. */ add_group (&default_groups, general_reggroup, XMALLOC (struct reggroup_el)); diff --git a/gdb/remote.c b/gdb/remote.c index 0da3fecff8..73906c7c71 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -6056,7 +6056,7 @@ _initialize_remote (void) struct cmd_list_element *tmpcmd; /* architecture specific data */ - remote_gdbarch_data_handle = register_gdbarch_data (init_remote_state, NULL); + remote_gdbarch_data_handle = register_gdbarch_data (init_remote_state); /* Old tacky stuff. NOTE: This comes after the remote protocol so that the remote protocol has been initialized. */ diff --git a/gdb/user-regs.c b/gdb/user-regs.c index 8b4600d433..470a518796 100644 --- a/gdb/user-regs.c +++ b/gdb/user-regs.c @@ -201,5 +201,5 @@ extern initialize_file_ftype _initialize_user_regs; /* -Wmissing-prototypes */ void _initialize_user_regs (void) { - user_regs_data = register_gdbarch_data (user_regs_init, NULL); + user_regs_data = register_gdbarch_data (user_regs_init); } -- 2.11.0