[Dwarf-Discuss] Attribute DW_AT_location has form DW_FORM_sdata?

David Anderson davea42@earthlink.net
Tue Oct 4 19:08:01 GMT 2011

On 10/04/2011 11:03 AM, Ron Louzon wrote:
> In the past, when dealing with structure and class members, I have 
> always been able to use the dwarf_loclist() and dwarf_loclist_n() 
> functions to retrieve location information for the members.  These 
> functions would return the offset which was applicable for whatever 
> member was being examined.  With the GNU 4.4 compiler, these functions 
> are returning an error because the DW_AT_data_member_location 
> attribute is of the form DW_FORM_sdata and these functions do not 
> handle that attribute form.
> I have never encountered this before.  I can deal with this by reading 
> the data as a signed number but is this normal?  Do I always need to 
> examine the form type to determine how to deal with a 
> DW_AT_data_member_location attribute or is this a special case due to 
> abnormal output from the GNU 4.4 compiler?

I added support  (June 2011 I think) to dwarfdump
for an arbitrary constant as the value of DW_AT_data_member_location
and I seem to recall this was exactly because of gcc and DW_FORM_sdata on
DW_AT_data_member_location.    The signed constant kind of surprised me too.

David Anderson.

I have a rock garden. Last week three of them died. -- Richard Diran

More information about the Dwarf-discuss mailing list