[Dwarf-Discuss] DW_FORM_data1 and DW_AT_const_value

Michael Eager eager@eagercon.com
Mon Jul 26 23:43:58 GMT 2010


David Anderson wrote:
> Michael Eager wrote:
>>> There is a distinction between "ambiguous" and "unspecified".
>>> The interpretation of the value of DW_FORM_data is unspecified.
>>> I don't believe that there is any ambiguity.
>>>      
>>    
> 
> If gcc simply avoided using a DW_FORM_data<n> that was unspecified-meaning
> the problem would go away.  For the value 204, DW_FORM_data2 (and
> some other FORMs)  would do fine
> without treading unspecified waters.

If the value has the high order bit set, you don't know if it
should be sign or zero extended.  I guess you could always use
a data size larger than the smallest which could contain the value.

> When the data<n> is an offset (as in DWARF3 data4, data8) then it 
> clearly is 'unsigned'.
> 
> If a data type is 'char', and char is 8 bits,
> and a data object's  DW_AT_const_value has form DW_FORM_data1
> there is no ambiguity at all.
> 
> DW_TAG_subrange gives reason to think that if the basis type and the
> DW_FORM_data<n> are the same size that the DW_AT_upper (and lower)
> bounds would use the signedness of the basis type to 'extend' the bits
> if one is expanding the value to a larger integer.
> 
> So not all uses of DW_FORM_data<n> have any value ambiguity.
> 
> But some  uses of data<n> stray into unspecified waters.
> 
> DavidA.
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Dwarf-Discuss mailing list
> Dwarf-Discuss at lists.dwarfstd.org
> http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org
> 


-- 
Michael Eager	 eager at eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077




More information about the Dwarf-discuss mailing list