Bug 12616

Summary: gdb does not implement DW_AT_data_bit_offset
Product: gdb Reporter: Tom Tromey <tromey>
Component: gdbAssignee: Andreas Arnez <arnez>
Status: RESOLVED FIXED    
Severity: normal CC: arnez, pinskia
Priority: P2 Keywords: archer
Version: HEAD   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description Tom Tromey 2011-03-29 13:55:39 UTC
gdb does not implement DW_AT_data_bit_offset
See http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00074.html
Comment 1 Andrew Pinski 2016-06-26 20:41:00 UTC
Filed GCC bug as:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71669
Comment 2 Andreas Arnez 2016-11-14 15:21:41 UTC
Posted a proposed fix:
https://sourceware.org/ml/gdb-patches/2016-11/msg00337.html
Comment 3 Sourceware Commits 2016-11-24 16:49:46 UTC
The master branch has been updated by Andreas Arnez <arnez@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=da5b30da2d1167591aa8d71b543f97bfdc2ec2a2

commit da5b30da2d1167591aa8d71b543f97bfdc2ec2a2
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date:   Thu Nov 24 17:48:03 2016 +0100

    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.
Comment 4 Andreas Arnez 2017-03-07 15:58:59 UTC
(In reply to cvs-commit@gcc.gnu.org from comment #3)
> The master branch has been updated by Andreas Arnez <arnez@sourceware.org>:
> 
> https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;
> h=da5b30da2d1167591aa8d71b543f97bfdc2ec2a2

This commit fixes the missing support for DW_AT_data_bit_offset.