[Dwarf-Discuss] DW_TAG_base_type must have DW_AT_name?
Robinson, Paul T (JCTL-NonStop)
paul.t.robinson at hp.com
Wed Oct 27 12:25:14 PDT 2010
On Wed, Oct 27, 2010 at 11:39:24AM -0400, Kendrick Wong wrote:
> In section 5.1, does the specification mean that DW_TAG_base_type must
> have a DW_AT_name or it can have a DW_AT_name?
> The name attribute makes sense for language like C/C++, but I'm not sure
> how it applies to language like COBOL, where the type name is implied in
> the picture string:
> MYEDIT PIC ABBA(5)
> this generates a variable MYEDIT, which points to a base type with
> DW_AT_encoding(DW_ATE_edited). The type itself really has no name.
> FYI.. here is the wordings In section 5.1:
> "A base type is represented by a debugging information entry with the tag
> A base type entry has a DW_AT_name attribute whose value is a
> null-terminated string containing the name of the base type as recognized
> by the programming language of the compilation unit containing the base
> type entry.
> A base type entry may have a DW_AT_endianity attribute as described in
> Section 4.1. If omitted, the encoding assumes the representation that is
> the default for the target architecture."
> Kendrick Wong
Section 5.1 clearly did not contemplate the existence of a language
that doesn't have predefined base types, but I think COBOL can be
accurately described that way. It has a kind of sub-language for
specifying characteristics of types (the PICTURE and USAGE clauses).
You couldn't even really give a name to a user-defined type until
the COBOL-2002 standard introduced TYPEDEF.
Language-lawyering the text in 5.1, three attributes are specified
as "has": name, encoding, and (byte_size or bit_size). The latter
are really required, in the sense that the entry is meaningless
without them, but the name doesn't fall into that category.
So, I think an editorial correction for name would be appropriate.
This would make 5.1 consistent with 4.1, which uses "may have"
globally for a bunch of attributes, including DW_AT_name.
More information about the Dwarf-Discuss