[Dwarf-Discuss] What is a byte's size?

Jan van Dongen jvd@ace.nl
Mon Jul 21 13:04:41 GMT 2008


I've an issue with one of our users about the meaning of the DW_AT_byte_size

In my interpretation a value of '1' means '1' minimal addressable unit. On an
architecture with 16-bit memory, this then means one '16-bit' byte.

The user (or actually his debugger provider) interprets the value '1'
as one '8-bit' byte. Iow: a byte is always 8-bit in size. A 16-bit 'short int'
then should have a 'DW_AT_byte_size' with value '2'.

The DWARF3 standard defines:
  A base type entry has a DW_AT_byte_size attribute, whose value (see Section
  2.19) is the size in bytes of the storage unit used to represent an object of
  the given type.

The phrase 'bytes of the storage unit used' to me explains that the size of a
byte depends on the architecture and thus is not an 8-bit entity by
definition. Unfortunately, the DWARF document nowhere gives an explanation of
the term 'byte'.

Even worse, of course a 'byte' in an object file does not have to match
a 'byte' on the architecture, so there can be confusion everywhere.

Can anyone provide me the proper interpretation?

Kind regards,
	Jan van Dongen

Jan van Dongen, Senior Software Engineer, ACE Associated Compiler Experts bv,
De Ruyterkade 113, 1011 AB Amsterdam, The Netherlands.
Tel: +31 20 6646416, Fax: +31 20 6750389,
mailto:jvd at ace.nl, http://www.ace.nl
This e-mail and any files transmitted with it are confidential. Any tech-
nical information contained herein is supplied as-is, and no rights can
be derived therefrom. Unless you are the intended recipient, you should
not read, disclose, copy, or otherwise use the information in this message.
If you have received the message in error, please notify the sender by
reply e-mail immediately and delete the message and all copies thereof.

More information about the Dwarf-discuss mailing list