* objfiles.c (struct objfile_data): Delete member cleanup and replace
with save, free. (register_objfile_data_with_cleanup): Delete arg cleanup and replace with save, free. All callers updated. (clear_objfile_data): Replace cleanup loop with separate save and free loops. * objfiles.h (register_objfile_data_with_cleanup): Update. * arm-tdep.c (arm_objfile_data_free): Renamed from arm_objfile_data_cleanup, all callers updated. * dwarf2read.c (dwarf2_per_objfile_free): Renamed from dwarf2_per_objfile_cleanup, all callers updated. * python/py-objfile.c (py_free_objfile): Renamed from clean_up_objfile, all callers updated. * python/py-type.c (save_objfile_types): Renamed from clean_up_objfile_types, all callers updated.
This commit is contained in:
parent
cec03d703f
commit
c1bd65d042
7 changed files with 55 additions and 15 deletions
|
@ -1,3 +1,21 @@
|
||||||
|
2009-09-11 Doug Evans <dje@google.com>
|
||||||
|
|
||||||
|
* objfiles.c (struct objfile_data): Delete member cleanup and replace
|
||||||
|
with save, free.
|
||||||
|
(register_objfile_data_with_cleanup): Delete arg cleanup and replace
|
||||||
|
with save, free. All callers updated.
|
||||||
|
(clear_objfile_data): Replace cleanup loop with separate save and
|
||||||
|
free loops.
|
||||||
|
* objfiles.h (register_objfile_data_with_cleanup): Update.
|
||||||
|
* arm-tdep.c (arm_objfile_data_free): Renamed from
|
||||||
|
arm_objfile_data_cleanup, all callers updated.
|
||||||
|
* dwarf2read.c (dwarf2_per_objfile_free): Renamed from
|
||||||
|
dwarf2_per_objfile_cleanup, all callers updated.
|
||||||
|
* python/py-objfile.c (py_free_objfile): Renamed from clean_up_objfile,
|
||||||
|
all callers updated.
|
||||||
|
* python/py-type.c (save_objfile_types): Renamed from
|
||||||
|
clean_up_objfile_types, all callers updated.
|
||||||
|
|
||||||
2009-09-11 Tom Tromey <tromey@redhat.com>
|
2009-09-11 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
* dwarf2loc.c (struct piece_closure) <arch>: New field.
|
* dwarf2loc.c (struct piece_closure) <arch>: New field.
|
||||||
|
|
|
@ -5240,7 +5240,7 @@ arm_coff_make_msymbol_special(int val, struct minimal_symbol *msym)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
arm_objfile_data_cleanup (struct objfile *objfile, void *arg)
|
arm_objfile_data_free (struct objfile *objfile, void *arg)
|
||||||
{
|
{
|
||||||
struct arm_per_objfile *data = arg;
|
struct arm_per_objfile *data = arg;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -6032,7 +6032,7 @@ _initialize_arm_tdep (void)
|
||||||
gdbarch_register (bfd_arch_arm, arm_gdbarch_init, arm_dump_tdep);
|
gdbarch_register (bfd_arch_arm, arm_gdbarch_init, arm_dump_tdep);
|
||||||
|
|
||||||
arm_objfile_data_key
|
arm_objfile_data_key
|
||||||
= register_objfile_data_with_cleanup (arm_objfile_data_cleanup);
|
= register_objfile_data_with_cleanup (NULL, arm_objfile_data_free);
|
||||||
|
|
||||||
/* Register an ELF OS ABI sniffer for ARM binaries. */
|
/* Register an ELF OS ABI sniffer for ARM binaries. */
|
||||||
gdbarch_register_osabi_sniffer (bfd_arch_arm,
|
gdbarch_register_osabi_sniffer (bfd_arch_arm,
|
||||||
|
|
|
@ -11837,7 +11837,7 @@ munmap_section_buffer (struct dwarf2_section_info *info)
|
||||||
/* munmap debug sections for OBJFILE, if necessary. */
|
/* munmap debug sections for OBJFILE, if necessary. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dwarf2_per_objfile_cleanup (struct objfile *objfile, void *d)
|
dwarf2_per_objfile_free (struct objfile *objfile, void *d)
|
||||||
{
|
{
|
||||||
struct dwarf2_per_objfile *data = d;
|
struct dwarf2_per_objfile *data = d;
|
||||||
munmap_section_buffer (&data->info);
|
munmap_section_buffer (&data->info);
|
||||||
|
@ -11857,7 +11857,7 @@ void
|
||||||
_initialize_dwarf2_read (void)
|
_initialize_dwarf2_read (void)
|
||||||
{
|
{
|
||||||
dwarf2_objfile_data_key
|
dwarf2_objfile_data_key
|
||||||
= register_objfile_data_with_cleanup (dwarf2_per_objfile_cleanup);
|
= register_objfile_data_with_cleanup (NULL, dwarf2_per_objfile_free);
|
||||||
|
|
||||||
add_prefix_cmd ("dwarf2", class_maintenance, set_dwarf2_cmd, _("\
|
add_prefix_cmd ("dwarf2", class_maintenance, set_dwarf2_cmd, _("\
|
||||||
Set DWARF 2 specific variables.\n\
|
Set DWARF 2 specific variables.\n\
|
||||||
|
|
|
@ -975,7 +975,8 @@ in_plt_section (CORE_ADDR pc, char *name)
|
||||||
struct objfile_data
|
struct objfile_data
|
||||||
{
|
{
|
||||||
unsigned index;
|
unsigned index;
|
||||||
void (*cleanup) (struct objfile *, void *);
|
void (*save) (struct objfile *, void *);
|
||||||
|
void (*free) (struct objfile *, void *);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct objfile_data_registration
|
struct objfile_data_registration
|
||||||
|
@ -993,7 +994,8 @@ struct objfile_data_registry
|
||||||
static struct objfile_data_registry objfile_data_registry = { NULL, 0 };
|
static struct objfile_data_registry objfile_data_registry = { NULL, 0 };
|
||||||
|
|
||||||
const struct objfile_data *
|
const struct objfile_data *
|
||||||
register_objfile_data_with_cleanup (void (*cleanup) (struct objfile *, void *))
|
register_objfile_data_with_cleanup (void (*save) (struct objfile *, void *),
|
||||||
|
void (*free) (struct objfile *, void *))
|
||||||
{
|
{
|
||||||
struct objfile_data_registration **curr;
|
struct objfile_data_registration **curr;
|
||||||
|
|
||||||
|
@ -1005,7 +1007,8 @@ register_objfile_data_with_cleanup (void (*cleanup) (struct objfile *, void *))
|
||||||
(*curr)->next = NULL;
|
(*curr)->next = NULL;
|
||||||
(*curr)->data = XMALLOC (struct objfile_data);
|
(*curr)->data = XMALLOC (struct objfile_data);
|
||||||
(*curr)->data->index = objfile_data_registry.num_registrations++;
|
(*curr)->data->index = objfile_data_registry.num_registrations++;
|
||||||
(*curr)->data->cleanup = cleanup;
|
(*curr)->data->save = save;
|
||||||
|
(*curr)->data->free = free;
|
||||||
|
|
||||||
return (*curr)->data;
|
return (*curr)->data;
|
||||||
}
|
}
|
||||||
|
@ -1013,7 +1016,7 @@ register_objfile_data_with_cleanup (void (*cleanup) (struct objfile *, void *))
|
||||||
const struct objfile_data *
|
const struct objfile_data *
|
||||||
register_objfile_data (void)
|
register_objfile_data (void)
|
||||||
{
|
{
|
||||||
return register_objfile_data_with_cleanup (NULL);
|
return register_objfile_data_with_cleanup (NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1041,11 +1044,21 @@ clear_objfile_data (struct objfile *objfile)
|
||||||
|
|
||||||
gdb_assert (objfile->data != NULL);
|
gdb_assert (objfile->data != NULL);
|
||||||
|
|
||||||
|
/* Process all the save handlers. */
|
||||||
|
|
||||||
for (registration = objfile_data_registry.registrations, i = 0;
|
for (registration = objfile_data_registry.registrations, i = 0;
|
||||||
i < objfile->num_data;
|
i < objfile->num_data;
|
||||||
registration = registration->next, i++)
|
registration = registration->next, i++)
|
||||||
if (objfile->data[i] != NULL && registration->data->cleanup)
|
if (objfile->data[i] != NULL && registration->data->save != NULL)
|
||||||
registration->data->cleanup (objfile, objfile->data[i]);
|
registration->data->save (objfile, objfile->data[i]);
|
||||||
|
|
||||||
|
/* Now process all the free handlers. */
|
||||||
|
|
||||||
|
for (registration = objfile_data_registry.registrations, i = 0;
|
||||||
|
i < objfile->num_data;
|
||||||
|
registration = registration->next, i++)
|
||||||
|
if (objfile->data[i] != NULL && registration->data->free != NULL)
|
||||||
|
registration->data->free (objfile, objfile->data[i]);
|
||||||
|
|
||||||
memset (objfile->data, 0, objfile->num_data * sizeof (void *));
|
memset (objfile->data, 0, objfile->num_data * sizeof (void *));
|
||||||
}
|
}
|
||||||
|
|
|
@ -500,9 +500,18 @@ extern int in_plt_section (CORE_ADDR, char *);
|
||||||
/* Keep a registry of per-objfile data-pointers required by other GDB
|
/* Keep a registry of per-objfile data-pointers required by other GDB
|
||||||
modules. */
|
modules. */
|
||||||
|
|
||||||
|
/* Allocate an entry in the per-objfile registry. */
|
||||||
extern const struct objfile_data *register_objfile_data (void);
|
extern const struct objfile_data *register_objfile_data (void);
|
||||||
|
|
||||||
|
/* Allocate an entry in the per-objfile registry.
|
||||||
|
SAVE and FREE are called when clearing objfile data.
|
||||||
|
First all registered SAVE functions are called.
|
||||||
|
Then all registered FREE functions are called.
|
||||||
|
Either or both of SAVE, FREE may be NULL. */
|
||||||
extern const struct objfile_data *register_objfile_data_with_cleanup
|
extern const struct objfile_data *register_objfile_data_with_cleanup
|
||||||
(void (*cleanup) (struct objfile *, void *));
|
(void (*save) (struct objfile *, void *),
|
||||||
|
void (*free) (struct objfile *, void *));
|
||||||
|
|
||||||
extern void clear_objfile_data (struct objfile *objfile);
|
extern void clear_objfile_data (struct objfile *objfile);
|
||||||
extern void set_objfile_data (struct objfile *objfile,
|
extern void set_objfile_data (struct objfile *objfile,
|
||||||
const struct objfile_data *data, void *value);
|
const struct objfile_data *data, void *value);
|
||||||
|
|
|
@ -118,7 +118,7 @@ objfpy_set_printers (PyObject *o, PyObject *value, void *ignore)
|
||||||
/* Clear the OBJFILE pointer in an Objfile object and remove the
|
/* Clear the OBJFILE pointer in an Objfile object and remove the
|
||||||
reference. */
|
reference. */
|
||||||
static void
|
static void
|
||||||
clean_up_objfile (struct objfile *objfile, void *datum)
|
py_free_objfile (struct objfile *objfile, void *datum)
|
||||||
{
|
{
|
||||||
struct cleanup *cleanup;
|
struct cleanup *cleanup;
|
||||||
objfile_object *object = datum;
|
objfile_object *object = datum;
|
||||||
|
@ -166,7 +166,7 @@ void
|
||||||
gdbpy_initialize_objfile (void)
|
gdbpy_initialize_objfile (void)
|
||||||
{
|
{
|
||||||
objfpy_objfile_data_key
|
objfpy_objfile_data_key
|
||||||
= register_objfile_data_with_cleanup (clean_up_objfile);
|
= register_objfile_data_with_cleanup (NULL, py_free_objfile);
|
||||||
|
|
||||||
if (PyType_Ready (&objfile_object_type) < 0)
|
if (PyType_Ready (&objfile_object_type) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -527,7 +527,7 @@ typy_str (PyObject *self)
|
||||||
static const struct objfile_data *typy_objfile_data_key;
|
static const struct objfile_data *typy_objfile_data_key;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clean_up_objfile_types (struct objfile *objfile, void *datum)
|
save_objfile_types (struct objfile *objfile, void *datum)
|
||||||
{
|
{
|
||||||
type_object *obj = datum;
|
type_object *obj = datum;
|
||||||
htab_t copied_types;
|
htab_t copied_types;
|
||||||
|
@ -643,7 +643,7 @@ gdbpy_initialize_types (void)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
typy_objfile_data_key
|
typy_objfile_data_key
|
||||||
= register_objfile_data_with_cleanup (clean_up_objfile_types);
|
= register_objfile_data_with_cleanup (save_objfile_types, NULL);
|
||||||
|
|
||||||
if (PyType_Ready (&type_object_type) < 0)
|
if (PyType_Ready (&type_object_type) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue