| Submitter | Jakub Jelinek |
|---|---|
| Date | July 27, 2010, 9:21 a.m. |
| Message ID | <20100727092137.GV18378@tyan-ft48-01.lab.bos.redhat.com> |
| Download | mbox | patch |
| Permalink | /patch/59983/ |
| State | New |
| Headers | show |
Comments
OK. Jsaon
Patch
--- 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
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. Jakub