diff options
author | Ian Lance Taylor <ian@airs.com> | 1995-11-29 18:46:07 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1995-11-29 18:46:07 +0000 |
commit | 27fb8f2933cd65eb68179a79f0078034f20cfb2c (patch) | |
tree | 25b4f5c9d8ff4898019eecb4caf8705df42ccbcf /bfd/elf.c | |
parent | 77fa4d98a80a87ae11ab99852efd3807b034c2fa (diff) | |
download | gdb-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.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r-- | bfd/elf.c | 55 |
1 files changed, 55 insertions, 0 deletions
@@ -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) |