aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.c
diff options
context:
space:
mode:
authorAndreas Arnez <arnez@linux.vnet.ibm.com>2016-11-24 17:48:03 +0100
committerAndreas Arnez <arnez@linux.vnet.ibm.com>2016-11-24 17:48:03 +0100
commitda5b30da2d1167591aa8d71b543f97bfdc2ec2a2 (patch)
tree02b8642e03532bfd81e14658ccf016b1e2dfa428 /gdb/dwarf2read.c
parent1dcb9720d62cd053a72c31881b7724ce9f74332c (diff)
downloadgdb-da5b30da2d1167591aa8d71b543f97bfdc2ec2a2.zip
gdb-da5b30da2d1167591aa8d71b543f97bfdc2ec2a2.tar.gz
gdb-da5b30da2d1167591aa8d71b543f97bfdc2ec2a2.tar.bz2
Fix PR12616 - gdb does not implement DW_AT_data_bit_offset
The DW_AT_data_bit_offset attribute was introduced by DWARF V4 and allows specifying the offset of a data member within its containing entity. But although the new attribute was intended to replace DW_AT_bit_offset for this purpose, GDB ignores it, and thus GCC still emits DW_AT_bit_offset instead. See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71669. This change fixes GDB's lack of support for DW_AT_data_bit_offset and adds an appropriate test case. gdb/ChangeLog: PR gdb/12616 * dwarf2read.c (dwarf2_add_field): Handle the DWARF V4 attribute DW_AT_data_bit_offset. gdb/testsuite/ChangeLog: PR gdb/12616 * gdb.dwarf2/nonvar-access.exp: New testcase. Check that GDB respects the DW_AT_data_bit_offset attribute.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r--gdb/dwarf2read.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 1ad6b00..558159a 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -12584,6 +12584,10 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
- bit_offset - FIELD_BITSIZE (*fp)));
}
}
+ attr = dwarf2_attr (die, DW_AT_data_bit_offset, cu);
+ if (attr != NULL)
+ SET_FIELD_BITPOS (*fp, (FIELD_BITPOS (*fp)
+ + dwarf2_get_attr_constant_value (attr, 0)));
/* Get name of field. */
fieldname = dwarf2_name (die, cu);