[PATCH] Use slightly more compact DW_AT_data_member_location
Jakub Jelinek
jakub@redhat.com
Tue Jul 27 09:22:00 GMT 2010
Hi!
E.g. on
struct A { char pad[136]; int i; } a;
the following patch saves one byte in .debug_info, by using DW_FORM_data1
instead of DW_FORM_sdata for DW_AT_data_member_location.
I've briefly looked at gdb (and valgrind) and I think it should handle
this just fine:
xxx = dwarf2_get_attr_constant_value (attr, 0);
and
if (attr->form == DW_FORM_sdata)
return DW_SND (attr);
else if (attr->form == DW_FORM_udata
|| attr->form == DW_FORM_data1
|| attr->form == DW_FORM_data2
|| attr->form == DW_FORM_data4
|| attr->form == DW_FORM_data8)
return DW_UNSND (attr);
Ok for trunk?
2010-07-27 Jakub Jelinek <jakub@redhat.com>
* dwarf2out.c (add_data_member_location_attribute): Use
add_AT_unsigned instead of add_AT_int if offset is non-negative.
--- gcc/dwarf2out.c.jj 2010-07-26 11:40:20.000000000 +0200
+++ gcc/dwarf2out.c 2010-07-27 11:08:38.000000000 +0200
@@ -15911,7 +15911,10 @@ add_data_member_location_attribute (dw_d
if (dwarf_version > 2)
{
/* Don't need to output a location expression, just the constant. */
- add_AT_int (die, DW_AT_data_member_location, offset);
+ if (offset < 0)
+ add_AT_int (die, DW_AT_data_member_location, offset);
+ else
+ add_AT_unsigned (die, DW_AT_data_member_location, offset);
return;
}
else
Jakub
More information about the Gcc-patches
mailing list