This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Support constants for DW_AT_data_member_location
- From: Vladimir Prus <vladimir at codesourcery dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Thu, 29 Nov 2007 12:54:13 +0300
- Subject: Support constants for DW_AT_data_member_location
DWARF standard allows DW_AT_data_member_location value
to be a plain constant, but GDB does not. Is the following OK?
- Volodya
* dwarf2read.c (dwarf2_add_field): Allow
the DW_AT_data_member_location to be of
DW_FORM_udata form.
--- dwarf2read.c (revision 123)
+++ dwarf2read.c (local)
@@ -3500,8 +3500,11 @@ dwarf2_add_field (struct field_info *fip
attr = dwarf2_attr (die, DW_AT_data_member_location, cu);
if (attr)
{
- FIELD_BITPOS (*fp) =
- decode_locdesc (DW_BLOCK (attr), cu) * bits_per_byte;
+ if (attr->form == DW_FORM_udata)
+ FIELD_BITPOS (*fp) = 8 * DW_UNSND (attr);
+ else
+ FIELD_BITPOS (*fp) =
+ decode_locdesc (DW_BLOCK (attr), cu) * bits_per_byte;
}
else
FIELD_BITPOS (*fp) = 0;