[Dwarf-Discuss] byte vs. octet size
jsachs at dekaresearch.com
Fri Feb 12 06:29:47 PST 2010
I'm having a bit of a concern with a vendor's implementation (Texas Instruments) of DWARF debugging info. The TI C2000 series of processors has memory locations each containing 16 bits. TI has chosen to measure the size of variables in DWARF debugging information (DW_AT_byte_size) as their size in memory locations, so a 16-bit int has DW_AT_byte_size of 1, and a 32-bit long has DW_AT_byte_size of 2.
I can't find anywhere in the DWARF manual (I've read version 2.0 which TI implements; not sure if this has been clarified in 3.0 somewhere) where it either states definitively that a byte is an 8-bit octet, or that a byte may not be 8 bits per the C standard. The DWARF manual 2.0 does state in section 5.1:
For example, the C type int on a machine that uses 32-bit
integers would be represented by a base type entry with a
name attribute whose value was ''int,'' an encoding attribute
whose value was DW_ATE_signed and a byte size attribute whose value was 4.
...thereby making the assumption of 8-bit bytes, but that isn't stated explicitly.
Nor can I find anywhere in the DWARF manual where there might be a place for implementations to describe any of the following aspects of machine architecture:
- the number of bits in a byte
- the endianness of multibyte quantities, e.g. in a machine with 8-bit bytes, whether the 16-bit quantity "2" is stored as the successive bytes (0x00, 0x02) or as the successive bytes (0x02, 0x00)
- machine architecture name (e.g. "Intel x86" or "TI C2000" or "8051" or [insert your favorite processor type here])
This information is important in a few key areas, notably translation of bit field positions from DW_AT_bit_offset (measured as an offset from the most significant end of the variable... but if I don't know how many bits a byte is, and my variable size is measured in bytes, I can't handle this properly).
Any thoughts? I figured I'd get this straight from those of you familiar with the DWARF standard. (apologies if this has been asked before, I tried a little searching on the mailing list but didn't find anything)
DEKA Research and Development
This e-mail and the information, including any attachments, it contains are intended to be a confidential communication only to the person or entity to whom it is addressed and may contain information that is privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender and destroy the original message.
Please consider the environment before printing this email.
More information about the Dwarf-Discuss