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
20 \addtoindexx{fundamental type|see{base type entry}}
21 Each programming language has a set of base
22 types that are considered to be built into that language.}
24 A base type is represented by a debugging information entry
26 \livetarg{chap:DWTAGbasetype}{DW\_TAG\_base\_type}.
28 A \addtoindex{base type entry}
29 has a \livelink{chap:DWATname}{DW\_AT\_name} attribute
31 \addtoindexx{name attribute}
33 a null\dash terminated string containing the name of the base type
34 as recognized by the programming language of the compilation
35 unit containing the base type entry.
38 \addtoindexx{encoding attribute}
39 a \livelink{chap:DWATencoding}{DW\_AT\_encoding} attribute describing
40 how the base type is encoded and is to be interpreted. The
41 value of this attribute is an
42 \livelink{chap:classconstant}{integer constant}. The set of
43 values and their meanings for the
44 \livelink{chap:DWATencoding}{DW\_AT\_encoding} attribute
46 Table \refersec{tab:encodingattributevalues}
50 may have a \livelink{chap:DWATendianity}{DW\_AT\_endianity} attribute
51 \addtoindexx{endianity attribute}
53 Section \refersec{chap:dataobjectentries}.
54 If omitted, the encoding assumes the representation that
55 is the default for the target architecture.
58 \hypertarget{chap:DWATbytesizedataobjectordatatypesize}
59 either a \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size} attribute
60 \hypertarget{chap:DWATbitsizebasetypebitsize}
61 or a \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} attribute
62 \addtoindexx{bit size attribute}
63 whose \livelink{chap:classconstant}{integer constant} value
64 (see Section \refersec{chap:byteandbitsizes})
65 is the amount of storage needed to hold
69 \textit{For example, the
70 \addtoindex{C} type \texttt{int} on a machine that uses 32\dash bit
71 integers is represented by a base type entry with a name
72 attribute whose value is \doublequote{int}, an encoding attribute
73 whose value is \livelink{chap:DWATEsigned}{DW\_ATE\_signed}
74 and a byte size attribute whose value is 4.}
76 If the value of an object of the given type does not fully
77 occupy the storage described by a byte size attribute,
78 \hypertarget{chap:DWATdatabitoffsetbasetypebitlocation}
79 the base type entry may also have
80 \addtoindexx{bit size attribute}
82 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} and a
83 \livelink{chap:DWATdatabitoffset}{DW\_AT\_data\_bit\_offset} attribute,
85 \addtoindexx{data bit offset attribute}
87 \livelink{chap:classconstant}{integer constant} values
88 (see Section \refersec{chap:staticanddynamicvaluesofattributes}).
90 attribute describes the actual size in bits used to represent
91 values of the given type. The data bit offset attribute is the
92 offset in bits from the beginning of the containing storage to
93 the beginning of the value. Bits that are part of the offset
94 are padding. The data bit offset uses the bit numbering and
95 direction conventions that are appropriate to the current
97 target system to locate the beginning of the storage and
98 value. If this attribute is omitted a default data bit offset
102 \livelink{chap:DWATdatabitoffset}{DW\_AT\_data\_bit\_offset}
104 \addtoindexx{bit offset attribute}
106 \addtoindexx{data bit offset attribute}
108 \addtoindex{DWARF Version 4}, unchanged in \addtoindex{DWARF Version 5}, and
109 is also used for bit field members
110 (see Section \refersec{chap:datamemberentries}).
112 \hypertarget{chap:DWATbitoffsetbasetypebitlocation}
113 replaces the attribute
114 \livelink{chap:DWATbitoffset}{DW\_AT\_bit\_offset}
116 \addtoindexx{bit offset attribute (V3)}
117 types as defined in DWARF V3 and earlier.
118 \livelink{chap:DWATbitoffset}{DW\_AT\_bit\_offset}
119 is deprecated for use in base types in DWARF Version 4 and later.
120 See Section 5.1 in the DWARF Version 4
121 specification for a discussion of compatibility considerations.}
124 \caption{Encoding attribute values}
125 \label{tab:encodingattributevalues}
127 \begin{tabular}{l|p{8cm}}
129 Name&Meaning\\ \hline
130 \livetarg{chap:DWATEaddress}{DW\_ATE\_address} & linear machine address (for segmented\break
132 Section \refersec{chap:segmentedaddresses}) \\
133 \livetarg{chap:DWATEboolean}{DW\_ATE\_boolean}& true or false \\
135 \livetarg{chap:DWATEcomplexfloat}{DW\_ATE\_complex\_float}& complex binary
136 floating\dash point number \\
137 \livetarg{chap:DWATEfloat}{DW\_ATE\_float} & binary floating\dash point number \\
138 \livetarg{chap:DWATEimaginaryfloat}{DW\_ATE\_imaginary\_float}& imaginary binary
139 floating\dash point number \\
140 \livetarg{chap:DWATEsigned}{DW\_ATE\_signed}& signed binary integer \\
141 \livetarg{chap:DWATEsignedchar}{DW\_ATE\_signed\_char}& signed character \\
142 \livetarg{chap:DWATEunsigned}{DW\_ATE\_unsigned} & unsigned binary integer \\
143 \livetarg{chap:DWATEunsignedchar}{DW\_ATE\_unsigned\_char} & unsigned character \\
144 \livetarg{chap:DWATEpackeddecimal}{DW\_ATE\_packed\_decimal} & packed decimal \\
145 \livetarg{chap:DWATEnumericstring}{DW\_ATE\_numeric\_string}& numeric string \\
146 \livetarg{chap:DWATEedited}{DW\_ATE\_edited} & edited string \\
147 \livetarg{chap:DWATEsignedfixed}{DW\_ATE\_signed\_fixed} & signed fixed\dash point scaled integer \\
148 \livetarg{chap:DWATEunsignedfixed}{DW\_ATE\_unsigned\_fixed}& unsigned fixed\dash point scaled integer \\
149 \livetarg{chap:DWATEdecimalfloat}{DW\_ATE\_decimal\_float} & decimal floating\dash point number \\
150 \livetarg{chap:DWATEUTF}{DW\_ATE\_UTF} & \addtoindex{Unicode} character \\
155 \textit{The \livelink{chap:DWATEdecimalfloat}{DW\_ATE\_decimal\_float} encoding is intended for
156 floating\dash point representations that have a power\dash of\dash ten
157 exponent, such as that specified in IEEE 754R.}
159 \textit{The \livelink{chap:DWATEUTF}{DW\_ATE\_UTF} encoding is intended for \addtoindex{Unicode}
160 string encodings (see the Universal Character Set standard,
161 ISO/IEC 10646\dash 1:1993). For example, the
162 \addtoindex{C++} type char16\_t is
163 represented by a base type entry with a name attribute whose
164 value is \doublequote{char16\_t}, an encoding attribute whose value
165 is \livelink{chap:DWATEUTF}{DW\_ATE\_UTF} and a byte size attribute whose value is 2.}
168 \livelink{chap:DWATEpackeddecimal}{DW\_ATE\_packed\_decimal}
170 \livelink{chap:DWATEnumericstring}{DW\_ATE\_numeric\_string}
172 represent packed and unpacked decimal string numeric data
173 types, respectively, either of which may be
175 \addtoindexx{decimal scale attribute}
177 \addtoindexx{decimal sign attribute}
179 \addtoindexx{digit count attribute}
181 \hypertarget{chap:DWATdecimalsigndecimalsignrepresentation}
183 \hypertarget{chap:DWATdigitcountdigitcountforpackeddecimalornumericstringtype}
184 base types are used in combination with
185 \livelink{chap:DWATdecimalsign}{DW\_AT\_decimal\_sign},
186 \livelink{chap:DWATdigitcount}{DW\_AT\_digit\_count} and
187 \livelink{chap:DWATdecimalscale}{DW\_AT\_decimal\_scale}
191 A \livelink{chap:DWATdecimalsign}{DW\_AT\_decimal\_sign} attribute
192 \addtoindexx{decimal sign attribute}
193 is an \livelink{chap:classconstant}{integer constant} that
194 conveys the representation of the sign of the decimal type
195 (see Table \refersec{tab:decimalsignattributevalues}).
196 Its \livelink{chap:classconstant}{integer constant} value is interpreted to
197 mean that the type has a leading overpunch, trailing overpunch,
198 leading separate or trailing separate sign representation or,
199 alternatively, no sign at all.
202 \caption{Decimal sign attribute values}
203 \label{tab:decimalsignattributevalues}
205 \begin{tabular}{l|p{9cm}}
209 \livetarg{chap:DWDSunsigned}{DW\_DS\_unsigned} & Unsigned \\
210 \livetarg{chap:DWDSleadingoverpunch}{DW\_DS\_leading\_overpunch} & Sign
211 is encoded in the most significant digit in a target\dash dependent manner \\
212 \livetarg{chap:DWDStrailingoverpunch}{DW\_DS\_trailing\_overpunch} & Sign
213 is encoded in the least significant digit in a target\dash dependent manner \\
214 \livetarg{chap:DWDSleadingseparate}{DW\_DS\_leading\_separate}
215 & Decimal type: Sign is a \doublequote{+} or \doublequote{-} character
216 to the left of the most significant digit. \\
217 \livetarg{chap:DWDStrailingseparate}{DW\_DS\_trailing\_separate}
218 & Decimal type: Sign is a \doublequote{+} or \doublequote{-} character
219 to the right of the least significant digit. \\
220 &Packed decimal type: Least significant nibble contains
221 a target\dash dependent value
222 indicating positive or negative. \\
228 \livelink{chap:DWATdigitcount}{DW\_AT\_digit\_count}
230 \addtoindexx{digit count attribute}
231 is an \livelink{chap:classconstant}{integer constant}
232 value that represents the number of digits in an instance of
235 \hypertarget{chap:DWATdecimalscaledecimalscalefactor}
236 The \livelink{chap:DWATdecimalscale}{DW\_AT\_decimal\_scale}
238 \addtoindexx{decimal scale attribute}
239 is an integer constant value
240 that represents the exponent of the base ten scale factor to
241 be applied to an instance of the type. A scale of zero puts the
242 decimal point immediately to the right of the least significant
243 digit. Positive scale moves the decimal point to the right
244 and implies that additional zero digits on the right are not
245 stored in an instance of the type. Negative scale moves the
246 decimal point to the left; if the absolute value of the scale
247 is larger than the digit count, this implies additional zero
248 digits on the left are not stored in an instance of the type.
250 The \livelink{chap:DWATEedited}{DW\_ATE\_edited}
252 \hypertarget{chap:DWATpicturestringpicturestringfornumericstringtype}
253 type is used to represent an edited
254 numeric or alphanumeric data type. It is used in combination
255 with a \livelink{chap:DWATpicturestring}{DW\_AT\_picture\_string} attribute whose value is a
256 null\dash terminated string containing the target\dash dependent picture
257 string associated with the type.
259 If the edited base type entry describes an edited numeric
260 data type, the edited type entry has a \livelink{chap:DWATdigitcount}{DW\_AT\_digit\_count} and a
261 \livelink{chap:DWATdecimalscale}{DW\_AT\_decimal\_scale} attribute.
262 \addtoindexx{decimal scale attribute}
263 These attributes have the same
264 interpretation as described for the
265 \livelink{chap:DWATEpackeddecimal}{DW\_ATE\_packed\_decimal} and
266 \livelink{chap:DWATEnumericstring}{DW\_ATE\_numeric\_string} base
267 types. If the edited type entry
268 describes an edited alphanumeric data type, the edited type
269 entry does not have these attributes.
272 \textit{The presence or absence of the \livelink{chap:DWATdigitcount}{DW\_AT\_digit\_count} and
273 \livelink{chap:DWATdecimalscale}{DW\_AT\_decimal\_scale} attributes
274 \addtoindexx{decimal scale attribute}
275 allows a debugger to easily
276 distinguish edited numeric from edited alphanumeric, although
277 in principle the digit count and scale are derivable by
278 interpreting the picture string.}
280 The \livelink{chap:DWATEsignedfixed}{DW\_ATE\_signed\_fixed} and \livelink{chap:DWATEunsignedfixed}{DW\_ATE\_unsigned\_fixed} entries
281 describe signed and unsigned fixed\dash point binary data types,
284 The fixed binary type entries have
285 \addtoindexx{digit count attribute}
287 \livelink{chap:DWATdigitcount}{DW\_AT\_digit\_count}
288 attribute with the same interpretation as described for the
289 \livelink{chap:DWATEpackeddecimal}{DW\_ATE\_packed\_decimal} and \livelink{chap:DWATEnumericstring}{DW\_ATE\_numeric\_string} base types.
292 For a data type with a decimal scale factor, the fixed binary
294 \livelink{chap:DWATdecimalscale}{DW\_AT\_decimal\_scale} attribute
295 \addtoindexx{decimal scale attribute}
297 interpretation as described for the
298 \livelink{chap:DWATEpackeddecimal}{DW\_ATE\_packed\_decimal}
299 and \livelink{chap:DWATEnumericstring}{DW\_ATE\_numeric\_string} base types.
301 \hypertarget{chap:DWATbinaryscalebinaryscalefactorforfixedpointtype}
302 For a data type with a binary scale factor, the fixed
303 \addtoindexx{binary scale attribute}
304 binary type entry has a
305 \livelink{chap:DWATbinaryscale}{DW\_AT\_binary\_scale} attribute.
307 \livelink{chap:DWATbinaryscale}{DW\_AT\_binary\_scale} attribute
308 is an \livelink{chap:classconstant}{integer constant} value
309 that represents the exponent of the base two scale factor to
310 be applied to an instance of the type. Zero scale puts the
311 binary point immediately to the right of the least significant
312 bit. Positive scale moves the binary point to the right and
313 implies that additional zero bits on the right are not stored
314 in an instance of the type. Negative scale moves the binary
315 point to the left; if the absolute value of the scale is
316 larger than the number of bits, this implies additional zero
317 bits on the left are not stored in an instance of the type.
320 \hypertarget{chap:DWATsmallscalefactorforfixedpointtype}
321 a data type with a non\dash decimal and non\dash binary scale factor,
322 the fixed binary type entry has a
323 \livelink{chap:DWATsmall}{DW\_AT\_small} attribute which
324 \addtoindexx{small attribute}
326 \livelink{chap:DWTAGconstant}{DW\_TAG\_constant} entry. The scale factor value
327 is interpreted in accordance with the value defined by the
328 \livelink{chap:DWTAGconstant}{DW\_TAG\_constant} entry. The value represented is the product
329 of the integer value in memory and the associated constant
332 \textit{The \livelink{chap:DWATsmall}{DW\_AT\_small} attribute
333 is defined with the \addtoindex{Ada} \texttt{small}
336 \section{Unspecified Type Entries}
337 \label{chap:unspecifiedtypeentries}
338 \addtoindexx{unspecified type entry}
339 \addtoindexx{void type|see{unspecified type entry}}
340 Some languages have constructs in which a type
341 may be left unspecified or the absence of a type
342 may be explicitly indicated.
344 An unspecified (implicit, unknown, ambiguous or nonexistent)
345 type is represented by a debugging information entry with
346 the tag \livetarg{chap:DWTAGunspecifiedtype}{DW\_TAG\_unspecified\_type}.
347 If a name has been given
348 to the type, then the corresponding unspecified type entry
349 has a \livelink{chap:DWATname}{DW\_AT\_name} attribute
350 \addtoindexx{name attribute}
352 a null\dash terminated
353 string containing the name as it appears in the source program.
355 The interpretation of this debugging information entry is
356 intentionally left flexible to allow it to be interpreted
357 appropriately in different languages. For example, in
358 \addtoindex{C} and \addtoindex{C++}
359 the language implementation can provide an unspecified type
360 entry with the name \doublequote{void} which can be referenced by the
361 type attribute of pointer types and typedef declarations for
363 Sections \refersec{chap:typemodifierentries} and
364 %The following reference was valid, so the following is probably correct.
365 Section \refersec{chap:typedefentries},
366 respectively). As another
367 example, in \addtoindex{Ada} such an unspecified type entry can be referred
368 to by the type attribute of an access type where the denoted
369 \addtoindexx{incomplete type (Ada)}
370 type is incomplete (the name is declared as a type but the
371 definition is deferred to a separate compilation unit).
373 \section{Type Modifier Entries}
374 \label{chap:typemodifierentries}
375 \addtoindexx{type modifier entry}
377 A base or user\dash defined type may be modified in different ways
378 in different languages. A type modifier is represented in
379 DWARF by a debugging information entry with one of the tags
380 given in Table \refersec{tab:typemodifiertags}.
381 \addtoindexx{type modifier|see{constant type entry}}
382 \addtoindexx{type modifier|see{reference type entry}}
383 \addtoindexx{type modifier|see{restricted type entry}}
384 \addtoindexx{type modifier|see{packed type entry}}
385 \addtoindexx{type modifier|see{pointer type entry}}
386 \addtoindexx{type modifier|see{shared type entry}}
387 \addtoindexx{type modifier|see{volatile type entry}}
389 If a name has been given to the modified type in the source
390 program, then the corresponding modified type entry has
391 a \livelink{chap:DWATname}{DW\_AT\_name} attribute
392 \addtoindexx{name attribute}
393 whose value is a null\dash terminated
394 string containing the modified type name as it appears in
397 Each of the type modifier entries has
398 \addtoindexx{type attribute}
400 \livelink{chap:DWATtype}{DW\_AT\_type} attribute,
401 whose value is a \livelink{chap:classreference}{reference}
402 to a debugging information entry
403 describing a base type, a user-defined type or another type
406 A modified type entry describing a
407 \addtoindexx{pointer type entry}
408 pointer or \addtoindex{reference type}
409 (using \livelink{chap:DWTAGpointertype}{DW\_TAG\_pointer\_type},
410 \livelink{chap:DWTAGreferencetype}{DW\_TAG\_reference\_type} or
411 \livelink{chap:DWTAGrvaluereferencetype}{DW\_TAG\_rvalue\_reference\_type})
412 % Another instance of no-good-place-to-put-index entry.
414 \addtoindexx{address class!attribute}
416 \hypertarget{chap:DWATadressclasspointerorreferencetypes}
418 \livelink{chap:DWATaddressclass}{DW\_AT\_address\_class}
419 attribute to describe how objects having the given pointer
420 or reference type ought to be dereferenced.
422 A modified type entry describing a \addtoindex{UPC} shared qualified type
423 (using \livelink{chap:DWTAGsharedtype}{DW\_TAG\_shared\_type}) may have a
424 \livelink{chap:DWATcount}{DW\_AT\_count} attribute
425 \addtoindexx{count attribute}
426 whose value is a constant expressing the (explicit or implied) blocksize specified for the
427 type in the source. If no count attribute is present, then the \doublequote{infinite}
428 blocksize is assumed.
430 When multiple type modifiers are chained together to modify
431 a base or user-defined type, the tree ordering reflects the
433 \addtoindexx{reference type entry, lvalue|see{reference type entry}}
435 \addtoindexx{reference type entry, rvalue|see{rvalue reference type entry}}
437 \addtoindexx{parameter|see{macro formal parameter list}}
439 \addtoindexx{parameter|see{\textit{this} parameter}}
441 \addtoindexx{parameter|see{variable parameter attribute}}
443 \addtoindexx{parameter|see{optional parameter attribute}}
445 \addtoindexx{parameter|see{unspecified parameters entry}}
447 \addtoindexx{parameter|see{template value parameter entry}}
449 \addtoindexx{parameter|see{template type parameter entry}}
451 \addtoindexx{parameter|see{formal parameter entry}}
455 \caption{Type modifier tags}
456 \label{tab:typemodifiertags}
458 \begin{tabular}{l|p{9cm}}
460 Name&Meaning\\ \hline
461 \livetarg{chap:DWTAGconsttype}{DW\_TAG\_const\_type} & C or C++ const qualified type
462 \addtoindexx{const qualified type entry} \addtoindexx{C} \addtoindexx{C++} \\
463 \livetarg{chap:DWTAGpackedtype}{DW\_TAG\_packed\_type}& \addtoindex{Pascal} or Ada packed type\addtoindexx{packed type entry}
464 \addtoindexx{packed qualified type entry} \addtoindexx{Ada} \addtoindexx{Pascal} \\
465 \livetarg{chap:DWTAGpointertype}{DW\_TAG\_pointer\_type} & Pointer to an object of
466 the type being modified \addtoindexx{pointer qualified type entry} \\
467 \livetarg{chap:DWTAGreferencetype}{DW\_TAG\_reference\_type}& C++ (lvalue) reference
468 to an object of the type
469 \addtoindexx{reference type entry}
471 \addtoindexx{reference qualified type entry} \\
472 \livetarg{chap:DWTAGrestricttype}{DW\_TAG\_restrict\_type}& \addtoindex{C}
474 \addtoindexx{restricted type entry}
476 \addtoindexx{restrict qualified type} \\
477 \livetarg{chap:DWTAGrvaluereferencetype}{DW\_TAG\_rvalue\_reference\_type} & C++
478 \addtoindexx{rvalue reference type entry}
480 \addtoindexx{restricted type entry}
481 reference to an object of the type being modified
482 \addtoindexx{rvalue reference qualified type entry} \\
483 \livetarg{chap:DWTAGsharedtype}{DW\_TAG\_shared\_type}&\addtoindex{UPC} shared qualified type
484 \addtoindexx{shared qualified type entry} \\
485 \livetarg{chap:DWTAGvolatiletype}{DW\_TAG\_volatile\_type}&C or C++ volatile qualified type
486 \addtoindexx{volatile qualified type entry} \\
491 %The following clearpage prevents splitting the example across pages.
492 \textit{As examples of how type modifiers are ordered, consider the following
493 \addtoindex{C} declarations:}
494 \begin{lstlisting}[numbers=none]
495 const unsigned char * volatile p;
497 \textit{which represents a volatile pointer to a constant
498 character. This is encoded in DWARF as:}
502 \livelink{chap:DWTAGvariable}{DW\_TAG\_variable}(p) -->
503 \livelink{chap:DWTAGvolatiletype}{DW\_TAG\_volatile\_type} -->
504 \livelink{chap:DWTAGpointertype}{DW\_TAG\_pointer\_type} -->
505 \livelink{chap:DWTAGconsttype}{DW\_TAG\_const\_type} -->
506 \livelink{chap:DWTAGbasetype}{DW\_TAG\_base\_type}(unsigned char)
511 \textit{On the other hand}
512 \begin{lstlisting}[numbers=none]
513 volatile unsigned char * const restrict p;
515 \textit{represents a restricted constant
516 pointer to a volatile character. This is encoded as:}
520 \livelink{chap:DWTAGvariable}{DW\_TAG\_variable}(p) -->
521 \livelink{chap:DWTAGrestricttype}{DW\_TAG\_restrict\_type} -->
522 \livelink{chap:DWTAGconsttype}{DW\_TAG\_const\_type} -->
523 \livelink{chap:DWTAGpointertype}{DW\_TAG\_pointer\_type} -->
524 \livelink{chap:DWTAGvolatiletype}{DW\_TAG\_volatile\_type} -->
525 \livelink{chap:DWTAGbasetype}{DW\_TAG\_base\_type}(unsigned char)
529 \section{Typedef Entries}
530 \label{chap:typedefentries}
531 A named type that is defined in terms of another type
532 definition is represented by a debugging information entry with
533 \addtoindexx{typedef entry}
534 the tag \livetarg{chap:DWTAGtypedef}{DW\_TAG\_typedef}.
535 The typedef entry has a \livelink{chap:DWATname}{DW\_AT\_name} attribute
536 \addtoindexx{name attribute}
537 whose value is a null\dash terminated string containing
538 the name of the typedef as it appears in the source program.
540 The typedef entry may also contain
541 \addtoindexx{type attribute}
543 \livelink{chap:DWATtype}{DW\_AT\_type} attribute whose
544 value is a \livelink{chap:classreference}{reference}
545 to the type named by the typedef. If
546 the debugging information entry for a typedef represents
547 a declaration of the type that is not also a definition,
548 it does not contain a type attribute.
550 \textit{Depending on the language, a named type that is defined in
551 terms of another type may be called a type alias, a subtype,
552 a constrained type and other terms. A type name declared with
553 no defining details may be termed an
554 \addtoindexx{incomplete type}
555 incomplete, forward or hidden type.
556 While the DWARF \livelink{chap:DWTAGtypedef}{DW\_TAG\_typedef} entry was
557 originally inspired by the like named construct in
558 \addtoindex{C} and \addtoindex{C++},
559 it is broadly suitable for similar constructs (by whatever
560 source syntax) in other languages.}
562 \section{Array Type Entries}
563 \label{chap:arraytypeentries}
564 \label{chap:DWTAGgenericsubrange}
566 \textit{Many languages share the concept of an \doublequote{array,} which is
567 \addtoindexx{array type entry}
568 a table of components of identical type.}
570 An array type is represented by a debugging information entry
571 with the tag \livetarg{chap:DWTAGarraytype}{DW\_TAG\_array\_type}.
572 If a name has been given to
573 \addtoindexx{array!declaration of type}
574 the array type in the source program, then the corresponding
575 array type entry has a \livelink{chap:DWATname}{DW\_AT\_name} attribute
576 \addtoindexx{name attribute}
578 null\dash terminated string containing the array type name as it
579 appears in the source program.
582 \hypertarget{chap:DWATorderingarrayrowcolumnordering}
583 array type entry describing a multidimensional array may
584 \addtoindexx{array!element ordering}
585 have a \livelink{chap:DWATordering}{DW\_AT\_ordering} attribute whose
586 \livelink{chap:classconstant}{integer constant} value is
587 interpreted to mean either row-major or column-major ordering
588 of array elements. The set of values and their meanings
589 for the ordering attribute are listed in
590 Table \refersec{tab:arrayordering}.
592 ordering attribute is present, the default ordering for the
593 source language (which is indicated by the
594 \livelink{chap:DWATlanguage}{DW\_AT\_language}
596 \addtoindexx{language attribute}
597 of the enclosing compilation unit entry) is assumed.
599 \begin{simplenametable}[1.6in]{Array ordering}{tab:arrayordering}
600 \livetarg{chap:DWORDcolmajor}{DW\_ORD\_col\_major} \\
601 \livetarg{chap:DWORDrowmajor}{DW\_ORD\_row\_major} \\
602 \end{simplenametable}
604 The ordering attribute may optionally appear on one-dimensional
605 arrays; it will be ignored.
607 An array type entry has
608 \addtoindexx{type attribute}
609 a \livelink{chap:DWATtype}{DW\_AT\_type} attribute
611 \addtoindexx{array!element type}
612 the type of each element of the array.
614 If the amount of storage allocated to hold each element of an
615 object of the given array type is different from the amount
616 \addtoindexx{stride attribute|see{bit stride attribute or byte stride attribute}}
617 of storage that is normally allocated to hold an individual
618 \hypertarget{chap:DWATbitstridearrayelementstrideofarraytype}
620 \hypertarget{chap:DWATbytestridearrayelementstrideofarraytype}
621 indicated element type, then the array type
622 \addtoindexx{bit stride attribute}
624 \livelink{chap:DWATbytestride}{DW\_AT\_byte\_stride}
626 \addtoindexx{byte stride attribute}
627 a \livelink{chap:DWATbitstride}{DW\_AT\_bit\_stride}
629 \addtoindexx{bit stride attribute}
631 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
633 element of the array.
635 The array type entry may have either a \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size} or a
636 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} attribute
637 (see Section \refersec{chap:byteandbitsizes}),
639 amount of storage needed to hold an instance of the array type.
641 \textit{If the size of the array can be determined statically at
642 compile time, this value can usually be computed by multiplying
643 the number of array elements by the size of each element.}
646 Each array dimension is described by a debugging information
647 entry with either the
648 \addtoindexx{subrange type entry!as array dimension}
649 tag \livelink{chap:DWTAGsubrangetype}{DW\_TAG\_subrange\_type} or the
650 \addtoindexx{enumeration type entry!as array dimension}
652 \livelink{chap:DWTAGenumerationtype}{DW\_TAG\_enumeration\_type}. These entries are
654 array type entry and are ordered to reflect the appearance of
655 the dimensions in the source program (i.e., leftmost dimension
656 first, next to leftmost second, and so on).
658 \textit{In languages that have no concept of a
659 \doublequote{multidimensional array} (for example,
660 \addtoindex{C}), an array of arrays may
661 be represented by a debugging information entry for a
662 multidimensional array.}
664 \hypertarget{chap:DWTAGgenericsubrange}
665 Alternatively, the array dimensions can also be described with the
666 \DWTAGgenericsubrange, which contains only a single, generic
667 expression describing each of the attributes. If \DWTAGgenericsubrange
668 is used, the number dimensions must be stored in the
669 \livelink{chap:DWATrank}{DW\_AT\_rank} attribute. See also Section
670 \ref{chap:DWATrank}, Dynamic Type Properties: Array Rank.
674 Other attributes especially applicable to arrays are
675 \livelink{chap:DWATallocated}{DW\_AT\_allocated},
676 \livelink{chap:DWATassociated}{DW\_AT\_associated} and
677 \livelink{chap:DWATdatalocation}{DW\_AT\_data\_location},
678 which are described in
679 Section \refersec{chap:dynamictypeproperties}.
680 For relevant examples, see also Appendix \refersec{app:fortranarrayexample}.
682 \section{Coarray Type Entries}
683 \label{chap:coarraytypeentries}
684 \addtoindexx{coarray}
685 \textit{In Fortran, a \doublequote{coarray} is an array whose
686 elements are located in different processes rather than in the
687 memory of one process. The individual elements
688 of a coarray can be scalars or arrays.
689 Similar to arrays, coarrays have \doublequote{codimensions} that are
690 indexed using a \doublequote{coindex} or multiple \doublequote{coindices}.
691 \addtoindexx{codimension|see{coarray}}
692 \addtoindexx{coindex|see{coarray}}
695 A coarray type is represented by a debugging information entry
696 with the tag \livetarg{chap:DWTAGcoarraytype}{DW\_TAG\_coarray\_type}.
697 If a name has been given to the
698 coarray type in the source, then the corresponding coarray type
699 entry has a \DWATname{} attribute whose value is a null-terminated
700 string containing the array type name as it appears in the source
703 A coarray entry has one or more \DWTAGsubrangetype{} child entries,
704 one for each codimension. It also has a \DWATtype{} attribute
705 describing the type of each element of the coarray.
707 \textit{In a coarray application, the run-time number of processes in the application
708 is part of the coindex calculation. It is represented in the Fortran source by
709 a coindex which is declared with a \doublequote{*} as the upper bound. To express this
710 concept in DWARF, the \DWTAGsubrangetype{} child entry for that index has
711 only a lower bound and no upper bound.}
713 \textit{How coarray elements are located and how coindices are
714 converted to process specifications is processor-dependent.}
716 \section{Structure, Union, Class and Interface Type Entries}
717 \label{chap:structureunionclassandinterfacetypeentries}
719 \textit{The languages
721 \addtoindex{C++}, and
722 \addtoindex{Pascal}, among others, allow the
723 programmer to define types that are collections of related
724 \addtoindexx{structure type entry}
726 In \addtoindex{C} and \addtoindex{C++}, these collections are called
727 \doublequote{structures.}
728 In \addtoindex{Pascal}, they are called \doublequote{records.}
729 The components may be of different types. The components are
730 called \doublequote{members} in \addtoindex{C} and
731 \addtoindex{C++}, and \doublequote{fields} in \addtoindex{Pascal}.}
733 \textit{The components of these collections each exist in their
734 own space in computer memory. The components of a C or C++
735 \doublequote{union} all coexist in the same memory.}
737 \textit{\addtoindex{Pascal} and
738 other languages have a \doublequote{discriminated union,}
739 \addtoindexx{discriminated union|see {variant entry}}
740 also called a \doublequote{variant record.} Here, selection of a
741 number of alternative substructures (\doublequote{variants}) is based
742 on the value of a component that is not part of any of those
743 substructures (the \doublequote{discriminant}).}
745 \textit{\addtoindex{C++} and
746 \addtoindex{Java} have the notion of \doublequote{class,} which is in some
747 ways similar to a structure. A class may have \doublequote{member
748 functions} which are subroutines that are within the scope
749 of a class or structure.}
751 \textit{The \addtoindex{C++} notion of
752 structure is more general than in \addtoindex{C}, being
753 equivalent to a class with minor differences. Accordingly,
754 in the following discussion statements about
755 \addtoindex{C++} classes may
756 be understood to apply to \addtoindex{C++} structures as well.}
758 \subsection{Structure, Union and Class Type Entries}
759 \label{chap:structureunionandclasstypeentries}
762 Structure, union, and class types are represented by debugging
763 \addtoindexx{structure type entry}
765 \addtoindexx{union type entry}
767 \addtoindexx{class type entry}
769 \livetarg{chap:DWTAGstructuretype}{DW\_TAG\_structure\_type},
770 \livetarg{chap:DWTAGuniontype}{DW\_TAG\_union\_type},
771 and \livetarg{chap:DWTAGclasstype}{DW\_TAG\_class\_type},
772 respectively. If a name has been given to the structure,
773 union, or class in the source program, then the corresponding
774 structure type, union type, or class type entry has a
775 \livelink{chap:DWATname}{DW\_AT\_name} attribute
776 \addtoindexx{name attribute}
777 whose value is a null\dash terminated string
778 containing the type name as it appears in the source program.
780 The members of a structure, union, or class are represented
781 by debugging information entries that are owned by the
782 corresponding structure type, union type, or class type entry
783 and appear in the same order as the corresponding declarations
784 in the source program.
786 A structure type, union type or class type entry may have
787 either a \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size} or a
788 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} attribute
789 \hypertarget{chap:DWATbitsizedatamemberbitsize}
790 (see Section \refersec{chap:byteandbitsizes}),
791 whose value is the amount of storage needed
792 to hold an instance of the structure, union or class type,
793 including any padding.
795 An incomplete structure, union or class type
796 \addtoindexx{incomplete structure/union/class}
798 \addtoindexx{incomplete type}
799 represented by a structure, union or class
800 entry that does not have a byte size attribute and that has
801 \addtoindexx{declaration attribute}
802 a \livelink{chap:DWATdeclaration}{DW\_AT\_declaration} attribute.
804 If the complete declaration of a type has been placed in
805 \hypertarget{chap:DWATsignaturetypesignature}
806 a separate \addtoindex{type unit}
807 (see Section \refersec{chap:separatetypeunitentries}),
808 an incomplete declaration
809 \addtoindexx{incomplete type}
810 of that type in the compilation unit may provide
811 the unique 64\dash bit signature of the type using
812 \addtoindexx{type signature}
813 a \livelink{chap:DWATsignature}{DW\_AT\_signature}
816 If a structure, union or class entry represents the definition
817 of a structure, union or class member corresponding to a prior
818 incomplete structure, union or class, the entry may have a
819 \livelink{chap:DWATspecification}{DW\_AT\_specification} attribute
820 \addtoindexx{specification attribute}
821 whose value is a \livelink{chap:classreference}{reference} to
822 the debugging information entry representing that incomplete
825 Structure, union and class entries containing the
826 \livelink{chap:DWATspecification}{DW\_AT\_specification} attribute
827 \addtoindexx{specification attribute}
828 do not need to duplicate
829 information provided by the declaration entry referenced by the
830 specification attribute. In particular, such entries do not
831 need to contain an attribute for the name of the structure,
832 union or class they represent if such information is already
833 provided in the declaration.
835 \textit{For \addtoindex{C} and \addtoindex{C++},
837 \addtoindexx{data member|see {member entry (data)}}
838 member declarations occurring within
839 the declaration of a structure, union or class type are
840 considered to be \doublequote{definitions} of those members, with
841 the exception of \doublequote{static} data members, whose definitions
842 appear outside of the declaration of the enclosing structure,
843 union or class type. Function member declarations appearing
844 within a structure, union or class type declaration are
845 definitions only if the body of the function also appears
846 within the type declaration.}
848 If the definition for a given member of the structure, union
849 or class does not appear within the body of the declaration,
850 that member also has a debugging information entry describing
851 its definition. That latter entry has a
852 \livelink{chap:DWATspecification}{DW\_AT\_specification} attribute
853 \addtoindexx{specification attribute}
854 referencing the debugging information entry
855 owned by the body of the structure, union or class entry and
856 representing a non\dash defining declaration of the data, function
857 or type member. The referenced entry will not have information
858 about the location of that member (low and high pc attributes
859 for function members, location descriptions for data members)
860 and will have a \livelink{chap:DWATdeclaration}{DW\_AT\_declaration} attribute.
863 \textit{Consider a nested class whose
864 definition occurs outside of the containing class definition, as in:}
866 \begin{lstlisting}[numbers=none]
873 \textit{The two different structs can be described in
874 different compilation units to
875 facilitate DWARF space compression
876 (see Appendix \refersec{app:usingcompilationunits}).}
878 \subsection{Interface Type Entries}
879 \label{chap:interfacetypeentries}
881 \textit{The \addtoindex{Java} language defines \doublequote{interface} types.
883 \addtoindexx{interface type entry}
884 in \addtoindex{Java} is similar to a \addtoindex{C++} or
885 \addtoindex{Java} class with only abstract
886 methods and constant data members.}
889 \addtoindexx{interface type entry}
890 are represented by debugging information
892 tag \livetarg{chap:DWTAGinterfacetype}{DW\_TAG\_interface\_type}.
894 An interface type entry has
895 a \livelink{chap:DWATname}{DW\_AT\_name} attribute,
896 \addtoindexx{name attribute}
898 value is a null\dash terminated string containing the type name
899 as it appears in the source program.
901 The members of an interface are represented by debugging
902 information entries that are owned by the interface type
903 entry and that appear in the same order as the corresponding
904 declarations in the source program.
906 \subsection{Derived or Extended Structs, Classes and Interfaces}
907 \label{chap:derivedorextendedstructsclasesandinterfaces}
909 \textit{In \addtoindex{C++}, a class (or struct)
911 \addtoindexx{derived type (C++)|see{inheritance entry}}
912 be \doublequote{derived from} or be a
913 \doublequote{subclass of} another class.
914 In \addtoindex{Java}, an interface may \doublequote{extend}
915 \addtoindexx{extended type (Java)|see{inheritance entry}}
917 \addtoindexx{implementing type (Java)|see{inheritance entry}}
918 or more other interfaces, and a class may \doublequote{extend} another
919 class and/or \doublequote{implement} one or more interfaces. All of these
920 relationships may be described using the following. Note that
921 in \addtoindex{Java},
922 the distinction between extends and implements is
923 implied by the entities at the two ends of the relationship.}
925 A class type or interface type entry that describes a
926 derived, extended or implementing class or interface owns
927 \addtoindexx{implementing type (Java)|see{inheritance entry}}
928 debugging information entries describing each of the classes
929 or interfaces it is derived from, extending or implementing,
930 respectively, ordered as they were in the source program. Each
932 \addtoindexx{inheritance entry}
934 tag \livetarg{chap:DWTAGinheritance}{DW\_TAG\_inheritance}.
937 \addtoindexx{type attribute}
939 \addtoindexx{inheritance entry}
941 \livelink{chap:DWATtype}{DW\_AT\_type} attribute whose value is
942 a reference to the debugging information entry describing the
943 class or interface from which the parent class or structure
944 of the inheritance entry is derived, extended or implementing.
947 \addtoindexx{inheritance entry}
948 for a class that derives from or extends
949 \hypertarget{chap:DWATdatamemberlocationinheritedmemberlocation}
950 another class or struct also has
951 \addtoindexx{data member location attribute}
953 \livelink{chap:DWATdatamemberlocation}{DW\_AT\_data\_member\_location}
954 attribute, whose value describes the location of the beginning
955 of the inherited type relative to the beginning address of the
956 instance of the derived class. If that value is a constant, it is the offset
957 in bytes from the beginning of the class to the beginning of
958 the instance of the inherited type. Otherwise, the value must be a location
959 description. In this latter case, the beginning address of
960 the instance of the derived class is pushed on the expression stack before
961 the \addtoindex{location description}
962 is evaluated and the result of the
963 evaluation is the location of the instance of the inherited type.
965 \textit{The interpretation of the value of this attribute for
966 inherited types is the same as the interpretation for data
968 (see Section \referfol{chap:datamemberentries}). }
971 \addtoindexx{inheritance entry}
973 \hypertarget{chap:DWATaccessibilitycppinheritedmembers}
975 \addtoindexx{accessibility attribute}
977 \livelink{chap:DWATaccessibility}{DW\_AT\_accessibility}
979 If no accessibility attribute
980 is present, private access is assumed for an entry of a class
981 and public access is assumed for an entry of an interface,
985 \hypertarget{chap:DWATvirtualityvirtualityofbaseclass}
986 the class referenced by the
987 \addtoindexx{inheritance entry}
988 inheritance entry serves
989 as a \addtoindex{C++} virtual base class, the inheritance entry has a
990 \livelink{chap:DWATvirtuality}{DW\_AT\_virtuality} attribute.
992 \textit{For a \addtoindex{C++} virtual base, the
993 \addtoindex{data member location attribute}
994 will usually consist of a non-trivial
995 \addtoindex{location description}.}
997 \subsection{Access Declarations}
998 \label{chap:accessdeclarations}
1000 \textit{In \addtoindex{C++}, a derived class may contain access declarations that
1001 \addtoindexx{access declaration entry}
1002 change the accessibility of individual class members from the
1003 overall accessibility specified by the inheritance declaration.
1004 A single access declaration may refer to a set of overloaded
1007 If a derived class or structure contains access declarations,
1008 each such declaration may be represented by a debugging
1009 information entry with the tag
1010 \livetarg{chap:DWTAGaccessdeclaration}{DW\_TAG\_access\_declaration}.
1012 such entry is a child of the class or structure type entry.
1014 An access declaration entry has
1015 a \livelink{chap:DWATname}{DW\_AT\_name} attribute,
1016 \addtoindexx{name attribute}
1018 value is a null\dash terminated string representing the name used
1019 in the declaration in the source program, including any class
1020 or structure qualifiers.
1022 An access declaration entry
1023 \hypertarget{chap:DWATaccessibilitycppbaseclasses}
1026 \livelink{chap:DWATaccessibility}{DW\_AT\_accessibility}
1027 attribute describing the declared accessibility of the named
1032 \subsection{Friends}
1033 \label{chap:friends}
1035 Each \doublequote{friend}
1036 \addtoindexx{friend entry}
1037 declared by a structure, union or class
1038 \hypertarget{chap:DWATfriendfriendrelationship}
1039 type may be represented by a debugging information entry
1040 that is a child of the structure, union or class type entry;
1041 the friend entry has the
1042 tag \livetarg{chap:DWTAGfriend}{DW\_TAG\_friend}.
1045 \addtoindexx{friend attribute}
1046 a \livelink{chap:DWATfriend}{DW\_AT\_friend} attribute, whose value is
1047 a reference to the debugging information entry describing
1048 the declaration of the friend.
1051 \subsection{Data Member Entries}
1052 \label{chap:datamemberentries}
1054 A data member (as opposed to a member function) is
1055 represented by a debugging information entry with the
1056 tag \livetarg{chap:DWTAGmember}{DW\_TAG\_member}.
1058 \addtoindexx{member entry (data)}
1059 member entry for a named member has
1060 a \livelink{chap:DWATname}{DW\_AT\_name} attribute
1061 \addtoindexx{name attribute}
1062 whose value is a null\dash terminated
1063 string containing the member name as it appears in the source
1064 program. If the member entry describes an
1065 \addtoindex{anonymous union},
1066 the name attribute is omitted or the value of the attribute
1067 consists of a single zero byte.
1069 The data member entry has
1070 \addtoindexx{type attribute}
1072 \livelink{chap:DWATtype}{DW\_AT\_type} attribute to denote
1073 \addtoindexx{member entry (data)}
1074 the type of that member.
1076 A data member entry may
1077 \addtoindexx{accessibility attribute}
1079 \livelink{chap:DWATaccessibility}{DW\_AT\_accessibility}
1080 attribute. If no accessibility attribute is present, private
1081 access is assumed for an entry of a class and public access
1082 is assumed for an entry of a structure, union, or interface.
1085 \hypertarget{chap:DWATmutablemutablepropertyofmemberdata}
1087 \addtoindexx{member entry (data)}
1089 \addtoindexx{mutable attribute}
1090 have a \livelink{chap:DWATmutable}{DW\_AT\_mutable} attribute,
1091 which is a \livelink{chap:classflag}{flag}.
1092 This attribute indicates whether the data
1093 member was declared with the mutable storage class specifier.
1095 The beginning of a data member
1096 \addtoindexx{beginning of a data member}
1097 is described relative to
1098 \addtoindexx{beginning of an object}
1099 the beginning of the object in which it is immediately
1100 contained. In general, the beginning is characterized by
1101 both an address and a bit offset within the byte at that
1102 address. When the storage for an entity includes all of
1103 the bits in the beginning byte, the beginning bit offset is
1106 Bit offsets in DWARF use the bit numbering and direction
1107 conventions that are appropriate to the current language on
1111 \addtoindexx{member entry (data)}
1112 corresponding to a data member that is
1113 \hypertarget{chap:DWATdatabitoffsetdatamemberbitlocation}
1115 \hypertarget{chap:DWATdatamemberlocationdatamemberlocation}
1116 in a structure, union or class may have either
1117 \addtoindexx{data member location attribute}
1119 \livelink{chap:DWATdatamemberlocation}{DW\_AT\_data\_member\_location} attribute or a
1120 \livelink{chap:DWATdatabitoffset}{DW\_AT\_data\_bit\_offset}
1121 attribute. If the beginning of the data member is the same as
1122 the beginning of the containing entity then neither attribute
1126 For a \livelink{chap:DWATdatamemberlocation}{DW\_AT\_data\_member\_location} attribute
1127 \addtoindexx{data member location attribute}
1128 there are two cases:
1129 \begin{enumerate}[1. ]
1130 \item If the value is an \livelink{chap:classconstant}{integer constant},
1132 in bytes from the beginning of the containing entity. If
1133 the beginning of the containing entity has a non-zero bit
1134 offset then the beginning of the member entry has that same
1137 \item Otherwise, the value must be a \addtoindex{location description}.
1139 this case, the beginning of the containing entity must be byte
1140 aligned. The beginning address is pushed on the DWARF stack
1141 before the \addtoindex{location} description is evaluated; the result of
1142 the evaluation is the base address of the member entry.
1144 \textit{The push on the DWARF expression stack of the base address of
1145 the containing construct is equivalent to execution of the
1146 \livelink{chap:DWOPpushobjectaddress}{DW\_OP\_push\_object\_address} operation
1147 (see Section \refersec{chap:stackoperations});
1148 \livelink{chap:DWOPpushobjectaddress}{DW\_OP\_push\_object\_address} therefore
1149 is not needed at the
1150 beginning of a \addtoindex{location description} for a data member.
1152 result of the evaluation is a location---either an address or
1153 the name of a register, not an offset to the member.}
1155 \textit{A \livelink{chap:DWATdatamemberlocation}{DW\_AT\_data\_member\_location}
1157 \addtoindexx{data member location attribute}
1158 that has the form of a
1159 \addtoindex{location description} is not valid for a data member contained
1160 in an entity that is not byte aligned because DWARF operations
1161 do not allow for manipulating or computing bit offsets.}
1165 For a \livelink{chap:DWATdatabitoffset}{DW\_AT\_data\_bit\_offset} attribute,
1166 the value is an \livelink{chap:classconstant}{integer constant}
1167 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1168 that specifies the number of bits
1169 from the beginning of the containing entity to the beginning
1170 of the data member. This value must be greater than or equal
1171 to zero, but is not limited to less than the number of bits
1174 If the size of a data member is not the same as the size
1175 of the type given for the data member, the data member has
1176 \addtoindexx{bit size attribute}
1177 either a \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size}
1178 or a \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} attribute whose
1179 \livelink{chap:classconstant}{integer constant} value
1180 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1182 of storage needed to hold the value of the data member.
1184 \textit{Bit fields in \addtoindex{C} and \addtoindex{C++}
1186 \addtoindexx{bit fields}
1188 \addtoindexx{data bit offset}
1190 \addtoindexx{data bit size}
1192 \livelink{chap:DWATdatabitoffset}{DW\_AT\_data\_bit\_offset} and
1193 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} attributes.}
1196 \textit{This Standard uses the following bit numbering and direction
1197 conventions in examples. These conventions are for illustrative
1198 purposes and other conventions may apply on particular
1201 \item \textit{For big\dash endian architectures, bit offsets are
1202 counted from high-order to low\dash order bits within a byte (or
1203 larger storage unit); in this case, the bit offset identifies
1204 the high\dash order bit of the object.}
1206 \item \textit{For little\dash endian architectures, bit offsets are
1207 counted from low\dash order to high\dash order bits within a byte (or
1208 larger storage unit); in this case, the bit offset identifies
1209 the low\dash order bit of the object.}
1213 \textit{In either case, the bit so identified is defined as the
1214 \addtoindexx{beginning of an object}
1215 beginning of the object.}
1217 \textit{For example, take one possible representation of the following
1218 \addtoindex{C} structure definition
1219 in both big\dash and little\dash endian byte orders:}
1230 \textit{Figures \referfol{fig:bigendiandatabitoffsets} and
1231 \refersec{fig:littleendiandatabitoffsets}
1232 show the structure layout
1233 and data bit offsets for example big\dash\ and little\dash endian
1234 architectures, respectively. Both diagrams show a structure
1235 that begins at address A and whose size is four bytes. Also,
1236 high order bits are to the left and low order bits are to
1248 Addresses increase ->
1249 | A | A + 1 | A + 2 | A + 3 |
1251 Data bit offsets increase ->
1252 +---------------+---------------+---------------+---------------+
1253 |0 4|5 10|11 15|16 23|24 31|
1254 | j | k | m | n | <pad> |
1256 +---------------------------------------------------------------+
1260 \caption{Big-endian data bit offsets}
1261 \label{fig:bigendiandatabitoffsets}
1272 <- Addresses increase
1273 | A + 3 | A + 2 | A + 1 | A |
1275 <- Data bit offsets increase
1276 +---------------+---------------+---------------+---------------+
1277 |31 24|23 16|15 11|10 5|4 0|
1278 | <pad> | n | m | k | j |
1280 +---------------------------------------------------------------+
1284 \caption{Little-endian data bit offsets}
1285 \label{fig:littleendiandatabitoffsets}
1288 \textit{Note that data member bit offsets in this example are the
1289 same for both big\dash\ and little\dash endian architectures even
1290 though the fields are allocated in different directions
1291 (high\dash order to low-order versus low\dash order to high\dash order);
1292 the bit naming conventions for memory and/or registers of
1293 the target architecture may or may not make this seem natural.}
1295 \textit{For a more extensive example showing nested and packed records
1297 Appendix \refersec{app:pascalexample}.}
1299 \textit{Attribute \livelink{chap:DWATdatabitoffset}{DW\_AT\_data\_bit\_offset}
1301 \addtoindex{DWARF Version 4}, unchanged in \addtoindex{DWARF Version 5},
1302 and is also used for base types
1304 \refersec{chap:basetypeentries}).
1306 \livetarg{chap:DWATbitoffsetdatamemberbitlocation}{}
1307 attributes \livelink{chap:DWATbitoffset}{DW\_AT\_bit\_offset} and
1308 \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size} when used to
1309 identify the beginning of bit field data members as defined
1310 in DWARF V3 and earlier. The \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size},
1311 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} and
1312 \livelink{chap:DWATbitoffset}{DW\_AT\_bit\_offset}
1313 attribute combination is deprecated for data members in DWARF
1314 Version 4 and later. See Section 5.6.6 in the DWARF Version 4
1315 specification for a discussion of compatibility considerations.}
1317 \subsection{Member Function Entries}
1318 \label{chap:memberfunctionentries}
1320 A member function is represented by a
1321 \addtoindexx{member function entry}
1322 debugging information entry
1324 \addtoindexx{subprogram entry!as member function}
1325 tag \livelink{chap:DWTAGsubprogram}{DW\_TAG\_subprogram}.
1326 The member function entry
1327 may contain the same attributes and follows the same rules
1328 as non\dash member global subroutine entries
1329 (see Section \refersec{chap:subroutineandentrypointentries}).
1332 \addtoindexx{accessibility attribute}
1333 member function entry may have a
1334 \livelink{chap:DWATaccessibility}{DW\_AT\_accessibility}
1335 attribute. If no accessibility attribute is present, private
1336 access is assumed for an entry of a class and public access
1337 is assumed for an entry of a structure, union or interface.
1340 \hypertarget{chap:DWATvirtualityvirtualityoffunction}
1341 the member function entry describes a virtual function,
1342 then that entry has a
1343 \livelink{chap:DWATvirtuality}{DW\_AT\_virtuality} attribute.
1346 \hypertarget{chap:DWATexplicitexplicitpropertyofmemberfunction}
1347 the member function entry describes an explicit member
1348 function, then that entry has
1349 \addtoindexx{explicit attribute}
1351 \livelink{chap:DWATexplicit}{DW\_AT\_explicit} attribute.
1354 \hypertarget{chap:DWATvtableelemlocationvirtualfunctiontablevtableslot}
1355 entry for a virtual function also has a
1356 \livelink{chap:DWATvtableelemlocation}{DW\_AT\_vtable\_elem\_location}
1357 \addtoindexi{attribute}{vtable element location attribute} whose value contains
1358 a \addtoindex{location description}
1359 yielding the address of the slot
1360 for the function within the virtual function table for the
1361 enclosing class. The address of an object of the enclosing
1362 type is pushed onto the expression stack before the location
1363 description is evaluated.
1366 \hypertarget{chap:DWATobjectpointerobjectthisselfpointerofmemberfunction}
1367 the member function entry describes a non\dash static member
1368 \addtoindexx{this pointer attribute|see{object pointer attribute}}
1369 function, then that entry
1370 \addtoindexx{self pointer attribute|see{object pointer attribute}}
1372 \addtoindexx{object pointer attribute}
1373 a \livelink{chap:DWATobjectpointer}{DW\_AT\_object\_pointer}
1375 whose value is a \livelink{chap:classreference}{reference}
1376 to the formal parameter entry
1377 that corresponds to the object for which the function is
1378 called. The name attribute of that formal parameter is defined
1379 by the current language (for example,
1380 \texttt{this} for \addtoindex{C++} or \texttt{self}
1381 for \addtoindex{Objective C}
1382 and some other languages). That parameter
1383 also has a \livelink{chap:DWATartificial}{DW\_AT\_artificial} attribute whose value is true.
1385 Conversely, if the member function entry describes a static
1386 member function, the entry does not have
1387 \addtoindexx{object pointer attribute}
1389 \livelink{chap:DWATobjectpointer}{DW\_AT\_object\_pointer}
1392 If the member function entry describes a non\dash static member
1393 function that has a const\dash volatile qualification, then
1394 the entry describes a non\dash static member function whose
1395 object formal parameter has a type that has an equivalent
1396 const\dash volatile qualification.
1398 If a subroutine entry represents the defining declaration
1399 of a member function and that definition appears outside of
1400 the body of the enclosing class declaration, the subroutine
1402 \livelink{chap:DWATspecification}{DW\_AT\_specification} attribute,
1403 \addtoindexx{specification attribute}
1405 a reference to the debugging information entry representing
1406 the declaration of this function member. The referenced entry
1407 will be a child of some class (or structure) type entry.
1409 Subroutine entries containing the
1410 \livelink{chap:DWATspecification}{DW\_AT\_specification} attribute
1411 \addtoindexx{specification attribute}
1412 do not need to duplicate information provided
1413 by the declaration entry referenced by the specification
1414 attribute. In particular, such entries do not need to contain
1415 attributes for the name or return type of the function member
1416 whose definition they represent.
1419 \subsection{Class Template Instantiations}
1420 \label{chap:classtemplateinstantiations}
1422 \textit{In \addtoindex{C++} a class template is a generic definition of a class
1423 type that may be instantiated when an instance of the class
1424 is declared or defined. The generic description of the
1425 class may include both parameterized types and parameterized
1426 constant values. DWARF does not represent the generic template
1427 definition, but does represent each instantiation.}
1429 A class template instantiation is represented by a
1430 debugging information entry with the tag \livelink{chap:DWTAGclasstype}{DW\_TAG\_class\_type},
1431 \livelink{chap:DWTAGstructuretype}{DW\_TAG\_structure\_type} or
1432 \livelink{chap:DWTAGuniontype}{DW\_TAG\_union\_type}. With five
1433 exceptions, such an entry will contain the same attributes
1434 and have the same types of child entries as would an entry
1435 for a class type defined explicitly using the instantiation
1436 types and values. The exceptions are:
1438 \begin{enumerate}[1. ]
1439 \item Each formal parameterized type declaration appearing in the
1440 template definition is represented by a debugging information
1442 \livelink{chap:DWTAGtemplatetypeparameter}{DW\_TAG\_template\_type\_parameter}. Each
1443 such entry may have a \livelink{chap:DWATname}{DW\_AT\_name} attribute,
1444 \addtoindexx{name attribute}
1446 a null\dash terminated string containing the name of the formal
1447 type parameter as it appears in the source program. The
1448 template type parameter entry also has
1449 \addtoindexx{type attribute}
1451 \livelink{chap:DWATtype}{DW\_AT\_type} attribute
1452 describing the actual type by which the formal is replaced
1453 for this instantiation.
1455 \item Each formal parameterized value declaration appearing in the
1456 template definition is represented by a
1457 debugging information entry with the
1458 \addtoindexx{template value parameter entry}
1459 tag \livetarg{chap:DWTAGtemplatevalueparameter}{DW\_TAG\_template\_value\_parameter}.
1461 such entry may have a
1462 \livelink{chap:DWATname}{DW\_AT\_name} attribute,
1463 \addtoindexx{name attribute}
1465 a null\dash terminated string containing the name of the formal
1466 value parameter as it appears in the source program.
1468 \hypertarget{chap:DWATconstvaluetemplatevalueparameter}
1469 template value parameter entry
1470 \addtoindexx{template value parameter entry}
1472 \addtoindexx{type attribute}
1474 \livelink{chap:DWATtype}{DW\_AT\_type} attribute
1475 describing the type of the parameterized value. Finally,
1476 the template value parameter entry has a
1477 \livelink{chap:DWATconstvalue}{DW\_AT\_const\_value}
1478 attribute, whose value is the actual constant value of the
1479 value parameter for this instantiation as represented on the
1480 target architecture.
1483 \item The class type entry and each of its child entries reference
1484 a \addtoindex{template type parameter entry} in any circumstance where the
1485 source template definition references a formal parameterized
1487 Similarly, the class type entry and each of its child
1488 entries reference a template value parameter entry in any
1489 circumstance where the source template definition references
1490 a formal parameterized value.
1493 \item If the compiler has generated a special compilation unit to
1495 \addtoindexx{template instantiation!and special compilation unit}
1496 template instantiation and that special compilation
1497 unit has a different name from the compilation unit containing
1498 the template definition, the name attribute for the debugging
1499 information entry representing the special compilation unit
1500 should be empty or omitted.
1503 \item If the class type entry representing the template
1504 instantiation or any of its child entries contains declaration
1505 coordinate attributes, those attributes should refer to
1506 the source for the template definition, not to any source
1507 generated artificially by the compiler.
1511 \subsection{Variant Entries}
1512 \label{chap:variantentries}
1514 A variant part of a structure is represented by a debugging
1515 information entry\addtoindexx{variant part entry} with the
1516 tag \livetarg{chap:DWTAGvariantpart}{DW\_TAG\_variant\_part} and is
1517 owned by the corresponding structure type entry.
1519 If the variant part has a discriminant, the discriminant is
1520 \hypertarget{chap:DWATdiscrdiscriminantofvariantpart}
1522 \addtoindexx{discriminant (entry)}
1523 separate debugging information entry which
1524 is a child of the variant part entry. This entry has the form
1526 \addtoindexx{member entry (data)!as discriminant}
1527 structure data member entry. The variant part entry will
1528 \addtoindexx{discriminant attribute}
1530 \livelink{chap:DWATdiscr}{DW\_AT\_discr} attribute
1531 whose value is a \livelink{chap:classreference}{reference} to
1532 the member entry for the discriminant.
1534 If the variant part does not have a discriminant (tag field),
1535 the variant part entry has
1536 \addtoindexx{type attribute}
1538 \livelink{chap:DWATtype}{DW\_AT\_type} attribute to represent
1541 Each variant of a particular variant part is represented by
1542 \hypertarget{chap:DWATdiscrvaluediscriminantvalue}
1543 a debugging information entry\addtoindexx{variant entry} with the
1544 tag \livetarg{chap:DWTAGvariant}{DW\_TAG\_variant}
1545 and is a child of the variant part entry. The value that
1546 selects a given variant may be represented in one of three
1547 ways. The variant entry may have a
1548 \livelink{chap:DWATdiscrvalue}{DW\_AT\_discr\_value} attribute
1549 whose value represents a single case label. The value of this
1550 attribute is encoded as an LEB128 number. The number is signed
1551 if the tag type for the variant part containing this variant
1552 is a signed type. The number is unsigned if the tag type is
1557 \hypertarget{chap:DWATdiscrlistlistofdiscriminantvalues}
1558 the variant entry may contain
1559 \addtoindexx{discriminant list attribute}
1561 \livelink{chap:DWATdiscrlist}{DW\_AT\_discr\_list}
1562 attribute, whose value represents a list of discriminant
1563 values. This list is represented by any of the
1564 \livelink{chap:classblock}{block} forms and
1565 may contain a mixture of case labels and label ranges. Each
1566 item on the list is prefixed with a discriminant value
1567 descriptor that determines whether the list item represents
1568 a single label or a label range. A single case label is
1569 represented as an LEB128 number as defined above for
1570 \addtoindexx{discriminant value attribute}
1572 \livelink{chap:DWATdiscrvalue}{DW\_AT\_discr\_value}
1573 attribute. A label range is represented by
1574 two LEB128 numbers, the low value of the range followed by the
1575 high value. Both values follow the rules for signedness just
1576 described. The discriminant value descriptor is an integer
1577 constant that may have one of the values given in
1578 Table \refersec{tab:discriminantdescriptorvalues}.
1580 \begin{simplenametable}[1.4in]{Discriminant descriptor values}{tab:discriminantdescriptorvalues}
1581 \livetarg{chap:DWDSClabel}{DW\_DSC\_label} \\
1582 \livetarg{chap:DWDSCrange}{DW\_DSC\_range} \\
1583 \end{simplenametable}
1585 If a variant entry has neither a \livelink{chap:DWATdiscrvalue}{DW\_AT\_discr\_value}
1586 attribute nor a \livelink{chap:DWATdiscrlist}{DW\_AT\_discr\_list} attribute, or if it has
1587 a \livelink{chap:DWATdiscrlist}{DW\_AT\_discr\_list} attribute with 0 size, the variant is a
1590 The components selected by a particular variant are represented
1591 by debugging information entries owned by the corresponding
1592 variant entry and appear in the same order as the corresponding
1593 declarations in the source program.
1595 \section{Condition Entries}
1596 \label{chap:conditionentries}
1598 \textit{COBOL has the notion of
1599 \addtoindexx{level-88 condition, COBOL}
1600 a \doublequote{level\dash 88 condition} that
1601 associates a data item, called the conditional variable, with
1602 a set of one or more constant values and/or value ranges.
1603 % Note: the {} after \textquoteright (twice) is necessary to assure a following space separator
1604 Semantically, the condition is \textquoteleft true\textquoteright{}
1606 variable's value matches any of the described constants,
1607 and the condition is \textquoteleft false\textquoteright{} otherwise.}
1609 The \livetarg{chap:DWTAGcondition}{DW\_TAG\_condition}
1610 debugging information entry\addtoindexx{condition entry}
1612 logical condition that tests whether a given data item\textquoteright s
1613 value matches one of a set of constant values. If a name
1614 has been given to the condition, the condition entry has a
1615 \livelink{chap:DWATname}{DW\_AT\_name} attribute
1616 \addtoindexx{name attribute}
1617 whose value is a null\dash terminated string
1618 giving the condition name as it appears in the source program.
1620 The condition entry's parent entry describes the conditional
1621 variable; normally this will be a \livelink{chap:DWTAGvariable}{DW\_TAG\_variable},
1622 \livelink{chap:DWTAGmember}{DW\_TAG\_member} or
1623 \livelink{chap:DWTAGformalparameter}{DW\_TAG\_formal\_parameter} entry.
1625 \addtoindexx{formal parameter entry}
1627 entry has an array type, the condition can test any individual
1628 element, but not the array as a whole. The condition entry
1629 implicitly specifies a \doublequote{comparison type} that is the
1630 type of an array element if the parent has an array type;
1631 otherwise it is the type of the parent entry.
1634 The condition entry owns \livelink{chap:DWTAGconstant}{DW\_TAG\_constant} and/or
1635 \livelink{chap:DWTAGsubrangetype}{DW\_TAG\_subrange\_type} entries that describe the constant
1636 values associated with the condition. If any child entry
1637 \addtoindexx{type attribute}
1639 a \livelink{chap:DWATtype}{DW\_AT\_type} attribute,
1640 that attribute should describe a type
1641 compatible with the comparison type (according to the source
1642 language); otherwise the child\textquoteright s type is the same as the
1645 \textit{For conditional variables with alphanumeric types, COBOL
1646 permits a source program to provide ranges of alphanumeric
1647 constants in the condition. Normally a subrange type entry
1648 does not describe ranges of strings; however, this can be
1649 represented using bounds attributes that are references to
1650 constant entries describing strings. A subrange type entry may
1651 refer to constant entries that are siblings of the subrange
1655 \section{Enumeration Type Entries}
1656 \label{chap:enumerationtypeentries}
1658 \textit{An \doublequote{enumeration type} is a scalar that can assume one of
1659 a fixed number of symbolic values.}
1661 An enumeration type is represented by a debugging information
1663 \livetarg{chap:DWTAGenumerationtype}{DW\_TAG\_enumeration\_type}.
1665 If a name has been given to the enumeration type in the source
1666 program, then the corresponding enumeration type entry has
1667 a \livelink{chap:DWATname}{DW\_AT\_name} attribute
1668 \addtoindexx{name attribute}
1669 whose value is a null\dash terminated
1670 string containing the enumeration type name as it appears
1671 in the source program. This entry also has a
1672 \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size}
1673 attribute whose \livelink{chap:classconstant}{integer constant}
1674 value is the number of bytes
1675 required to hold an instance of the enumeration.
1677 The \addtoindex{enumeration type entry}
1679 \addtoindexx{type attribute}
1680 a \livelink{chap:DWATtype}{DW\_AT\_type} attribute
1681 which refers to the underlying data type used to implement
1684 If an enumeration type has type safe
1685 \addtoindexx{type safe enumeration types}
1688 \begin{enumerate}[1. ]
1689 \item Enumerators are contained in the scope of the enumeration type, and/or
1691 \item Enumerators are not implicitly converted to another type
1694 then the \addtoindex{enumeration type entry} may
1695 \addtoindexx{enum class|see{type-safe enumeration}}
1696 have a \livelink{chap:DWATenumclass}{DW\_AT\_enum\_class}
1697 attribute, which is a \livelink{chap:classflag}{flag}.
1698 In a language that offers only
1699 one kind of enumeration declaration, this attribute is not
1702 \textit{In \addtoindex{C} or \addtoindex{C++},
1703 the underlying type will be the appropriate
1704 integral type determined by the compiler from the properties of
1705 \hypertarget{chap:DWATenumclasstypesafeenumerationdefinition}
1706 the enumeration literal values.
1707 A \addtoindex{C++} type declaration written
1708 using enum class declares a strongly typed enumeration and
1709 is represented using \livelink{chap:DWTAGenumerationtype}{DW\_TAG\_enumeration\_type}
1710 in combination with \livelink{chap:DWATenumclass}{DW\_AT\_enum\_class}.}
1712 Each enumeration literal is represented by a debugging
1713 \addtoindexx{enumeration literal|see{enumeration entry}}
1714 information entry with the
1715 tag \livetarg{chap:DWTAGenumerator}{DW\_TAG\_enumerator}.
1717 such entry is a child of the
1718 \addtoindex{enumeration type entry}, and the
1719 enumerator entries appear in the same order as the declarations
1720 of the enumeration literals in the source program.
1722 Each \addtoindex{enumerator entry} has a
1723 \livelink{chap:DWATname}{DW\_AT\_name} attribute, whose
1724 \addtoindexx{name attribute}
1725 value is a null\dash terminated string containing the name of the
1726 \hypertarget{chap:DWATconstvalueenumerationliteralvalue}
1727 enumeration literal as it appears in the source program.
1728 Each enumerator entry also has a
1729 \livelink{chap:DWATconstvalue}{DW\_AT\_const\_value} attribute,
1730 whose value is the actual numeric value of the enumerator as
1731 represented on the target system.
1734 If the enumeration type occurs as the description of a
1735 \addtoindexx{enumeration type endry!as array dimension}
1736 dimension of an array type, and the stride for that dimension
1737 \hypertarget{chap:DWATbytestrideenumerationstridedimensionofarraytype}
1738 is different than what would otherwise be determined, then
1739 \hypertarget{chap:DWATbitstrideenumerationstridedimensionofarraytype}
1740 the enumeration type entry has either a
1741 \livelink{chap:DWATbytestride}{DW\_AT\_byte\_stride}
1742 or \livelink{chap:DWATbitstride}{DW\_AT\_bit\_stride} attribute
1743 \addtoindexx{bit stride attribute}
1744 which specifies the separation
1745 between successive elements along the dimension as described
1747 Section \refersec{chap:staticanddynamicvaluesofattributes}.
1749 \livelink{chap:DWATbitstride}{DW\_AT\_bit\_stride} attribute
1750 \addtoindexx{bit stride attribute}
1751 is interpreted as bits and the value of
1752 \addtoindexx{byte stride attribute}
1754 \livelink{chap:DWATbytestride}{DW\_AT\_byte\_stride}
1755 attribute is interpreted as bytes.
1758 \section{Subroutine Type Entries}
1759 \label{chap:subroutinetypeentries}
1761 \textit{It is possible in \addtoindex{C}
1762 to declare pointers to subroutines
1763 that return a value of a specific type. In both
1764 \addtoindex{C} and \addtoindex{C++},
1765 it is possible to declare pointers to subroutines that not
1766 only return a value of a specific type, but accept only
1767 arguments of specific types. The type of such pointers would
1768 be described with a \doublequote{pointer to} modifier applied to a
1769 user\dash defined type.}
1771 A subroutine type is represented by a debugging information
1773 \addtoindexx{subroutine type entry}
1774 tag \livetarg{chap:DWTAGsubroutinetype}{DW\_TAG\_subroutine\_type}.
1776 been given to the subroutine type in the source program,
1777 then the corresponding subroutine type entry has
1778 a \livelink{chap:DWATname}{DW\_AT\_name} attribute
1779 \addtoindexx{name attribute}
1780 whose value is a null\dash terminated string containing
1781 the subroutine type name as it appears in the source program.
1783 If the subroutine type describes a function that returns
1784 a value, then the subroutine type entry has
1785 \addtoindexx{type attribute}
1786 a \livelink{chap:DWATtype}{DW\_AT\_type}
1787 attribute to denote the type returned by the subroutine. If
1788 the types of the arguments are necessary to describe the
1789 subroutine type, then the corresponding subroutine type
1790 entry owns debugging information entries that describe the
1791 arguments. These debugging information entries appear in the
1792 order that the corresponding argument types appear in the
1795 \textit{In \addtoindex{C} there
1796 is a difference between the types of functions
1797 declared using function prototype style declarations and
1798 those declared using non\dash prototype declarations.}
1801 \hypertarget{chap:DWATprototypedsubroutineprototype}
1802 subroutine entry declared with a function prototype style
1803 declaration may have
1804 \addtoindexx{prototyped attribute}
1806 \livelink{chap:DWATprototyped}{DW\_AT\_prototyped} attribute, which is
1807 a \livelink{chap:classflag}{flag}.
1809 Each debugging information entry owned by a subroutine
1810 type entry corresponds to either a formal parameter or the sequence of
1811 unspecified parameters of the subprogram type:
1813 \begin{enumerate}[1. ]
1814 \item A formal parameter of a parameter list (that has a
1815 specific type) is represented by a debugging information entry
1816 with the tag \livelink{chap:DWTAGformalparameter}{DW\_TAG\_formal\_parameter}.
1817 Each formal parameter
1819 \addtoindexx{type attribute}
1820 a \livelink{chap:DWATtype}{DW\_AT\_type} attribute that refers to the type of
1821 the formal parameter.
1823 \item The unspecified parameters of a variable parameter list
1824 \addtoindexx{unspecified parameters entry}
1826 \addtoindexx{\texttt{...} parameters|see{unspecified parameters entry}}
1827 represented by a debugging information entry with the
1828 tag \livelink{chap:DWTAGunspecifiedparameters}{DW\_TAG\_unspecified\_parameters}.
1833 \section{String Type Entries}
1834 \label{chap:stringtypeentries}
1836 \textit{A \doublequote{string} is a sequence of characters that have specific
1837 \addtoindexx{string type entry}
1838 semantics and operations that distinguish them from arrays of
1840 \addtoindex{Fortran} is one of the languages that has a string
1841 type. Note that \doublequote{string} in this context refers to a target
1842 machine concept, not the class string as used in this document
1843 (except for the name attribute).}
1845 A string type is represented by a debugging information entry
1846 with the tag \livetarg{chap:DWTAGstringtype}{DW\_TAG\_string\_type}.
1847 If a name has been given to
1848 the string type in the source program, then the corresponding
1849 string type entry has a
1850 \livelink{chap:DWATname}{DW\_AT\_name} attribute
1851 \addtoindexx{name attribute}
1853 a null\dash terminated string containing the string type name as
1854 it appears in the source program.
1857 The string type entry may have a
1858 \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size} attribute or
1859 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size}
1860 attribute, whose value
1861 (see Section \refersec{chap:byteandbitsizes})
1863 storage needed to hold a value of the string type.
1867 \hypertarget{chap:DWATstringlengthstringlengthofstringtype}
1868 string type entry may also have a
1869 \livelink{chap:DWATstringlength}{DW\_AT\_string\_length} attribute
1871 \addtoindexx{string length attribute}
1873 \addtoindex{location description} yielding the location
1874 where the length of the string is stored in the program.
1875 If the \DWATstringlength{} attribute is not present, the size
1876 of the string is assumed to be the amount of storage that is
1877 allocated for the string (as specified by the \DWATbytesize{}
1878 or \DWATbitsize{} attribute).
1880 The string type entry may also have a
1881 \livetarg{chap:DWATstringlengthbytesize}{DW\_AT\_string\_length\_byte\_size}
1883 \livetarg{chap:DWATstringlengthbitsize}{DW\_AT\_string\_length\_bit\_size} attribute,
1884 \addtoindexx{string length attribute!size of length data}
1885 whose value (see Section \refersec{chap:byteandbitsizes})
1886 is the size of the data to be retrieved from the location
1887 referenced by the string length attribute. If no (byte or bit)
1888 size attribute is present, the size of the data to be retrieved
1890 \addtoindex{size of an address} on the target machine.
1892 \addtoindexx{DWARF Version 5} % Avoid italics
1893 \textit{Prior to DWARF Version 5, the meaning of a
1894 \DWATbytesize{} attribute depends on the presence of the
1895 \DWATstringlength{} attribute:
1897 \item If \DWATstringlength{} is present, \DWATbytesize{}
1898 specifies the size of the length data to be retrieved
1899 from the location specified by the \DWATstringlength{} attribute.
1900 \item If \DWATstringlength{} is not present, \DWATbytesize{}
1901 specifies the amount of storage allocated for objects
1904 In DWARF Version 5, \DWATbytesize{} always specifies the amount of storage
1905 allocated for objects of the string type.}
1907 \section{Set Type Entries}
1908 \label{chap:settypeentries}
1910 \textit{\addtoindex{Pascal} provides the concept of a \doublequote{set,} which represents
1911 a group of values of ordinal type.}
1913 A set is represented by a debugging information entry with
1914 the tag \livetarg{chap:DWTAGsettype}{DW\_TAG\_set\_type}.
1915 \addtoindexx{set type entry}
1916 If a name has been given to the
1917 set type, then the set type entry has
1918 a \livelink{chap:DWATname}{DW\_AT\_name} attribute
1919 \addtoindexx{name attribute}
1920 whose value is a null\dash terminated string containing the
1921 set type name as it appears in the source program.
1923 The set type entry has
1924 \addtoindexx{type attribute}
1925 a \livelink{chap:DWATtype}{DW\_AT\_type} attribute to denote the
1926 type of an element of the set.
1929 If the amount of storage allocated to hold each element of an
1930 object of the given set type is different from the amount of
1931 storage that is normally allocated to hold an individual object
1932 of the indicated element type, then the set type entry has
1933 either a \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size} attribute, or
1934 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} attribute
1935 whose value (see Section \refersec{chap:byteandbitsizes}) is
1936 the amount of storage needed to hold a value of the set type.
1939 \section{Subrange Type Entries}
1940 \label{chap:subrangetypeentries}
1942 \textit{Several languages support the concept of a \doublequote{subrange}
1943 type object. These objects can represent a subset of the
1944 values that an object of the basis type for the subrange can
1946 Subrange type entries may also be used to represent
1947 the bounds of array dimensions.}
1949 A subrange type is represented by a debugging information
1951 \addtoindexx{subrange type entry}
1952 tag \livetarg{chap:DWTAGsubrangetype}{DW\_TAG\_subrange\_type}.
1954 given to the subrange type, then the subrange type entry
1955 has a \livelink{chap:DWATname}{DW\_AT\_name} attribute
1956 \addtoindexx{name attribute}
1957 whose value is a null\dash terminated
1958 string containing the subrange type name as it appears in
1962 \livelink{chap:DWTAGgenericsubrange}{DW\_TAG\_generic\_subrange} is
1963 used to describe arrays with a dynamic rank. See Section
1964 \ref{chap:DWTAGgenericsubrange}.
1966 The subrange entry may have
1967 \addtoindexx{type attribute}
1968 a \livelink{chap:DWATtype}{DW\_AT\_type} attribute to describe
1969 the type of object, called the basis type, of whose values
1970 this subrange is a subset.
1972 If the amount of storage allocated to hold each element of an
1973 object of the given subrange type is different from the amount
1974 of storage that is normally allocated to hold an individual
1975 object of the indicated element type, then the subrange
1977 \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size} attribute or
1978 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size}
1979 attribute, whose value
1980 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1982 storage needed to hold a value of the subrange type.
1985 \hypertarget{chap:DWATthreadsscaledupcarrayboundthreadsscalfactor}
1986 subrange entry may have
1987 \addtoindexx{threads scaled attribute}
1989 \livelink{chap:DWATthreadsscaled}{DW\_AT\_threads\_scaled} attribute,
1990 which is a \livelink{chap:classflag}{flag}.
1991 If present, this attribute indicates whether
1992 this subrange represents a \addtoindex{UPC} array bound which is scaled
1993 by the runtime THREADS value (the number of UPC threads in
1994 this execution of the program).
1996 \textit{This allows the representation of a \addtoindex{UPC} shared array such as}
1998 \begin{lstlisting}[numbers=none]
1999 int shared foo[34*THREADS][10][20];
2003 \hypertarget{chap:DWATlowerboundlowerboundofsubrange}
2005 \hypertarget{chap:DWATupperboundupperboundofsubrange}
2006 entry may have the attributes
2007 \livelink{chap:DWATlowerbound}{DW\_AT\_lower\_bound}
2008 \addtoindexx{lower bound attribute}
2009 and \livelink{chap:DWATupperbound}{DW\_AT\_upper\_bound}
2010 \addtoindexx{upper bound attribute} to specify, respectively, the lower
2011 and upper bound values of the subrange. The
2012 \livelink{chap:DWATupperbound}{DW\_AT\_upper\_bound}
2014 \hypertarget{chap:DWATcountelementsofsubrangetype}
2016 % FIXME: The following matches DWARF4: odd as there is no default count.
2017 \addtoindexx{count attribute!default}
2019 \addtoindexx{count attribute}
2021 \livelink{chap:DWATcount}{DW\_AT\_count} attribute,
2023 value describes the number of elements in the subrange rather
2024 than the value of the last element. The value of each of
2025 these attributes is determined as described in
2026 Section \refersec{chap:staticanddynamicvaluesofattributes}.
2028 If the lower bound value is missing, the value is assumed to
2029 be a language\dash dependent default constant.
2030 \addtoindexx{lower bound attribute!default}
2031 The default lower bound is 0 for
2032 \addtoindex{C}, \addtoindex{C++},
2035 \addtoindex{Haskell},
2037 \addtoindex{Objective C},
2038 \addtoindex{Objective C++},
2039 \addtoindex{OpenCL},
2040 \addtoindex{Python}, and
2042 The default lower bound is 1 for
2045 \addtoindex{Fortran},
2046 \addtoindex{Modula-2},
2047 \addtoindex{Modula-3},
2048 \addtoindex{Pascal} and
2051 \textit{No other default lower bound values are currently defined.}
2053 If the upper bound and count are missing, then the upper bound value is
2054 \textit{unknown}.\addtoindexx{upper bound attribute!default unknown}
2056 If the subrange entry has no type attribute describing the
2057 basis type, the basis type is determined as follows:
2058 \begin{enumerate}[1. ]
2060 If there is a lower bound attribute that references an object,
2061 the basis type is assumed to be the same as the type of that object.
2063 Otherwise, if there is an upper bound or count attribute that references
2064 an object, the basis type is assumed to be the same as the type of that object.
2066 Otherwise, the type is
2067 assumed to be the same type, in the source language of the
2068 compilation unit containing the subrange entry, as a signed
2069 integer with the same size as an address on the target machine.
2072 If the subrange type occurs as the description of a dimension
2073 of an array type, and the stride for that dimension is
2074 \hypertarget{chap:DWATbytestridesubrangestridedimensionofarraytype}
2075 different than what would otherwise be determined, then
2076 \hypertarget{chap:DWATbitstridesubrangestridedimensionofarraytype}
2077 the subrange type entry has either
2078 \addtoindexx{byte stride attribute}
2080 \livelink{chap:DWATbytestride}{DW\_AT\_byte\_stride} or
2081 \livelink{chap:DWATbitstride}{DW\_AT\_bit\_stride} attribute
2082 \addtoindexx{bit stride attribute}
2083 which specifies the separation
2084 between successive elements along the dimension as described
2086 Section \refersec{chap:byteandbitsizes}.
2088 \textit{Note that the stride can be negative.}
2090 \section{Pointer to Member Type Entries}
2091 \label{chap:pointertomembertypeentries}
2093 \textit{In \addtoindex{C++}, a
2094 pointer to a data or function member of a class or
2095 structure is a unique type.}
2097 A debugging information entry representing the type of an
2098 object that is a pointer to a structure or class member has
2099 the tag \livetarg{chap:DWTAGptrtomembertype}{DW\_TAG\_ptr\_to\_member\_type}.
2101 If the \addtoindex{pointer to member type} has a name, the
2102 \addtoindexx{pointer to member type entry}
2103 pointer to member entry has a
2104 \livelink{chap:DWATname}{DW\_AT\_name} attribute,
2105 \addtoindexx{name attribute}
2107 null\dash terminated string containing the type name as it appears
2108 in the source program.
2110 The \addtoindex{pointer to member} entry
2112 \addtoindexx{type attribute}
2113 a \livelink{chap:DWATtype}{DW\_AT\_type} attribute to
2114 describe the type of the class or structure member to which
2115 objects of this type may point.
2117 The \addtoindexx{pointer to member} entry also
2118 \hypertarget{chap:DWATcontainingtypecontainingtypeofpointertomembertype}
2120 \livelink{chap:DWATcontainingtype}{DW\_AT\_containing\_type}
2121 attribute, whose value is a \livelink{chap:classreference}{reference} to a debugging
2122 information entry for the class or structure to whose members
2123 objects of this type may point.
2125 The \addtoindex{pointer to member entry}
2126 \hypertarget{chap:DWATuselocationmemberlocationforpointertomembertype}
2128 \livelink{chap:DWATuselocation}{DW\_AT\_use\_location} attribute
2129 \addtoindexx{use location attribute}
2131 \addtoindex{location description} that computes the
2132 address of the member of the class to which the pointer to
2133 member entry points.
2135 \textit{The method used to find the address of a given member of a
2136 class or structure is common to any instance of that class
2137 or structure and to any instance of the pointer or member
2138 type. The method is thus associated with the type entry,
2139 rather than with each instance of the type.}
2141 The \livelink{chap:DWATuselocation}{DW\_AT\_use\_location} description is used in conjunction
2142 with the location descriptions for a particular object of the
2143 given \addtoindex{pointer to member type} and for a particular structure or
2144 class instance. The \livelink{chap:DWATuselocation}{DW\_AT\_use\_location}
2145 attribute expects two values to be
2146 \addtoindexi{pushed}{address!implicit push for member operator}
2147 onto the DWARF expression stack before
2148 the \livelink{chap:DWATuselocation}{DW\_AT\_use\_location} description is evaluated.
2150 \addtoindexi{pushed}{address!implicit push for member operator}
2151 is the value of the \addtoindex{pointer to member} object
2152 itself. The second value
2153 \addtoindexi{pushed}{address!implicit push for member operator}
2154 is the base address of the
2155 entire structure or union instance containing the member
2156 whose address is being calculated.
2159 \textit{For an expression such as}
2161 \begin{lstlisting}[numbers=none]
2164 \textit{where \texttt{mbr\_ptr} has some \addtoindex{pointer to member type}, a debugger should:}
2166 \item \textit{Push the value of \texttt{mbr\_ptr} onto the DWARF expression stack.}
2167 \item \textit{Push the base address of \texttt{object} onto the DWARF expression stack.}
2168 \item \textit{Evaluate the \livelink{chap:DWATuselocation}{DW\_AT\_use\_location} description
2169 given in the type of \texttt{mbr\_ptr}.}
2173 \section{File Type Entries}
2174 \label{chap:filetypeentries}
2176 \textit{Some languages, such as \addtoindex{Pascal},
2177 provide a data type to represent
2180 A file type is represented by a debugging information entry
2182 \addtoindexx{file type entry}
2184 \livetarg{chap:DWTAGfiletype}{DW\_TAG\_file\_type}.
2185 If the file type has a name,
2186 the file type entry has a \livelink{chap:DWATname}{DW\_AT\_name} attribute,
2187 \addtoindexx{name attribute}
2189 is a null\dash terminated string containing the type name as it
2190 appears in the source program.
2192 The file type entry has
2193 \addtoindexx{type attribute}
2194 a \livelink{chap:DWATtype}{DW\_AT\_type} attribute describing
2195 the type of the objects contained in the file.
2197 The file type entry also
2198 \addtoindexx{byte size}
2200 \addtoindexx{bit size}
2202 \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size} or
2203 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} attribute, whose value
2204 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
2205 is the amount of storage need to hold a value of the file type.
2207 \subsection{Dynamic Type Properties}
2208 \label{chap:dynamictypeproperties}
2209 \subsection{Data Location}
2210 \label{chap:datalocation}
2212 \textit{Some languages may represent objects using descriptors to hold
2213 information, including a location and/or run\dash time parameters,
2214 about the data that represents the value for that object.}
2216 \hypertarget{chap:DWATdatalocationindirectiontoactualdata}
2217 The \livelink{chap:DWATdatalocation}{DW\_AT\_data\_location}
2218 attribute may be used with any
2219 \addtoindexx{data location attribute}
2220 type that provides one or more levels of
2221 \addtoindexx{hidden indirection|see{data location attribute}}
2223 and/or run\dash time parameters in its representation. Its value
2224 is a \addtoindex{location description}.
2225 The result of evaluating this
2226 description yields the location of the data for an object.
2227 When this attribute is omitted, the address of the data is
2228 the same as the address of the object.
2231 \textit{This location description will typically begin with
2232 \livelink{chap:DWOPpushobjectaddress}{DW\_OP\_push\_object\_address}
2233 which loads the address of the
2234 object which can then serve as a descriptor in subsequent
2235 calculation. For an example using
2236 \livelink{chap:DWATdatalocation}{DW\_AT\_data\_location}
2237 for a \addtoindex{Fortran 90 array}, see
2238 Appendix \refersec{app:fortranarrayexample}.}
2240 \subsection{Allocation and Association Status}
2241 \label{chap:allocationandassociationstatus}
2243 \textit{Some languages, such as \addtoindex{Fortran 90},
2244 provide types whose values
2245 may be dynamically allocated or associated with a variable
2246 under explicit program control.}
2248 \hypertarget{chap:DWATallocatedallocationstatusoftypes}
2250 \livelink{chap:DWATallocated}{DW\_AT\_allocated}
2252 \addtoindexx{allocated attribute}
2253 may optionally be used with any
2254 type for which objects of the type can be explicitly allocated
2255 and deallocated. The presence of the attribute indicates that
2256 objects of the type are allocatable and deallocatable. The
2257 integer value of the attribute (see below) specifies whether
2258 an object of the type is
2259 currently allocated or not.
2261 \hypertarget{chap:DWATassociatedassociationstatusoftypes}
2263 \livelink{chap:DWATassociated}{DW\_AT\_associated} attribute
2265 \addtoindexx{associated attribute}
2266 optionally be used with
2267 any type for which objects of the type can be dynamically
2268 associated with other objects. The presence of the attribute
2269 indicates that objects of the type can be associated. The
2270 integer value of the attribute (see below) indicates whether
2271 an object of the type is currently associated or not.
2273 \textit{While these attributes are defined specifically with
2274 \addtoindex{Fortran 90} ALLOCATABLE and POINTER types
2275 in mind, usage is not limited
2276 to just that language.}
2278 The value of these attributes is determined as described in
2279 Section \refersec{chap:staticanddynamicvaluesofattributes}.
2281 A non\dash zero value is interpreted as allocated or associated,
2282 and zero is interpreted as not allocated or not associated.
2284 \textit{For \addtoindex{Fortran 90},
2285 if the \livelink{chap:DWATassociated}{DW\_AT\_associated}
2286 attribute is present,
2287 the type has the POINTER property where either the parent
2288 variable is never associated with a dynamic object or the
2289 implementation does not track whether the associated object
2290 is static or dynamic. If the \livelink{chap:DWATallocated}{DW\_AT\_allocated} attribute is
2291 present and the \livelink{chap:DWATassociated}{DW\_AT\_associated} attribute is not, the type
2292 has the ALLOCATABLE property. If both attributes are present,
2293 then the type should be assumed to have the POINTER property
2294 (and not ALLOCATABLE); the \livelink{chap:DWATallocated}{DW\_AT\_allocated} attribute may then
2295 be used to indicate that the association status of the object
2296 resulted from execution of an ALLOCATE statement rather than
2297 pointer assignment.}
2299 \textit{For examples using
2300 \livelink{chap:DWATallocated}{DW\_AT\_allocated} for \addtoindex{Ada} and
2301 \addtoindex{Fortran 90}
2303 see Appendix \refersec{app:aggregateexamples}.}
2305 \subsection{Array Rank}
2306 \label{chap:DWATrank}
2307 \textit{The Fortran language supports ``assumed-rank arrays''. The
2308 rank (the number of dimensions) of an assumed-rank array is unknown
2309 at compile time. The Fortran runtime stores the rank in the array
2310 descriptor metadata.}
2312 The presence of \DWATrank{} indicates that an array's rank
2313 (dimensionality) is dynamic, and therefore unknown at compile
2314 time. \DWATrank{} contains an expression that can be evaluated to look
2315 up the dynamic rank from the array descriptor.
2317 The dimensions of an array with dynamic rank are described using the
2318 \DWTAGgenericsubrange{} tag. The \DWTAGgenericsubrange{} tag is the
2319 dynamic rank array equivalent of
2320 \livelink{chap:DWTAGsubrangetype}{DW\_TAG\_subrange\_type}. The
2321 difference is that a \DWTAGgenericsubrange{} contains generic
2322 lower/upper bound and stride expressions that need to be evaluated for
2323 each dimension: Before any expression contained in a
2324 \DWTAGgenericsubrange{} can be evaluated, the dimension for which the
2325 expression should be evaluated needs to be pushed onto the stack. The
2326 expression will use it to find the offset of the respective field in
2327 the array descriptor metadata.
2329 \textit{The Fortran compiler is free to choose any layout for the
2330 array descriptor. In particular, the upper and lower bounds and
2331 stride values do not need to be bundled into a structure or record,
2332 but could be laid end to end in the containing descriptor, pointed
2333 to by the descriptor, or even allocated independently of the
2336 Dimensions are enumerated $0$ to $\mathit{rank}-1$ in a left-to-right
2339 \textit{For an example in Fortran 2008, see
2340 Section~\ref{app:assumedrankexample}.}
2343 \section{Template Alias Entries}
2344 \label{chap:templatealiasentries}
2346 A type named using a template alias is represented
2347 by a debugging information entry
2348 \addtoindexx{template alias entry}
2350 \livetarg{chap:DWTAGtemplatealias}{DW\_TAG\_template\_alias}.
2351 The template alias entry has a
2352 \livelink{chap:DWATname}{DW\_AT\_name} attribute
2353 \addtoindexx{name attribute}
2354 whose value is a null\dash terminated string
2355 containing the name of the template alias as it appears in
2356 the source program. The template alias entry also contains
2357 \addtoindexx{type attribute}
2359 \livelink{chap:DWATtype}{DW\_AT\_type} attribute
2360 whose value is a \livelink{chap:classreference}{reference}
2361 to the type named by the template alias.
2364 The template alias entry has the following child entries:
2365 \begin{enumerate}[1. ]
2366 \item Each formal parameterized type declaration appearing
2367 in the template alias declaration is represented
2368 by a debugging information entry with the tag
2369 \livelink{chap:DWTAGtemplatetypeparameter}{DW\_TAG\_template\_type\_parameter}.
2370 Each such entry may have
2371 a \livelink{chap:DWATname}{DW\_AT\_name} attribute,
2372 \addtoindexx{name attribute}
2373 whose value is a null\dash terminated
2374 string containing the name of the formal type parameter as it
2375 appears in the source program. The template type parameter
2377 \addtoindexx{type attribute}
2378 a \livelink{chap:DWATtype}{DW\_AT\_type} attribute
2379 describing the actual
2380 type by which the formal is replaced for this instantiation.
2382 \item Each formal parameterized value declaration
2383 appearing in the template alias declaration is
2384 represented by a debugging information entry with the tag
2385 \livelink{chap:DWTAGtemplatevalueparameter}{DW\_TAG\_template\_value\_parameter}.
2386 Each such entry may have
2387 a \livelink{chap:DWATname}{DW\_AT\_name} attribute,
2388 \addtoindexx{name attribute}
2389 whose value is a null\dash terminated
2390 string containing the name of the formal value parameter
2391 as it appears in the source program. The template value
2392 parameter entry also has
2393 \addtoindexx{type attribute}
2394 a \livelink{chap:DWATtype}{DW\_AT\_type} attribute describing
2395 the type of the parameterized value. Finally, the template
2396 value parameter entry has a \livelink{chap:DWATconstvalue}{DW\_AT\_const\_value}
2397 attribute, whose value is the actual constant value of the value parameter for
2398 this instantiation as represented on the target architecture.