This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 01/10] change gdb to refcount bfd everywhere
On Thu, 19 Jul 2012 22:58:03 +0200, Tom Tromey wrote:
> >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
>
> Jan> The comments are present in both and neither is a reference, they
> Jan> are already out of sync.
>
> I don't really follow,
There was some conclusion on gdb-patches to make happy both people wanting
comments in *.c and people wanting comments in *.h and to prevent duplication
of the same comment in both *.c and *.h which leads to stale invalid comments
in one of the files to put the comment only in *.h file and in the *.c file
state:
/* See gdb_bfd.h. */
You even use it at various functions in gdb_bfd.c, just not for gdb_bfd_ref
and gdb_bfd_unref.
> >> @@ -2519,14 +2512,10 @@ reread_symbols (void)
> >> to close the descriptor but BFD lacks a way of closing the
> >> BFD without closing the descriptor. */
> >> obfd_filename = bfd_get_filename (objfile->obfd);
> >> - if (!bfd_close (objfile->obfd))
> >> - error (_("Can't close BFD for %s: %s"), objfile->name,
> >> - bfd_errmsg (bfd_get_error ()));
> >> + gdb_bfd_unref (objfile->obfd);
> >> objfile-> obfd = bfd_open_maybe_remote (obfd_filename);
> >> if (objfile->obfd == NULL)
> >> error (_("Can't open %s to read symbols."), objfile->name);
> >> - else
> >> - objfile->obfd = gdb_bfd_ref (objfile->obfd);
>
> Jan> Why isn't gdb_bfd_ref missing here?
>
> bfd_open_maybe_remote returns a new reference.
Aha, OK.
> I wonder if I should rename it to gdb_bfd_open_maybe_remote, for
> consistency. What do you think? I'm inclined to do it.
Definitely.
Thanks,
Jan