2 \label{chap:typeentries}
3 This section presents the debugging information entries
4 that describe program types: base types, modified types and
5 user\dash defined types.
7 If the scope of the declaration of a named type begins after
8 \hypertarget{chap:DWATstartscopetypedeclaration}
9 the low pc value for the scope most closely enclosing the
10 declaration, the declaration may have a
11 \livelink{chap:DWATstartscope}{DW\-\_AT\-\_start\-\_scope}
12 attribute as described for objects in
13 Section \refersec{chap:dataobjectentries}.
15 \section{Base Type Entries}
16 \label{chap:basetypeentries}
18 \textit{A base type is a data type that is not defined in terms of
19 other data types. Each programming language has a set of base
20 types that are considered to be built into that language.}
22 A base type is represented by a debugging information entry
24 \livetarg{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}.
26 A base type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is
27 a null\dash terminated string containing the name of the base type
28 as recognized by the programming language of the compilation
29 unit containing the base type entry.
31 A base type entry has a \livelink{chap:DWATencoding}{DW\-\_AT\-\_encoding} attribute describing
32 how the base type is encoded and is to be interpreted. The
33 value of this attribute is an integer constant. The set of
34 values and their meanings for the \livelink{chap:DWATencoding}{DW\-\_AT\-\_encoding} attribute
36 Figure \refersec{fig:encodingattributevalues}
40 may have a \livelink{chap:DWATendianity}{DW\-\_AT\-\_endianity} attribute as described in
41 Section \refersec{chap:dataobjectentries}.
42 If omitted, the encoding assumes the representation that
43 is the default for the target architecture.
46 \hypertarget{chap:DWATbytesizedataobjectordatatypesize}
47 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute
48 \hypertarget{chap:DWATbitsizebasetypebitsize}
49 or a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute whose integer constant value
50 (see Section \refersec{chap:byteandbitsizes})
51 is the amount of storage needed to hold
54 \textit{For example, the C type int on a machine that uses 32\dash bit
55 integers is represented by a base type entry with a name
56 attribute whose value is “int”, an encoding attribute
57 whose value is \livelink{chap:DWATEsigned}{DW\-\_ATE\-\_signed} and a byte size attribute whose
60 If the value of an object of the given type does not fully
61 occupy the storage described by a byte size attribute,
62 \hypertarget{chap:DWATdatabitoffsetbasetypebitlocation}
63 the base type entry may also have a
64 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and a
65 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} attribute, both of whose values are
66 integer constant values (
67 see Section \refersec{chap:staticanddynamicvaluesofattributes}).
69 attribute describes the actual size in bits used to represent
70 values of the given type. The data bit offset attribute is the
71 offset in bits from the beginning of the containing storage to
72 the beginning of the value. Bits that are part of the offset
73 are padding. The data bit offset uses the bit numbering and
74 direction conventions that are appropriate to the current
76 target system to locate the beginning of the storage and
77 value. If this attribute is omitted a default data bit offset
80 \textit{Attribute \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} is new in DWARF Version 4 and
81 is also used for bit field members
82 (see Section \refersec{chap:datamemberentries}).
84 \hypertarget{chap:DWATbitoffsetbasetypebitlocation}
85 replaces the attribute \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} when used for base
86 types as defined in DWARF V3 and earlier. The earlier attribute
87 is defined in a manner suitable for bit field members on
88 big\dash endian architectures but which is wasteful for use on
89 little\dash endian architectures.}
91 \textit{The attribute \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} is
92 deprecated in DWARF Version
93 4 for use in base types, but implementations may continue to
94 support its use for compatibility.}
96 \textit{The DWARF Version 3 definition of these attributes is as follows.}
98 \begin{myindentpara}{1cm}
99 \textit{A base type entry has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute, whose value
100 (see Section 2.19) is the size in bytes of the storage unit
101 used to represent an object of the given type.}
103 \textit{If the value of an object of the given type does not fully
104 occupy the storage unit described by the byte size attribute,
105 the base type entry may have a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute and a
106 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} attribute, both of whose values (see Section
107 2.19) are integers. The bit size attribute describes the actual
108 size in bits used to represent a value of the given type.
109 The bit offset attribute describes the offset in bits of the
110 high order bit of a value of the given type from the high
111 order bit of the storage unit used to contain that value.}
114 \textit{In comparing DWARF Versions 3 and 4, note that DWARF V4
115 defines the following combinations of attributes:}
118 \item \textit{DW\-\_AT\-\_byte\-\_size}
119 \item \textit{DW\-\_AT\-\_bit\-\_size}
120 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}, \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
121 and optionally \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}}
123 DWARF V3 defines the following combinations:
124 % FIXME: the figure below interferes with the following
125 % bullet list, which looks horrible as a result.
127 \item \textit{DW\-\_AT\-\_byte\-\_size}
128 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}, \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}}
131 \begin{figure}[!here]
133 \begin{tabular}{lp{9cm}}
134 Name&Meaning\\ \hline
135 \livetarg{chap:DWATEaddress}{DW\-\_ATE\-\_address} & linear machine address (for
136 segmented addresses see
137 Section \refersec{chap:segmentedaddresses}) \\
138 \livetarg{chap:DWATEboolean}{DW\-\_ATE\-\_boolean}& true or false \\
140 \livetarg{chap:DWATEcomplexfloat}{DW\-\_ATE\-\_complex\-\_float}& complex binary floating\dash point number \\
141 \livetarg{chap:DWATEfloat}{DW\-\_ATE\-\_float} & binary floating\dash point number \\
142 \livetarg{chap:DWATEimaginaryfloat}{DW\-\_ATE\-\_imaginary\-\_float}& imaginary binary floating\dash point number \\
143 \livetarg{chap:DWATEsigned}{DW\-\_ATE\-\_signed}& signed binary integer \\
144 \livetarg{chap:DWATEsignedchar}{DW\-\_ATE\-\_signed\-\_char}& signed character \\
145 \livetarg{chap:DWATEunsigned}{DW\-\_ATE\-\_unsigned} & unsigned binary integer \\
146 \livetarg{chap:DWATEunsignedchar}{DW\-\_ATE\-\_unsigned\-\_char} & unsigned character \\
147 \livetarg{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} & packed decimal \\
148 \livetarg{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string}& numeric string \\
149 \livetarg{chap:DWATEedited}{DW\-\_ATE\-\_edited} & edited string \\
150 \livetarg{chap:DWATEsignedfixed}{DW\-\_ATE\-\_signed\-\_fixed} & signed fixed\dash point scaled integer \\
151 \livetarg{chap:DWATEunsignedfixed}{DW\-\_ATE\-\_unsigned\-\_fixed}& unsigned fixed\dash point scaled integer \\
152 \livetarg{chap:DWATEdecimalfloat}{DW\-\_ATE\-\_decimal\-\_float} & decimal floating\dash point number \\
153 \livetarg{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} & Unicode character \\
155 \caption{Encoding attribute values}
156 \label{fig:encodingattributevalues}
159 \textit{The \livelink{chap:DWATEdecimalfloat}{DW\-\_ATE\-\_decimal\-\_float} encoding is intended for
160 floating\dash point representations that have a power\dash of\dash ten
161 exponent, such as that specified in IEEE 754R.}
163 \textit{The \livelink{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} encoding is intended for Unicode string
164 encodings (see the Universal Character Set standard,
165 ISO/IEC 10646\dash 1:1993). For example, the C++ type char16\_t is
166 represented by a base type entry with a name attribute whose
167 value is “char16\_t”, an encoding attribute whose value
168 is \livelink{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} and a byte size attribute whose value is 2.}
171 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal}
173 \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string}
175 represent packed and unpacked decimal string numeric data
176 types, respectively, either of which may be either signed
178 \hypertarget{chap:DWATdecimalsigndecimalsignrepresentation}
180 \hypertarget{chap:DWATdigitcountdigitcountforpackeddecimalornumericstringtype}
181 base types are used in combination with
182 \livelink{chap:DWATdecimalsign}{DW\-\_AT\-\_decimal\-\_sign},
183 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and
184 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale}
187 A \livelink{chap:DWATdecimalsign}{DW\-\_AT\-\_decimal\-\_sign} attribute is an integer constant that
188 conveys the representation of the sign of the decimal type
189 (see Figure \refersec{fig:decimalsignattributevalues}).
190 Its integer constant value is interpreted to
191 mean that the type has a leading overpunch, trailing overpunch,
192 leading separate or trailing separate sign representation or,
193 alternatively, no sign at all.
196 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count}
197 attribute is an integer constant
198 value that represents the number of digits in an instance of
201 \hypertarget{chap:DWATdecimalscaledecimalscalefactor}
202 The \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attribute is an integer constant value
203 that represents the exponent of the base ten scale factor to
204 be applied to an instance of the type. A scale of zero puts the
205 decimal point immediately to the right of the least significant
206 digit. Positive scale moves the decimal point to the right
207 and implies that additional zero digits on the right are not
208 stored in an instance of the type. Negative scale moves the
209 decimal point to the left; if the absolute value of the scale
210 is larger than the digit count, this implies additional zero
211 digits on the left are not stored in an instance of the type.
213 The \livelink{chap:DWATEedited}{DW\-\_ATE\-\_edited}
215 \hypertarget{chap:DWATpicturestringpicturestringfornumericstringtype}
216 type is used to represent an edited
217 numeric or alphanumeric data type. It is used in combination
218 with an \livelink{chap:DWATpicturestring}{DW\-\_AT\-\_picture\-\_string} attribute whose value is a
219 null\dash terminated string containing the target\dash dependent picture
220 string associated with the type.
222 If the edited base type entry describes an edited numeric
223 data type, the edited type entry has a \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and a
224 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attribute. These attributes have the same
225 interpretation as described for the \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} and
226 \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base types. If the edited type entry
227 describes an edited alphanumeric data type, the edited type
228 entry does not have these attributes.
231 \textit{The presence or absence of the \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and
232 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attributes allows a debugger to easily
233 distinguish edited numeric from edited alphanumeric, although
234 in principle the digit count and scale are derivable by
235 interpreting the picture string.}
237 The \livelink{chap:DWATEsignedfixed}{DW\-\_ATE\-\_signed\-\_fixed} and \livelink{chap:DWATEunsignedfixed}{DW\-\_ATE\-\_unsigned\-\_fixed} entries
238 describe signed and unsigned fixed\dash point binary data types,
241 The fixed binary type entries have a \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count}
242 attribute with the same interpretation as described for the
243 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} and \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base types.
245 For a data type with a decimal scale factor, the fixed binary
246 type entry has a \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attribute with the same
247 interpretation as described for the \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal}
248 and \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base types.
250 \hypertarget{chap:DWATbinaryscalebinaryscalefactorforfixedpointtype}
251 For a data type with a binary scale factor, the fixed
252 binary type entry has a \livelink{chap:DWATbinaryscale}{DW\-\_AT\-\_binary\-\_scale} attribute. The
253 \livelink{chap:DWATbinaryscale}{DW\-\_AT\-\_binary\-\_scale} attribute is an integer constant value
254 that represents the exponent of the base two scale factor to
255 be applied to an instance of the type. Zero scale puts the
256 binary point immediately to the right of the least significant
257 bit. Positive scale moves the binary point to the right and
258 implies that additional zero bits on the right are not stored
259 in an instance of the type. Negative scale moves the binary
260 point to the left; if the absolute value of the scale is
261 larger than the number of bits, this implies additional zero
262 bits on the left are not stored in an instance of the type.
265 \hypertarget{chap:DWATsmallscalefactorforfixedpointtype}
266 a data type with a non\dash decimal and non\dash binary scale factor,
267 the fixed binary type entry has a
268 \livelink{chap:DWATsmall}{DW\-\_AT\-\_small} attribute which
270 \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} entry. The scale factor value
271 is interpreted in accordance with the value defined by the
272 \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} entry. The value represented is the product
273 of the integer value in memory and the associated constant
276 \textit{The \livelink{chap:DWATsmall}{DW\-\_AT\-\_small} attribute is defined with the Ada small
281 \begin{tabular}{lp{9cm}}
282 Name&Meaning\\ \hline
283 \livetarg{chap:DWDSunsigned}{DW\-\_DS\-\_unsigned} & unsigned \\
284 \livetarg{chap:DWDSleadingoverpunch}{DW\-\_DS\-\_leading\-\_overpunch} & Sign is encoded in the most significant digit in a target\dash dependent manner \\
285 \livetarg{chap:DWDStrailingoverpunch}{DW\-\_DS\-\_trailing\-\_overpunch} & Sign is encoded in the least significant digit in a target\dash dependent manner \\
286 \livetarg{chap:DWDSleadingseparate}{DW\-\_DS\-\_leading\-\_separate}
287 & Decimal type: Sign is a ``+'' or ``-'' character
288 to the left of the most significant digit. \\
289 \livetarg{chap:DWDStrailingseparate}{DW\-\_DS\-\_trailing\-\_separate}
290 & Decimal type: Sign is a ``+'' or ``-'' character
291 to the right of the least significant digit. \\
292 &Packed decimal type: Least significant nibble contains
293 a target\dash dependent value
294 indicating positive or negative. \\
296 \caption{Decimal sign attribute values}
297 \label{fig:decimalsignattributevalues}
300 \section{Unspecified Type Entries}
301 \label{chap:unspecifiedtypeentries}
302 Some languages have constructs in which a type
303 may be left unspecified or the absence of a type
304 \addtoindex{unspecified type entry}
305 may be explicitly indicated.
307 An unspecified (implicit, unknown, ambiguous or nonexistent)
308 type is represented by a debugging information entry with
309 the tag \livetarg{chap:DWTAGunspecifiedtype}{DW\-\_TAG\-\_unspecified\-\_type}.
310 If a name has been given
311 to the type, then the corresponding unspecified type entry
312 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated
313 string containing the name as it appears in the source program.
315 The interpretation of this debugging information entry is
316 intentionally left flexible to allow it to be interpreted
317 appropriately in different languages. For example, in C and C++
318 the language implementation can provide an unspecified type
319 entry with the name “void” which can be referenced by the
320 type attribute of pointer types and typedef declarations for
322 % FIXME: the following reference was wrong in DW4 so DavidA guessed
324 Sections \refersec{chap:unspecifiedtypeentries} and
325 %The following reference was valid, so the following is probably correct.
326 Section \refersec{chap:typedefentries},
327 respectively). As another
328 example, in Ada such an unspecified type entry can be referred
329 to by the type attribute of an access type where the denoted
330 type is incomplete (the name is declared as a type but the
331 definition is deferred to a separate compilation unit). Type
334 A base or user\dash defined type may be modified in different ways
335 in different languages. A type modifier is represented in
336 DWARF by a debugging information entry with one of the tags
338 Figure \refersec{fig:typemodifiertags}.
341 If a name has been given to the modified type in the source
342 program, then the corresponding modified type entry has
343 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null-terminated
344 string containing the modified type name as it appears in
347 Each of the type modifier entries has a
348 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute,
349 whose value is a reference to a debugging information entry
350 describing a base type, a user-defined type or another type
353 A modified type entry describing a pointer or reference
354 type (using \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type}, \livelink{chap:DWTAGreferencetype}{DW\-\_TAG\-\_reference\-\_type} or
355 \livelink{chap:DWTAGrvaluereferencetype}{DW\-\_TAG\-\_rvalue\-\_reference\-\_type})
356 % Another instance of no-good-place-to-put-index entry.
358 \addtoindexx{address class!attribute}
360 \hypertarget{chap:DWATadressclasspointerorreferencetypes}
362 \livelink{chap:DWATaddressclass}{DW\-\_AT\-\_address\-\_class}
363 attribute to describe how objects having the given pointer
364 or reference type ought to be dereferenced.
366 A modified type entry describing a shared qualified type
367 (using \livelink{chap:DWTAGsharedtype}{DW\-\_TAG\-\_shared\-\_type}) may have a \livelink{chap:DWATcount}{DW\-\_AT\-\_count} attribute
368 whose value is a constant expressing the blocksize of the
369 type. If no count attribute is present, then the “infinite”
370 blocksize is assumed.
372 When multiple type modifiers are chained together to modify
373 a base or user-defined type, the tree ordering reflects the
374 semantics of the applicable lanuage rather than the textual
375 order in the source presentation.
379 \begin{tabular}{lp{9cm}}
380 Name&Meaning\\ \hline
381 \livetarg{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} & C or C++ const qualified type \\
382 \livetarg{chap:DWTAGpackedtype}{DW\-\_TAG\-\_packed\-\_type}& Pascal or Ada packed type \\
383 \livetarg{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} & Pointer to an object of the type being modified \\
384 \livetarg{chap:DWTAGreferencetype}{DW\-\_TAG\-\_reference\-\_type}& C++ (lvalue) reference to an object of the type
386 \livetarg{chap:DWTAGrestricttype}{DW\-\_TAG\-\_restrict\-\_type}&C restrict qualified type \\
387 \livetarg{chap:DWTAGrvaluereferencetype}{DW\-\_TAG\-\_rvalue\-\_reference\-\_type} & C++ rvalue reference to an object of the type
389 \livetarg{chap:DWTAGsharedtype}{DW\-\_TAG\-\_shared\-\_type}&UPC shared qualified type \\
390 \livetarg{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type}&C or C++ volatile qualified type \\
392 \caption{Type modifier tags}
393 \label{fig:typemodifiertags}
396 % The following prevents splitting the examples up.
397 % FIXME perhaps there is a better way. We could box the verbatim,
398 % see memman.pdf on verbatims.
400 \textit{As examples of how tye modifiers are ordered, take the following C
404 const unsigned char * volatile p;
405 which represents a volatile pointer to a constant
406 character. This is encoded in DWARF as:
407 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}(p) -->
408 \livelink{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type} -->
409 \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} -->
410 \livelink{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} -->
411 \livelink{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}(unsigned char)
413 volatile unsigned char * const restrict p;
414 on the other hand, represents a restricted constant
415 pointer to a volatile character. This is encoded as:
416 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}(p) -->
417 \livelink{chap:DWTAGrestricttype}{DW\-\_TAG\-\_restrict\-\_type} -->
418 \livelink{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} -->
419 \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} -->
420 \livelink{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type} -->
421 \livelink{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}(unsigned char)
425 \section{Typedef Entries}
426 \label{chap:typedefentries}
427 A named type that is defined in terms of another type
428 definition is represented by a debugging information entry with
429 the tag \livetarg{chap:DWTAGtypedef}{DW\-\_TAG\-\_typedef}.
430 The typedef entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
431 attribute whose value is a null-terminated string containing
432 the name of the typedef as it appears in the source program.
434 The typedef entry may also contain a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose
435 value is a reference to the type named by the typedef. If
436 the debugging information entry for a typedef represents
437 a declaration of the type that is not also a definition,
438 it does not contain a type attribute.
440 \textit{Depending on the language, a named type that is defined in
441 terms of another type may be called a type alias, a subtype,
442 a constrained type and other terms. A type name declared with
443 no defining details may be termed an incomplete, forward
444 or hidden type. While the DWARF \livelink{chap:DWTAGtypedef}{DW\-\_TAG\-\_typedef} entry was
445 originally inspired by the like named construct in C and C++,
446 it is broadly suitable for similar constructs (by whatever
447 source syntax) in other languages.}
449 \section{Array Type Entries}
450 \label{chap:arraytypeentries}
452 Many languages share the concept of an ``array,'' which is
453 a table of components of identical type.
455 An array type is represented by a debugging information entry
456 with the tag \livetarg{chap:DWTAGarraytype}{DW\-\_TAG\-\_array\-\_type}.
457 If a name has been given to
458 the array type in the source program, then the corresponding
459 array type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a
460 null-terminated string containing the array type name as it
461 appears in the source program.
464 \hypertarget{chap:DWATorderingarrayrowcolumnordering}
465 array type entry describing a multidimensional array may
466 have a \livelink{chap:DWATordering}{DW\-\_AT\-\_ordering} attribute whose integer constant value is
467 interpreted to mean either row-major or column-major ordering
468 of array elements. The set of values and their meanings
469 for the ordering attribute are listed in
470 Figure \refersec{fig:arrayordering}.
472 ordering attribute is present, the default ordering for the
473 source language (which is indicated by the \livelink{chap:DWATlanguage}{DW\-\_AT\-\_language}
474 attribute of the enclosing compilation unit entry) is assumed.
477 \autorows[0pt]{c}{1}{l}{
478 \livetarg{chap:DWORDcolmajor}{DW\-\_ORD\-\_col\-\_major},
479 \livetarg{chap:DWORDrowmajor}{DW\-\_ORD\-\_row\-\_major}
481 \caption{Array ordering}\label{fig:arrayordering}
484 The ordering attribute may optionally appear on one-dimensional
485 arrays; it will be ignored.
487 An array type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
488 the type of each element of the array.
490 If the amount of storage allocated to hold each element of an
491 object of the given array type is different from the amount
492 of storage that is normally allocated to hold an individual
493 \hypertarget{chap:DWATbitstridearrayelementstrideofarraytype}
495 \hypertarget{chap:DWATbytestridearrayelementstrideofarraytype}
496 indicated element type, then the array type
497 entry has either a \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride} or a \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride}
498 attribute, whose value
499 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
501 element of the array.
503 The array type entry may have either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a
504 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
505 (see Section \refersec{chap:byteandbitsizes}),
507 amount of storage needed to hold an instance of the array type.
509 \textit{If the size of the array can be determined statically at
510 compile time, this value can usually be computed by multiplying
511 the number of array elements by the size of each element.}
514 Each array dimension is described by a debugging information
515 entry with either the tag \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} or the tag
516 \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}. These entries are children of the
517 array type entry and are ordered to reflect the appearance of
518 the dimensions in the source program (i.e., leftmost dimension
519 first, next to leftmost second, and so on).
521 In languages, such as C, in which there is no concept of
522 a “multidimensional array”, an array of arrays may
523 be represented by a debugging information entry for a
524 multidimensional array.
526 Other attributes especially applicable to arrays are
527 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated},
528 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} and
529 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location},
530 which are described in
531 Section \refersec{chap:dynamictypeproperties}.
532 For relevant examples,
534 Appendix \refersec{app:fortran90example}.
536 \section{ Structure, Union, Class and Interface Type Entries}
537 \label{chap:structureunionclassandinterfacetypeentries}
539 \textit{The languages C, C++, and Pascal, among others, allow the
540 programmer to define types that are collections of related
541 components. In C and C++, these collections are called
542 “structures.” In Pascal, they are called “records.”
543 The components may be of different types. The components are
544 called “members” in C and C++, and “fields” in Pascal.}
546 \textit{The components of these collections each exist in their
547 own space in computer memory. The components of a C or C++
548 “union” all coexist in the same memory.}
550 \textit{Pascal and other languages have a “discriminated union,”
551 also called a “variant record.” Here, selection of a
552 number of alternative substructures (“variants”) is based
553 on the value of a component that is not part of any of those
554 substructures (the “discriminant”).}
556 \textit{C++ and Java have the notion of "class”, which is in some
557 ways similar to a structure. A class may have “member
558 functions” which are subroutines that are within the scope
559 of a class or structure.}
561 \textit{The C++ notion of structure is more general than in C, being
562 equivalent to a class with minor differences. Accordingly,
563 in the following discussion statements about C++ classes may
564 be understood to apply to C++ structures as well.}
566 \subsection{Structure, Union and Class Type Entries}
567 \label{chap:structureunionandclasstypeentries}
570 Structure, union, and class types are represented by debugging
571 information entries with
572 the tags \livetarg{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type},
573 \livetarg{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type},
574 and \livetarg{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
575 respectively. If a name has been given to the structure,
576 union, or class in the source program, then the corresponding
577 structure type, union type, or class type entry has a
578 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
579 containing the type name as it appears in the source program.
581 The members of a structure, union, or class are represented
582 by debugging information entries that are owned by the
583 corresponding structure type, union type, or class type entry
584 and appear in the same order as the corresponding declarations
585 in the source program.
587 A structure type, union type or class type entry may have
588 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
589 \hypertarget{chap:DWATbitsizedatamemberbitsize}
590 (see Section \refersec{chap:byteandbitsizes}),
591 whose value is the amount of storage needed
592 to hold an instance of the structure, union or class type,
593 including any padding. An incomplete structure, union or
594 class type is represented by a structure, union or class
595 entry that does not have a byte size attribute and that has
596 a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
598 If the complete declaration of a type has been placed in
599 \hypertarget{chap:DWATsignaturetypesignature}
601 (see Section \refersec{chap:separatetypeunitentries}),
603 declaration of that type in the compilation unit may provide
604 the unique 64\dash bit signature of the type using a \livelink{chap:DWATsignature}{DW\-\_AT\-\_signature}
607 If a structure, union or class entry represents the definition
608 of a structure, class or union member corresponding to a prior
609 incomplete structure, class or union, the entry may have a
610 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute whose value is a reference to
611 the debugging information entry representing that incomplete
614 Structure, union and class entries containing the
615 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute do not need to duplicate
616 information provided by the declaration entry referenced by the
617 specification attribute. In particular, such entries do not
618 need to contain an attribute for the name of the structure,
619 class or union they represent if such information is already
620 provided in the declaration.
622 \textit{For C and C++, data member declarations occurring within
623 the declaration of a structure, union or class type are
624 considered to be “definitions” of those members, with
625 the exception of “static” data members, whose definitions
626 appear outside of the declaration of the enclosing structure,
627 union or class type. Function member declarations appearing
628 within a structure, union or class type declaration are
629 definitions only if the body of the function also appears
630 within the type declaration.}
632 If the definition for a given member of the structure, union
633 or class does not appear within the body of the declaration,
634 that member also has a debugging information entry describing
635 its definition. That latter entry has a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
636 attribute referencing the debugging information entry
637 owned by the body of the structure, union or class entry and
638 representing a non\dash defining declaration of the data, function
639 or type member. The referenced entry will not have information
640 about the location of that member (low and high pc attributes
641 for function members, location descriptions for data members)
642 and will have a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
644 \textit{Consider a nested class whose
645 definition occurs outside of the containing class definition, as in:}
654 \textit{The two different structs can be described in
655 different compilation units to
656 facilitate DWARF space compression
657 (see Appendix \refersec{app:usingcompilationunits}).}
659 \subsection{Interface Type Entries}
660 \label{chap:interfacetypeentries}
662 \textit{The Java language defines "interface" types. An interface
663 in Java is similar to a C++ or Java class with only abstract
664 methods and constant data members.}
666 Interface types are represented by debugging information
668 tag \livetarg{chap:DWTAGinterfacetype}{DW\-\_TAG\-\_interface\-\_type}.
670 An interface type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
671 value is a null-terminated string containing the type name
672 as it appears in the source program.
674 The members of an interface are represented by debugging
675 information entries that are owned by the interface type
676 entry and that appear in the same order as the corresponding
677 declarations in the source program.
679 \subsection{Derived or Extended Structs, Classes and Interfaces}
680 \label{chap:derivedorextendedstructsclasesandinterfaces}
682 \textit{In C++, a class (or struct) may be ``derived from'' or be a
683 ``subclass of'' another class. In Java, an interface may ``extend''
684 one or more other interfaces, and a class may "extend" another
685 class and/or "implement" one or more interfaces. All of these
686 relationships may be described using the following. Note that
687 in Java, the distinction between extends and implements is
688 implied by the entities at the two ends of the relationship.}
690 A class type or interface type entry that describes a
691 derived, extended or implementing class or interface owns
692 debugging information entries describing each of the classes
693 or interfaces it is derived from, extending or implementing,
694 respectively, ordered as they were in the source program. Each
696 tag \livetarg{chap:DWTAGinheritance}{DW\-\_TAG\-\_inheritance}.
698 An inheritance entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is
699 a reference to the debugging information entry describing the
700 class or interface from which the parent class or structure
701 of the inheritance entry is derived, extended or implementing.
703 An inheritance entry for a class that derives from or extends
704 \hypertarget{chap:DWATdatamemberlocationinheritedmemberlocation}
705 another class or struct also has a
706 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
707 attribute, whose value describes the location of the beginning
708 of the inherited type relative to the beginning address of the
709 derived class. If that value is a constant, it is the offset
710 in bytes from the beginning of the class to the beginning of
711 the inherited type. Otherwise, the value must be a location
712 description. In this latter case, the beginning address of
713 the derived class is pushed on the expression stack before
714 the location description is evaluated and the result of the
715 evaluation is the location of the inherited type.
717 \textit{The interpretation of the value of this attribute for
718 inherited types is the same as the interpretation for data
720 (see Section \refersec{chap:datamemberentries}). }
723 \hypertarget{chap:DWATaccessibilitycppinheritedmembers}
725 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
726 attribute. If no accessibility attribute
727 is present, private access is assumed for an entry of a class
728 and public access is assumed for an entry of an interface,
732 \hypertarget{chap:DWATvirtualityvirtualityofbaseclass}
733 the class referenced by the inheritance entry serves
734 as a C++ virtual base class, the inheritance entry has a
735 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
737 \textit{For a C++ virtual base, the data member location attribute
738 will usually consist of a non-trivial location description.}
740 \subsection{Access Declarations}
741 \label{chap:accessdeclarations}
743 \textit{In C++, a derived class may contain access declarations that
744 change the accessibility of individual class members from the
745 overall accessibility specified by the inheritance declaration.
746 A single access declaration may refer to a set of overloaded
749 If a derived class or structure contains access declarations,
750 each such declaration may be represented by a debugging
751 information entry with the tag
752 \livetarg{chap:DWTAGaccessdeclaration}{DW\-\_TAG\-\_access\-\_declaration}.
754 such entry is a child of the class or structure type entry.
756 An access declaration entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
757 value is a null-terminated string representing the name used
758 in the declaration in the source program, including any class
759 or structure qualifiers.
761 An access declaration entry
762 \hypertarget{chap:DWATaccessibilitycppbaseclasses}
764 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
765 attribute describing the declared accessibility of the named
772 Each ``friend'' declared by a structure, union or class
773 \hypertarget{chap:DWATfriendfriendrelationship}
774 type may be represented by a debugging information entry
775 that is a child of the structure, union or class type entry;
776 the friend entry has the
777 tag \livetarg{chap:DWTAGfriend}{DW\-\_TAG\-\_friend}.
779 A friend entry has a \livelink{chap:DWATfriend}{DW\-\_AT\-\_friend} attribute, whose value is
780 a reference to the debugging information entry describing
781 the declaration of the friend.
784 \subsection{Data Member Entries}
785 \label{chap:datamemberentries}
787 A data member (as opposed to a member function) is
788 represented by a debugging information entry with the
789 tag \livetarg{chap:DWTAGmember}{DW\-\_TAG\-\_member}.
790 The member entry for a named member has
791 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null-terminated
792 string containing the member name as it appears in the source
793 program. If the member entry describes an anonymous union, the
794 name attribute is omitted or consists of a single zero byte.
796 The data member entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote
797 the type of that member.
799 A data member entry may have a \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
800 attribute. If no accessibility attribute is present, private
801 access is assumed for an entry of a class and public access
802 is assumed for an entry of a structure, union, or interface.
805 \hypertarget{chap:DWATmutablemutablepropertyofmemberdata}
806 entry may have a \livelink{chap:DWATmutable}{DW\-\_AT\-\_mutable} attribute,
807 which is a \livelink{chap:flag}{flag}.
808 This attribute indicates whether the data
809 member was declared with the mutable storage class specifier.
811 The beginning of a data member is described relative to
812 the beginning of the object in which it is immediately
813 contained. In general, the beginning is characterized by
814 both an address and a bit offset within the byte at that
815 address. When the storage for an entity includes all of
816 the bits in the beginning byte, the beginning bit offset is
819 Bit offsets in DWARF use the bit numbering and direction
820 conventions that are appropriate to the current language on
823 The member entry corresponding to a data member that is
824 \hypertarget{chap:DWATdatabitoffsetdatamemberbitlocation}
826 \hypertarget{chap:DWATdatamemberlocationdatamemberlocation}
827 in a structure, union or class may have either a
828 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute or a \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
829 attribute. If the beginning of the data member is the same as
830 the beginning of the containing entity then neither attribute
833 For a \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute there are two cases:
835 \begin{enumerate}[1.]
837 \item If the value is an integer constant, it is the offset
838 in bytes from the beginning of the containing entity. If
839 the beginning of the containing entity has a non-zero bit
840 offset then the beginning of the member entry has that same
843 \item Otherwise, the value must be a location description. In
844 this case, the beginning of the containing entity must be byte
845 aligned. The beginning address is pushed on the DWARF stack
846 before the location description is evaluated; the result of
847 the evaluation is the base address of the member entry.
849 \textit{The push on the DWARF expression stack of the base address of
850 the containing construct is equivalent to execution of the
851 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} operation
852 (see Section \refersec{chap:stackoperations});
853 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} therefore is not needed at the
854 beginning of a location description for a data member. The
855 result of the evaluation is a location--either an address or
856 the name of a register, not an offset to the member.}
858 \textit{A \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute that has the form of a
859 location description is not valid for a data member contained
860 in an entity that is not byte aligned because DWARF operations
861 do not allow for manipulating or computing bit offsets.}
865 For a \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} attribute, the value is an integer
867 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
868 that specifies the number of bits
869 from the beginning of the containing entity to the beginning
870 of the data member. This value must be greater than or equal
871 to zero, but is not limited to less than the number of bits
874 If the size of a data member is not the same as the size
875 of the type given for the data member, the data member has
876 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute whose
877 integer constant value
878 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
880 of storage needed to hold the value of the data member.
882 \textit{C and C++ bit fields typically require the use of the
883 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} and \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attributes.}
885 \textit{This Standard uses the following bit numbering and direction
886 conventions in examples. These conventions are for illustrative
887 purposes and other conventions may apply on particular
892 \item \textit{For big\dash endian architectures, bit offsets are
893 counted from high-order to low\dash order bits within a byte (or
894 larger storage unit); in this case, the bit offset identifies
895 the high\dash order bit of the object.}
897 \item \textit{For little\dash endian architectures, bit offsets are
898 counted from low\dash order to high\dash order bits within a byte (or
899 larger storage unit); in this case, the bit offset identifies
900 the low\dash order bit of the object.}
904 \textit{In either case, the bit so identified is defined as the beginning of the object.}
906 \textit{For example, take one possible representation of the following C structure definition in both big\dash and little\dash endian byte orders:}
917 \textit{The following diagrams show the structure layout
918 and data bit offsets for example big\dash\ and little\dash endian
919 architectures, respectively. Both diagrams show a structure
920 that begins at address A and whose size is four bytes. Also,
921 high order bits are to the left and low order bits are to
924 \textit{Big\dash Endian Data Bit Offsets:}
932 Addresses increase ->
933 | A | A + 1 | A + 2 | A + 3 |
935 Data bit offsets increase ->
936 +---------------+---------------+---------------+---------------+
937 |0 4|5 10|11 15|16 23|24 31|
938 | j | k | m | n | <pad> |
940 +---------------------------------------------------------------+
943 \textit{Little\dash Endian Data Bit Offsets:}
949 <- Addresses increase
950 | A | A + 1 | A + 2 | A + 3 |
952 <- Data bit offsets increase
954 +---------------+---------------+---------------+---------------+
955 |31 24|23 16|15 11|10 5|4 0|
956 | <pad> | n | m | k | j |
958 +---------------------------------------------------------------+
962 \textit{Note that data member bit offsets in this example are the
963 same for both big\dash\ and little\dash endian architectures even
964 though the fields are allocated in different directions
965 (high\dash order to low-order versus low\dash order to high\dash order);
966 the bit naming conventions for memory and/or registers of
967 the target architecture may or may not make this seem natural.}
969 \textit{For a more extensive example showing nested and packed records
971 Appendix \refersec{app:pascalexample}.}
973 \textit{Attribute \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} is new in DWARF Version 4 and
974 is also used for base types
975 (see Section \refersec{chap:basetypeentries}).
977 \livetarg{chap:DWATbitoffsetdatamemberbitlocation}
978 attributes \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} and \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} when used to
979 identify the beginning of bit field data members as defined
980 in DWARF V3 and earlier. The earlier attributes are defined
981 in a manner suitable for bit field members on big-endian
982 architectures but which is either awkward or incomplete for
983 use on little-endian architectures. (\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} also
984 has other uses that are not affected by this change.)}
986 \textit{The \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}, \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
987 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
988 attribute combination is deprecated for data members in DWARF
989 Version 4, but implementations may continue to support this
990 use for compatibility.}
992 \textit{The DWARF Version 3 definitions of these attributes are
995 \begin{myindentpara}{1cm}
996 \textit{If the data member entry describes a bit field, then that
997 entry has the following attributes:}
1000 \item \textit{A \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute whose value (see Section
1001 2.19) is the number of bytes that contain an instance of the
1002 bit field and any padding bits.}
1004 \textit{The byte size attribute may be omitted if the size of the
1005 object containing the bit field can be inferred from the type
1006 attribute of the data member containing the bit field.}
1008 \item \textit{A \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} attribute whose value (see Section
1009 2.19) is the number of bits to the left of the leftmost
1010 (most significant) bit of the bit field value.}
1012 \item \textit{A \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute whose value (see Section
1013 2.19) is the number of bits occupied by the bit field value.}
1017 \textit{The location description for a bit field calculates the address
1018 of an anonymous object containing the bit field. The address
1019 is relative to the structure, union, or class that most closely
1020 encloses the bit field declaration. The number of bytes in this
1021 anonymous object is the value of the byte size attribute of
1022 the bit field. The offset (in bits) from the most significant
1023 bit of the anonymous object to the most significant bit of
1024 the bit field is the value of the bit offset attribute.}
1028 \textit{Diagrams similar to the above that show the use of the
1029 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}, \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} attribute
1030 combination may be found in the DWARF Version 3 Standard.}
1032 \textit{In comparing DWARF Versions 3 and 4, note that DWARF V4
1033 defines the following combinations of attributes:}
1036 \item \textit{either \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} or
1037 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} (to specify the beginning of the
1040 % FIXME: the indentation of the following line is suspect.
1041 \textit{optionally together with}
1043 \item \textit{either \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} (to
1044 specify the size of the data member)}
1048 \textit{DWARF V3 defines the following combinations}
1051 \item \textit{\livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} (to specify the beginning
1052 of the data member, except this specification is only partial
1053 in the case of a bit field) }
1055 % FIXME: the indentation of the following line is suspect.
1056 \textit{optionally together with}
1058 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}, \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1059 (to further specify the beginning of a bit field data member
1060 as well as specify the size of the data member) }
1063 \subsection{Member Function Entries}
1064 \label{chap:memberfunctionentries}
1066 A member function is represented by a debugging information
1067 entry with the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}. The member function entry
1068 may contain the same attributes and follows the same rules
1069 as non\dash member global subroutine entries
1070 (see Section \refersec{chap:subroutineandentrypointentries}).
1072 A member function entry may have a \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
1073 attribute. If no accessibility attribute is present, private
1074 access is assumed for an entry of a class and public access
1075 is assumed for an entry of a structure, union or interface.
1078 \hypertarget{chap:DWATvirtualityvirtualityoffunction}
1079 the member function entry describes a virtual function,
1080 then that entry has a
1081 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
1084 \hypertarget{chap:DWATexplicitexplicitpropertyofmemberfunction}
1085 the member function entry describes an explicit member
1086 function, then that entry has a
1087 \livelink{chap:DWATexplicit}{DW\-\_AT\-\_explicit} attribute.
1090 \hypertarget{chap:DWATvtableelemlocationvirtualfunctiontablevtableslot}
1091 entry for a virtual function also has a
1092 \livelink{chap:DWATvtableelemlocation}{DW\-\_AT\-\_vtable\-\_elem\-\_location} attribute whose value contains
1093 a location description yielding the address of the slot
1094 for the function within the virtual function table for the
1095 enclosing class. The address of an object of the enclosing
1096 type is pushed onto the expression stack before the location
1097 description is evaluated.
1100 \hypertarget{chap:DWATobjectpointerobjectthisselfpointerofmemberfunction}
1101 the member function entry describes a non\dash static member
1102 function, then that entry has a \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer} attribute
1103 whose value is a reference to the formal parameter entry
1104 that corresponds to the object for which the function is
1105 called. The name attribute of that formal parameter is defined
1106 by the current language (for example, this for C++ or self
1107 for Objective C and some other languages). That parameter
1108 also has a \livelink{chap:DWATartificial}{DW\-\_AT\-\_artificial} attribute whose value is true.
1110 Conversely, if the member function entry describes a static
1111 member function, the entry does not have a \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer}
1114 If the member function entry describes a non\dash static member
1115 function that has a const\dash volatile qualification, then
1116 the entry describes a non\dash static member function whose
1117 object formal parameter has a type that has an equivalent
1118 const\dash volatile qualification.
1120 If a subroutine entry represents the defining declaration
1121 of a member function and that definition appears outside of
1122 the body of the enclosing class declaration, the subroutine
1123 entry has a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute, whose value is
1124 a reference to the debugging information entry representing
1125 the declaration of this function member. The referenced entry
1126 will be a child of some class (or structure) type entry.
1128 Subroutine entries containing the \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
1129 attribute do not need to duplicate information provided
1130 by the declaration entry referenced by the specification
1131 attribute. In particular, such entries do not need to contain
1132 attributes for the name or return type of the function member
1133 whose definition they represent.
1135 \subsection{Class Template Instantiations}
1136 \label{chap:classtemplateinstantiations}
1138 \textit{In C++ a class template is a generic definition of a class
1139 type that may be instantiated when an instance of the class
1140 is declared or defined. The generic description of the
1141 class may include both parameterized types and parameterized
1142 constant values. DWARF does not represent the generic template
1143 definition, but does represent each instantiation.}
1145 A class template instantiation is represented by a
1146 debugging information entry with the tag \livelink{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
1147 \livelink{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type} or \livelink{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type}. With five
1148 exceptions, such an entry will contain the same attributes
1149 and have the same types of child entries as would an entry
1150 for a class type defined explicitly using the instantiation
1151 types and values. The exceptions are:
1153 \begin{enumerate}[1.]
1154 \item Each formal parameterized type declaration appearing in the
1155 template definition is represented by a debugging information
1156 entry with the tag \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}. Each
1157 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is
1158 a null\dash terminated string containing the name of the formal
1159 type parameter as it appears in the source program. The
1160 template type parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1161 describing the actual type by which the formal is replaced
1162 for this instantiation.
1164 \item Each formal parameterized value declaration appearing in the
1165 template definition is represented by a debugging information
1167 tag \livetarg{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}.
1169 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is
1170 a null\dash terminated string containing the name of the formal
1171 value parameter as it appears in the source program.
1173 \hypertarget{chap:DWATconstvaluetemplatevalueparameter}
1174 template value parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1175 describing the type of the parameterized value. Finally,
1176 the template value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value}
1177 attribute, whose value is the actual constant value of the
1178 value parameter for this instantiation as represented on the
1179 target architecture.
1181 \item The class type entry and each of its child entries references
1182 a template type parameter entry in any circumstance where the
1183 source template definition references a formal parameterized
1184 type. Similarly, the class type entry and each of its child
1185 entries references a template value parameter entry in any
1186 circumstance where the source template definition references
1187 a formal parameterized value.
1189 \item If the compiler has generated a special compilation unit to
1190 hold the template instantiation and that special compilation
1191 unit has a different name from the compilation unit containing
1192 the template definition, the name attribute for the debugging
1193 information entry representing the special compilation unit
1194 should be empty or omitted.
1196 \item If the class type entry representing the template
1197 instantiation or any of its child entries contains declaration
1198 coordinate attributes, those attributes should refer to
1199 the source for the template definition, not to any source
1200 generated artificially by the compiler.
1204 \subsection{Variant Entries}
1205 \label{chap:variantentries}
1207 A variant part of a structure is represented by a debugging
1208 information entry with the
1209 tag \livetarg{chap:DWTAGvariantpart}{DW\-\_TAG\-\_variant\-\_part} and is
1210 owned by the corresponding structure type entry.
1212 If the variant part has a discriminant, the discriminant is
1213 \hypertarget{chap:DWATdiscrdiscriminantofvariantpart}
1214 represented by a separate debugging information entry which
1215 is a child of the variant part entry. This entry has the form
1216 of a structure data member entry. The variant part entry will
1218 \livelink{chap:DWATdiscr}{DW\-\_AT\-\_discr} attribute whose value is a reference to
1219 the member entry for the discriminant.
1221 If the variant part does not have a discriminant (tag field),
1222 the variant part entry has a
1223 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to represent
1226 Each variant of a particular variant part is represented by
1227 \hypertarget{chap:DWATdiscrvaluediscriminantvalue}
1228 a debugging information entry with the
1229 tag \livetarg{chap:DWTAGvariant}{DW\-\_TAG\-\_variant}
1230 and is a child of the variant part entry. The value that
1231 selects a given variant may be represented in one of three
1232 ways. The variant entry may have a
1233 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value} attribute
1234 whose value represents a single case label. The value of this
1235 attribute is encoded as an LEB128 number. The number is signed
1236 if the tag type for the variant part containing this variant
1237 is a signed type. The number is unsigned if the tag type is
1241 \hypertarget{chap:DWATdiscrlistlistofdiscriminantvalues}
1242 the variant entry may contain a
1243 \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list}
1244 attribute, whose value represents a list of discriminant
1245 values. This list is represented by any of the
1246 \livelink{chap:block}{block} forms and
1247 may contain a mixture of case labels and label ranges. Each
1248 item on the list is prefixed with a discriminant value
1249 descriptor that determines whether the list item represents
1250 a single label or a label range. A single case label is
1251 represented as an LEB128 number as defined above for the
1252 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value} attribute. A label range is represented by
1253 two LEB128 numbers, the low value of the range followed by the
1254 high value. Both values follow the rules for signedness just
1255 described. The discriminant value descriptor is an integer
1256 constant that may have one of the values given in
1257 Figure \refersec{fig:discriminantdescriptorvalues}.
1259 \begin{figure}[here]
1260 \autorows[0pt]{c}{1}{l}{
1261 \addtoindex{DW\-\_DSC\-\_label},
1262 \addtoindex{DW\-\_DSC\-\_range}
1264 \caption{Discriminant descriptor values}\label{fig:discriminantdescriptorvalues}
1267 If a variant entry has neither a \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value}
1268 attribute nor a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute, or if it has
1269 a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute with 0 size, the variant is a
1272 The components selected by a particular variant are represented
1273 by debugging information entries owned by the corresponding
1274 variant entry and appear in the same order as the corresponding
1275 declarations in the source program.
1277 \section{Condition Entries}
1278 \label{chap:conditionentries}
1280 \textit{COBOL has the notion of a ``level\dash 88 condition'' that
1281 associates a data item, called the conditional variable, with
1282 a set of one or more constant values and/or value ranges.
1283 Semantically, the condition is ‛true’ if the conditional
1284 variable's value matches any of the described constants,
1285 and the condition is ‛false’ otherwise.}
1287 The \livetarg{chap:DWTAGcondition}{DW\-\_TAG\-\_condition} debugging information entry
1289 logical condition that tests whether a given data item’s
1290 value matches one of a set of constant values. If a name
1291 has been given to the condition, the condition entry has a
1292 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
1293 giving the condition name as it appears in the source program.
1295 The condition entry's parent entry describes the conditional
1296 variable; normally this will be a \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable},
1297 \livelink{chap:DWTAGmember}{DW\-\_TAG\-\_member} or \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter} entry. If the parent
1298 entry has an array type, the condition can test any individual
1299 element, but not the array as a whole. The condition entry
1300 implicitly specifies a “comparison type” that is the
1301 type of an array element if the parent has an array type;
1302 otherwise it is the type of the parent entry.
1304 The condition entry owns \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} and/or
1305 \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} entries that describe the constant
1306 values associated with the condition. If any child entry has
1307 a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute, that attribute should describe a type
1308 compatible with the comparison type (according to the source
1309 language); otherwise the child’s type is the same as the
1312 \textit{For conditional variables with alphanumeric types, COBOL
1313 permits a source program to provide ranges of alphanumeric
1314 constants in the condition. Normally a subrange type entry
1315 does not describe ranges of strings; however, this can be
1316 represented using bounds attributes that are references to
1317 constant entries describing strings. A subrange type entry may
1318 refer to constant entries that are siblings of the subrange
1322 \section{Enumeration Type Entries}
1323 \label{chap:enumerationtypeentries}
1325 \textit{An “enumeration type” is a scalar that can assume one of
1326 a fixed number of symbolic values.}
1328 An enumeration type is represented by a debugging information
1330 \livetarg{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}.
1332 If a name has been given to the enumeration type in the source
1333 program, then the corresponding enumeration type entry has
1334 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated
1335 string containing the enumeration type name as it appears
1336 in the source program. This entry also has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1337 attribute whose integer constant value is the number of bytes
1338 required to hold an instance of the enumeration.
1340 The enumeration type entry may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1341 which refers to the underlying data type used to implement
1344 If an enumeration type has type safe semantics such that
1346 \begin{enumerate}[1.]
1347 \item Enumerators are contained in the scope of the enumeration type, and/or
1349 \item Enumerators are not implicitly converted to another type
1352 then the enumeration type entry may have a \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}
1353 attribute, which is a \livelink{chap:flag}{flag}.
1354 In a language that offers only
1355 one kind of enumeration declaration, this attribute is not
1358 \textit{In C or C++, the underlying type will be the appropriate
1359 integral type determined by the compiler from the properties of
1360 \hypertarget{chap:DWATenumclasstypesafeenumerationdefinition}
1361 the enumeration literal values. A C++ type declaration written
1362 using enum class declares a strongly typed enumeration and
1363 is represented using \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type} in combination
1364 with \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}.}
1366 Each enumeration literal is represented by a debugging
1367 information entry with the
1368 tag \livetarg{chap:DWTAGenumerator}{DW\-\_TAG\-\_enumerator}.
1370 such entry is a child of the enumeration type entry, and the
1371 enumerator entries appear in the same order as the declarations
1372 of the enumeration literals in the source program.
1374 Each enumerator entry has a
1375 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
1376 value is a null\dash terminated string containing the name of the
1377 \hypertarget{chap:DWATconstvalueenumerationliteralvalue}
1378 enumeration literal as it appears in the source program.
1379 Each enumerator entry also has a
1380 \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value} attribute,
1381 whose value is the actual numeric value of the enumerator as
1382 represented on the target system.
1385 If the enumeration type occurs as the description of a
1386 dimension of an array type, and the stride for that dimension
1387 \hypertarget{chap:DWATbytestrideenumerationstridedimensionofarraytype}
1388 is different than what would otherwise be determined, then
1389 \hypertarget{chap:DWATbitstrideenumerationstridedimensionofarraytype}
1390 the enumeration type entry has either a \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1391 or \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute which specifies the separation
1392 between successive elements along the dimension as described
1394 Section \refersec{chap:visibilityofdeclarations}.
1395 The value of the \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1396 is interpreted as bits and the value of the \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1397 attribute is interpreted as bytes.
1400 \section{Subroutine Type Entries}
1401 \label{chap:subroutinetypeentries}
1403 It is possible in C to declare pointers to subroutines
1404 that return a value of a specific type. In both C and C++,
1405 it is possible to declare pointers to subroutines that not
1406 only return a value of a specific type, but accept only
1407 arguments of specific types. The type of such pointers would
1408 be described with a ``pointer to'' modifier applied to a
1409 user\dash defined type.
1411 A subroutine type is represented by a debugging information
1413 tag \livetarg{chap:DWTAGsubroutinetype}{DW\-\_TAG\-\_subroutine\-\_type}.
1415 been given to the subroutine type in the source program,
1416 then the corresponding subroutine type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
1417 attribute whose value is a null\dash terminated string containing
1418 the subroutine type name as it appears in the source program.
1420 If the subroutine type describes a function that returns
1421 a value, then the subroutine type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
1422 attribute to denote the type returned by the subroutine. If
1423 the types of the arguments are necessary to describe the
1424 subroutine type, then the corresponding subroutine type
1425 entry owns debugging information entries that describe the
1426 arguments. These debugging information entries appear in the
1427 order that the corresponding argument types appear in the
1430 In C there is a difference between the types of functions
1431 declared using function prototype style declarations and
1432 those declared using non\dash prototype declarations.
1435 \hypertarget{chap:DWATprototypedsubroutineprototype}
1436 subroutine entry declared with a function prototype style
1437 declaration may have a
1438 \livelink{chap:DWATprototyped}{DW\-\_AT\-\_prototyped} attribute, which is
1439 a \livelink{chap:flag}{flag}.
1441 Each debugging information entry owned by a subroutine
1442 type entry has a tag whose value has one of two possible
1445 \begin{enumerate}[1.]
1446 \item The formal parameters of a parameter list (that have a
1447 specific type) are represented by a debugging information entry
1448 with the tag \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter}. Each formal parameter
1449 entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute that refers to the type of
1450 the formal parameter.
1452 \item The unspecified parameters of a variable parameter list
1453 \addtoindexx{unspecified parameters entry}
1455 \addtoindexx{... parameters|see{unspecified parameters entry}}
1456 represented by a debugging information entry with the
1457 tag \livelink{chap:DWTAGunspecifiedparameters}{DW\-\_TAG\-\_unspecified\-\_parameters}.
1462 \section{String Type Entries}
1463 \label{chap:stringtypeentries}
1466 A ``string'' is a sequence of characters that have specific
1467 semantics and operations that separate them from arrays of
1468 characters. Fortran is one of the languages that has a string
1469 type. Note that ``string'' in this context refers to a target
1470 machine concept, not the class string as used in this document
1471 (except for the name attribute).
1473 A string type is represented by a debugging information entry
1474 with the tag \livetarg{chap:DWTAGstringtype}{DW\-\_TAG\-\_string\-\_type}.
1475 If a name has been given to
1476 the string type in the source program, then the corresponding
1477 string type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is
1478 a null\dash terminated string containing the string type name as
1479 it appears in the source program.
1482 \hypertarget{chap:DWATstringlengthstringlengthofstringtype}
1483 string type entry may have a
1484 \livelink{chap:DWATstringlength}{DW\-\_AT\-\_string\-\_length} attribute
1485 whose value is a location description yielding the location
1486 where the length of the string is stored in the program. The
1487 string type entry may also have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute
1488 or \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
1489 (see Section \refersec{chap:byteandbitsizes})
1490 is the size of the data to be retrieved from the location
1491 referenced by the string length attribute. If no (byte or bit)
1492 size attribute is present, the size of the data to be retrieved
1493 is the same as the size of an address on the target machine.
1495 If no string length attribute is present, the string type
1496 entry may have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1497 attribute, whose value
1498 (see Section \refersec{chap:byteandbitsizes})
1500 storage needed to hold a value of the string type.
1503 \section{Set Type Entries}
1504 \label{chap:settypeentries}
1506 \textit{Pascal provides the concept of a “set,” which represents
1507 a group of values of ordinal type.}
1509 A set is represented by a debugging information entry with
1510 the tag \livetarg{chap:DWTAGsettype}{DW\-\_TAG\-\_set\-\_type}.
1511 If a name has been given to the
1512 set type, then the set type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1513 whose value is a null\dash terminated string containing the
1514 set type name as it appears in the source program.
1516 The set type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote the
1517 type of an element of the set.
1519 If the amount of storage allocated to hold each element of an
1520 object of the given set type is different from the amount of
1521 storage that is normally allocated to hold an individual object
1522 of the indicated element type, then the set type entry has
1523 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute, or \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
1524 whose value (see Section \refersec{chap:byteandbitsizes}) is
1525 the amount of storage needed to hold a value of the set type.
1528 \section{Subrange Type Entries}
1529 \label{chap:subrangetypeentries}
1531 \textit{Several languages support the concept of a ``subrange''
1532 type object. These objects can represent a subset of the
1533 values that an object of the basis type for the subrange can
1534 represent. Subrange type entries may also be used to represent
1535 the bounds of array dimensions.}
1537 A subrange type is represented by a debugging information
1539 tag \livetarg{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type}.
1541 given to the subrange type, then the subrange type entry
1542 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated
1543 string containing the subrange type name as it appears in
1546 The subrange entry may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to describe
1547 the type of object, called the basis type, of whose values
1548 this subrange is a subset.
1550 If the amount of storage allocated to hold each element of an
1551 object of the given subrange type is different from the amount
1552 of storage that is normally allocated to hold an individual
1553 object of the indicated element type, then the subrange
1554 type entry has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1555 attribute, whose value
1556 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1558 storage needed to hold a value of the subrange type.
1561 \hypertarget{chap:DWATthreadsscaledupcarrayboundthreadsscalfactor}
1562 subrange entry may have a \livelink{chap:DWATthreadsscaled}{DW\-\_AT\-\_threads\-\_scaled} attribute,
1563 which is a \livelink{chap:flag}{flag}.
1564 If present, this attribute indicates whether
1565 this subrange represents a UPC array bound which is scaled
1566 by the runtime THREADS value (the number of UPC threads in
1567 this execution of the program).
1569 \textit{This allows the representation of a UPC shared array such as}
1572 int shared foo[34*THREADS][10][20];
1576 \hypertarget{chap:DWATlowerboundlowerboundofsubrange}
1578 \hypertarget{chap:DWATupperboundupperboundofsubrange}
1579 entry may have the attributes
1580 \livelink{chap:DWATlowerbound}{DW\-\_AT\-\_lower\-\_bound}
1581 and \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound} to specify, respectively, the lower
1582 and upper bound values of the subrange. The \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound}
1584 \hypertarget{chap:DWATcountelementsofsubrangetype}
1585 may be replaced by a
1586 \livelink{chap:DWATcount}{DW\-\_AT\-\_count} attribute, whose
1587 value describes the number of elements in the subrange rather
1588 than the value of the last element. The value of each of
1589 these attributes is determined as described in
1590 Section \refersec{chap:staticanddynamicvaluesofattributes}.
1592 If the lower bound value is missing, the value is assumed to
1593 be a language\dash dependent default constant. The default lower
1594 bound is 0 for C, C++, D, Java, Objective C, Objective C++,
1595 Python, and UPC. The default lower bound is 1 for Ada, COBOL,
1596 Fortran, Modula\dash 2, Pascal and PL/I.
1598 \textit{No other default lower bound values are currently defined.}
1600 If the upper bound and count are missing, then the upper bound value is
1603 If the subrange entry has no type attribute describing the
1604 basis type, the basis type is assumed to be the same as
1605 the object described by the lower bound attribute (if it
1606 references an object). If there is no lower bound attribute,
1607 or that attribute does not reference an object, the basis type
1608 is the type of the upper bound or count attribute (if either
1609 of them references an object). If there is no upper bound or
1610 count attribute, or neither references an object, the type is
1611 assumed to be the same type, in the source language of the
1612 compilation unit containing the subrange entry, as a signed
1613 integer with the same size as an address on the target machine.
1615 If the subrange type occurs as the description of a dimension
1616 of an array type, and the stride for that dimension is
1617 \hypertarget{chap:DWATbytestridesubrangestridedimensionofarraytype}
1618 different than what would otherwise be determined, then
1619 \hypertarget{chap:DWATbitstridesubrangestridedimensionofarraytype}
1620 the subrange type entry has either a \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride} or
1621 \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute which specifies the separation
1622 between successive elements along the dimension as described
1624 Section \refersec{chap:byteandbitsizes}.
1626 \textit{Note that the stride can be negative.}
1628 \section{Pointer to Member Type Entries}
1629 \label{chap:pointertomembertypeentries}
1631 \textit{In C++, a pointer to a data or function member of a class or
1632 structure is a unique type.}
1634 A debugging information entry representing the type of an
1635 object that is a pointer to a structure or class member has
1636 the tag \livetarg{chap:DWTAGptrtomembertype}{DW\-\_TAG\-\_ptr\-\_to\-\_member\-\_type}.
1638 If the pointer to member type has a name, the pointer to
1639 member entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a
1640 null\dash terminated string containing the type name as it appears
1641 in the source program.
1643 The pointer to member entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to
1644 describe the type of the class or structure member to which
1645 objects of this type may point.
1647 The pointer to member entry also
1648 \hypertarget{chap:DWATcontainingtypecontainingtypeofpointertomembertype}
1650 \livelink{chap:DWATcontainingtype}{DW\-\_AT\-\_containing\-\_type}
1651 attribute, whose value is a reference to a debugging
1652 information entry for the class or structure to whose members
1653 objects of this type may point.
1656 \hypertarget{chap:DWATuselocationmemberlocationforpointertomembertype}
1657 pointer to member entry has a
1658 \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} attribute
1659 whose value is a location description that computes the
1660 address of the member of the class to which the pointer to
1661 member entry points.
1663 \textit{The method used to find the address of a given member of a
1664 class or structure is common to any instance of that class
1665 or structure and to any instance of the pointer or member
1666 type. The method is thus associated with the type entry,
1667 rather than with each instance of the type.}
1669 The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is used in conjunction
1670 with the location descriptions for a particular object of the
1671 given pointer to member type and for a particular structure or
1672 class instance. The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} attribute expects two
1674 \addtoindexi{pushed}{address!implicit push for member operator}
1675 onto the DWARF expression stack before
1676 the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is evaluated. The first
1678 \addtoindexi{pushed}{address!implicit push for member operator}
1679 is the value of the pointer to member object
1680 itself. The second value
1681 \addtoindexi{pushed}{address!implicit push for member operator}
1682 is the base address of the
1683 entire structure or union instance containing the member
1684 whose address is being calculated.
1686 \textit{For an expression such as}
1691 % FIXME: object and mbr\_ptr should be distinguished from italic. See DW4.
1692 \textit{where mbr\_ptr has some pointer to member type, a debugger should:}
1694 \textit{1. Push the value of mbr\_ptr onto the DWARF expression stack.}
1696 \textit{2. Push the base address of object onto the DWARF expression stack.}
1698 \textit{3. Evaluate the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description
1699 given in the type of mbr\_ptr.}
1701 \section{File Type Entries}
1702 \label{chap:filetypeentries}
1704 \textit{Some languages, such as Pascal, provide a data type to represent
1707 A file type is represented by a debugging information entry
1709 \livetarg{chap:DWTAGfiletype}{DW\-\_TAG\-\_file\-\_type}.
1710 If the file type has a name,
1711 the file type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value
1712 is a null\dash terminated string containing the type name as it
1713 appears in the source program.
1715 The file type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
1716 the type of the objects contained in the file.
1718 The file type entry also has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or
1719 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
1720 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1721 is the amount of storage need to hold a value of the file type.
1723 \section{Dynamic Type Properties}
1724 \label{chap:dynamictypeproperties}
1725 \subsection{Data Location}
1726 \label{chap:datalocation}
1728 \textit{Some languages may represent objects using descriptors to hold
1729 information, including a location and/or run\dash time parameters,
1730 about the data that represents the value for that object.}
1732 \hypertarget{chap:DWATdatalocationindirectiontoactualdata}
1733 The \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
1734 attribute may be used with any
1735 type that provides one or more levels of hidden indirection
1736 and/or run\dash time parameters in its representation. Its value
1737 is a location description. The result of evaluating this
1738 description yields the location of the data for an object.
1739 When this attribute is omitted, the address of the data is
1740 the same as the address of the object.
1742 \textit{This location description will typically begin with
1743 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address}
1744 which loads the address of the
1745 object which can then serve as a descriptor in subsequent
1746 calculation. For an example using
1747 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
1748 for a Fortran 90 array, see
1749 Appendix \refersec{app:fortran90example}.}
1751 \subsection{Allocation and Association Status}
1752 \label{chap:allocationandassociationstatus}
1754 \textit{Some languages, such as Fortran 90, provide types whose values
1755 may be dynamically allocated or associated with a variable
1756 under explicit program control.}
1758 \hypertarget{chap:DWATallocatedallocationstatusoftypes}
1760 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated}
1761 attribute may optionally be used with any
1762 type for which objects of the type can be explicitly allocated
1763 and deallocated. The presence of the attribute indicates that
1764 objects of the type are allocatable and deallocatable. The
1765 integer value of the attribute (see below) specifies whether
1766 an object of the type is
1767 currently allocated or not.
1769 \hypertarget{chap:DWATassociatedassociationstatusoftypes}
1771 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute
1772 may optionally be used with
1773 any type for which objects of the type can be dynamically
1774 associated with other objects. The presence of the attribute
1775 indicates that objects of the type can be associated. The
1776 integer value of the attribute (see below) indicates whether
1777 an object of the type is currently associated or not.
1779 While these attributes are defined specifically with Fortran
1780 90 ALLOCATABLE and POINTER types in mind, usage is not limited
1781 to just that language.
1783 The value of these attributes is determined as described in
1784 Section \refersec{chap:staticanddynamicvaluesofattributes}.
1786 A non\dash zero value is interpreted as allocated or associated,
1787 and zero is interpreted as not allocated or not associated.
1789 \textit{For Fortran 90, if the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute is present,
1790 the type has the POINTER property where either the parent
1791 variable is never associated with a dynamic object or the
1792 implementation does not track whether the associated object
1793 is static or dynamic. If the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute is
1794 present and the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute is not, the type
1795 has the ALLOCATABLE property. If both attributes are present,
1796 then the type should be assumed to have the POINTER property
1797 (and not ALLOCATABLE); the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute may then
1798 be used to indicate that the association status of the object
1799 resulted from execution of an ALLOCATE statement rather than
1800 pointer assignment.}
1802 \textit{For examples using \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} for Ada and Fortran 90
1804 see Appendix \refersec{app:aggregateexamples}.}
1808 \section{Template Alias Entries}
1809 \label{chap:templatealiasentries}
1811 A type named using a template alias is represented
1812 by a debugging information entry with the tag
1813 \livetarg{chap:DWTAGtemplatealias}{DW\-\_TAG\-\_template\-\_alias}.
1814 The template alias entry has a
1815 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
1816 containing the name of the template alias as it appears in
1817 the source program. The template alias entry also contains a
1818 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is a reference to the type
1819 named by the template alias. The template alias entry has
1820 the following child entries:
1822 \begin{enumerate}[1.]
1823 \item Each formal parameterized type declaration appearing
1824 in the template alias declaration is represented
1825 by a debugging information entry with the tag
1826 \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}. Each such entry may have
1827 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a null\dash terminated
1828 string containing the name of the formal type parameter as it
1829 appears in the source program. The template type parameter
1830 entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing the actual
1831 type by which the formal is replaced for this instantiation.
1833 \item Each formal parameterized value declaration
1834 appearing in the template alias declaration is
1835 represented by a debugging information entry with the tag
1836 \livelink{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}. Each such entry may have
1837 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a null\dash terminated
1838 string containing the name of the formal value parameter
1839 as it appears in the source program. The template value
1840 parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
1841 the type of the parameterized value. Finally, the template
1842 value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value} attribute, whose
1843 value is the actual constant value of the value parameter for
1844 this instantiation as represented on the target architecture.