summaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2013-10-09 14:06:00 +0000
committerNick Clifton <nickc@redhat.com>2013-10-09 14:06:00 +0000
commitaf0f30c1d78a7f1466b06102aaff1036ceb064f9 (patch)
tree863e735d3c25c616d928161739b1228e16132327 /binutils
parent03fc0bdbb22d4f9b66fd8c43bf0fcf32a7066d75 (diff)
downloadbinutils-redhat-af0f30c1d78a7f1466b06102aaff1036ceb064f9.tar.gz
* dwarf.c (add64): New function.
(read_and_display_attr_value): Add CU offset in to the value displayed for a DW_AT_ref8 attribute.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/dwarf.c36
2 files changed, 39 insertions, 3 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index a6815f3076..2bebf99999 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2013-10-09 Nick Clifton <nickc@redhat.com>
+
+ * dwarf.c (add64): New function.
+ (read_and_display_attr_value): Add CU offset in to the value
+ displayed for a DW_AT_ref8 attribute.
+
2013-10-01 Cory Fields <cory@coryfields.com>
* arsup.c (ar_save): Respect the deterministic setting when
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 283aceb495..d5f7baf33a 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -1425,6 +1425,34 @@ find_cu_tu_set_v2 (dwarf_vma cu_offset, int do_types)
return NULL;
}
+/* Add INC to HIGH_BITS:LOW_BITS. */
+static void
+add64 (dwarf_vma * high_bits, dwarf_vma * low_bits, dwarf_vma inc)
+{
+ dwarf_vma tmp = * low_bits;
+
+ tmp += inc;
+
+ /* FIXME: There is probably a better way of handling this:
+
+ We need to cope with dwarf_vma being a 32-bit or 64-bit
+ type. Plus regardless of its size LOW_BITS is meant to
+ only hold 32-bits, so if there is overflow or wrap around
+ we must propagate into HIGH_BITS. */
+ if (tmp < * low_bits)
+ {
+ ++ * high_bits;
+ }
+ else if (sizeof (tmp) > 8
+ && (tmp >> 31) > 1)
+ {
+ ++ * high_bits;
+ tmp &= 0xFFFFFFFF;
+ }
+
+ * low_bits = tmp;
+}
+
static unsigned char *
read_and_display_attr_value (unsigned long attribute,
unsigned long form,
@@ -1567,15 +1595,17 @@ read_and_display_attr_value (unsigned long attribute,
case DW_FORM_ref8:
case DW_FORM_data8:
- if (!do_loc)
{
dwarf_vma high_bits;
+ dwarf_vma utmp;
char buf[64];
SAFE_BYTE_GET64 (data, &high_bits, &uvalue, end);
-
+ utmp = uvalue;
+ if (form == DW_FORM_ref8)
+ add64 (& high_bits, & utmp, cu_offset);
printf (" 0x%s",
- dwarf_vmatoa64 (high_bits, uvalue, buf, sizeof (buf)));
+ dwarf_vmatoa64 (high_bits, utmp, buf, sizeof (buf)));
}
if ((do_loc || do_debug_loc || do_debug_ranges)