010302.1 | A | T. Allen | Ada | DW_AT_description attribute |
PROBLEM:
We added the DW_AT_description attribute, which we found very handy for
artificial entities in a program. There are lot of these in an Ada program.
It's a lot like DW_AT_name, only different. It's meant that a debugger will
only ever display these names, and never accept them (as part of expression
evaluation), even if their strings were legal identifiers (which they aren't
required to be).
For instance, say the debugger stops in a package elaboration routine, or in
a routine called from a package elaboration routine. In a walkback, we want
the debugger to describe the package elaboration routine's frame with a nice
name so the user knows what's going on. (In our implementation we use a
string like "<package spec foo elaboration>". The angle brackets are just
to
indicate that this something compiler-generated.)
We also use it whenever the compiler needs to "freeze" the value of a
variable. This sort of thing happens when, say, a type references that
variable as bound or something. The elaboration of the type freezes the
value of the variable at that time, and the type uses that frozen value
henceforth. In that case, we describe the frozen value with the same name as
the variable (with no angle brackets), only using DW_AT_description. Or if
the bound was a full-blown expression, we make the description the string for
that expression. Incidentally, this is one reason why DW_AT_description
names should not be allowed in expression evaluations. They may have names
identical to real variables and could end up hiding the real variables!
We also use it for some non-artificial things, so I don't want to tie it to
only artificial entities. For instance, an Ada object may be of
taggedtype'Class. We describe that class-wide type with a DW_AT_description
of "taggedtype'Class", so the description of the object looks good, and
because that string isn't an identifier. But it's a real type, not
artificial.
WORDING CHANGE:
New section:
| 2.19 Entity Descriptions
|
| Some debug information entries may describe entities in the program that
| are artificial, or which otherwise have descriptions which aren't valid
| identifiers for the language. For example, Ada 95 has package elaboration
| routines, type descriptions of the form typename'Class, and "access
| typename" parameters. These entries may have a DW_AT_description
| attribute, whose value is a string representing the description of the
| entity.
|
| The intent is that a debugger will only ever display these descriptions,
| as part of walkbacks or descriptions of other entities. It should not
| accept them in expressions, nor should it allow them to be assigned, for
| instance.
Adopted, with the second paragraph of the proposed text as non-normative commentary.