[Dwarf-Discuss] Attribute DW_AT_location has form DW_FORM_sdata?

David Anderson davea42 at earthlink.net
Wed Oct 5 17:12:36 PDT 2011


On 10/04/2011 12:34 PM, Ron Louzon wrote:
> Since dwarf_loclist_n() already supports DW_FORM_data4 
> and DW_FORM_data8, i s there any plan to update it in a future release 
> to accomodate DW_FORM_sdata?
>
For the record, a solution to proper handling of 
DW_AT_data_member_location  (while being
sensitive to the dwarf version of the compilation unit under 
consideration)  when using libdwarf
is the one used in dwarfdump:

             fc = dwarf_get_form_class(version,attr,offset_size,theform);
             if(fc == DW_FORM_CLASS_CONSTANT) {
                    ...and here read the data as a constant.
             } else {
                    call dwarf_loclist_n
              }

dwarf_get_form_class () understands that DW_FORM_data4 (for example) is 
a constant for DWARF4
but is a loclist offset for 32bit DWARF3.  And so on.

Anyone with information that I've messed up here, please let me know...

A new release is in the works, I've found a few small bugs and now 
dwarfdump2
will have all the checking and option features of dwarfdump.

Many thanks to Carlos Alberto Enciso and Paul Marinescu for 
recent-assistance/test-cases!
My apologies to folks who have helped but are not mentioned here.
DavidA.



More information about the Dwarf-Discuss mailing list