[Dwarf-Discuss] decoding of form entries

Michael Eager eager at eagercon.com
Mon Aug 2 13:50:45 PDT 2010


David Gross wrote:
> Michael wrote:
>> David Gross wrote:
>>> Michael wrote:
>>>
>>>> Mathieu Lacage wrote:
>>>>> On Mon, Aug 2, 2010 at 18:07, Michael Eager <eager at eagercon.com> wrote:
>>>>>
>>>>>>> So, I have a very practical question: if I want to get the value of
>>>>>>> this form, I read the reference, that gives me a new location to parse
>>>>>>> in the dwarf sections. What is the content of that new location ? Does
>>>>>>> it point to an entry (meaning, I am going to find there an abbrev
>>>>>>> code) ? If so, how do I know which attribute in this entry is going to
>>>>>>> contain the value of my original attribute ? Would it be expected to
>>>>>>> be the same attribute with a different non-reference form ?
>>>>>> In the most common cases, the "entity" will be another DIE in the
>>>>>> same compilation unit, which you will need to parse to find the
>>>>>> value of attribute you are looking for.
>>>>> That is what I suspected but, I am not sure I really understand your
>>>>> answer so, let me restate my question again.
>>>>>
>>>>> How do I know which attribute to look for in the new DIE ? Is it
>>>>> expected that the new DIE will contain the same attribute I looked at
>>>>> originally but with a non-reference form ? For the sake of discussion,
>>>>> what about DW_AT_byte_size ?
>>>> Yes, generally you would search the referenced DIE to find the same
>>>> attribute.
>>> I see a different pattern in D.2.2 (Ada Example): 13$ contains a
>>> DW_AT_upper_bound whose value is a reference to a variable.  The
>>> variable does not contain a DW_AT_upper_bound; the value of the
>>> variable itself is the value of the DW_AT_upper_bound.  That's the
>>> pattern that I expected to see; I wasn't aware that the standard
>>> intends to support the delegation pattern you describe above.
>> For DW_AT_upper_bound and DW_AT_lower_bound, the intent of a reference
>> is to point to the DIE for a variable which contains the value.  But
>> this does not appear to be stated explicitly in the description of
>> 5.11 Subrange Type Entries.
>>
>> Can you add an issue so that we fix this in the next version?
> 
> Do you mean that these two attributes are different from the rest of
> the "applicable attributes" listed under Static and Dynamic
> Properties?

Maybe.  My interpretation of a reference for DW_AT_upper_bound
was that it pointed to a variable with the dynamic value of
the bound.  For DW_AT_byte_size, a reference points to a DIE
which has an attribute with that value.

Perhaps this was an incorrect impression.  The DWARF spec does say
that the reference is to "another entity which specifies the value
of the attribute" which I took to mean that the reference contained
an attribute with the value, not that the variable contained that
value.

Are there compilers which generate a reference to a variable containing
the value of DW_AT_byte_size?

I think that our wording allows both interpretations, unfortunately.


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



More information about the Dwarf-Discuss mailing list