This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [rfc] Plug memory leaks during gdbarch initialization
- From: Jim Blandy <jimb at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 23 Jan 2007 07:25:01 -0800
- Subject: Re: [rfc] Plug memory leaks during gdbarch initialization
- References: <20070123144523.GA6339@nevyn.them.org>
Daniel Jacobowitz <drow@false.org> writes:
> The patch is an improvement, but doesn't fix that wart. I don't really
> want to check it in without fixing the underlying problem but I don't
> see a good way... anyone have a suggestion?
I could imagine having each file's _initialize function start with:
void
_initialize_foo (void)
{
static initialized;
if (initialized)
return;
initialized = 1;
...
}
A sed script could get the job done. Then, they could call each other
with wild abandon. For extra points, you could do:
void
_initialize_foo (void)
{
static int initialized;
assert (initialized != 1);
if (initialized)
return;
initialized = 1;
...
initialized = 2;
}
So you'd catch circular dependencies.