summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2003-06-04 21:03:23 +0000
committerMark Kettenis <kettenis@gnu.org>2003-06-04 21:03:23 +0000
commit2d59d0286b9e5f58241bda2c20a744e1c4ec95c3 (patch)
tree2780600ecb60f8880b3072b01b3995a6fe4b1cfe
parent1970a153f4d1fb897011bdabcbece4f7f338aa29 (diff)
downloadgdb-2d59d0286b9e5f58241bda2c20a744e1c4ec95c3.tar.gz
* dwarf2-frame.c (struct comp_unit): Add member `dbase'.
(read_encoded_value): Handle DW_EH_PE_datarel encoding. (dwarf2_build_frame_info): Set base for DW_EH_PE_datarel encodings when handling .eh_frame sections.
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/dwarf2-frame.c17
2 files changed, 24 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 83782c62ab3..ef26dd977d7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2003-06-04 Mark Kettenis <kettenis@gnu.org>
+
+ * dwarf2-frame.c (struct comp_unit): Add member `dbase'.
+ (read_encoded_value): Handle DW_EH_PE_datarel encoding.
+ (dwarf2_build_frame_info): Set base for DW_EH_PE_datarel encodings
+ when handling .eh_frame sections.
+
2003-06-04 J. Brobecker <brobecker@gnat.com>
* config/pa/nm-hppah.h (PREPARE_TO_PROCEED): Use the generic
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index 7dbd0dbf753..f28fade3d7c 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -747,6 +747,9 @@ struct comp_unit
/* Pointer to the .debug_frame section. */
asection *dwarf_frame_section;
+
+ /* Base for DW_EH_PE_datarel encodings. */
+ bfd_vma dbase;
};
static unsigned int
@@ -916,6 +919,9 @@ read_encoded_value (struct comp_unit *unit, unsigned char encoding,
base = bfd_get_section_vma (unit->bfd, unit->dwarf_frame_section);
base += (buf - unit->dwarf_frame_buffer);
break;
+ case DW_EH_PE_datarel:
+ base = unit->dbase;
+ break;
default:
internal_error (__FILE__, __LINE__, "Invalid or unsupported encoding");
}
@@ -1251,11 +1257,14 @@ dwarf2_build_frame_info (struct objfile *objfile)
unit.abfd = objfile->obfd;
unit.objfile = objfile;
unit.addr_size = objfile->obfd->arch_info->bits_per_address / 8;
+ unit.dbase = 0;
/* First add the information from the .eh_frame section. That way,
the FDEs from that section are searched last. */
if (dwarf_eh_frame_offset)
{
+ asection *got;
+
unit.cie = NULL;
unit.dwarf_frame_buffer = dwarf2_read_section (objfile,
dwarf_eh_frame_offset,
@@ -1265,6 +1274,14 @@ dwarf2_build_frame_info (struct objfile *objfile)
unit.dwarf_frame_size = dwarf_eh_frame_size;
unit.dwarf_frame_section = dwarf_eh_frame_section;
+ /* FIXME: kettenis/20030602: This is the DW_EH_PE_datarel base
+ that for the i386/amd64 target, which currently is the only
+ target in GCC that supports/uses the DW_EH_PE_datarel
+ encoding. */
+ got = bfd_get_section_by_name (unit.abfd, ".got");
+ if (got)
+ unit.dbase = got->vma;
+
frame_ptr = unit.dwarf_frame_buffer;
while (frame_ptr < unit.dwarf_frame_buffer + unit.dwarf_frame_size)
frame_ptr = decode_frame_entry (&unit, frame_ptr, 1);