diff options
author | Tom Tromey <tromey@redhat.com> | 2012-11-28 18:48:38 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2012-11-28 18:48:38 +0000 |
commit | 0cd61f44022489a19b75ee744e2bff83180d0cd5 (patch) | |
tree | ae18b0598e1af5e2e1f4706ce82f15b3c0f917e6 /gdb/gdb_bfd.c | |
parent | d406f3e430b5a156b943895791f2d081e78c8194 (diff) | |
download | gdb-0cd61f44022489a19b75ee744e2bff83180d0cd5.zip gdb-0cd61f44022489a19b75ee744e2bff83180d0cd5.tar.gz gdb-0cd61f44022489a19b75ee744e2bff83180d0cd5.tar.bz2 |
PR gdb/14290:
* solib-darwin.c (gdb_bfd_mach_o_fat_extract): New function.
(darwin_solib_get_all_image_info_addr_at_init, darwin_bfd_open):
Use it.
* gdb_bfd.h (gdb_bfd_mark_parent): Declare.
* gdb_bfd.c (gdb_bfd_mark_parent): New function.
(gdb_bfd_openr_next_archived_file): Use it.
Diffstat (limited to 'gdb/gdb_bfd.c')
-rw-r--r-- | gdb/gdb_bfd.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c index 2bcc4b4..f0e349b 100644 --- a/gdb/gdb_bfd.c +++ b/gdb/gdb_bfd.c @@ -499,24 +499,34 @@ gdb_bfd_openr_iovec (const char *filename, const char *target, /* See gdb_bfd.h. */ +void +gdb_bfd_mark_parent (bfd *child, bfd *parent) +{ + struct gdb_bfd_data *gdata; + + gdb_bfd_ref (child); + /* No need to stash the filename here, because we also keep a + reference on the parent archive. */ + + gdata = bfd_usrdata (child); + if (gdata->archive_bfd == NULL) + { + gdata->archive_bfd = parent; + gdb_bfd_ref (parent); + } + else + gdb_assert (gdata->archive_bfd == parent); +} + +/* See gdb_bfd.h. */ + bfd * gdb_bfd_openr_next_archived_file (bfd *archive, bfd *previous) { bfd *result = bfd_openr_next_archived_file (archive, previous); if (result) - { - struct gdb_bfd_data *gdata; - - gdb_bfd_ref (result); - /* No need to stash the filename here, because we also keep a - reference on the parent archive. */ - - gdata = bfd_usrdata (result); - gdb_assert (gdata->archive_bfd == NULL || gdata->archive_bfd == archive); - gdata->archive_bfd = archive; - gdb_bfd_ref (archive); - } + gdb_bfd_mark_parent (result, archive); return result; } |