This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: TYPE_NAME memory management


On Wed, Sep 9, 2009 at 10:29 AM, Paul Pluzhnikov<ppluzhnikov@google.com> wrote:
> On Wed, Sep 9, 2009 at 9:40 AM, Doug Evans<dje@google.com> wrote:
>
>> struct objfile_data
>> {
>> ? unsigned index;
>> ? /* The objfile is about to be freed. ?Save anything needed from it. ?*/
>> ? void (*save) (struct objfile *, void *);
>> ? /* Free all objfile-related resources held. ?*/
>> ? void (*free) (struct objfile *, void *);
>> };
>
> How about s/save/cleanup/ and s/free/destroy/:

[fwiw]
I chose to stay away from "cleanup" because cleanups in gdb have the
connotation of freeing resources, which we want the cleanup in
"cleanup/destroy" to explicitly not do.

>> It would require adding a parameter to
>> register_objfile_data_with_cleanup and updating all the callers.
>
> Perhaps a new 'register_objfile_data_with_cleanup_and_destroy' function
> which register_objfile_data_with_cleanup can call with NULL as the destroy
> parameter?

Yeah, though given that I was explicitly staying away from "cleanup"
in the name of the functions to call I chose to avoid this.
[I don't mind "cleanup" appearing in
register_objfile_data_with_cleanup because here it encompasses both
the "save" and "free" routines.]

> But then there are only 4 places which call it, so not a big deal to
> update them all.

Yeah, that was my thinking.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]