From: Jan Kratochvil Date: Mon, 10 Aug 2009 22:09:22 +0000 (+0000) Subject: gdb/ X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4f6f9936b60049a0f3d8725b279b3a61082660f2;p=binutils-gdb.git gdb/ * objfiles.c (gdb_bfd_unref): Use the bfd_usrdata accessor. * solib.c (symbol_add_stub): Likewise. * symfile.c (symfile_bfd_open): Assert BFD_USRDATA is NULL. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0d4179112b6..6355f7bec63 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2009-08-10 Jan Kratochvil + + * objfiles.c (gdb_bfd_unref): Use the bfd_usrdata accessor. + * solib.c (symbol_add_stub): Likewise. + * symfile.c (symfile_bfd_open): Assert BFD_USRDATA is NULL. + 2009-08-10 Paul Pluzhnikov * objfiles.c (qsort_cmp): Remove assert. diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 6663c3393ba..586f5d00117 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -1070,7 +1070,7 @@ gdb_bfd_unref (struct bfd *abfd) if (abfd == NULL) return; - p_refcount = abfd->usrdata; + p_refcount = bfd_usrdata (abfd); /* Valid range for p_refcount: NULL (single owner), or a pointer to int counter, which has a value of 1 (single owner) or 2 (shared). */ @@ -1083,7 +1083,7 @@ gdb_bfd_unref (struct bfd *abfd) return; } xfree (p_refcount); - abfd->usrdata = NULL; /* Paranoia. */ + bfd_usrdata (abfd) = NULL; /* Paranoia. */ name = bfd_get_filename (abfd); if (!bfd_close (abfd)) diff --git a/gdb/solib.c b/gdb/solib.c index 564a55c2594..aad2d59545a 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -459,7 +459,7 @@ symbol_add_stub (struct so_list *so, int flags) so->objfile = symbol_file_add_from_bfd (so->abfd, flags, sap, OBJF_SHARED); p_refcount = xmalloc (sizeof (*p_refcount)); *p_refcount = 2; /* Both solib and objfile refer to this abfd. */ - so->abfd->usrdata = p_refcount; + bfd_usrdata (so->abfd) = p_refcount; free_section_addr_info (sap); diff --git a/gdb/symfile.c b/gdb/symfile.c index 4bdab916e4f..c182faac5d1 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1638,6 +1638,9 @@ symfile_bfd_open (char *name) bfd_errmsg (bfd_get_error ())); } + /* bfd_usrdata exists for applications and libbfd must not touch it. */ + gdb_assert (bfd_usrdata (sym_bfd) == NULL); + return sym_bfd; }