[Dwarf-Discuss] Dwarf-Discuss Digest, Vol 15, Issue 2

Moore, David david.moore@intel.com
Tue Jul 22 18:32:21 GMT 2008


One can, for example, look at:

---------------------------------- from the standard ----------------------
DW_OP_pick The single operand of the DW_OP_pick operation provides a 1-byte index. The stack entry with the specified index (0 through 255, inclusive) is pushed on the stack.
---------------------------------------------------------------------------

Which is implicitly defining a BYTE to have values 0 to 255.

Elsewhere, in at least two places, addresses are defined to need 4 or 8 bytes on 32 or 64 bit versions (respectively) of Dwarf.

So really if a byte could be anything other than 8 bits, there would be difficulties on a number of places in the standard. You would at best have some funny encodings of opcodes.

Unfortunately, the standard also implicitly associates bytes with characters in strings. However, if characters are of a different size, I think that can be read as "a string of characters reinterpreted as a string of bytes" without serious damage to one's ability to emit conforming Dwarf.

-----Original Message-----
From: dwarf-discuss-bounces at lists.dwarfstd.org [mailto:dwarf-discuss-bounces at lists.dwarfstd.org] On Behalf Of dwarf-discuss-request@lists.dwarfstd.org
Sent: Tuesday, July 22, 2008 10:35 AM
To: dwarf-discuss at lists.dwarfstd.org
Subject: Dwarf-Discuss Digest, Vol 15, Issue 2

Send Dwarf-Discuss mailing list submissions to
        dwarf-discuss at lists.dwarfstd.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org
or, via email, send a message with subject or body 'help' to
        dwarf-discuss-request at lists.dwarfstd.org

You can reach the person managing the list at
        dwarf-discuss-owner at lists.dwarfstd.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Dwarf-Discuss digest..."


Today's Topics:

   1. Re: What is a byte's size? (Michael Eager)
   2. Re: What is a byte's size? (Michael Eager)


----------------------------------------------------------------------

Message: 1
Date: Mon, 21 Jul 2008 10:49:44 -0700
From: Michael Eager <eager@eagercon.com>
Subject: Re: [Dwarf-Discuss] What is a byte's size?
To: Jan van Dongen <jvd at ace.nl>
Cc: DWARF <dwarf-discuss at lists.dwarfstd.org>
Message-ID: <4884CC38.5020201 at eagercon.com>
Content-Type: text/plain; charset=UTF-8; format=flowed

Oops.  Replied to the wrong mailing list.

Jan van Dongen wrote:
> Hi,
>
> I've an issue with one of our users about the meaning of the DW_AT_byte_size attribute.
>
> 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

Section 5.1 of the DWARF 3 Standard has this definition of DW_AT_byte_size:
    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.

"Storage unit" in this sentence is the container (e.g., memory) which contains
an object of a particular type.  "Storage unit" is only used in this section and
in the other two uses it is clear that it is describing a container of arbitrary
size, not referring to an architecture-dependent addressing unit.

Unfortunately, the standard doesn't explicitly define 'byte'.  If it did, this
possible ambiguity would not arise.  Byte is used with a single consistent
machine-independent fashion throughout the standard.

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



------------------------------

Message: 2
Date: Mon, 21 Jul 2008 10:56:11 -0700
From: Michael Eager <eager@eagercon.com>
Subject: Re: [Dwarf-Discuss] What is a byte's size?
To: Jan van Dongen <jvd at ace.nl>
Cc: DWARF <dwarf-discuss at lists.dwarfstd.org>,   DWARF Workgroup
        <dwarf-workgroup at lists.dwarfstd.org>
Message-ID: <4884CDBB.6060106 at eagercon.com>
Content-Type: text/plain; charset=UTF-8; format=flowed

Jan van Dongen wrote:
> Dear Michael,
>
> You wrote:
>> Jan van Dongen wrote:
>>> Hi,
>>>
>>> I've an issue with one of our users about the meaning of the
>>> DW_AT_byte_size attribute.
>>>
>>> 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
>>
>> Section 5.1 of the DWARF 3 Standard has this definition of
>> DW_AT_byte_size:
>>    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.
>>
>> "Storage unit" in this sentence is the container (e.g., memory) which
>> contains
>> an object of a particular type.  "Storage unit" is only used in this
>> section and
>> in the other two uses it is clear that it is describing a container of
>> arbitrary
>> size, not referring to an architecture-dependent addressing unit.
>>
>> Unfortunately, the standard doesn't explicitly define 'byte'.  If it
>> did, this
>> possible ambiguity would not arise.  Byte is used with a single
>> consistent
>> machine-independent fashion throughout the standard.
>
> Somehow I feel stupid to ask these questions, but I have to be sure:

Don't be concerned.  It's much better if you confirm assumptions.

> This container 'container of arbitrary size' then is something the producer
> (compiler) and consumer (debugger) have to agree on.

Nope.  The container's size is described by the DW_AT_byte_size attribute.

A double float type would normally be contained in a "storage
unit" which had DW_AT_byte_size = 8.  There's nothing that the
compiler and debugger have to agree upon; it's explicit in the
type description.

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


------------------------------

_______________________________________________
Dwarf-Discuss mailing list
Dwarf-Discuss at lists.dwarfstd.org
http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org


End of Dwarf-Discuss Digest, Vol 15, Issue 2
********************************************




More information about the Dwarf-discuss mailing list