/* Only print out the name of non-default-named archive members.
The name .ctf appears everywhere, even for things that aren't
- really archives, so printing it out is liable to be confusing. */
+ really archives, so printing it out is liable to be confusing.
+
+ The parent, if there is one, is the default-owned archive member:
+ avoid importing it into itself. (This does no harm, but looks
+ confusing.) */
+
if (strcmp (name, ".ctf") != 0)
- printf (_("\nCTF archive member: %s:\n"), sanitize_string (name));
+ {
+ printf (_("\nCTF archive member: %s:\n"), sanitize_string (name));
+ ctf_import (ctf, parent);
+ }
- ctf_import (ctf, parent);
for (i = 0, thing = things; *thing[0]; thing++, i++)
{
ctf_dump_state_t *s = NULL;
static void
dump_ctf (bfd *abfd, const char *sect_name, const char *parent_name)
{
- ctf_archive_t *ctfa, *parenta = NULL;
+ ctf_archive_t *ctfa, *parenta = NULL, *lookparent;
bfd_byte *ctfdata, *parentdata = NULL;
bfd_size_type ctfsize, parentsize;
ctf_sect_t ctfsect;
bfd_fatal (bfd_get_filename (abfd));
}
- /* Assume that the applicable parent archive member is the default one.
- (This is what all known implementations are expected to do, if they
- put CTFs and their parents in archives together.) */
- if ((parent = ctf_arc_open_by_name (parenta, NULL, &err)) == NULL)
- {
- non_fatal (_("CTF open failure: %s\n"), ctf_errmsg (err));
- bfd_fatal (bfd_get_filename (abfd));
- }
+ lookparent = parenta;
+ }
+ else
+ lookparent = ctfa;
+
+ /* Assume that the applicable parent archive member is the default one.
+ (This is what all known implementations are expected to do, if they
+ put CTFs and their parents in archives together.) */
+ if ((parent = ctf_arc_open_by_name (lookparent, NULL, &err)) == NULL)
+ {
+ non_fatal (_("CTF open failure: %s\n"), ctf_errmsg (err));
+ bfd_fatal (bfd_get_filename (abfd));
}
printf (_("Contents of CTF section %s:\n"), sanitize_string (sect_name));