Simple struct member offset doesn't need a full dwarf location expression

Mark Wielaard mjw@redhat.com
Wed Jul 8 12:57:00 GMT 2009


On Tue, 2009-07-07 at 15:04 -0700, Richard Henderson wrote:
> On 07/07/2009 10:09 AM, Mark Wielaard wrote:
> > As explained in PR40659 a simple struct member offset doesn't need a
> > full dwarf location expression, but can just encode the
> > DW_AT_data_member_location as a constant offset according to the Dwarf
> > standard. This saves a little space (one byte per struct field member)
> > and is slightly simpler to handle for debuginfo consumers. It is also
> > the recommended way to encode this according to the examples in the
> > Dwarf standard appendix.
> 
> This is true for dwarf3 only.
> 
> For dwarf2, section 7.5.4 figure 18 specifies that DW_AT_d_m_l is only 
> valid with block/reference forms.  Which suggests we want to emit this 
> only when dwarf_version > 2.

OK, I had missed that. The following patch it that way, so the condensed
representation is only output when -gdwarf-3 is given. Again the
MIPS_DEBUGGING_INFO case hasn't changed.

2009-07-08  Mark Wielaard  <mjw@redhat.com>

    PR debug/40659
    * dwarf2out.c (add_data_member_location_attribute): When we have
    only a constant offset don't emit a new location description using
    DW_OP_plus_uconst, but just add the constant with add_AT_int, when
    dwarf_version > 2.

This is slightly harder to test though, since neither gdb, nor systemtap
currently support dwarf3 fully, in particular they don't support
DW_OP_call_frame_cfa that is emitted with dwarf_version > 2.

Thanks,

Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dw_at_member_location.patch
Type: text/x-patch
Size: 546 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20090708/316d18dc/attachment.bin>


More information about the Gcc-patches mailing list