aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Tietz <kai.tietz@onevision.com>2009-04-05 18:12:21 +0000
committerKai Tietz <kai.tietz@onevision.com>2009-04-05 18:12:21 +0000
commitc7c7219d3a06a714e04e73ebd029811e6bd5bd37 (patch)
tree28c613b8389513b0290b88ea841b4eaaf2d89e8c
parentbab7ee3b3577fff3b8eb0b3fcf7554d5ac152549 (diff)
downloadgdb-c7c7219d3a06a714e04e73ebd029811e6bd5bd37.zip
gdb-c7c7219d3a06a714e04e73ebd029811e6bd5bd37.tar.gz
gdb-c7c7219d3a06a714e04e73ebd029811e6bd5bd37.tar.bz2
2009-04-05 Kai Tietz <kai.tietz@onevision.com>
* coff-x86_64.c (bfd_pe_print_pdata): Define as _bfd_pep_print_x64_pdata. * libpei.h (_bfd_pep_print_x64_pdata): Add prototype. * peXXigen.c (_bfd_pep_print_x64_pdata): New.
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/coff-x86_64.c5
-rw-r--r--bfd/libpei.h1
-rw-r--r--bfd/peXXigen.c80
4 files changed, 90 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ea46be6..182cc8a 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2009-04-05 Kai Tietz <kai.tietz@onevision.com>
+
+ * coff-x86_64.c (bfd_pe_print_pdata): Define as
+ _bfd_pep_print_x64_pdata.
+ * libpei.h (_bfd_pep_print_x64_pdata): Add prototype.
+ * peXXigen.c (_bfd_pep_print_x64_pdata): New.
+
2009-04-02 Sterling Augustine <sterling@jaw.hq.tensilica.com>
* elf32-xtensa.c (relax_property_section): Always set r_offset
diff --git a/bfd/coff-x86_64.c b/bfd/coff-x86_64.c
index 78a7886..aca5c8d 100644
--- a/bfd/coff-x86_64.c
+++ b/bfd/coff-x86_64.c
@@ -711,9 +711,8 @@ coff_amd64_is_local_label_name (bfd *abfd, const char *name)
#endif /* TARGET_UNDERSCORE */
-#ifndef bfd_pe_print_pdata
-#define bfd_pe_print_pdata NULL
-#endif
+#undef bfd_pe_print_pdata
+#define bfd_pe_print_pdata _bfd_pep_print_x64_pdata
#include "coffcode.h"
diff --git a/bfd/libpei.h b/bfd/libpei.h
index 8fcae7b..b9a2683 100644
--- a/bfd/libpei.h
+++ b/bfd/libpei.h
@@ -393,4 +393,5 @@ bfd_boolean _bfd_pe_print_ce_compressed_pdata (bfd *, void *);
bfd_boolean _bfd_pe64_print_ce_compressed_pdata (bfd *, void *);
bfd_boolean _bfd_pex64_print_ce_compressed_pdata (bfd *, void *);
bfd_boolean _bfd_pep_print_ce_compressed_pdata (bfd *, void *);
+bfd_boolean _bfd_pep_print_x64_pdata (bfd *, void *);
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index 6cdcf34..a95af9c 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -1894,6 +1894,86 @@ _bfd_XX_print_ce_compressed_pdata (bfd * abfd, void * vfile)
return TRUE;
#undef PDATA_ROW_SIZE
}
+
+/* The PE+ x64 variant. */
+bfd_boolean
+_bfd_pep_print_x64_pdata (bfd *abfd, void *vfile)
+{
+# define PDATA_ROW_SIZE (3 * 4)
+ FILE *file = (FILE *) vfile;
+ bfd_byte *data = NULL;
+ asection *section = bfd_get_section_by_name (abfd, ".pdata");
+ bfd_size_type datasize = 0;
+ bfd_size_type i;
+ bfd_size_type start, stop;
+ int onaline = PDATA_ROW_SIZE;
+ struct sym_cache sym_cache = {0, 0};
+
+ if (section == NULL
+ || coff_section_data (abfd, section) == NULL
+ || pei_section_data (abfd, section) == NULL)
+ return TRUE;
+
+ stop = pei_section_data (abfd, section)->virt_size;
+ if ((stop % onaline) != 0)
+ fprintf (file,
+ _("warning: .pdata section size (%ld) is not a multiple of %d\n"),
+ (long) stop, onaline);
+
+ fprintf (file,
+ _("\nThe Function Table (interpreted .pdata section contents)\n"));
+
+ fprintf (file, _("vma:\t\t\tBeginAddress\t EndAddress\t UnwindData\n"));
+
+ datasize = section->size;
+ if (datasize == 0)
+ return TRUE;
+
+ if (!bfd_malloc_and_get_section (abfd, section, &data))
+ {
+ if (data != NULL)
+ free (data);
+ return FALSE;
+ }
+
+ start = 0;
+
+ for (i = start; i < stop; i += onaline)
+ {
+ bfd_vma begin_addr;
+ bfd_vma end_addr;
+ bfd_vma unwind_data_addr;
+
+ if (i + PDATA_ROW_SIZE > stop)
+ break;
+
+ begin_addr = bfd_get_32 (abfd, data + i);
+ end_addr = bfd_get_32 (abfd, data + i + 4);
+ unwind_data_addr = bfd_get_32 (abfd, data + i + 8);
+
+ if (begin_addr == 0 && end_addr == 0 && unwind_data_addr == 0)
+ /* We are probably into the padding of the section now. */
+ break;
+
+ fputc (' ', file);
+ fprintf_vma (file, i + section->vma);
+ fprintf (file, ":\t");
+ fprintf_vma (file, begin_addr);
+ fputc (' ', file);
+ fprintf_vma (file, end_addr);
+ fputc (' ', file);
+ fprintf_vma (file, unwind_data_addr);
+
+ fprintf (file, "\n");
+ }
+
+ free (data);
+
+ cleanup_syms (&sym_cache);
+
+ return TRUE;
+#undef PDATA_ROW_SIZE
+}
#define IMAGE_REL_BASED_HIGHADJ 4
static const char * const tbl[] =