This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC-v2] Dispose properly of registered gdbarch'es at exit.
- From: Tom Tromey <tromey at redhat dot com>
- To: "Pierre Muller" <pierre dot muller at ics-cnrs dot unistra dot fr>
- Cc: <gdb-patches at sourceware dot org>
- Date: Wed, 12 Dec 2012 08:29:09 -0700
- Subject: Re: [RFC-v2] Dispose properly of registered gdbarch'es at exit.
- References: <10150.4984115765$1355246247@news.gmane.org> <87sj7cbeui.fsf@fleche.redhat.com> <43661.4969782115$1355267677@news.gmane.org>
Tom> I see a bogus-by-this-rule final cleanup in gdb_insn_length.
Pierre> It took me some time to understand your point:
Pierre> we also need to reset that static variable to NULL inside...
Pierre> Included in new version of the patch.
Actually what I meant in this case is that the cleanup isn't useful to
gdb-as-executable. There's no point destroying that ui-out object for
ordinary gdb.
If you really want to initialize gdb-as-a-library, then shut it down,
and then re-initialize it, then I think you will find there are other
function-local statics that must be handled.
Pierre> I wasn't sure about unused args, do we still need anything
Pierre> special for those, otherwise I agree it would e easier to just
Pierre> use a dummy NULL arg.
You don't have to do anything special.
We haven't tried enabling -Wunused-parameter in gdb.
I usually just give them an obvious name like "ignore".
Pierre> static void
Pierre> do_ui_file_delete (void *arg)
Pierre> {
Pierre> - ui_file_delete (arg);
Pierre> + struct ui_file **ui = (struct ui_file **) arg;
Pierre> + ui_file_delete (*ui);
Blank line between declarations and code.
Pierre> + make_final_cleanup (gdbarch_free_registered, NULL);
I'd still rather have a new mechanism, not run by ordinary gdb.
Tom