[Dwarf-Discuss] Multiple meaning for DW_AT_byte_size in DW_TAG_string_type

Kendrick Wong kendrick@ca.ibm.com
Thu Dec 2 22:50:23 GMT 2010


PL/I has the a data type "varying char".  For example:
dcl c1 char(5) varying;
would create a variable 'c1' that occupies 7 bytes of storage (with the 
first 2 bytes indicating the actual string length, followed by 5 bytes 
holding the character data)

In DWARF, DW_TAG_string_type can be used to represent a "varying char" 
type.  But the current specification states that DW_AT_byte_size is used 
for holding length of string length field (i.e. 2 in this example) or 
amount of storage needed to hold data (i.e. 7 in this example), but not 
both:

A string type is represented by a debugging information entry with the tag 
DW_TAG_string_type. If a name has been given to the string type in the 
source program, then the corresponding string type entry has a DW_AT_name 
attribute whose value is a null- terminated string containing the string 
type name as it appears in the source program. 
The string type entry may have a DW_AT_string_length attribute whose value 
is a location description yielding the location where the length of the 
string is stored in the program. The string type entry may also have a 
DW_AT_byte_size attribute or DW_AT_bit_size attribute, whose value (see 
Section 2.21) is the size of the data to be retrieved from the location 
referenced by the string length attribute. If no (byte or bit) size 
attribute is present, the size of the data to be retrieved is the same as 
the size of an address on the target machine. 
If no string length attribute is present, the string type entry may have a 
DW_AT_byte_size attribute or DW_AT_bit_size attribute, whose value (see 
Section 2.21) is the amount of storage needed to hold a value of the 
string type. 

Are there any producers who use DW_AT_byte_size to hold the size in string 
length attribute?  The meaning of DW_AT_byte_size have been overloaded for 
DW_TAG_string_type.  If possible, I would like to change the meaning of 
DW_AT_byte_size to always reflect the amount of storage required to hold a 
data object and propose a new attribute to hold the size in string length 
attribute.  If that's not possible, then a new attribute to hold the 
amount of storage required to hold the data specifically for 
DW_TAG_string_type.
Kendrick Wong 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/private.cgi/dwarf-discuss-dwarfstd.org/attachments/20101202/7d0de2cc/attachment.htm>



More information about the Dwarf-discuss mailing list