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
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
28 A \addtoindex{base type entry}
29 has a \DWATname{} 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 \DWATencoding{} 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 \DWATencoding{} attribute
46 Table \refersec{tab:encodingattributevalues}
50 may have a \DWATendianity{} 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 \DWATbytesize{} attribute
60 \hypertarget{chap:DWATbitsizebasetypebitsize}{}
61 or a \DWATbitsize{} 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 \DWATEsigned{}
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}
83 \DWATdatabitoffset{} 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
104 \addtoindexx{bit offset attribute (Version 3)}
105 \addtoindexx{bit offset attribute (Version 3)|see{\textit{also} data bit offset attribute}}
107 \addtoindexx{data bit offset attribute}
109 \addtoindex{DWARF Version 4}, unchanged in \addtoindex{DWARF Version 5}, and
110 is also used for bit field members
111 (see Section \refersec{chap:datamemberentries}).
113 \hypertarget{chap:DWATbitoffsetbasetypebitlocation}{}
114 replaces the attribute
117 \addtoindexx{bit offset attribute (Version 3)}
118 types as defined in \DWARFVersionIII{} and earlier.
120 is deprecated for use in base types in DWARF Version 4 and later.
121 See Section 5.1 in the \DWARFVersionIV{}
122 specification for a discussion of compatibility considerations.}
125 \caption{Encoding attribute values}
126 \label{tab:encodingattributevalues}
128 \begin{tabular}{l|p{8cm}}
130 Name&Meaning\\ \hline
131 \DWATEaddressTARG{} & linear machine address (for segmented\break
133 Section \refersec{chap:segmentedaddresses}) \\
134 \DWATEbooleanTARG& true or false \\
136 \DWATEcomplexfloatTARG& complex binary
137 floating\dash point number \\
138 \DWATEfloatTARG{} & binary floating\dash point number \\
139 \DWATEimaginaryfloatTARG& imaginary binary
140 floating\dash point number \\
141 \DWATEsignedTARG& signed binary integer \\
142 \DWATEsignedcharTARG& signed character \\
143 \DWATEunsignedTARG{} & unsigned binary integer \\
144 \DWATEunsignedcharTARG{} & unsigned character \\
145 \DWATEpackeddecimalTARG{} & packed decimal \\
146 \DWATEnumericstringTARG& numeric string \\
147 \DWATEeditedTARG{} & edited string \\
148 \DWATEsignedfixedTARG{} & signed fixed\dash point scaled integer \\
149 \DWATEunsignedfixedTARG& unsigned fixed\dash point scaled integer \\
150 \DWATEdecimalfloatTARG{} & decimal floating\dash point number \\
151 \DWATEUTFTARG{} & \addtoindexi{Unicode character}{Unicode character base type} \\
152 \DWATEASCIITARG{} & \addtoindexi{ASCII character}{ASCII character base type}\\
153 \DWATEUCSTARG{} & \addtoindexi{ISO 10646 character}{ISO 10646 character base type}
154 \addtoindexx{ISO 10646 character set standard} \\
159 \textit{The \DWATEdecimalfloat{} encoding is intended for
160 floating\dash point representations that have a power\dash of\dash ten
161 exponent, such as that specified in IEEE 754R.}
163 \textit{The \DWATEUTF{} encoding is intended for \addtoindex{Unicode}
164 string encodings (see the Universal Character Set standard,
165 ISO/IEC 10646\dash 1:1993).
166 \addtoindexx{ISO 10646 character set standard}
168 \addtoindex{C++} type char16\_t is
169 represented by a base type entry with a name attribute whose
170 value is \doublequote{char16\_t}, an encoding attribute whose value
171 is \DWATEUTF{} and a byte size attribute whose value is 2.}
173 \textit{The \DWATEASCII{} and \DWATEUCS{} encodings are intended for
174 the {Fortran 2003} string kinds
175 \texttt{ASCII}\index{ASCII@\texttt{ASCII} (Fortran string kind)} (ISO/IEC 646:1991) and
176 \texttt{ISO\_10646}\index{ISO\_10646@\texttt{ISO\_10646} (Fortran string kind)} (UCS-4 in ISO/IEC 10646:2000).}
177 \addtoindexx{ISO 10646 character set standard}
180 \DWATEpackeddecimal{}
182 \DWATEnumericstring{}
184 represent packed and unpacked decimal string numeric data
185 types, respectively, either of which may be
187 \addtoindexx{decimal scale attribute}
189 \addtoindexx{decimal sign attribute}
191 \addtoindexx{digit count attribute}
193 \hypertarget{chap:DWATdecimalsigndecimalsignrepresentation}{}
195 \hypertarget{chap:DWATdigitcountdigitcountforpackeddecimalornumericstringtype}{}
196 base types are used in combination with
198 \DWATdigitcount{} and
203 A \DWATdecimalsign{} attribute
204 \addtoindexx{decimal sign attribute}
205 is an \livelink{chap:classconstant}{integer constant} that
206 conveys the representation of the sign of the decimal type
207 (see Table \refersec{tab:decimalsignattributevalues}).
208 Its \livelink{chap:classconstant}{integer constant} value is interpreted to
209 mean that the type has a leading overpunch, trailing overpunch,
210 leading separate or trailing separate sign representation or,
211 alternatively, no sign at all.
214 \caption{Decimal sign attribute values}
215 \label{tab:decimalsignattributevalues}
217 \begin{tabular}{l|p{9cm}}
221 \DWDSunsignedTARG{} & Unsigned \\
222 \DWDSleadingoverpunchTARG{} & Sign
223 is encoded in the most significant digit in a target\dash dependent manner \\
224 \DWDStrailingoverpunchTARG{} & Sign
225 is encoded in the least significant digit in a target\dash dependent manner \\
226 \DWDSleadingseparateTARG{}
227 & Decimal type: Sign is a \doublequote{+} or \doublequote{-} character
228 to the left of the most significant digit. \\
229 \DWDStrailingseparateTARG{}
230 & Decimal type: Sign is a \doublequote{+} or \doublequote{-} character
231 to the right of the least significant digit. \\
232 &Packed decimal type: Least significant nibble contains
233 a target\dash dependent value
234 indicating positive or negative. \\
239 \hypertarget{chap:DWATdecimalscaledecimalscalefactor}{}
240 The \DWATdecimalscale{}
242 \addtoindexx{decimal scale attribute}
243 is an integer constant value
244 that represents the exponent of the base ten scale factor to
245 be applied to an instance of the type. A scale of zero puts the
246 decimal point immediately to the right of the least significant
247 digit. Positive scale moves the decimal point to the right
248 and implies that additional zero digits on the right are not
249 stored in an instance of the type. Negative scale moves the
250 decimal point to the left; if the absolute value of the scale
251 is larger than the digit count, this implies additional zero
252 digits on the left are not stored in an instance of the type.
257 \addtoindexx{digit count attribute}
258 is an \livelink{chap:classconstant}{integer constant}
259 value that represents the number of digits in an instance of
264 \hypertarget{chap:DWATpicturestringpicturestringfornumericstringtype}{}
265 type is used to represent an edited
266 numeric or alphanumeric data type. It is used in combination
267 with a \DWATpicturestring{} attribute whose value is a
268 null\dash terminated string containing the target\dash dependent picture
269 string associated with the type.
271 If the edited base type entry describes an edited numeric
272 data type, the edited type entry has a \DWATdigitcount{} and a
273 \DWATdecimalscale{} attribute.
274 \addtoindexx{decimal scale attribute}
275 These attributes have the same
276 interpretation as described for the
277 \DWATEpackeddecimal{} and
278 \DWATEnumericstring{} base
279 types. If the edited type entry
280 describes an edited alphanumeric data type, the edited type
281 entry does not have these attributes.
284 \textit{The presence or absence of the \DWATdigitcount{} and
285 \DWATdecimalscale{} attributes
286 \addtoindexx{decimal scale attribute}
287 allows a debugger to easily
288 distinguish edited numeric from edited alphanumeric, although
289 in principle the digit count and scale are derivable by
290 interpreting the picture string.}
292 The \DWATEsignedfixed{} and \DWATEunsignedfixed{} entries
293 describe signed and unsigned fixed\dash point binary data types,
296 The fixed binary type entries have
297 \addtoindexx{digit count attribute}
300 attribute with the same interpretation as described for the
301 \DWATEpackeddecimal{} and \DWATEnumericstring{} base types.
304 For a data type with a decimal scale factor, the fixed binary
306 \DWATdecimalscale{} attribute
307 \addtoindexx{decimal scale attribute}
309 interpretation as described for the
310 \DWATEpackeddecimal{}
311 and \DWATEnumericstring{} base types.
313 \hypertarget{chap:DWATbinaryscalebinaryscalefactorforfixedpointtype}{}
314 For a data type with a binary scale factor, the fixed
315 \addtoindexx{binary scale attribute}
316 binary type entry has a
317 \DWATbinaryscale{} attribute.
319 \DWATbinaryscale{} attribute
320 is an \livelink{chap:classconstant}{integer constant} value
321 that represents the exponent of the base two scale factor to
322 be applied to an instance of the type. Zero scale puts the
323 binary point immediately to the right of the least significant
324 bit. Positive scale moves the binary point to the right and
325 implies that additional zero bits on the right are not stored
326 in an instance of the type. Negative scale moves the binary
327 point to the left; if the absolute value of the scale is
328 larger than the number of bits, this implies additional zero
329 bits on the left are not stored in an instance of the type.
332 \hypertarget{chap:DWATsmallscalefactorforfixedpointtype}{}
333 a data type with a non\dash decimal and non\dash binary scale factor,
334 the fixed binary type entry has a
335 \DWATsmall{} attribute which
336 \addtoindexx{small attribute}
338 \DWTAGconstant{} entry. The scale factor value
339 is interpreted in accordance with the value defined by the
340 \DWTAGconstant{} entry. The value represented is the product
341 of the integer value in memory and the associated constant
344 \textit{The \DWATsmall{} attribute
345 is defined with the \addtoindex{Ada} \texttt{small}
348 \section{Unspecified Type Entries}
349 \label{chap:unspecifiedtypeentries}
350 \addtoindexx{unspecified type entry}
351 \addtoindexx{void type|see{unspecified type entry}}
352 Some languages have constructs in which a type
353 may be left unspecified or the absence of a type
354 may be explicitly indicated.
356 An unspecified (implicit, unknown, ambiguous or nonexistent)
357 type is represented by a debugging information entry with
358 the tag \DWTAGunspecifiedtypeTARG.
359 If a name has been given
360 to the type, then the corresponding unspecified type entry
361 has a \DWATname{} attribute
362 \addtoindexx{name attribute}
364 a null\dash terminated
365 string containing the name as it appears in the source program.
367 The interpretation of this debugging information entry is
368 intentionally left flexible to allow it to be interpreted
369 appropriately in different languages. For example, in
370 \addtoindex{C} and \addtoindex{C++}
371 the language implementation can provide an unspecified type
372 entry with the name \doublequote{void} which can be referenced by the
373 type attribute of pointer types and typedef declarations for
375 Sections \refersec{chap:typemodifierentries} and
376 %The following reference was valid, so the following is probably correct.
377 Section \refersec{chap:typedefentries},
378 respectively). As another
379 example, in \addtoindex{Ada} such an unspecified type entry can be referred
380 to by the type attribute of an access type where the denoted
381 \addtoindexx{incomplete type (Ada)}
382 type is incomplete (the name is declared as a type but the
383 definition is deferred to a separate compilation unit).
385 \addtoindex{C++} permits using the
386 \autoreturntype{} specifier for the return type of a member function declaration.
387 The actual return type is deduced based on the definition of the
388 function, so it may not be known when the function is declared. The language
389 implementation can provide an unspecified type entry with the name \texttt{auto} which
390 can be referenced by the return type attribute of a function declaration entry.
391 When the function is later defined, the \DWTAGsubprogram{} entry for the definition
392 includes a reference to the actual return type.
395 \section{Type Modifier Entries}
396 \label{chap:typemodifierentries}
397 \addtoindexx{type modifier entry}
398 \addtoindexx{type modifier|see{atomic type entry}}
399 \addtoindexx{type modifier|see{constant type entry}}
400 \addtoindexx{type modifier|see{reference type entry}}
401 \addtoindexx{type modifier|see{restricted type entry}}
402 \addtoindexx{type modifier|see{packed type entry}}
403 \addtoindexx{type modifier|see{pointer type entry}}
404 \addtoindexx{type modifier|see{shared type entry}}
405 \addtoindexx{type modifier|see{volatile type entry}}
406 A base or user\dash defined type may be modified in different ways
407 in different languages. A type modifier is represented in
408 DWARF by a debugging information entry with one of the tags
409 given in Table \refersec{tab:typemodifiertags}.
411 If a name has been given to the modified type in the source
412 program, then the corresponding modified type entry has
413 a \DWATname{} attribute
414 \addtoindexx{name attribute}
415 whose value is a null\dash terminated
416 string containing the modified type name as it appears in
419 Each of the type modifier entries has
420 \addtoindexx{type attribute}
422 \DWATtype{} attribute,
423 whose value is a \livelink{chap:classreference}{reference}
424 to a debugging information entry
425 describing a base type, a user-defined type or another type
428 A modified type entry describing a
429 \addtoindexx{pointer type entry}
430 pointer or \addtoindex{reference type}
431 (using \DWTAGpointertype,
432 \DWTAGreferencetype{} or
433 \DWTAGrvaluereferencetype)
434 % Another instance of no-good-place-to-put-index entry.
436 \addtoindexx{address class attribute}
438 \hypertarget{chap:DWATadressclasspointerorreferencetypes}{}
441 attribute to describe how objects having the given pointer
442 or reference type ought to be dereferenced.
444 A modified type entry describing a \addtoindex{UPC} shared qualified type
445 (using \DWTAGsharedtype) may have a
446 \DWATcount{} attribute
447 \addtoindexx{count attribute}
448 whose value is a constant expressing the (explicit or implied) blocksize specified for the
449 type in the source. If no count attribute is present, then the \doublequote{infinite}
450 blocksize is assumed.
452 When multiple type modifiers are chained together to modify
453 a base or user-defined type, the tree ordering reflects the
455 \addtoindexx{reference type entry, lvalue|see{reference type entry}}
457 \addtoindexx{reference type entry, rvalue|see{rvalue reference type entry}}
459 \addtoindexx{parameter|see{macro formal parameter list}}
461 \addtoindexx{parameter|see{\textit{this} parameter}}
463 \addtoindexx{parameter|see{variable parameter attribute}}
465 \addtoindexx{parameter|see{optional parameter attribute}}
467 \addtoindexx{parameter|see{unspecified parameters entry}}
469 \addtoindexx{parameter|see{template value parameter entry}}
471 \addtoindexx{parameter|see{template type parameter entry}}
473 \addtoindexx{parameter|see{formal parameter entry}}
477 \caption{Type modifier tags}
478 \label{tab:typemodifiertags}
480 \begin{tabular}{l|p{9cm}}
482 Name&Meaning\\ \hline
483 \DWTAGatomictypeTARG{} & C \addtoindex{\_Atomic} qualified type \\
484 \DWTAGconsttypeTARG{} & C or C++ const qualified type
485 \addtoindexx{const qualified type entry} \addtoindexx{C} \addtoindexx{C++} \\
486 \DWTAGpackedtypeTARG& \addtoindex{Pascal} or Ada packed type\addtoindexx{packed type entry}
487 \addtoindexx{packed qualified type entry} \addtoindexx{Ada} \addtoindexx{Pascal} \\
488 \DWTAGpointertypeTARG{} & Pointer to an object of
489 the type being modified \addtoindexx{pointer qualified type entry} \\
490 \DWTAGreferencetypeTARG& \addtoindex{C++} (lvalue) reference
491 to an object of the type
492 \addtoindexx{reference type entry}
493 \mbox{being} modified
494 \addtoindexx{reference qualified type entry} \\
495 \DWTAGrestricttypeTARG& \addtoindex{C}
497 \addtoindexx{restricted type entry}
499 \addtoindexx{restrict qualified type} \\
500 \DWTAGrvaluereferencetypeTARG{} & \addtoindex{C++}
501 \addtoindexx{rvalue reference type entry}
503 \addtoindexx{restricted type entry}
504 reference to an object of the type \mbox{being} modified
505 \addtoindexx{rvalue reference qualified type entry} \\
506 \DWTAGsharedtypeTARG&\addtoindex{UPC} shared qualified type
507 \addtoindexx{shared qualified type entry} \\
508 \DWTAGvolatiletypeTARG&\addtoindex{C} or \addtoindex{C++} volatile qualified type
509 \addtoindexx{volatile qualified type entry} \\
515 \textit{As examples of how type modifiers are ordered, consider the following
516 \addtoindex{C} declarations:}
517 \begin{lstlisting}[numbers=none]
518 const unsigned char * volatile p;
520 \textit{which represents a volatile pointer to a constant
521 character. This is encoded in DWARF as:}
525 \DWTAGvariable(p) -->
526 \DWTAGvolatiletype -->
527 \DWTAGpointertype -->
529 \DWTAGbasetype(unsigned char)
534 \textit{On the other hand}
535 \begin{lstlisting}[numbers=none]
536 volatile unsigned char * const restrict p;
538 \textit{represents a restricted constant
539 pointer to a volatile character. This is encoded as:}
543 \DWTAGvariable(p) -->
544 \DWTAGrestricttype -->
546 \DWTAGpointertype -->
547 \DWTAGvolatiletype -->
548 \DWTAGbasetype(unsigned char)
552 \section{Typedef Entries}
553 \label{chap:typedefentries}
554 A named type that is defined in terms of another type
555 definition is represented by a debugging information entry with
556 \addtoindexx{typedef entry}
557 the tag \DWTAGtypedefTARG.
558 The typedef entry has a \DWATname{} attribute
559 \addtoindexx{name attribute}
560 whose value is a null\dash terminated string containing
561 the name of the typedef as it appears in the source program.
563 The typedef entry may also contain
564 \addtoindexx{type attribute}
566 \DWATtype{} attribute whose
567 value is a \livelink{chap:classreference}{reference}
568 to the type named by the typedef. If
569 the debugging information entry for a typedef represents
570 a declaration of the type that is not also a definition,
571 it does not contain a type attribute.
573 \textit{Depending on the language, a named type that is defined in
574 terms of another type may be called a type alias, a subtype,
575 a constrained type and other terms. A type name declared with
576 no defining details may be termed an
577 \addtoindexx{incomplete type}
578 incomplete, forward or hidden type.
579 While the DWARF \DWTAGtypedef{} entry was
580 originally inspired by the like named construct in
581 \addtoindex{C} and \addtoindex{C++},
582 it is broadly suitable for similar constructs (by whatever
583 source syntax) in other languages.}
585 \section{Array Type Entries}
586 \label{chap:arraytypeentries}
587 \label{chap:DWTAGgenericsubrange}
589 \textit{Many languages share the concept of an \doublequote{array,} which is
590 \addtoindexx{array type entry}
591 a table of components of identical type.}
593 An array type is represented by a debugging information entry
594 with the tag \DWTAGarraytypeTARG.
595 If a name has been given to
596 \addtoindexx{array!declaration of type}
597 the array type in the source program, then the corresponding
598 array type entry has a \DWATname{} attribute
599 \addtoindexx{name attribute}
601 null\dash terminated string containing the array type name as it
602 appears in the source program.
605 \hypertarget{chap:DWATorderingarrayrowcolumnordering}{}
606 array type entry describing a multidimensional array may
607 \addtoindexx{array!element ordering}
608 have a \DWATordering{} attribute whose
609 \livelink{chap:classconstant}{integer constant} value is
610 interpreted to mean either row-major or column-major ordering
611 of array elements. The set of values and their meanings
612 for the ordering attribute are listed in
613 Table \refersec{tab:arrayordering}.
615 ordering attribute is present, the default ordering for the
616 source language (which is indicated by the
619 \addtoindexx{language attribute}
620 of the enclosing compilation unit entry) is assumed.
622 \begin{simplenametable}[1.8in]{Array ordering}{tab:arrayordering}
623 \DWORDcolmajorTARG{} \\
624 \DWORDrowmajorTARG{} \\
625 \end{simplenametable}
627 The ordering attribute may optionally appear on one-dimensional
628 arrays; it will be ignored.
630 An array type entry has
631 \addtoindexx{type attribute}
632 a \DWATtype{} attribute
634 \addtoindexx{array!element type}
635 the type of each element of the array.
637 If the amount of storage allocated to hold each element of an
638 object of the given array type is different from the amount
639 \addtoindexx{stride attribute|see{bit stride attribute or byte stride attribute}}
640 of storage that is normally allocated to hold an individual
641 \hypertarget{chap:DWATbitstridearrayelementstrideofarraytype}{}
643 \hypertarget{chap:DWATbytestridearrayelementstrideofarraytype}{}
644 indicated element type, then the array type
645 \addtoindexx{bit stride attribute}
649 \addtoindexx{byte stride attribute}
652 \addtoindexx{bit stride attribute}
654 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
656 element of the array.
658 The array type entry may have either a \DWATbytesize{} or a
659 \DWATbitsize{} attribute
660 (see Section \refersec{chap:byteandbitsizes}),
662 amount of storage needed to hold an instance of the array type.
664 \textit{If the size of the array can be determined statically at
665 compile time, this value can usually be computed by multiplying
666 the number of array elements by the size of each element.}
669 Each array dimension is described by a debugging information
670 entry with either the
671 \addtoindexx{subrange type entry!as array dimension}
672 tag \DWTAGsubrangetype{} or the
673 \addtoindexx{enumeration type entry!as array dimension}
675 \DWTAGenumerationtype. These entries are
677 array type entry and are ordered to reflect the appearance of
678 the dimensions in the source program (that is, leftmost dimension
679 first, next to leftmost second, and so on).
681 \textit{In languages that have no concept of a
682 \doublequote{multidimensional array} (for example,
683 \addtoindex{C}), an array of arrays may
684 be represented by a debugging information entry for a
685 multidimensional array.}
687 Alternatively, for an array with dynamic rank the array dimensions
688 are described by a debugging information entry with the tag
689 \DWTAGgenericsubrangeTARG.
690 This entry has the same attributes as a
691 \DWTAGsubrangetype{} entry; however,
692 there is just one \DWTAGgenericsubrangeNAME{} entry and it describes all of the
693 dimensions of the array.
694 If \DWTAGgenericsubrangeNAME{}
695 is used, the number of dimensions must be specified using a
696 \DWATrank{} attribute. See also Section
697 \refersec{chap:DWATrank}.
701 Other attributes especially applicable to arrays are
703 \DWATassociated{} and
705 which are described in
706 Section \refersec{chap:dynamictypeproperties}.
707 For relevant examples, see also Appendix \refersec{app:fortranarrayexample}.
709 \section{Coarray Type Entries}
710 \label{chap:coarraytypeentries}
711 \addtoindexx{coarray}
712 \textit{In Fortran, a \doublequote{coarray} is an array whose
713 elements are located in different processes rather than in the
714 memory of one process. The individual elements
715 of a coarray can be scalars or arrays.
716 Similar to arrays, coarrays have \doublequote{codimensions} that are
717 indexed using a \doublequote{coindex} or multiple \doublequote{coindices}.
718 \addtoindexx{codimension|see{coarray}}
719 \addtoindexx{coindex|see{coarray}}
722 A coarray type is represented by a debugging information entry
723 with the tag \DWTAGcoarraytypeTARG.
724 If a name has been given to the
725 coarray type in the source, then the corresponding coarray type
726 entry has a \DWATname{} attribute whose value is a null-terminated
727 string containing the array type name as it appears in the source
730 A coarray entry has one or more \DWTAGsubrangetype{} child entries,
731 one for each codimension. It also has a \DWATtype{} attribute
732 describing the type of each element of the coarray.
734 \textit{In a coarray application, the run-time number of processes in the application
735 is part of the coindex calculation. It is represented in the Fortran source by
736 a coindex which is declared with a \doublequote{*} as the upper bound. To express this
737 concept in DWARF, the \DWTAGsubrangetype{} child entry for that index has
738 only a lower bound and no upper bound.}
740 \textit{How coarray elements are located and how coindices are
741 converted to process specifications is processor-dependent.}
744 \section{Structure, Union, Class and Interface Type Entries}
745 \label{chap:structureunionclassandinterfacetypeentries}
747 \textit{The languages
749 \addtoindex{C++}, and
750 \addtoindex{Pascal}, among others, allow the
751 programmer to define types that are collections of related
752 \addtoindexx{structure type entry}
754 In \addtoindex{C} and \addtoindex{C++}, these collections are called
755 \doublequote{structures.}
756 In \addtoindex{Pascal}, they are called \doublequote{records.}
757 The components may be of different types. The components are
758 called \doublequote{members} in \addtoindex{C} and
759 \addtoindex{C++}, and \doublequote{fields} in \addtoindex{Pascal}.}
761 \textit{The components of these collections each exist in their
762 own space in computer memory. The components of a \addtoindex{C} or \addtoindex{C++}
763 \doublequote{union} all coexist in the same memory.}
765 \textit{\addtoindex{Pascal} and
766 other languages have a \doublequote{discriminated union,}
767 \addtoindexx{discriminated union|see {variant entry}}
768 also called a \doublequote{variant record.} Here, selection of a
769 number of alternative substructures (\doublequote{variants}) is based
770 on the value of a component that is not part of any of those
771 substructures (the \doublequote{discriminant}).}
773 \textit{\addtoindex{C++} and
774 \addtoindex{Java} have the notion of \doublequote{class,} which is in some
775 ways similar to a structure. A class may have \doublequote{member
776 functions} which are subroutines that are within the scope
777 of a class or structure.}
779 \textit{The \addtoindex{C++} notion of
780 structure is more general than in \addtoindex{C}, being
781 equivalent to a class with minor differences. Accordingly,
782 in the following discussion statements about
783 \addtoindex{C++} classes may
784 be understood to apply to \addtoindex{C++} structures as well.}
786 \subsection{Structure, Union and Class Type Entries}
787 \label{chap:structureunionandclasstypeentries}
790 Structure, union, and class types are represented by debugging
791 \addtoindexx{structure type entry}
793 \addtoindexx{union type entry}
795 \addtoindexx{class type entry}
797 \DWTAGstructuretypeTARG,
799 and \DWTAGclasstypeTARG,
800 respectively. If a name has been given to the structure,
801 union, or class in the source program, then the corresponding
802 structure type, union type, or class type entry has a
803 \DWATname{} attribute
804 \addtoindexx{name attribute}
805 whose value is a null\dash terminated string
806 containing the type name as it appears in the source program.
808 The members of a structure, union, or class are represented
809 by debugging information entries that are owned by the
810 corresponding structure type, union type, or class type entry
811 and appear in the same order as the corresponding declarations
812 in the source program.
814 A structure type, union type or class type entry may have
815 either a \DWATbytesize{} or a
816 \DWATbitsize{} attribute
817 \hypertarget{chap:DWATbitsizedatamemberbitsize}{}
818 (see Section \refersec{chap:byteandbitsizes}),
819 whose value is the amount of storage needed
820 to hold an instance of the structure, union or class type,
821 including any padding.
823 An incomplete structure, union or class type
824 \addtoindexx{incomplete structure/union/class}
826 \addtoindexx{incomplete type}
827 represented by a structure, union or class
828 entry that does not have a byte size attribute and that has
829 \addtoindexx{declaration attribute}
830 a \DWATdeclaration{} attribute.
832 If the complete declaration of a type has been placed in
833 \hypertarget{chap:DWATsignaturetypesignature}{}
834 a separate \addtoindex{type unit}
835 (see Section \refersec{chap:separatetypeunitentries}),
836 an incomplete declaration
837 \addtoindexx{incomplete type}
838 of that type in the compilation unit may provide
839 the unique 64\dash bit signature of the type using
840 \addtoindexx{type signature}
844 If a structure, union or class entry represents the definition
845 of a structure, union or class member corresponding to a prior
846 incomplete structure, union or class, the entry may have a
847 \DWATspecification{} attribute
848 \addtoindexx{specification attribute}
849 whose value is a \livelink{chap:classreference}{reference} to
850 the debugging information entry representing that incomplete
853 Structure, union and class entries containing the
854 \DWATspecification{} attribute
855 \addtoindexx{specification attribute}
856 do not need to duplicate
857 information provided by the declaration entry referenced by the
858 specification attribute. In particular, such entries do not
859 need to contain an attribute for the name of the structure,
860 union or class they represent if such information is already
861 provided in the declaration.
863 \textit{For \addtoindex{C} and \addtoindex{C++},
865 \addtoindexx{data member|see {member entry (data)}}
866 member declarations occurring within
867 the declaration of a structure, union or class type are
868 considered to be \doublequote{definitions} of those members, with
869 the exception of \doublequote{static} data members, whose definitions
870 appear outside of the declaration of the enclosing structure,
871 union or class type. Function member declarations appearing
872 within a structure, union or class type declaration are
873 definitions only if the body of the function also appears
874 within the type declaration.}
876 If the definition for a given member of the structure, union
877 or class does not appear within the body of the declaration,
878 that member also has a debugging information entry describing
879 its definition. That latter entry has a
880 \DWATspecification{} attribute
881 \addtoindexx{specification attribute}
882 referencing the debugging information entry
883 owned by the body of the structure, union or class entry and
884 representing a non\dash defining declaration of the data, function
885 or type member. The referenced entry will not have information
886 about the location of that member (low and high pc attributes
887 for function members, location descriptions for data members)
888 and will have a \DWATdeclaration{} attribute.
891 \textit{Consider a nested class whose
892 definition occurs outside of the containing class definition, as in:}
894 \begin{lstlisting}[numbers=none]
901 \textit{The two different structs can be described in
902 different compilation units to
903 facilitate DWARF space compression
904 (see Appendix \refersec{app:usingcompilationunits}).}
906 \subsection{Interface Type Entries}
907 \label{chap:interfacetypeentries}
909 \textit{The \addtoindex{Java} language defines \doublequote{interface} types.
911 \addtoindexx{interface type entry}
912 in \addtoindex{Java} is similar to a \addtoindex{C++} or
913 \addtoindex{Java} class with only abstract
914 methods and constant data members.}
917 \addtoindexx{interface type entry}
918 are represented by debugging information
920 tag \DWTAGinterfacetypeTARG.
922 An interface type entry has
923 a \DWATname{} attribute,
924 \addtoindexx{name attribute}
926 value is a null\dash terminated string containing the type name
927 as it appears in the source program.
929 The members of an interface are represented by debugging
930 information entries that are owned by the interface type
931 entry and that appear in the same order as the corresponding
932 declarations in the source program.
934 \subsection{Derived or Extended Structs, Classes and Interfaces}
935 \label{chap:derivedorextendedstructsclasesandinterfaces}
937 \textit{In \addtoindex{C++}, a class (or struct)
939 \addtoindexx{derived type (C++)|see{inheritance entry}}
940 be \doublequote{derived from} or be a
941 \doublequote{subclass of} another class.
942 In \addtoindex{Java}, an interface may \doublequote{extend}
943 \addtoindexx{extended type (Java)|see{inheritance entry}}
945 \addtoindexx{implementing type (Java)|see{inheritance entry}}
946 or more other interfaces, and a class may \doublequote{extend} another
947 class and/or \doublequote{implement} one or more interfaces. All of these
948 relationships may be described using the following. Note that
949 in \addtoindex{Java},
950 the distinction between extends and implements is
951 implied by the entities at the two ends of the relationship.}
953 A class type or interface type entry that describes a
954 derived, extended or implementing class or interface owns
955 \addtoindexx{implementing type (Java)|see{inheritance entry}}
956 debugging information entries describing each of the classes
957 or interfaces it is derived from, extending or implementing,
958 respectively, ordered as they were in the source program. Each
960 \addtoindexx{inheritance entry}
962 tag \DWTAGinheritanceTARG.
965 \addtoindexx{type attribute}
967 \addtoindexx{inheritance entry}
969 \DWATtype{} attribute whose value is
970 a reference to the debugging information entry describing the
971 class or interface from which the parent class or structure
972 of the inheritance entry is derived, extended or implementing.
975 \addtoindexx{inheritance entry}
976 for a class that derives from or extends
977 \hypertarget{chap:DWATdatamemberlocationinheritedmemberlocation}{}
978 another class or struct also has
979 \addtoindexx{data member location attribute}
981 \DWATdatamemberlocation{}
982 attribute, whose value describes the location of the beginning
983 of the inherited type relative to the beginning address of the
984 instance of the derived class. If that value is a constant, it is the offset
985 in bytes from the beginning of the class to the beginning of
986 the instance of the inherited type. Otherwise, the value must be a location
987 description. In this latter case, the beginning address of
988 the instance of the derived class is pushed on the expression stack before
989 the \addtoindex{location description}
990 is evaluated and the result of the
991 evaluation is the location of the instance of the inherited type.
993 \textit{The interpretation of the value of this attribute for
994 inherited types is the same as the interpretation for data
996 (see Section \referfol{chap:datamemberentries}). }
999 \addtoindexx{inheritance entry}
1001 \hypertarget{chap:DWATaccessibilitycppinheritedmembers}{}
1003 \addtoindexx{accessibility attribute}
1005 \DWATaccessibility{}
1007 If no accessibility attribute
1008 is present, private access is assumed for an entry of a class
1009 and public access is assumed for an entry of an interface,
1013 \hypertarget{chap:DWATvirtualityvirtualityofbaseclass}{}
1014 the class referenced by the
1015 \addtoindexx{inheritance entry}
1016 inheritance entry serves
1017 as a \addtoindex{C++} virtual base class, the inheritance entry has a
1018 \DWATvirtuality{} attribute.
1020 \textit{For a \addtoindex{C++} virtual base, the
1021 \addtoindex{data member location attribute}
1022 will usually consist of a non-trivial
1023 \addtoindex{location description}.}
1025 \subsection{Access Declarations}
1026 \label{chap:accessdeclarations}
1028 \textit{In \addtoindex{C++}, a derived class may contain access declarations that
1029 \addtoindexx{access declaration entry}
1030 change the accessibility of individual class members from the
1031 overall accessibility specified by the inheritance declaration.
1032 A single access declaration may refer to a set of overloaded
1035 If a derived class or structure contains access declarations,
1036 each such declaration may be represented by a debugging
1037 information entry with the tag
1038 \DWTAGaccessdeclarationTARG.
1040 such entry is a child of the class or structure type entry.
1042 An access declaration entry has
1043 a \DWATname{} attribute,
1044 \addtoindexx{name attribute}
1046 value is a null\dash terminated string representing the name used
1047 in the declaration in the source program, including any class
1048 or structure qualifiers.
1050 An access declaration entry
1051 \hypertarget{chap:DWATaccessibilitycppbaseclasses}{}
1054 \DWATaccessibility{}
1055 attribute describing the declared accessibility of the named
1060 \subsection{Friends}
1061 \label{chap:friends}
1063 Each \doublequote{friend}
1064 \addtoindexx{friend entry}
1065 declared by a structure, union or class
1066 \hypertarget{chap:DWATfriendfriendrelationship}{}
1067 type may be represented by a debugging information entry
1068 that is a child of the structure, union or class type entry;
1069 the friend entry has the
1070 tag \DWTAGfriendTARG.
1073 \addtoindexx{friend attribute}
1074 a \DWATfriend{} attribute, whose value is
1075 a reference to the debugging information entry describing
1076 the declaration of the friend.
1079 \subsection{Data Member Entries}
1080 \label{chap:datamemberentries}
1082 A data member (as opposed to a member function) is
1083 represented by a debugging information entry with the
1084 tag \DWTAGmemberTARG.
1086 \addtoindexx{member entry (data)}
1087 member entry for a named member has
1088 a \DWATname{} attribute
1089 \addtoindexx{name attribute}
1090 whose value is a null\dash terminated
1091 string containing the member name as it appears in the source
1092 program. If the member entry describes an
1093 \addtoindex{anonymous union},
1094 the name attribute is omitted or the value of the attribute
1095 consists of a single zero byte.
1097 The data member entry has
1098 \addtoindexx{type attribute}
1100 \DWATtype{} attribute to denote
1101 \addtoindexx{member entry (data)}
1102 the type of that member.
1104 A data member entry may
1105 \addtoindexx{accessibility attribute}
1107 \DWATaccessibility{}
1108 attribute. If no accessibility attribute is present, private
1109 access is assumed for an entry of a class and public access
1110 is assumed for an entry of a structure, union, or interface.
1113 \hypertarget{chap:DWATmutablemutablepropertyofmemberdata}{}
1115 \addtoindexx{member entry (data)}
1117 \addtoindexx{mutable attribute}
1118 have a \DWATmutable{} attribute,
1119 which is a \livelink{chap:classflag}{flag}.
1120 This attribute indicates whether the data
1121 member was declared with the mutable storage class specifier.
1123 The beginning of a data member
1124 \addtoindexx{beginning of a data member}
1125 is described relative to
1126 \addtoindexx{beginning of an object}
1127 the beginning of the object in which it is immediately
1128 contained. In general, the beginning is characterized by
1129 both an address and a bit offset within the byte at that
1130 address. When the storage for an entity includes all of
1131 the bits in the beginning byte, the beginning bit offset is
1134 Bit offsets in DWARF use the bit numbering and direction
1135 conventions that are appropriate to the current language on
1139 \addtoindexx{member entry (data)}
1140 corresponding to a data member that is
1141 \hypertarget{chap:DWATdatabitoffsetdatamemberbitlocation}{}
1143 \hypertarget{chap:DWATdatamemberlocationdatamemberlocation}{}
1144 in a structure, union or class may have either
1145 \addtoindexx{data member location attribute}
1147 \DWATdatamemberlocation{} attribute or a
1148 \DWATdatabitoffset{}
1149 attribute. If the beginning of the data member is the same as
1150 the beginning of the containing entity then neither attribute
1154 For a \DWATdatamemberlocation{} attribute
1155 \addtoindexx{data member location attribute}
1156 there are two cases:
1157 \begin{enumerate}[1. ]
1158 \item If the value is an \livelink{chap:classconstant}{integer constant},
1160 in bytes from the beginning of the containing entity. If
1161 the beginning of the containing entity has a non-zero bit
1162 offset then the beginning of the member entry has that same
1165 \item Otherwise, the value must be a \addtoindex{location description}.
1167 this case, the beginning of the containing entity must be byte
1168 aligned. The beginning address is pushed on the DWARF stack
1169 before the \addtoindex{location} description is evaluated; the result of
1170 the evaluation is the base address of the member entry.
1172 \textit{The push on the DWARF expression stack of the base address of
1173 the containing construct is equivalent to execution of the
1174 \DWOPpushobjectaddress{} operation
1175 (see Section \refersec{chap:stackoperations});
1176 \DWOPpushobjectaddress{} therefore
1177 is not needed at the
1178 beginning of a \addtoindex{location description} for a data member.
1180 result of the evaluation is a location---either an address or
1181 the name of a register, not an offset to the member.}
1183 \textit{A \DWATdatamemberlocation{}
1185 \addtoindexx{data member location attribute}
1186 that has the form of a
1187 \addtoindex{location description} is not valid for a data member contained
1188 in an entity that is not byte aligned because DWARF operations
1189 do not allow for manipulating or computing bit offsets.}
1194 For a \DWATdatabitoffset{} attribute,
1195 the value is an \livelink{chap:classconstant}{integer constant}
1196 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1197 that specifies the number of bits
1198 from the beginning of the containing entity to the beginning
1199 of the data member. This value must be greater than or equal
1200 to zero, but is not limited to less than the number of bits
1203 If the size of a data member is not the same as the size
1204 of the type given for the data member, the data member has
1205 \addtoindexx{bit size attribute}
1206 either a \DWATbytesize{}
1207 or a \DWATbitsize{} attribute whose
1208 \livelink{chap:classconstant}{integer constant} value
1209 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1211 of storage needed to hold the value of the data member.
1213 \textit{Bit fields in \addtoindex{C} and \addtoindex{C++}
1215 \addtoindexx{bit fields}
1217 \addtoindexx{data bit offset}
1219 \addtoindexx{data bit size}
1221 \DWATdatabitoffset{} and
1222 \DWATbitsize{} attributes.}
1225 \textit{This Standard uses the following bit numbering and direction
1226 conventions in examples. These conventions are for illustrative
1227 purposes and other conventions may apply on particular
1230 \item \textit{For big\dash endian architectures, bit offsets are
1231 counted from high-order to low\dash order bits within a byte (or
1232 larger storage unit); in this case, the bit offset identifies
1233 the high\dash order bit of the object.}
1235 \item \textit{For little\dash endian architectures, bit offsets are
1236 counted from low\dash order to high\dash order bits within a byte (or
1237 larger storage unit); in this case, the bit offset identifies
1238 the low\dash order bit of the object.}
1242 \textit{In either case, the bit so identified is defined as the
1243 \addtoindexx{beginning of an object}
1244 beginning of the object.}
1247 \textit{For example, take one possible representation of the following
1248 \addtoindex{C} structure definition
1249 in both big\dash and little\dash endian byte orders:}
1260 \textit{Figures \referfol{fig:bigendiandatabitoffsets} and
1261 \refersec{fig:littleendiandatabitoffsets}
1262 show the structure layout
1263 and data bit offsets for example big\dash\ and little\dash endian
1264 architectures, respectively. Both diagrams show a structure
1265 that begins at address A and whose size is four bytes. Also,
1266 high order bits are to the left and low order bits are to
1278 Addresses increase ->
1279 | A | A + 1 | A + 2 | A + 3 |
1281 Data bit offsets increase ->
1282 +---------------+---------------+---------------+---------------+
1283 |0 4|5 10|11 15|16 23|24 31|
1284 | j | k | m | n | <pad> |
1286 +---------------------------------------------------------------+
1290 \caption{Big-endian data bit offsets}
1291 \label{fig:bigendiandatabitoffsets}
1302 <- Addresses increase
1303 | A + 3 | A + 2 | A + 1 | A |
1305 <- Data bit offsets increase
1306 +---------------+---------------+---------------+---------------+
1307 |31 24|23 16|15 11|10 5|4 0|
1308 | <pad> | n | m | k | j |
1310 +---------------------------------------------------------------+
1314 \caption{Little-endian data bit offsets}
1315 \label{fig:littleendiandatabitoffsets}
1319 \textit{Note that data member bit offsets in this example are the
1320 same for both big\dash\ and little\dash endian architectures even
1321 though the fields are allocated in different directions
1322 (high\dash order to low-order versus low\dash order to high\dash order);
1323 the bit naming conventions for memory and/or registers of
1324 the target architecture may or may not make this seem natural.}
1326 \textit{For a more extensive example showing nested and packed records
1328 Appendix \refersec{app:pascalexample}.}
1331 \textit{Attribute \DWATdatabitoffset{}
1333 \addtoindex{DWARF Version 4}, unchanged in \addtoindex{DWARF Version 5},
1334 and is also used for base types
1336 \refersec{chap:basetypeentries}).
1338 \livetarg{chap:DWATbitoffsetdatamemberbitlocation}{}
1339 attributes \DWATbitoffset{} and
1340 \DWATbytesize{} when used to
1341 identify the beginning of bit field data members as defined
1342 in DWARF V3 and earlier. The \DWATbytesize,
1345 attribute combination is deprecated for data members in DWARF
1346 Version 4 and later. See Section 5.6.6 in the DWARF Version 4
1347 specification for a discussion of compatibility considerations.}
1349 \subsection{Member Function Entries}
1350 \label{chap:memberfunctionentries}
1352 A member function is represented by a
1353 \addtoindexx{member function entry}
1354 debugging information entry
1356 \addtoindexx{subprogram entry!as member function}
1357 tag \DWTAGsubprogram.
1358 The member function entry
1359 may contain the same attributes and follows the same rules
1360 as non\dash member global subroutine entries
1361 (see Section \refersec{chap:subroutineandentrypointentries}).
1363 \textit{In particular, if the member function entry is an
1364 instantiation of a member function template, it follows the
1365 same rules as function template instantiations (see Section
1366 \refersec{chap:functiontemplateinstantiations}).
1370 \addtoindexx{accessibility attribute}
1371 member function entry may have a
1372 \DWATaccessibility{}
1373 attribute. If no accessibility attribute is present, private
1374 access is assumed for an entry of a class and public access
1375 is assumed for an entry of a structure, union or interface.
1378 \hypertarget{chap:DWATvirtualityvirtualityoffunction}{}
1379 the member function entry describes a virtual function,
1380 then that entry has a
1381 \DWATvirtuality{} attribute.
1384 \hypertarget{chap:DWATexplicitexplicitpropertyofmemberfunction}{}
1385 the member function entry describes an explicit member
1386 function, then that entry has
1387 \addtoindexx{explicit attribute}
1389 \DWATexplicit{} attribute.
1392 \hypertarget{chap:DWATvtableelemlocationvirtualfunctiontablevtableslot}{}
1393 entry for a virtual function also has a
1394 \DWATvtableelemlocation{}
1395 \addtoindexi{attribute}{vtable element location attribute} whose value contains
1396 a \addtoindex{location description}
1397 yielding the address of the slot
1398 for the function within the virtual function table for the
1399 enclosing class. The address of an object of the enclosing
1400 type is pushed onto the expression stack before the location
1401 description is evaluated.
1404 \hypertarget{chap:DWATobjectpointerobjectthisselfpointerofmemberfunction}{}
1405 the member function entry describes a non\dash static member
1406 \addtoindexx{this pointer attribute|see{object pointer attribute}}
1407 function, then that entry
1408 \addtoindexx{self pointer attribute|see{object pointer attribute}}
1410 \addtoindexx{object pointer attribute}
1411 a \DWATobjectpointer{}
1413 whose value is a \livelink{chap:classreference}{reference}
1414 to the formal parameter entry
1415 that corresponds to the object for which the function is
1416 called. The name attribute of that formal parameter is defined
1417 by the current language (for example,
1418 \texttt{this} for \addtoindex{C++} or \texttt{self}
1419 for \addtoindex{Objective C}
1420 and some other languages). That parameter
1421 also has a \DWATartificial{} attribute whose value is true.
1423 Conversely, if the member function entry describes a static
1424 member function, the entry does not have
1425 \addtoindexx{object pointer attribute}
1427 \DWATobjectpointer{}
1430 \textit{In \addtoindex{C++}, non-static member functions can have const-volatile
1431 qualifiers, which affect the type of the first formal parameter (the
1432 \doublequote{\texttt{this}}-pointer).}
1434 If the member function entry describes a non\dash static member
1435 function that has a const\dash volatile qualification, then
1436 the entry describes a non\dash static member function whose
1437 object formal parameter has a type that has an equivalent
1438 const\dash volatile qualification.
1440 \textit{In \addtoindex{C++:2011 (ISO)}, non-static member functions can also have one of the
1441 ref-qualifiers, \& and \&\&. They do not change the type of the
1442 \doublequote{\texttt{this}}-pointer, but they affect the types of object values the
1443 function can be invoked on.}
1445 The member function entry may have an \DWATreferenceNAME{} attribute
1446 \livetarg{chap:DWATreferenceofnonstaticmember}{}
1447 to indicate a non-static member function that can only be called on
1448 l-value objects, or the \DWATrvaluereferenceNAME{} attribute
1449 \livetarg{chap:DWATrvaluereferenceofnonstaticmember}{}
1450 to indicate that it can only be called on pr-values and x-values.
1452 If a subroutine entry represents the defining declaration
1453 of a member function and that definition appears outside of
1454 the body of the enclosing class declaration, the subroutine
1456 \DWATspecification{} attribute,
1457 \addtoindexx{specification attribute}
1459 a reference to the debugging information entry representing
1460 the declaration of this function member. The referenced entry
1461 will be a child of some class (or structure) type entry.
1463 Subroutine entries containing the
1464 \DWATspecification{} attribute
1465 \addtoindexx{specification attribute}
1466 do not need to duplicate information provided
1467 by the declaration entry referenced by the specification
1468 attribute. In particular, such entries do not need to contain
1469 a name attribute giving the name of the function member whose
1470 definition they represent.
1471 Similarly, such entries do not need to contain a return type attribute,
1472 unless the return type on the declaration was unspecified (for example, the
1473 declaration used the \addtoindex{C++} \autoreturntype{} specifier).
1476 \subsection{Class Template Instantiations}
1477 \label{chap:classtemplateinstantiations}
1479 \textit{In \addtoindex{C++} a class template is a generic definition of a class
1480 type that may be instantiated when an instance of the class
1481 is declared or defined. The generic description of the class may include
1482 parameterized types, parameterized compile-time constant
1483 values, and/or parameterized run-time constant addresses.
1484 DWARF does not represent the generic template
1485 definition, but does represent each instantiation.}
1487 A class template instantiation is represented by a
1488 debugging information entry with the tag \DWTAGclasstype,
1489 \DWTAGstructuretype{} or
1490 \DWTAGuniontype. With the following
1491 exceptions, such an entry will contain the same attributes
1492 and have the same types of child entries as would an entry
1493 for a class type defined explicitly using the instantiation
1494 types and values. The exceptions are:
1496 \begin{enumerate}[1. ]
1497 \item Template parameters are described and referenced as
1498 specified in Section \refersec{chap:templateparameters}.
1501 \item If the compiler has generated a special compilation unit to
1503 \addtoindexx{template instantiation!and special compilation unit}
1504 template instantiation and that special compilation
1505 unit has a different name from the compilation unit containing
1506 the template definition, the name attribute for the debugging
1507 information entry representing the special compilation unit
1508 should be empty or omitted.
1511 \item If the class type entry representing the template
1512 instantiation or any of its child entries contains declaration
1513 coordinate attributes, those attributes should refer to
1514 the source for the template definition, not to any source
1515 generated artificially by the compiler.
1519 \subsection{Variant Entries}
1520 \label{chap:variantentries}
1522 A variant part of a structure is represented by a debugging
1523 information entry\addtoindexx{variant part entry} with the
1524 tag \DWTAGvariantpartTARG{} and is
1525 owned by the corresponding structure type entry.
1527 If the variant part has a discriminant, the discriminant is
1528 \hypertarget{chap:DWATdiscrdiscriminantofvariantpart}{}
1530 \addtoindexx{discriminant (entry)}
1531 separate debugging information entry which
1532 is a child of the variant part entry. This entry has the form
1534 \addtoindexx{member entry (data)!as discriminant}
1535 structure data member entry. The variant part entry will
1536 \addtoindexx{discriminant attribute}
1538 \DWATdiscr{} attribute
1539 whose value is a \livelink{chap:classreference}{reference} to
1540 the member entry for the discriminant.
1542 If the variant part does not have a discriminant (tag field),
1543 the variant part entry has
1544 \addtoindexx{type attribute}
1546 \DWATtype{} attribute to represent
1549 Each variant of a particular variant part is represented by
1550 \hypertarget{chap:DWATdiscrvaluediscriminantvalue}{}
1551 a debugging information entry\addtoindexx{variant entry} with the
1552 tag \DWTAGvariantTARG{}
1553 and is a child of the variant part entry. The value that
1554 selects a given variant may be represented in one of three
1555 ways. The variant entry may have a
1556 \DWATdiscrvalue{} attribute
1557 whose value represents a single case label. The value of this
1558 attribute is encoded as an LEB128 number. The number is signed
1559 if the tag type for the variant part containing this variant
1560 is a signed type. The number is unsigned if the tag type is
1565 \hypertarget{chap:DWATdiscrlistlistofdiscriminantvalues}{}
1566 the variant entry may contain
1567 \addtoindexx{discriminant list attribute}
1570 attribute, whose value represents a list of discriminant
1571 values. This list is represented by any of the
1572 \livelink{chap:classblock}{block} forms and
1573 may contain a mixture of case labels and label ranges. Each
1574 item on the list is prefixed with a discriminant value
1575 descriptor that determines whether the list item represents
1576 a single label or a label range. A single case label is
1577 represented as an LEB128 number as defined above for
1578 \addtoindexx{discriminant value attribute}
1581 attribute. A label range is represented by
1582 two LEB128 numbers, the low value of the range followed by the
1583 high value. Both values follow the rules for signedness just
1584 described. The discriminant value descriptor is an integer
1585 constant that may have one of the values given in
1586 Table \refersec{tab:discriminantdescriptorvalues}.
1588 \begin{simplenametable}[1.4in]{Discriminant descriptor values}{tab:discriminantdescriptorvalues}
1589 \DWDSClabelTARG{} \\
1590 \DWDSCrangeTARG{} \\
1591 \end{simplenametable}
1593 If a variant entry has neither a \DWATdiscrvalue{}
1594 attribute nor a \DWATdiscrlist{} attribute, or if it has
1595 a \DWATdiscrlist{} attribute with 0 size, the variant is a
1598 The components selected by a particular variant are represented
1599 by debugging information entries owned by the corresponding
1600 variant entry and appear in the same order as the corresponding
1601 declarations in the source program.
1604 \section{Condition Entries}
1605 \label{chap:conditionentries}
1607 \textit{COBOL has the notion of
1608 \addtoindexx{level-88 condition, COBOL}
1609 a \doublequote{level\dash 88 condition} that
1610 associates a data item, called the conditional variable, with
1611 a set of one or more constant values and/or value ranges.
1612 % Note: the {} after \textquoteright (twice) is necessary to assure a following space separator
1613 Semantically, the condition is \textquoteleft true\textquoteright{}
1615 variable's value matches any of the described constants,
1616 and the condition is \textquoteleft false\textquoteright{} otherwise.}
1618 The \DWTAGconditionTARG{}
1619 debugging information entry\addtoindexx{condition entry}
1621 logical condition that tests whether a given data item\textquoteright s
1622 value matches one of a set of constant values. If a name
1623 has been given to the condition, the condition entry has a
1624 \DWATname{} attribute
1625 \addtoindexx{name attribute}
1626 whose value is a null\dash terminated string
1627 giving the condition name as it appears in the source program.
1630 The condition entry's parent entry describes the conditional
1631 variable; normally this will be a \DWTAGvariable,
1633 \DWTAGformalparameter{} entry.
1635 \addtoindexx{formal parameter entry}
1637 entry has an array type, the condition can test any individual
1638 element, but not the array as a whole. The condition entry
1639 implicitly specifies a \doublequote{comparison type} that is the
1640 type of an array element if the parent has an array type;
1641 otherwise it is the type of the parent entry.
1644 The condition entry owns \DWTAGconstant{} and/or
1645 \DWTAGsubrangetype{} entries that describe the constant
1646 values associated with the condition. If any child entry
1647 \addtoindexx{type attribute}
1649 a \DWATtype{} attribute,
1650 that attribute should describe a type
1651 compatible with the comparison type (according to the source
1652 language); otherwise the child\textquoteright s type is the same as the
1655 \textit{For conditional variables with alphanumeric types, COBOL
1656 permits a source program to provide ranges of alphanumeric
1657 constants in the condition. Normally a subrange type entry
1658 does not describe ranges of strings; however, this can be
1659 represented using bounds attributes that are references to
1660 constant entries describing strings. A subrange type entry may
1661 refer to constant entries that are siblings of the subrange
1665 \section{Enumeration Type Entries}
1666 \label{chap:enumerationtypeentries}
1668 \textit{An \doublequote{enumeration type} is a scalar that can assume one of
1669 a fixed number of symbolic values.}
1671 An enumeration type is represented by a debugging information
1673 \DWTAGenumerationtypeTARG.
1675 If a name has been given to the enumeration type in the source
1676 program, then the corresponding enumeration type entry has
1677 a \DWATname{} attribute
1678 \addtoindexx{name attribute}
1679 whose value is a null\dash terminated
1680 string containing the enumeration type name as it appears
1681 in the source program.
1683 The \addtoindex{enumeration type entry}
1685 \addtoindexx{type attribute}
1686 a \DWATtype{} attribute
1687 which refers to the underlying data type used to implement
1688 the enumeration. The entry also may have a
1689 \DWATbytesize{} attribute whose
1690 \livelink{chap:classconstant}{integer constant} value is the number of bytes
1691 required to hold an instance of the enumeration. If no \DWATbytesize{} attribute
1692 is present, the size for holding an instance of the enumeration is given by the size
1693 of the underlying data type.
1696 If an enumeration type has type safe
1697 \addtoindexx{type safe enumeration types}
1700 \begin{enumerate}[1. ]
1701 \item Enumerators are contained in the scope of the enumeration type, and/or
1703 \item Enumerators are not implicitly converted to another type
1706 then the \addtoindex{enumeration type entry} may
1707 \addtoindexx{enum class|see{type-safe enumeration}}
1708 have a \DWATenumclass{}
1709 attribute, which is a \livelink{chap:classflag}{flag}.
1710 In a language that offers only
1711 one kind of enumeration declaration, this attribute is not
1714 \textit{In \addtoindex{C} or \addtoindex{C++},
1715 the underlying type will be the appropriate
1716 integral type determined by the compiler from the properties of
1717 \hypertarget{chap:DWATenumclasstypesafeenumerationdefinition}{}
1718 the enumeration literal values.
1719 A \addtoindex{C++} type declaration written
1720 using enum class declares a strongly typed enumeration and
1721 is represented using \DWTAGenumerationtype{}
1722 in combination with \DWATenumclass.}
1724 Each enumeration literal is represented by a debugging
1725 \addtoindexx{enumeration literal|see{enumeration entry}}
1726 information entry with the
1727 tag \DWTAGenumeratorTARG.
1729 such entry is a child of the
1730 \addtoindex{enumeration type entry}, and the
1731 enumerator entries appear in the same order as the declarations
1732 of the enumeration literals in the source program.
1734 Each \addtoindex{enumerator entry} has a
1735 \DWATname{} attribute, whose
1736 \addtoindexx{name attribute}
1737 value is a null\dash terminated string containing the name of the
1738 \hypertarget{chap:DWATconstvalueenumerationliteralvalue}{}
1739 enumeration literal as it appears in the source program.
1740 Each enumerator entry also has a
1741 \DWATconstvalue{} attribute,
1742 whose value is the actual numeric value of the enumerator as
1743 represented on the target system.
1746 If the enumeration type occurs as the description of a
1747 \addtoindexx{enumeration type entry!as array dimension}
1748 dimension of an array type, and the stride for that dimension
1749 \hypertarget{chap:DWATbytestrideenumerationstridedimensionofarraytype}{}
1750 is different than what would otherwise be determined, then
1751 \hypertarget{chap:DWATbitstrideenumerationstridedimensionofarraytype}{}
1752 the enumeration type entry has either a
1754 or \DWATbitstride{} attribute
1755 \addtoindexx{bit stride attribute}
1756 which specifies the separation
1757 between successive elements along the dimension as described
1759 Section \refersec{chap:staticanddynamicvaluesofattributes}.
1761 \DWATbitstride{} attribute
1762 \addtoindexx{bit stride attribute}
1763 is interpreted as bits and the value of
1764 \addtoindexx{byte stride attribute}
1767 attribute is interpreted as bytes.
1770 \section{Subroutine Type Entries}
1771 \label{chap:subroutinetypeentries}
1773 \textit{It is possible in \addtoindex{C}
1774 to declare pointers to subroutines
1775 that return a value of a specific type. In both
1776 \addtoindex{C} and \addtoindex{C++},
1777 it is possible to declare pointers to subroutines that not
1778 only return a value of a specific type, but accept only
1779 arguments of specific types. The type of such pointers would
1780 be described with a \doublequote{pointer to} modifier applied to a
1781 user\dash defined type.}
1784 A subroutine type is represented by a debugging information
1786 \addtoindexx{subroutine type entry}
1787 tag \DWTAGsubroutinetypeTARG.
1789 been given to the subroutine type in the source program,
1790 then the corresponding subroutine type entry has
1791 a \DWATname{} attribute
1792 \addtoindexx{name attribute}
1793 whose value is a null\dash terminated string containing
1794 the subroutine type name as it appears in the source program.
1796 If the subroutine type describes a function that returns
1797 a value, then the subroutine type entry has
1798 \addtoindexx{type attribute}
1800 attribute to denote the type returned by the subroutine. If
1801 the types of the arguments are necessary to describe the
1802 subroutine type, then the corresponding subroutine type
1803 entry owns debugging information entries that describe the
1804 arguments. These debugging information entries appear in the
1805 order that the corresponding argument types appear in the
1808 \textit{In \addtoindex{C} there
1809 is a difference between the types of functions
1810 declared using function prototype style declarations and
1811 those declared using non\dash prototype declarations.}
1814 \hypertarget{chap:DWATprototypedsubroutineprototype}{}
1815 subroutine entry declared with a function prototype style
1816 declaration may have
1817 \addtoindexx{prototyped attribute}
1819 \DWATprototyped{} attribute, which is
1820 a \livelink{chap:classflag}{flag}.
1822 Each debugging information entry owned by a subroutine
1823 type entry corresponds to either a formal parameter or the sequence of
1824 unspecified parameters of the subprogram type:
1826 \begin{enumerate}[1. ]
1827 \item A formal parameter of a parameter list (that has a
1828 specific type) is represented by a debugging information entry
1829 with the tag \DWTAGformalparameter.
1830 Each formal parameter
1832 \addtoindexx{type attribute}
1833 a \DWATtype{} attribute that refers to the type of
1834 the formal parameter.
1836 \item The unspecified parameters of a variable parameter list
1837 \addtoindexx{unspecified parameters entry}
1839 \addtoindexx{\texttt{...} parameters|see{unspecified parameters entry}}
1840 represented by a debugging information entry with the
1841 tag \DWTAGunspecifiedparameters.
1844 \textit{\addtoindex{C++} const-volatile qualifiers are encoded as
1845 part of the type of the
1846 \doublequote{\texttt{this}}-pointer.
1847 \addtoindex{C++:2011 (ISO)} reference and rvalue-reference qualifiers are encoded using
1848 the \DWATreference{} and \DWATrvaluereference{} attributes, respectively.
1849 See also Section \refersec{chap:memberfunctionentries}.}
1851 A subroutine type entry may have the \DWATreference{} or
1852 \DWATrvaluereference{} attribute to indicate that it describes the
1853 type of a member function with reference or rvalue-reference
1854 semantics, respectively.
1857 \section{String Type Entries}
1858 \label{chap:stringtypeentries}
1860 \textit{A \doublequote{string} is a sequence of characters that have specific
1861 \addtoindexx{string type entry}
1862 semantics and operations that distinguish them from arrays of
1864 \addtoindex{Fortran} is one of the languages that has a string
1865 type. Note that \doublequote{string} in this context refers to a target
1866 machine concept, not the class string as used in this document
1867 (except for the name attribute).}
1869 A string type is represented by a debugging information entry
1870 with the tag \DWTAGstringtypeTARG.
1871 If a name has been given to
1872 the string type in the source program, then the corresponding
1873 string type entry has a
1874 \DWATname{} attribute
1875 \addtoindexx{name attribute}
1877 a null\dash terminated string containing the string type name as
1878 it appears in the source program.
1881 \addtoindex{Fortran 2003} language standard allows string
1882 types that are composed of different types of (same sized) characters.
1883 While there is no standard list of character kinds, the kinds
1884 \texttt{ASCII}\index{ASCII@\texttt{ASCII} (Fortran string kind)} (see \DWATEASCII),
1885 \texttt{ISO\_10646}\index{ISO\_10646@\texttt{ISO\_10646} (Fortran string kind)}
1886 \addtoindexx{ISO 10646 character set standard}
1888 \texttt{DEFAULT}\index{DEFAULT@\texttt{DEFAULT} (Fortran string kind)}
1891 A string type entry may have a \DWATtype{}
1892 \livetargi{char:DWAATtypeofstringtype}{attribute}{type attribute!of string type entry}
1893 describing how each character is encoded and is to be interpreted.
1894 The value of this attribute is a \CLASSreference to a
1895 \DWTAGbasetype{} base type entry. If the attribute is absent,
1896 then the character is encoded using the system default.
1899 The string type entry may have a
1900 \DWATbytesize{} attribute or
1902 attribute, whose value
1903 (see Section \refersec{chap:byteandbitsizes})
1905 storage needed to hold a value of the string type.
1908 \hypertarget{chap:DWATstringlengthstringlengthofstringtype}{}
1909 string type entry may also have a
1910 \DWATstringlength{} attribute
1912 \addtoindexx{string length attribute}
1914 \addtoindex{location description} yielding the location
1915 where the length of the string is stored in the program.
1916 If the \DWATstringlength{} attribute is not present, the size
1917 of the string is assumed to be the amount of storage that is
1918 allocated for the string (as specified by the \DWATbytesize{}
1919 or \DWATbitsize{} attribute).
1921 The string type entry may also have a
1922 \DWATstringlengthbytesizeNAME{}
1924 \DWATstringlengthbitsizeNAME{} attribute,
1925 \addtoindexx{string length attribute!size of length data}
1926 whose value (see Section \refersec{chap:byteandbitsizes})
1927 is the size of the data to be retrieved from the location
1928 referenced by the string length attribute. If no (byte or bit)
1929 size attribute is present, the size of the data to be retrieved
1931 \addtoindex{size of an address} on the target machine.
1933 \addtoindexx{DWARF Version 5} % Avoid italics
1934 \textit{Prior to DWARF Version 5, the meaning of a
1935 \DWATbytesize{} attribute depends on the presence of the
1936 \DWATstringlength{} attribute:
1938 \item If \DWATstringlength{} is present, \DWATbytesize{}
1939 specifies the size of the length data to be retrieved
1940 from the location specified by the \DWATstringlength{} attribute.
1941 \item If \DWATstringlength{} is not present, \DWATbytesize{}
1942 specifies the amount of storage allocated for objects
1945 In DWARF Version 5, \DWATbytesize{} always specifies the amount of storage
1946 allocated for objects of the string type.}
1949 \section{Set Type Entries}
1950 \label{chap:settypeentries}
1952 \textit{\addtoindex{Pascal} provides the concept of a \doublequote{set,} which represents
1953 a group of values of ordinal type.}
1955 A set is represented by a debugging information entry with
1956 the tag \DWTAGsettypeTARG.
1957 \addtoindexx{set type entry}
1958 If a name has been given to the
1959 set type, then the set type entry has
1960 a \DWATname{} attribute
1961 \addtoindexx{name attribute}
1962 whose value is a null\dash terminated string containing the
1963 set type name as it appears in the source program.
1965 The set type entry has
1966 \addtoindexx{type attribute}
1967 a \DWATtype{} attribute to denote the
1968 type of an element of the set.
1971 If the amount of storage allocated to hold each element of an
1972 object of the given set type is different from the amount of
1973 storage that is normally allocated to hold an individual object
1974 of the indicated element type, then the set type entry has
1975 either a \DWATbytesize{} attribute, or
1976 \DWATbitsize{} attribute
1977 whose value (see Section \refersec{chap:byteandbitsizes}) is
1978 the amount of storage needed to hold a value of the set type.
1981 \section{Subrange Type Entries}
1982 \label{chap:subrangetypeentries}
1984 \textit{Several languages support the concept of a \doublequote{subrange}
1985 type object. These objects can represent a subset of the
1986 values that an object of the basis type for the subrange can
1988 Subrange type entries may also be used to represent
1989 the bounds of array dimensions.}
1991 A subrange type is represented by a debugging information
1993 \addtoindexx{subrange type entry}
1994 tag \DWTAGsubrangetypeTARG.
1996 given to the subrange type, then the subrange type entry
1997 has a \DWATname{} attribute
1998 \addtoindexx{name attribute}
1999 whose value is a null\dash terminated
2000 string containing the subrange type name as it appears in
2003 The tag \DWTAGgenericsubrange{} is
2004 used to describe arrays with a dynamic rank. See Section
2005 \refersec{chap:DWTAGgenericsubrange}.
2007 The subrange entry may have
2008 \addtoindexx{type attribute}
2009 a \DWATtype{} attribute to describe
2010 the type of object, called the basis type, of whose values
2011 this subrange is a subset.
2013 If the amount of storage allocated to hold each element of an
2014 object of the given subrange type is different from the amount
2015 of storage that is normally allocated to hold an individual
2016 object of the indicated element type, then the subrange
2018 \DWATbytesize{} attribute or
2020 attribute, whose value
2021 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
2023 storage needed to hold a value of the subrange type.
2026 \hypertarget{chap:DWATthreadsscaledupcarrayboundthreadsscalfactor}{}
2027 subrange entry may have
2028 \addtoindexx{threads scaled attribute}
2030 \DWATthreadsscaled{} attribute,
2031 which is a \livelink{chap:classflag}{flag}.
2032 If present, this attribute indicates whether
2033 this subrange represents a \addtoindex{UPC} array bound which is scaled
2034 by the runtime THREADS value (the number of \addtoindex{UPC} threads in
2035 this execution of the program).
2037 \textit{This allows the representation of a \addtoindex{UPC} shared array such as}
2039 \begin{lstlisting}[numbers=none]
2040 int shared foo[34*THREADS][10][20];
2044 \hypertarget{chap:DWATlowerboundlowerboundofsubrange}{}
2046 \hypertarget{chap:DWATupperboundupperboundofsubrange}{}
2047 entry may have the attributes
2049 \addtoindexx{lower bound attribute}
2050 and \DWATupperbound{}
2051 \addtoindexx{upper bound attribute} to specify, respectively, the lower
2052 and upper bound values of the subrange. The
2055 \hypertarget{chap:DWATcountelementsofsubrangetype}{}
2057 % FIXME: The following matches DWARF4: odd as there is no default count.
2058 \addtoindexx{count attribute!default}
2060 \addtoindexx{count attribute}
2062 \DWATcount{} attribute,
2064 value describes the number of elements in the subrange rather
2065 than the value of the last element. The value of each of
2066 these attributes is determined as described in
2067 Section \refersec{chap:staticanddynamicvaluesofattributes}.
2069 If the lower bound value is missing, the value is assumed to
2070 be a language\dash dependent default constant as defined in
2071 Table \refersec{tab:languageencodings}.
2072 \addtoindexx{lower bound attribute!default}
2074 If the upper bound and count are missing, then the upper bound value is
2075 \textit{unknown}.\addtoindexx{upper bound attribute!default unknown}
2077 If the subrange entry has no type attribute describing the
2078 basis type, the basis type is determined as follows:
2079 \begin{enumerate}[1. ]
2081 If there is a lower bound attribute that references an object,
2082 the basis type is assumed to be the same as the type of that object.
2084 Otherwise, if there is an upper bound or count attribute that references
2085 an object, the basis type is assumed to be the same as the type of that object.
2087 Otherwise, the type is
2088 assumed to be the same type, in the source language of the
2089 compilation unit containing the subrange entry, as a signed
2090 integer with the same size as an address on the target machine.
2093 If the subrange type occurs as the description of a dimension
2094 of an array type, and the stride for that dimension is
2095 \hypertarget{chap:DWATbytestridesubrangestridedimensionofarraytype}{}
2096 different than what would otherwise be determined, then
2097 \hypertarget{chap:DWATbitstridesubrangestridedimensionofarraytype}{}
2098 the subrange type entry has either
2099 \addtoindexx{byte stride attribute}
2101 \DWATbytestride{} or
2102 \DWATbitstride{} attribute
2103 \addtoindexx{bit stride attribute}
2104 which specifies the separation
2105 between successive elements along the dimension as described
2107 Section \refersec{chap:byteandbitsizes}.
2109 \textit{Note that the stride can be negative.}
2112 \section{Pointer to Member Type Entries}
2113 \label{chap:pointertomembertypeentries}
2115 \textit{In \addtoindex{C++}, a
2116 pointer to a data or function member of a class or
2117 structure is a unique type.}
2119 A debugging information entry representing the type of an
2120 object that is a pointer to a structure or class member has
2121 the tag \DWTAGptrtomembertypeTARG.
2123 If the \addtoindex{pointer to member type} has a name, the
2124 \addtoindexx{pointer to member type entry}
2125 pointer to member entry has a
2126 \DWATname{} attribute,
2127 \addtoindexx{name attribute}
2129 null\dash terminated string containing the type name as it appears
2130 in the source program.
2132 The \addtoindex{pointer to member} entry
2134 \addtoindexx{type attribute}
2135 a \DWATtype{} attribute to
2136 describe the type of the class or structure member to which
2137 objects of this type may point.
2139 The \addtoindexx{pointer to member} entry also
2140 \hypertarget{chap:DWATcontainingtypecontainingtypeofpointertomembertype}{}
2142 \DWATcontainingtype{}
2143 attribute, whose value is a \livelink{chap:classreference}{reference} to a debugging
2144 information entry for the class or structure to whose members
2145 objects of this type may point.
2147 The \addtoindex{pointer to member entry}
2148 \hypertarget{chap:DWATuselocationmemberlocationforpointertomembertype}{}
2150 \DWATuselocation{} attribute
2151 \addtoindexx{use location attribute}
2153 \addtoindex{location description} that computes the
2154 address of the member of the class to which the pointer to
2155 member entry points.
2157 \textit{The method used to find the address of a given member of a
2158 class or structure is common to any instance of that class
2159 or structure and to any instance of the pointer or member
2160 type. The method is thus associated with the type entry,
2161 rather than with each instance of the type.}
2163 The \DWATuselocation{} description is used in conjunction
2164 with the location descriptions for a particular object of the
2165 given \addtoindex{pointer to member type} and for a particular structure or
2166 class instance. The \DWATuselocation{}
2167 attribute expects two values to be
2168 \addtoindexi{pushed}{address!implicit push for member operator}
2169 onto the DWARF expression stack before
2170 the \DWATuselocation{} description is evaluated.
2172 \addtoindexi{pushed}{address!implicit push for member operator}
2173 is the value of the \addtoindex{pointer to member} object
2174 itself. The second value
2175 \addtoindexi{pushed}{address!implicit push for member operator}
2176 is the base address of the
2177 entire structure or union instance containing the member
2178 whose address is being calculated.
2181 \textit{For an expression such as}
2183 \begin{lstlisting}[numbers=none]
2186 \textit{where \texttt{mbr\_ptr} has some \addtoindex{pointer to member type}, a debugger should:}
2187 \begin{enumerate}[1. ]
2188 \item \textit{Push the value of \texttt{mbr\_ptr} onto the DWARF expression stack.}
2189 \item \textit{Push the base address of \texttt{object} onto the DWARF expression stack.}
2190 \item \textit{Evaluate the \DWATuselocation{} description
2191 given in the type of \texttt{mbr\_ptr}.}
2195 \section{File Type Entries}
2196 \label{chap:filetypeentries}
2198 \textit{Some languages, such as \addtoindex{Pascal},
2199 provide a data type to represent
2202 A file type is represented by a debugging information entry
2204 \addtoindexx{file type entry}
2207 If the file type has a name,
2208 the file type entry has a \DWATname{} attribute,
2209 \addtoindexx{name attribute}
2211 is a null\dash terminated string containing the type name as it
2212 appears in the source program.
2214 The file type entry has
2215 \addtoindexx{type attribute}
2216 a \DWATtype{} attribute describing
2217 the type of the objects contained in the file.
2219 The file type entry also has a
2220 \DWATbytesize{}\addtoindexx{byte size attribute} or
2221 \DWATbitsize{}\addtoindexx{bit size attribute} attribute, whose value
2222 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
2223 is the amount of storage need to hold a value of the file type.
2225 \section{Dynamic Type Entries and Properties}
2227 \subsection{Dynamic Type Entries}
2228 \textit{Some languages such as
2229 \addtoindex{Fortran 90}, provide types whose values
2230 may be dynamically allocated or associated with a variable
2231 under explicit program control. However, unlike the related
2232 pointer type in \addtoindex{C} or
2233 \addtoindex{C++}, the indirection involved in accessing
2234 the value of the variable is generally implicit, that is, not
2235 indicated as part of program source.}
2237 A dynamic type entry is used to declare a dynamic type that is
2238 \doublequote{just like} another non-dynamic type without needing to
2239 replicate the full description of that other type.
2241 A dynamic type is represented by a debugging information entry
2242 with the tag \DWTAGdynamictypeTARG. If a name has been given to the
2243 dynamic type, then the dynamic type has a \DWATname{} attribute
2244 whose value is a null-terminated string containing the dynamic
2245 type name as it appears in the source.
2247 A dynamic type entry has a \DWATtype{} attribute whose value is a
2248 reference to the type of the entities that are dynamically allocated.
2250 A dynamic type entry also has a \DWATdatalocation, and may also
2251 have \DWATallocated{} and/or \DWATassociated{} attributes as
2252 described in Section \referfol{chap:dynamictypeproperties}.
2253 A \DWATdatalocation, \DWATallocated{} or \DWATassociated{} attribute
2254 may not occur on a dynamic type entry if the same kind of attribute
2255 already occurs on the type referenced by the \DWATtype{} attribute.
2257 \subsection{Dynamic Type Properties}
2258 \label{chap:dynamictypeproperties}
2260 The \DWATdatalocation, \DWATallocated{} and \DWATassociated{}
2261 attributes described in this section can be used for any type, not
2262 just dynamic types.}
2265 \subsubsection{Data Location}
2266 \label{chap:datalocation}
2268 \textit{Some languages may represent objects using descriptors to hold
2269 information, including a location and/or run\dash time parameters,
2270 about the data that represents the value for that object.}
2272 \hypertarget{chap:DWATdatalocationindirectiontoactualdata}{}
2273 The \DWATdatalocation{}
2274 attribute may be used with any
2275 \addtoindexx{data location attribute}
2276 type that provides one or more levels of
2277 \addtoindexx{hidden indirection|see{data location attribute}}
2279 and/or run\dash time parameters in its representation. Its value
2280 is a \addtoindex{location description}.
2281 The result of evaluating this
2282 description yields the location of the data for an object.
2283 When this attribute is omitted, the address of the data is
2284 the same as the address of the object.
2287 \textit{This location description will typically begin with
2288 \DWOPpushobjectaddress{}
2289 which loads the address of the
2290 object which can then serve as a descriptor in subsequent
2291 calculation. For an example using
2293 for a \addtoindex{Fortran 90 array}, see
2294 Appendix \refersec{app:fortranarrayexample}.}
2296 \subsubsection{Allocation and Association Status}
2297 \label{chap:allocationandassociationstatus}
2299 \textit{Some languages, such as \addtoindex{Fortran 90},
2300 provide types whose values
2301 may be dynamically allocated or associated with a variable
2302 under explicit program control.}
2304 \hypertarget{chap:DWATallocatedallocationstatusoftypes}{}
2308 \addtoindexx{allocated attribute}
2309 may optionally be used with any
2310 type for which objects of the type can be explicitly allocated
2311 and deallocated. The presence of the attribute indicates that
2312 objects of the type are allocatable and deallocatable. The
2313 integer value of the attribute (see below) specifies whether
2314 an object of the type is
2315 currently allocated or not.
2317 \hypertarget{chap:DWATassociatedassociationstatusoftypes}{}
2319 \DWATassociated{} attribute
2321 \addtoindexx{associated attribute}
2322 optionally be used with
2323 any type for which objects of the type can be dynamically
2324 associated with other objects. The presence of the attribute
2325 indicates that objects of the type can be associated. The
2326 integer value of the attribute (see below) indicates whether
2327 an object of the type is currently associated or not.
2329 \textit{While these attributes are defined specifically with
2330 \addtoindex{Fortran 90} ALLOCATABLE and POINTER types
2331 in mind, usage is not limited
2332 to just that language.}
2334 The value of these attributes is determined as described in
2335 Section \refersec{chap:staticanddynamicvaluesofattributes}.
2337 A non\dash zero value is interpreted as allocated or associated,
2338 and zero is interpreted as not allocated or not associated.
2340 \textit{For \addtoindex{Fortran 90},
2341 if the \DWATassociated{}
2342 attribute is present,
2343 the type has the POINTER property where either the parent
2344 variable is never associated with a dynamic object or the
2345 implementation does not track whether the associated object
2346 is static or dynamic. If the \DWATallocated{} attribute is
2347 present and the \DWATassociated{} attribute is not, the type
2348 has the ALLOCATABLE property. If both attributes are present,
2349 then the type should be assumed to have the POINTER property
2350 (and not ALLOCATABLE); the \DWATallocated{} attribute may then
2351 be used to indicate that the association status of the object
2352 resulted from execution of an ALLOCATE statement rather than
2353 pointer assignment.}
2355 \textit{For examples using
2356 \DWATallocated{} for \addtoindex{Ada} and
2357 \addtoindex{Fortran 90}
2359 see Appendix \refersec{app:aggregateexamples}.}
2361 \subsubsection{Array Rank}
2362 \label{chap:DWATrank}
2363 \addtoindexx{array!assumed-rank}
2364 \addtoindexx{assumed-rank array|see{array, assumed-rank}}
2365 \textit{The Fortran language supports \doublequote{assumed-rank arrays}. The
2366 rank (the number of dimensions) of an assumed-rank array is unknown
2367 at compile time. The Fortran runtime stores the rank in the array
2368 descriptor metadata.}
2371 \hypertarget{chap:DWATrankofdynamicarray}{\DWATrankINDX}
2372 attribute indicates that an array's rank
2373 (number of dimensions) is dynamic, and therefore unknown at compile
2374 time. The value of the \DWATrankNAME{} attribute is either an integer constant
2375 or a location expression whose evaluation yields the dynamic rank.
2377 The bounds of an array with dynamic rank are described using a
2378 \DWTAGgenericsubrange{} entry, which
2379 is the dynamic rank array equivalent of
2380 \DWTAGsubrangetype. The
2381 difference is that a \DWTAGgenericsubrange{} entry contains generic
2382 lower/upper bound and stride expressions that need to be evaluated for
2383 each dimension. Before any expression contained in a
2384 \DWTAGgenericsubrange{} can be evaluated, the dimension for which the
2385 expression is to be evaluated needs to be pushed onto the stack. The
2386 expression will use it to find the offset of the respective field in
2387 the array descriptor metadata.
2389 \textit{The Fortran compiler is free to choose any layout for the
2390 array descriptor. In particular, the upper and lower bounds and
2391 stride values do not need to be bundled into a structure or record,
2392 but could be laid end to end in the containing descriptor, pointed
2393 to by the descriptor, or even allocated independently of the
2396 Dimensions are enumerated $0$ to $\mathit{rank}-1$ in a left-to-right
2399 \textit{For an example in Fortran 2008, see
2400 Section~\refersec{app:assumedrankexample}.}
2403 \section{Template Alias Entries}
2404 \label{chap:templatealiasentries}
2407 In \addtoindex{C++}, a template alias is a form of typedef that has template
2408 parameters. DWARF does not represent the template alias definition
2409 but does represent instantiations of the alias.
2412 A type named using a template alias is represented
2413 by a debugging information entry
2414 \addtoindexx{template alias entry}
2416 \DWTAGtemplatealiasTARG.
2417 The template alias entry has a
2418 \DWATname{} attribute
2419 \addtoindexx{name attribute}
2420 whose value is a null\dash terminated string
2421 containing the name of the template alias as it appears in
2423 The template alias entry has child entries describing the template
2424 actual parameters (see Section \refersec{chap:templateparameters}).