aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1995-11-29 18:46:07 +0000
committerIan Lance Taylor <ian@airs.com>1995-11-29 18:46:07 +0000
commit27fb8f2933cd65eb68179a79f0078034f20cfb2c (patch)
tree25b4f5c9d8ff4898019eecb4caf8705df42ccbcf
parent77fa4d98a80a87ae11ab99852efd3807b034c2fa (diff)
downloadgdb-27fb8f2933cd65eb68179a79f0078034f20cfb2c.zip
gdb-27fb8f2933cd65eb68179a79f0078034f20cfb2c.tar.gz
gdb-27fb8f2933cd65eb68179a79f0078034f20cfb2c.tar.bz2
* elf.c (_bfd_elf_print_private_bfd_data): New function.
* elf-bfd.h (_bfd_elf_print_private_bfd_data): Declare. * elfxx-target.h (bfd_elfNN_bfd_print_private_bfd_data): Define to _bfd_elf_print_private_bfd_data.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf.c55
-rw-r--r--bfd/elfxx-target.h2
3 files changed, 61 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 0411ced..7e5b694 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
Wed Nov 29 12:42:36 1995 Ian Lance Taylor <ian@cygnus.com>
+ * elf.c (_bfd_elf_print_private_bfd_data): New function.
+ * elf-bfd.h (_bfd_elf_print_private_bfd_data): Declare.
+ * elfxx-target.h (bfd_elfNN_bfd_print_private_bfd_data): Define to
+ _bfd_elf_print_private_bfd_data.
+
* coff-alpha.c (alpha_ecoff_swap_reloc_in): Don't abort if
r_symndx is RELOC_SECTION_NONE for an ALPHA_R_IGNORE reloc.
Change a RELOC_SECTION_LITA symndx to RELOC_SECTION_ABS.
diff --git a/bfd/elf.c b/bfd/elf.c
index 083f8d2..b00997f 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -330,6 +330,61 @@ bfd_elf_generic_reloc (abfd,
return bfd_reloc_continue;
}
+/* Print out the program headers. */
+
+boolean
+_bfd_elf_print_private_bfd_data (abfd, farg)
+ bfd *abfd;
+ PTR farg;
+{
+ FILE *f = (FILE *) farg;
+ Elf_Internal_Phdr *p;
+ unsigned int i, c;
+
+ p = elf_tdata (abfd)->phdr;
+ if (p == NULL)
+ return true;
+
+ c = elf_elfheader (abfd)->e_phnum;
+ for (i = 0; i < c; i++, p++)
+ {
+ const char *s;
+ char buf[20];
+
+ switch (p->p_type)
+ {
+ case PT_NULL: s = "NULL"; break;
+ case PT_LOAD: s = "LOAD"; break;
+ case PT_DYNAMIC: s = "DYNAMIC"; break;
+ case PT_INTERP: s = "INTERP"; break;
+ case PT_NOTE: s = "NOTE"; break;
+ case PT_SHLIB: s = "SHLIB"; break;
+ case PT_PHDR: s = "PHDR"; break;
+ default: sprintf (buf, "0x%lx", p->p_type); s = buf; break;
+ }
+ fprintf (f, "%8s off 0x", s);
+ fprintf_vma (f, p->p_offset);
+ fprintf (f, " vaddr 0x");
+ fprintf_vma (f, p->p_vaddr);
+ fprintf (f, " paddr 0x");
+ fprintf_vma (f, p->p_paddr);
+ fprintf (f, " align 2**%u\n", bfd_log2 (p->p_align));
+ fprintf (f, " filesz 0x");
+ fprintf_vma (f, p->p_filesz);
+ fprintf (f, " memsz 0x");
+ fprintf_vma (f, p->p_memsz);
+ fprintf (f, " flags %c%c%c",
+ (p->p_flags & PF_R) != 0 ? 'r' : '-',
+ (p->p_flags & PF_W) != 0 ? 'w' : '-',
+ (p->p_flags & PF_X) != 0 ? 'x' : '-');
+ if ((p->p_flags &~ (PF_R | PF_W | PF_X)) != 0)
+ fprintf (f, " %lx", p->p_flags &~ (PF_R | PF_W | PF_X));
+ fprintf (f, "\n");
+ }
+
+ return true;
+}
+
/* Display ELF-specific fields of a symbol. */
void
bfd_elf_print_symbol (ignore_abfd, filep, symbol, how)
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index 5ef3ed0..e719d0d 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -101,7 +101,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#endif
#ifndef bfd_elfNN_bfd_print_private_bfd_data
#define bfd_elfNN_bfd_print_private_bfd_data \
- ((boolean (*) PARAMS ((bfd *, void *))) bfd_true)
+ _bfd_elf_print_private_bfd_data
#endif
#ifndef bfd_elfNN_bfd_merge_private_bfd_data
#define bfd_elfNN_bfd_merge_private_bfd_data \