[Dwarf-discuss] enumeration and byte size in dwarf2

Daniel Jacobowitz drow
Wed Aug 3 09:20:55 GMT 2005


On Wed, Aug 03, 2005 at 03:16:53PM +0200, Goud Stephane-r57256 wrote:
> Hello to everyone in the list,
> I have a question on dwarf2 format (surprising right?) about enumerations support.
>  
> For some enumerations in the file I have, I get a DW_TAG_enumeration which has an attribute DW_AT_byte_size set to 2.
> Then this entry is followed by the children entries representing the enumeration literal with the tag DW_TAG_enumerator.
>  
> Each entry has a DW_AT_const_value attribute and what is surprising to me is that it has an encoding type set to DW_FORM_data8.
>  
> I also have the case with an enum defined with DW_AT_byte_size = 1 and the DW_AT_const_value using DW_FORM_data4 or DW_FORM_data2.
>  
> I would like to understand how we can come to such case i.e. having the enumeration defined to be stored on X bytes and the children values defined on Y bytes
> with Y > X (in fact I was expecting Y == X).
>  
> Any clue of what could be the root cause of this?

It's just a quirk of whatever you are using to generate the debug
information.

The FORM only controls how the value is represented in debug info; it
has no relation to how the value is represented in your program.  The
constant will be stored in two bytes in memory, even if DW_FORM_data8
is used.

-- 
Daniel Jacobowitz
CodeSourcery, LLC




More information about the Dwarf-discuss mailing list