[Dwarf-Discuss] Attribute DW_AT_location has form DW_FORM_sdata?

Ron Louzon louzonr at yahoo.com
Tue Oct 4 11:03:15 PDT 2011


I am working with DWARF output from the GNU 4.4 C++ compiler and I have a question about the output for structure member locations.  I am looking at the following information for a class and its members 
 
 <1><2819e>: Abbrev Number: 108 (DW_TAG_class_type)
    <2819f>   DW_AT_name        : (indirect string, offset: 0x26a2d): CmpCommandListHandler 
    <281a3>   DW_AT_byte_size   : 20560 
    <281a5>   DW_AT_decl_file   : 55 
    <281a6>   DW_AT_decl_line   : 31 
    <281a7>   DW_AT_sibling     : <0x2834c> 

 <2><281ab>: Abbrev Number: 98 (DW_TAG_member)
    <281ac>   DW_AT_name        : (indirect string, offset: 0xb70e): activeWcl 
    <281b0>   DW_AT_decl_file   : 55 
    <281b1>   DW_AT_decl_line   : 75 
    <281b2>   DW_AT_type        : <0x27bc2> 
    <281b6>   DW_AT_data_member_location: 0 
    <281b7>   DW_AT_accessibility: 3 (private)

 <2><281b8>: Abbrev Number: 98 (DW_TAG_member)
    <281b9>   DW_AT_name        : (indirect string, offset: 0x1ca9d): activeMcl 
    <281bd>   DW_AT_decl_file   : 55 
    <281be>   DW_AT_decl_line   : 78 
    <281bf>   DW_AT_type        : <0x277ee> 
    <281c3>   DW_AT_data_member_location: 8216 
    <281c6>   DW_AT_accessibility: 3 (private)
 
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?
 
Thanks.
Ron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/private.cgi/dwarf-discuss-dwarfstd.org/attachments/20111004/0722619e/attachment-0001.htm>


More information about the Dwarf-Discuss mailing list