+ printf_filtered ("file type %s.\n", bfd_get_target (abfd));
+ if (abfd == exec_bfd)
+ {
+ printf_filtered ("\tEntry point: ");
+ print_address_numeric (bfd_get_start_address (abfd), 1, gdb_stdout);
+ printf_filtered ("\n");
+ }
+ for (p = t->to_sections; p < t->to_sections_end; p++)
+ {
+ printf_filtered ("\t%s", local_hex_string_custom (p->addr, fmt));
+ printf_filtered (" - %s", local_hex_string_custom (p->endaddr, fmt));
+
+ /* FIXME: A format of "08l" is not wide enough for file offsets
+ larger than 4GB. OTOH, making it "016l" isn't desirable either
+ since most output will then be much wider than necessary. It
+ may make sense to test the size of the file and choose the
+ format string accordingly. */
+ if (info_verbose)
+ printf_filtered (" @ %s",
+ local_hex_string_custom (p->the_bfd_section->filepos, "08l"));
+ printf_filtered (" is %s", bfd_section_name (p->bfd, p->the_bfd_section));
+ if (p->bfd != abfd)
+ {
+ printf_filtered (" in %s", bfd_get_filename (p->bfd));
+ }
+ printf_filtered ("\n");
+ }
+}
+
+static void
+exec_files_info (struct target_ops *t)
+{
+ print_section_info (t, exec_bfd);
+
+ if (vmap)
+ {
+ struct vmap *vp;
+
+ printf_unfiltered ("\tMapping info for file `%s'.\n", vmap->name);
+ printf_unfiltered ("\t %*s %*s %*s %*s %8.8s %s\n",
+ strlen_paddr (), "tstart",
+ strlen_paddr (), "tend",
+ strlen_paddr (), "dstart",
+ strlen_paddr (), "dend",
+ "section",
+ "file(member)");
+
+ for (vp = vmap; vp; vp = vp->nxt)
+ printf_unfiltered ("\t0x%s 0x%s 0x%s 0x%s %s%s%s%s\n",
+ paddr (vp->tstart),
+ paddr (vp->tend),
+ paddr (vp->dstart),
+ paddr (vp->dend),
+ vp->name,
+ *vp->member ? "(" : "", vp->member,
+ *vp->member ? ")" : "");
+ }
+}
+
+/* msnyder 5/21/99:
+ exec_set_section_offsets sets the offsets of all the sections
+ in the exec objfile. */
+
+void
+exec_set_section_offsets (bfd_signed_vma text_off, bfd_signed_vma data_off,
+ bfd_signed_vma bss_off)
+{
+ struct section_table *sect;
+
+ for (sect = exec_ops.to_sections;
+ sect < exec_ops.to_sections_end;
+ sect++)
+ {
+ flagword flags;
+
+ flags = bfd_get_section_flags (exec_bfd, sect->the_bfd_section);
+
+ if (flags & SEC_CODE)
+ {
+ sect->addr += text_off;
+ sect->endaddr += text_off;
+ }
+ else if (flags & (SEC_DATA | SEC_LOAD))
+ {
+ sect->addr += data_off;
+ sect->endaddr += data_off;
+ }
+ else if (flags & SEC_ALLOC)
+ {
+ sect->addr += bss_off;
+ sect->endaddr += bss_off;
+ }
+ }