This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: new plugin bfd_target breaks gdb with --enable-targets=all
- From: Rafael Espindola <espindola at google dot com>
- To: Pedro Alves <pedro at codesourcery dot com>
- Cc: binutils at sourceware dot org
- Date: Wed, 27 May 2009 10:42:21 +0100
- Subject: Re: new plugin bfd_target breaks gdb with --enable-targets=all
- References: <200905270218.36632.pedro@codesourcery.com>
> The below fixes the issue here, since program_name is declared as:
>
> Âextern char *program_name __attribute__ ((weak));
>
> ... and gdb doesn't define `program_name' since 1990. ÂSeems
> wrong to require all libbfd clients to do so now.
The fix looks correct to me. It was a thinko declaring the variable
weak but not checking the address. Sorry about that.
> (using weak in libbfd cries out hack to me, but well)
It is. Since the plugin target already has the bfd_plugin_set_plugin
function, it would probably be better for it to have a
bfd_plugin_set_program_name. Would you prefer that solution?
> It looks like something else is still wrong, because otherwise,
> should gdb be building plugin.c at all if the user doesn't
> specify --enable-plugins?
The plugin is just a strange target. That is why it is included in
--enable-targets=all.
> Maybe the check for empty string should be removed too, dunno
> if that was intended.
The check for program_name being NULL? It was a mistake, but it is
better to keep it for the case of a program that defines program_name
but never sets it.
Cheers,
--
Rafael Avila de Espindola
Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047