[Dwarf-Discuss] Multiple meaning for DW_AT_byte_size in DW_TAG_string_type

Robinson, Paul T JCTL-NonStop paul.t.robinson@hp.com
Fri Dec 3 02:23:56 GMT 2010


This same topic came up during the October 16 2009 document review, as reported by David Anderson in an e-mail dated October 17.
At that time we were looking only for editorial fixes, not substantive changes, and this would have been a substantive change.
I agree it's peculiar as currently written, and I meant to put together a proposal at some point, but that point never came.
I'd be happy to help put one together now.
--paulr

From: dwarf-discuss-bounces at lists.dwarfstd.org [mailto:dwarf-discuss-bounces@lists.dwarfstd.org] On Behalf Of Kendrick Wong
Sent: Thursday, December 02, 2010 2:50 PM
To: dwarf-discuss at lists.dwarfstd.org
Subject: [Dwarf-Discuss] Multiple meaning for DW_AT_byte_size in DW_TAG_string_type

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/20101203/73fc3c08/attachment.htm>



More information about the Dwarf-discuss mailing list