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
25 with the tag \DWTAGbasetypeTARG.
27 A \addtoindex{base type entry}
28 may have a \DWATname{} attribute\addtoindexx{name attribute}
30 a null-terminated string containing the name of the base type
31 as recognized by the programming language of the compilation
32 unit containing the base type entry.
35 \addtoindexx{encoding attribute}
36 a \DWATencoding{} attribute describing
37 how the base type is encoded and is to be interpreted.
38 The \DWATencoding{} attribute is described in
39 Section \referfol{chap:basetypeencodings}.
42 may have a \DWATendianity{} attribute
43 \addtoindexx{endianity attribute}
45 Section \refersec{chap:dataobjectentries}.
46 If omitted, the encoding assumes the representation that
47 is the default for the target architecture.
51 \hypertarget{chap:DWATbytesizedataobjectordatatypesize}{}
52 either a \DWATbytesize{} attribute
53 \hypertarget{chap:DWATbitsizebasetypebitsize}{}
54 or a \DWATbitsize{} attribute
55 \addtoindexx{bit size attribute}
56 whose \livelink{chap:classconstant}{integer constant} value
57 (see Section \refersec{chap:byteandbitsizes})
58 is the amount of storage needed to hold
62 \textit{For example, the
63 \addtoindex{C} type \texttt{int} on a machine that uses 32-bit
64 integers is represented by a base type entry with a name
65 attribute whose value is \doublequote{int}, an encoding attribute
66 whose value is \DWATEsigned{}
67 and a byte size attribute whose value is 4.}
69 If the value of an object of the given type does not fully
70 occupy the storage described by a byte size attribute,
71 \hypertarget{chap:DWATdatabitoffsetbasetypebitlocation}{}
72 the base type entry may also have
73 \addtoindexx{bit size attribute}
76 \DWATdatabitoffset{} attribute,
78 \addtoindexx{data bit offset attribute}
80 \livelink{chap:classconstant}{integer constant} values
81 (see Section \refersec{chap:staticanddynamicvaluesofattributes}).
83 attribute describes the actual size in bits used to represent
84 values of the given type. The data bit offset attribute is the
85 offset in bits from the beginning of the containing storage to
86 the beginning of the value. Bits that are part of the offset
87 are padding. The data bit offset uses the bit numbering and
88 direction conventions that are appropriate to the current
90 target system to locate the beginning of the storage and
91 value. If this attribute is omitted a default data bit offset
94 A \DWTAGbasetype{} entry may have additional attributes that
95 augment certain of the base type encodings; these are described
96 in the following section.
98 \subsection{Base Type Encodings}
99 \label{chap:basetypeencodings}
100 A base type entry has
101 \addtoindexx{encoding attribute}
102 a \DWATencoding{} attribute describing
103 how the base type is encoded and is to be interpreted. The
104 value of this attribute is an integer of class \CLASSconstant.
105 The set of values and their meanings for the
106 \DWATencoding{} attribute is given in
107 Table \refersec{tab:encodingattributevalues}.
109 \textit{In Table \ref{tab:encodingattributevalues}, encodings
110 are shown in groups that have similar characteristics purely
111 for presentation purposes. These groups are not part of this
112 DWARF specification.}
114 \newcommand{\EncodingGroup}[1]{\multicolumn{2}{l}{\hspace{2cm}\bfseries\textit{#1}}}
116 \caption{Encoding attribute values}
117 \label{tab:encodingattributevalues}
119 \begin{tabular}{l|p{8cm}}
121 \bfseries Name & \bfseries Meaning\\ \hline
123 \EncodingGroup{Simple encodings} \\
124 \DWATEbooleanTARG & true or false \\
125 \DWATEaddressTARG{} & linear machine address$^a$ \\
126 \DWATEsignedTARG & signed binary integer \\
127 \DWATEsignedcharTARG & signed character \\
128 \DWATEunsignedTARG & unsigned binary integer \\
129 \DWATEunsignedcharTARG & unsigned character \\
131 \EncodingGroup{Character encodings} \\
132 \DWATEASCIITARG{} & \addtoindex{ISO/IEC 646:1991 character}
133 \addtoindexx{ASCII character} \\
134 \DWATEUCSTARG{} & \addtoindex{ISO/IEC 10646-1:1993 character (UCS-4)}
135 \addtoindexx{UCS character} \\
136 \DWATEUTFTARG{} & \addtoindex{ISO/IEC 10646-1:1993 character}
137 \addtoindexx{UTF character} \\
139 \EncodingGroup{Scaled encodings} \\
140 \DWATEsignedfixedTARG{} & signed fixed-point scaled integer \\
141 \DWATEunsignedfixedTARG & unsigned fixed-point scaled integer \\
143 \EncodingGroup{Floating-point encodings} \\
144 \DWATEfloatTARG & binary floating-point number \\
145 \DWATEcomplexfloatTARG & complex binary floating-point number \\
146 \DWATEimaginaryfloatTARG & imaginary binary floating-point number \\
147 \DWATEdecimalfloatTARG{} & \addtoindex{IEEE 754R decimal floating-point number} \\
149 \EncodingGroup{Decimal string encodings} \\
150 \DWATEpackeddecimalTARG & packed decimal number\\
151 \DWATEnumericstringTARG & numeric string \\
152 \DWATEeditedTARG & edited string \\
155 \multicolumn{2}{l}{$^a$For segmented addresses, see Section \refersec{chap:segmentedaddresses}} \\
159 \subsubsection{Simple Encodings}
160 \label{simpleencodings}
161 Types with simple encodings are widely supported in many
162 programming languages and do not require further discussion.
165 \subsubsection{Character Encodings}
166 \label{characterencodings}
167 The \DWATEUTF{} encoding is intended for \addtoindex{Unicode}
168 string encodings (see the Universal Character Set standard,
169 ISO/IEC 10646\dash 1:1993).
170 \addtoindexx{ISO 10646 character set standard}
172 \addtoindex{C++} type char16\_t is
173 represented by a base type entry with a name attribute whose
174 value is \doublequote{char16\_t}, an encoding attribute whose value
175 is \DWATEUTF{} and a byte size attribute whose value is 2.
178 The \DWATEASCII{} and \DWATEUCS{} encodings are intended for
179 the {Fortran 2003} string kinds
180 \texttt{ASCII}\index{ASCII@\texttt{ASCII} (Fortran string kind)} (ISO/IEC 646:1991) and
181 \texttt{ISO\_10646}\index{ISO\_10646@\texttt{ISO\_10646} (Fortran string kind)} (UCS-4 in ISO/IEC 10646:2000).
182 \addtoindexx{ISO 10646 character set standard}
184 \subsubsection{Scaled Encodings}
185 \label{scaledencodings}
186 The \DWATEsignedfixed{} and \DWATEunsignedfixed{} entries
187 describe signed and unsigned fixed\dash point binary data types,
190 The fixed binary type encodings have a
191 \DWATdigitcount{} attribute\addtoindexx{digit count attribute}
192 with the same interpretation as described for the
193 \DWATEpackeddecimal{} and \DWATEnumericstring{} base type encodings
194 (see Section \refersec{chap:decimalstringencodings}).
197 For a data type with a decimal scale factor, the fixed binary
198 type entry has a \DWATdecimalscale{} attribute
199 \addtoindexx{decimal scale attribute}
200 with the same interpretation as described for the
201 \DWATEpackeddecimal{} and \DWATEnumericstring{} base types
202 (see Section \refersec{chap:decimalstringencodings}).
204 \hypertarget{chap:DWATbinaryscalebinaryscalefactorforfixedpointtype}{}
205 For a data type with a binary scale factor, the fixed
206 binary type entry has a \DWATbinaryscale{} attribute.
207 The \DWATbinaryscale{} attribute\addtoindexx{binary scale attribute}
208 is an \livelink{chap:classconstant}{integer constant} value
209 that represents the exponent of the base two scale factor to
210 be applied to an instance of the type. Zero scale puts the
211 binary point immediately to the right of the least significant
212 bit. Positive scale moves the binary point to the right and
213 implies that additional zero bits on the right are not stored
214 in an instance of the type. Negative scale moves the binary
215 point to the left; if the absolute value of the scale is
216 larger than the number of bits, this implies additional zero
217 bits on the left are not stored in an instance of the type.
220 \hypertarget{chap:DWATsmallscalefactorforfixedpointtype}{}
221 a data type with a non-decimal and non-binary scale factor,
222 the fixed binary type entry has a \DWATsmall{} attribute which
223 \addtoindexx{small attribute} references a
224 \DWTAGconstant{} entry. The scale factor value
225 is interpreted in accordance with the value defined by the
226 \DWTAGconstant{} entry. The value represented is the product
227 of the integer value in memory and the associated constant
230 \textit{The \DWATsmall{} attribute is defined with the
231 \addtoindex{Ada} \texttt{small} attribute in mind.}
234 \subsubsection{Floating-Point Encodings}
235 \label{chap:floatingpointencodings}
236 Types with binary floating-point encodings
237 (\DWATEfloat{}, \DWATEcomplexfloat{} and \DWATEimaginaryfloat{})
238 are supported in many
239 programming languages and do not require further discussion.
241 The \DWATEdecimalfloat{} encoding is intended for
242 floating-point representations that have a power-of-ten
243 exponent, such as that specified in IEEE 754R.
245 \subsubsection{Decimal String Encodings}
246 \label{chap:decimalstringencodings}
247 The \DWATEpackeddecimal{} and \DWATEnumericstring{}
249 represent packed and unpacked decimal string numeric data
250 types, respectively, either of which may be either
251 \addtoindexx{decimal scale attribute}
253 \addtoindexx{decimal sign attribute}
255 \addtoindexx{digit count attribute}
257 \hypertarget{chap:DWATdecimalsigndecimalsignrepresentation}{}
259 \hypertarget{chap:DWATdigitcountdigitcountforpackeddecimalornumericstringtype}{}
260 base types are used in combination with
262 \DWATdigitcount{} and
267 A \DWATdecimalsign{} attribute
268 \addtoindexx{decimal sign attribute}
269 is an \livelink{chap:classconstant}{integer constant} that
270 conveys the representation of the sign of the decimal type
271 (see Table \refersec{tab:decimalsignattributevalues}).
272 Its \livelink{chap:classconstant}{integer constant} value is interpreted to
273 mean that the type has a leading overpunch, trailing overpunch,
274 leading separate or trailing separate sign representation or,
275 alternatively, no sign at all.
278 \caption{Decimal sign attribute values}
279 \label{tab:decimalsignattributevalues}
281 \begin{tabular}{l|p{9cm}}
285 \DWDSunsignedTARG{} & Unsigned \\
286 \DWDSleadingoverpunchTARG{} & Sign
287 is encoded in the most significant digit in a target-dependent manner \\
288 \DWDStrailingoverpunchTARG{} & Sign
289 is encoded in the least significant digit in a target-dependent manner \\
290 \DWDSleadingseparateTARG{}
291 & Decimal type: Sign is a \doublequote{+} or \doublequote{-} character
292 to the left of the most significant digit. \\
293 \DWDStrailingseparateTARG{}
294 & Decimal type: Sign is a \doublequote{+} or \doublequote{-} character
295 to the right of the least significant digit. \\
296 &Packed decimal type: Least significant nibble contains
297 a target\dash dependent value
298 indicating positive or negative. \\
304 \hypertarget{chap:DWATdecimalscaledecimalscalefactor}{}
305 The \DWATdecimalscale{}
307 \addtoindexx{decimal scale attribute}
308 is an integer constant value
309 that represents the exponent of the base ten scale factor to
310 be applied to an instance of the type. A scale of zero puts the
311 decimal point immediately to the right of the least significant
312 digit. Positive scale moves the decimal point to the right
313 and implies that additional zero digits on the right are not
314 stored in an instance of the type. Negative scale moves the
315 decimal point to the left; if the absolute value of the scale
316 is larger than the digit count, this implies additional zero
317 digits on the left are not stored in an instance of the type.
319 The \DWATdigitcount{} attribute
320 \addtoindexx{digit count attribute}
321 is an \livelink{chap:classconstant}{integer constant}
322 value that represents the number of digits in an instance of
325 The \DWATEedited{} base
326 \hypertarget{chap:DWATpicturestringpicturestringfornumericstringtype}{}
327 type is used to represent an edited
328 numeric or alphanumeric data type. It is used in combination
329 with a \DWATpicturestring{} attribute whose value is a
330 null\dash terminated string containing the target\dash dependent picture
331 string associated with the type.
333 If the edited base type entry describes an edited numeric
334 data type, the edited type entry has a \DWATdigitcount{} and a
335 \DWATdecimalscale{} attribute.\addtoindexx{decimal scale attribute}
336 These attributes have the same
337 interpretation as described for the
338 \DWATEpackeddecimal{} and
339 \DWATEnumericstring{} base
340 types. If the edited type entry
341 describes an edited alphanumeric data type, the edited type
342 entry does not have these attributes.
344 \textit{The presence or absence of the \DWATdigitcount{} and
345 \DWATdecimalscale{} attributes\addtoindexx{decimal scale attribute}
346 allows a debugger to easily
347 distinguish edited numeric from edited alphanumeric, although
348 in principle the digit count and scale are derivable by
349 interpreting the picture string.}
352 \section{Unspecified Type Entries}
353 \label{chap:unspecifiedtypeentries}
354 \addtoindexx{unspecified type entry}
355 \addtoindexx{void type|see{unspecified type entry}}
356 Some languages have constructs in which a type
357 may be left unspecified or the absence of a type
358 may be explicitly indicated.
360 An unspecified (implicit, unknown, ambiguous or nonexistent)
361 type is represented by a debugging information entry with
362 the tag \DWTAGunspecifiedtypeTARG.
363 If a name has been given
364 to the type, then the corresponding unspecified type entry
365 has a \DWATname{} attribute
366 \addtoindexx{name attribute}
368 a null\dash terminated
369 string containing the name as it appears in the source program.
371 \textit{The interpretation of this debugging information entry is
372 intentionally left flexible to allow it to be interpreted
373 appropriately in different languages. For example, in
374 \addtoindex{C} and \addtoindex{C++}
375 the language implementation can provide an unspecified type
376 entry with the name \doublequote{void} which can be referenced by the
377 type attribute of pointer types and typedef declarations for
379 Sections \refersec{chap:typemodifierentries} and
380 %The following reference was valid, so the following is probably correct.
381 Section \refersec{chap:typedefentries},
382 respectively). As another
383 example, in \addtoindex{Ada} such an unspecified type entry can be referred
384 to by the type attribute of an access type where the denoted
385 \addtoindexx{incomplete type (Ada)}
386 type is incomplete (the name is declared as a type but the
387 definition is deferred to a separate compilation unit).}
389 \textit{\addtoindex{C++} permits using the
390 \autoreturntype{} specifier for the return type of a member function declaration.
391 The actual return type is deduced based on the definition of the
392 function, so it may not be known when the function is declared. The language
393 implementation can provide an unspecified type entry with the name \texttt{auto} which
394 can be referenced by the return type attribute of a function declaration entry.
395 When the function is later defined, the \DWTAGsubprogram{} entry for the definition
396 includes a reference to the actual return type.}
399 \section{Type Modifier Entries}
400 \label{chap:typemodifierentries}
401 \addtoindexx{type modifier entry}
402 \addtoindexx{type modifier|see{atomic type entry}}
403 \addtoindexx{type modifier|see{constant type entry}}
404 \addtoindexx{type modifier|see{reference type entry}}
405 \addtoindexx{type modifier|see{restricted type entry}}
406 \addtoindexx{type modifier|see{packed type entry}}
407 \addtoindexx{type modifier|see{pointer type entry}}
408 \addtoindexx{type modifier|see{shared type entry}}
409 \addtoindexx{type modifier|see{volatile type entry}}
410 A base or user\dash defined type may be modified in different ways
411 in different languages. A type modifier is represented in
412 DWARF by a debugging information entry with one of the tags
413 given in Table \refersec{tab:typemodifiertags}.
415 If a name has been given to the modified type in the source
416 program, then the corresponding modified type entry has
417 a \DWATname{} attribute
418 \addtoindexx{name attribute}
419 whose value is a null\dash terminated
420 string containing the modified type name as it appears in
423 Each of the type modifier entries has
424 \addtoindexx{type attribute}
426 \DWATtype{} attribute,
427 whose value is a \livelink{chap:classreference}{reference}
428 to a debugging information entry
429 describing a base type, a user-defined type or another type
432 A modified type entry describing a
433 \addtoindexx{pointer type entry}
434 pointer or \addtoindex{reference type}
435 (using \DWTAGpointertype,
436 \DWTAGreferencetype{} or
437 \DWTAGrvaluereferencetype)
438 % Another instance of no-good-place-to-put-index entry.
440 \addtoindexx{address class attribute}
442 \hypertarget{chap:DWATadressclasspointerorreferencetypes}{}
445 attribute to describe how objects having the given pointer
446 or reference type ought to be dereferenced.
448 A modified type entry describing a \addtoindex{UPC} shared qualified type
449 (using \DWTAGsharedtype) may have a
450 \DWATcount{} attribute
451 \addtoindexx{count attribute}
452 whose value is a constant expressing the (explicit or implied) blocksize specified for the
453 type in the source. If no count attribute is present, then the \doublequote{infinite}
454 blocksize is assumed.
456 When multiple type modifiers are chained together to modify
457 a base or user-defined type, the tree ordering reflects the
459 \addtoindexx{reference type entry, lvalue|see{reference type entry}}
461 \addtoindexx{reference type entry, rvalue|see{rvalue reference type entry}}
463 \addtoindexx{parameter|see{macro formal parameter list}}
465 \addtoindexx{parameter|see{\textit{this} parameter}}
467 \addtoindexx{parameter|see{variable parameter attribute}}
469 \addtoindexx{parameter|see{optional parameter attribute}}
471 \addtoindexx{parameter|see{unspecified parameters entry}}
473 \addtoindexx{parameter|see{template value parameter entry}}
475 \addtoindexx{parameter|see{template type parameter entry}}
477 \addtoindexx{parameter|see{formal parameter entry}}
481 \caption{Type modifier tags}
482 \label{tab:typemodifiertags}
484 \begin{tabular}{l|p{9cm}}
486 Name&Meaning\\ \hline
487 \DWTAGatomictypeTARG{} & C \addtoindex{\_Atomic} qualified type \\
488 \DWTAGconsttypeTARG{} & C or C++ const qualified type
489 \addtoindexx{const qualified type entry} \addtoindexx{C} \addtoindexx{C++} \\
490 \DWTAGpackedtypeTARG& \addtoindex{Pascal} or Ada packed type\addtoindexx{packed type entry}
491 \addtoindexx{packed qualified type entry} \addtoindexx{Ada} \addtoindexx{Pascal} \\
492 \DWTAGpointertypeTARG{} & Pointer to an object of
493 the type being modified \addtoindexx{pointer qualified type entry} \\
494 \DWTAGreferencetypeTARG& \addtoindex{C++} (lvalue) reference
495 to an object of the type
496 \addtoindexx{reference type entry}
497 \mbox{being} modified
498 \addtoindexx{reference qualified type entry} \\
499 \DWTAGrestricttypeTARG& \addtoindex{C}
501 \addtoindexx{restricted type entry}
503 \addtoindexx{restrict qualified type} \\
504 \DWTAGrvaluereferencetypeTARG{} & \addtoindex{C++}
505 \addtoindexx{rvalue reference type entry}
507 \addtoindexx{restricted type entry}
508 reference to an object of the type \mbox{being} modified
509 \addtoindexx{rvalue reference qualified type entry} \\
510 \DWTAGsharedtypeTARG&\addtoindex{UPC} shared qualified type
511 \addtoindexx{shared qualified type entry} \\
512 \DWTAGvolatiletypeTARG&\addtoindex{C} or \addtoindex{C++} volatile qualified type
513 \addtoindexx{volatile qualified type entry} \\
519 \textit{As examples of how type modifiers are ordered, consider the following
520 \addtoindex{C} declarations:}
521 \begin{lstlisting}[numbers=none]
522 const unsigned char * volatile p;
524 \textit{which represents a volatile pointer to a constant
525 character. This is encoded in DWARF as:}
529 \DWTAGvariable(p) -->
530 \DWTAGvolatiletype -->
531 \DWTAGpointertype -->
533 \DWTAGbasetype(unsigned char)
538 \textit{On the other hand}
539 \begin{lstlisting}[numbers=none]
540 volatile unsigned char * const restrict p;
542 \textit{represents a restricted constant
543 pointer to a volatile character. This is encoded as:}
547 \DWTAGvariable(p) -->
548 \DWTAGrestricttype -->
550 \DWTAGpointertype -->
551 \DWTAGvolatiletype -->
552 \DWTAGbasetype(unsigned char)
556 \section{Typedef Entries}
557 \label{chap:typedefentries}
558 A named type that is defined in terms of another type
559 definition is represented by a debugging information entry with
560 \addtoindexx{typedef entry}
561 the tag \DWTAGtypedefTARG.
562 The typedef entry has a \DWATname{} attribute
563 \addtoindexx{name attribute}
564 whose value is a null\dash terminated string containing
565 the name of the typedef as it appears in the source program.
567 The typedef entry may also contain
568 \addtoindexx{type attribute}
570 \DWATtype{} attribute whose
571 value is a \livelink{chap:classreference}{reference}
572 to the type named by the typedef. If
573 the debugging information entry for a typedef represents
574 a declaration of the type that is not also a definition,
575 it does not contain a type attribute.
577 \textit{Depending on the language, a named type that is defined in
578 terms of another type may be called a type alias, a subtype,
579 a constrained type and other terms. A type name declared with
580 no defining details may be termed an
581 \addtoindexx{incomplete type}
582 incomplete, forward or hidden type.
583 While the DWARF \DWTAGtypedef{} entry was
584 originally inspired by the like named construct in
585 \addtoindex{C} and \addtoindex{C++},
586 it is broadly suitable for similar constructs (by whatever
587 source syntax) in other languages.}
589 \section{Array Type Entries}
590 \label{chap:arraytypeentries}
591 \label{chap:DWTAGgenericsubrange}
593 \textit{Many languages share the concept of an \doublequote{array,} which is
594 \addtoindexx{array type entry}
595 a table of components of identical type.}
597 An array type is represented by a debugging information entry
598 with the tag \DWTAGarraytypeTARG.
599 If a name has been given to
600 \addtoindexx{array!declaration of type}
601 the array type in the source program, then the corresponding
602 array type entry has a \DWATname{} attribute
603 \addtoindexx{name attribute}
605 null\dash terminated string containing the array type name as it
606 appears in the source program.
609 \hypertarget{chap:DWATorderingarrayrowcolumnordering}{}
610 array type entry describing a multidimensional array may
611 \addtoindexx{array!element ordering}
612 have a \DWATordering{} attribute whose
613 \livelink{chap:classconstant}{integer constant} value is
614 interpreted to mean either row-major or column-major ordering
615 of array elements. The set of values and their meanings
616 for the ordering attribute are listed in
617 Table \referfol{tab:arrayordering}.
619 ordering attribute is present, the default ordering for the
620 source language (which is indicated by the
623 \addtoindexx{language attribute}
624 of the enclosing compilation unit entry) is assumed.
626 \begin{simplenametable}[1.8in]{Array ordering}{tab:arrayordering}
627 \DWORDcolmajorTARG{} \\
628 \DWORDrowmajorTARG{} \\
629 \end{simplenametable}
631 The ordering attribute may optionally appear on one-dimensional
632 arrays; it will be ignored.
634 An array type entry has
635 \addtoindexx{type attribute}
636 a \DWATtype{} attribute
638 \addtoindexx{array!element type}
639 the type of each element of the array.
641 If the amount of storage allocated to hold each element of an
642 object of the given array type is different from the amount
643 \addtoindexx{stride attribute|see{bit stride attribute or byte stride attribute}}
644 of storage that is normally allocated to hold an individual
645 \hypertarget{chap:DWATbitstridearrayelementstrideofarraytype}{}
647 \hypertarget{chap:DWATbytestridearrayelementstrideofarraytype}{}
648 indicated element type, then the array type
649 \addtoindexx{bit stride attribute}
653 \addtoindexx{byte stride attribute}
656 \addtoindexx{bit stride attribute}
658 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
660 element of the array.
662 The array type entry may have either a \DWATbytesize{} or a
663 \DWATbitsize{} attribute
664 (see Section \refersec{chap:byteandbitsizes}),
666 amount of storage needed to hold an instance of the array type.
668 \textit{If the size of the array can be determined statically at
669 compile time, this value can usually be computed by multiplying
670 the number of array elements by the size of each element.}
673 Each array dimension is described by a debugging information
674 entry with either the
675 \addtoindexx{subrange type entry!as array dimension}
676 tag \DWTAGsubrangetype{} or the
677 \addtoindexx{enumeration type entry!as array dimension}
679 \DWTAGenumerationtype. These entries are
681 array type entry and are ordered to reflect the appearance of
682 the dimensions in the source program (that is, leftmost dimension
683 first, next to leftmost second, and so on).
685 \textit{In languages that have no concept of a
686 \doublequote{multidimensional array} (for example,
687 \addtoindex{C}), an array of arrays may
688 be represented by a debugging information entry for a
689 multidimensional array.}
691 Alternatively, for an array with dynamic rank the array dimensions
692 are described by a debugging information entry with the tag
693 \DWTAGgenericsubrangeTARG.
694 This entry has the same attributes as a
695 \DWTAGsubrangetype{} entry; however,
696 there is just one \DWTAGgenericsubrangeNAME{} entry and it describes all of the
697 dimensions of the array.
698 If \DWTAGgenericsubrangeNAME{}
699 is used, the number of dimensions must be specified using a
700 \DWATrank{} attribute. See also Section
701 \refersec{chap:DWATrank}.
704 Other attributes especially applicable to arrays are
706 \DWATassociated{} and
708 which are described in
709 Section \refersec{chap:dynamicpropertiesoftypes}.
710 For relevant examples, see also Appendix \refersec{app:fortranarrayexample}.
712 \section{Coarray Type Entries}
713 \label{chap:coarraytypeentries}
714 \addtoindexx{coarray}
715 \textit{In Fortran, a \doublequote{coarray} is an array whose
716 elements are located in different processes rather than in the
717 memory of one process. The individual elements
718 of a coarray can be scalars or arrays.
719 Similar to arrays, coarrays have \doublequote{codimensions} that are
720 indexed using a \doublequote{coindex} or multiple \doublequote{coindices}.
721 \addtoindexx{codimension|see{coarray}}
722 \addtoindexx{coindex|see{coarray}}
725 A coarray type is represented by a debugging information entry
726 with the tag \DWTAGcoarraytypeTARG.
727 If a name has been given to the
728 coarray type in the source, then the corresponding coarray type
729 entry has a \DWATname{} attribute whose value is a null-terminated
730 string containing the array type name as it appears in the source
733 A coarray entry has one or more \DWTAGsubrangetype{} child entries,
734 one for each codimension. It also has a \DWATtype{} attribute
735 describing the type of each element of the coarray.
737 \textit{In a coarray application, the run-time number of processes in the application
738 is part of the coindex calculation. It is represented in the Fortran source by
739 a coindex which is declared with a \doublequote{*} as the upper bound. To express this
740 concept in DWARF, the \DWTAGsubrangetype{} child entry for that index has
741 only a lower bound and no upper bound.}
743 \textit{How coarray elements are located and how coindices are
744 converted to process specifications is implementation-defined.}
747 \section{Structure, Union, Class and Interface Type Entries}
748 \label{chap:structureunionclassandinterfacetypeentries}
750 \textit{The languages
752 \addtoindex{C++}, and
753 \addtoindex{Pascal}, among others, allow the
754 programmer to define types that are collections of related
755 \addtoindexx{structure type entry}
757 In \addtoindex{C} and \addtoindex{C++}, these collections are called
758 \doublequote{structures.}
759 In \addtoindex{Pascal}, they are called \doublequote{records.}
760 The components may be of different types. The components are
761 called \doublequote{members} in \addtoindex{C} and
762 \addtoindex{C++}, and \doublequote{fields} in \addtoindex{Pascal}.}
764 \textit{The components of these collections each exist in their
765 own space in computer memory. The components of a \addtoindex{C} or \addtoindex{C++}
766 \doublequote{union} all coexist in the same memory.}
768 \textit{\addtoindex{Pascal} and
769 other languages have a \doublequote{discriminated union,}
770 \addtoindexx{discriminated union|see {variant entry}}
771 also called a \doublequote{variant record.} Here, selection of a
772 number of alternative substructures (\doublequote{variants}) is based
773 on the value of a component that is not part of any of those
774 substructures (the \doublequote{discriminant}).}
776 \textit{\addtoindex{C++} and
777 \addtoindex{Java} have the notion of \doublequote{class,} which is in some
778 ways similar to a structure. A class may have \doublequote{member
779 functions} which are subroutines that are within the scope
780 of a class or structure.}
782 \textit{The \addtoindex{C++} notion of
783 structure is more general than in \addtoindex{C}, being
784 equivalent to a class with minor differences. Accordingly,
785 in the following discussion, statements about
786 \addtoindex{C++} classes may
787 be understood to apply to \addtoindex{C++} structures as well.}
789 \subsection{Structure, Union and Class Type Entries}
790 \label{chap:structureunionandclasstypeentries}
791 Structure, union, and class types are represented by debugging
792 \addtoindexx{structure type entry}
794 \addtoindexx{union type entry}
796 \addtoindexx{class type entry}
798 \DWTAGstructuretypeTARG,
800 and \DWTAGclasstypeTARG,
801 respectively. If a name has been given to the structure,
802 union, or class in the source program, then the corresponding
803 structure type, union type, or class type entry has a
804 \DWATname{} attribute
805 \addtoindexx{name attribute}
806 whose value is a null\dash terminated string
807 containing the type name as it appears in the source program.
809 The members of a structure, union, or class are represented
810 by debugging information entries that are owned by the
811 corresponding structure type, union type, or class type entry
812 and appear in the same order as the corresponding declarations
813 in the source program.
815 A structure, union, or class type may have a \DWATexportsymbolsNAME{}
817 \livetarg{chap:DWATexportsymbolsofstructunionclass}{}
818 which indicates that all member names defined within
819 the structure, union, or class may be referenced as if they were
820 defined within the containing structure, union, or class.
822 \textit{This may be used to describe anonymous structures, unions
823 and classes in \addtoindex{C} or \addtoindex{C++}}.
825 A structure type, union type or class type entry may have
826 either a \DWATbytesize{} or a
827 \DWATbitsize{} attribute
828 \hypertarget{chap:DWATbitsizedatamemberbitsize}{}
829 (see Section \refersec{chap:byteandbitsizes}),
830 whose value is the amount of storage needed
831 to hold an instance of the structure, union or class type,
832 including any padding.
834 An incomplete structure, union or class type
835 \addtoindexx{incomplete structure/union/class}
837 \addtoindexx{incomplete type}
838 represented by a structure, union or class
839 entry that does not have a byte size attribute and that has
840 \addtoindexx{declaration attribute}
841 a \DWATdeclaration{} attribute.
843 If the complete declaration of a type has been placed in
844 \hypertarget{chap:DWATsignaturetypesignature}{}
845 a separate \addtoindex{type unit}
846 (see Section \refersec{chap:typeunitentries}),
847 an incomplete declaration
848 \addtoindexx{incomplete type}
849 of that type in the compilation unit may provide
850 the unique 64-bit signature of the type using
851 \addtoindexx{type signature}
855 If a structure, union or class entry represents the definition
856 of a structure, union or class member corresponding to a prior
857 incomplete structure, union or class, the entry may have a
858 \DWATspecification{} attribute
859 \addtoindexx{specification attribute}
860 whose value is a \livelink{chap:classreference}{reference} to
861 the debugging information entry representing that incomplete
864 Structure, union and class entries containing the
865 \DWATspecification{} attribute
866 \addtoindexx{specification attribute}
867 do not need to duplicate
868 information provided by the declaration entry referenced by the
869 specification attribute. In particular, such entries do not
870 need to contain an attribute for the name of the structure,
871 union or class they represent if such information is already
872 provided in the declaration.
874 \textit{For \addtoindex{C} and \addtoindex{C++},
876 \addtoindexx{data member|see {member entry (data)}}
877 member declarations occurring within
878 the declaration of a structure, union or class type are
879 considered to be \doublequote{definitions} of those members, with
880 the exception of \doublequote{static} data members, whose definitions
881 appear outside of the declaration of the enclosing structure,
882 union or class type. Function member declarations appearing
883 within a structure, union or class type declaration are
884 definitions only if the body of the function also appears
885 within the type declaration.}
887 If the definition for a given member of the structure, union
888 or class does not appear within the body of the declaration,
889 that member also has a debugging information entry describing
890 its definition. That latter entry has a
891 \DWATspecification{} attribute
892 \addtoindexx{specification attribute}
893 referencing the debugging information entry
894 owned by the body of the structure, union or class entry and
895 representing a non\dash defining declaration of the data, function
896 or type member. The referenced entry will not have information
897 about the location of that member (low and high PC attributes
898 for function members, location descriptions for data members)
899 and will have a \DWATdeclaration{} attribute.
902 \textit{Consider a nested class whose
903 definition occurs outside of the containing class definition, as in:}
905 \begin{lstlisting}[numbers=none]
912 \textit{The two different structs can be described in
913 different compilation units to
914 facilitate DWARF space compression
915 (see Appendix \refersec{app:usingcompilationunits}).}
918 A structure type, union type or class type entry may have a
919 \DWATcallingconvention{} attribute,
920 \addtoindexx{calling convention attribute}
921 whose value indicates whether a value of the type should be passed by reference
922 or passed by value. The set of calling convention codes for use with types
923 \addtoindexx{calling convention codes!for types}
924 \hypertarget{chap:DWATcallingconventionfortypes}{}
925 is given in Table \referfol{tab:callingconventioncodesfortypes}.
927 \begin{simplenametable}[2.2in]{Calling convention codes for types}{tab:callingconventioncodesfortypes}
929 \DWCCpassbyvalueTARG \\
930 \DWCCpassbyreferenceTARG \\
931 \end{simplenametable}
933 If this attribute is not present, or its value is
934 \DWCCnormalNAME, the convention to be used for an object of the
935 given type is assumed to be unspecified.
937 \textit{Note that \DWCCnormalNAME{} is also used as a calling convention
938 code for certain subprograms
939 (see Table \refersec{tab:callingconventioncodesforsubroutines}).}
941 \textit{If unspecified, a consumer may be able to deduce the calling
942 convention based on knowledge of the type and the ABI.}
945 \subsection{Interface Type Entries}
946 \label{chap:interfacetypeentries}
948 \textit{The \addtoindex{Java} language defines \doublequote{interface} types.
950 \addtoindexx{interface type entry}
951 in \addtoindex{Java} is similar to a \addtoindex{C++} or
952 \addtoindex{Java} class with only abstract
953 methods and constant data members.}
956 \addtoindexx{interface type entry}
957 are represented by debugging information
959 tag \DWTAGinterfacetypeTARG.
961 An interface type entry has
962 a \DWATname{} attribute,
963 \addtoindexx{name attribute}
965 value is a null\dash terminated string containing the type name
966 as it appears in the source program.
968 The members of an interface are represented by debugging
969 information entries that are owned by the interface type
970 entry and that appear in the same order as the corresponding
971 declarations in the source program.
973 \subsection{Derived or Extended Structures, Classes and Interfaces}
974 \label{chap:derivedorextendedstructsclasesandinterfaces}
976 \textit{In \addtoindex{C++}, a class (or struct)
978 \addtoindexx{derived type (C++)|see{inheritance entry}}
979 be \doublequote{derived from} or be a
980 \doublequote{subclass of} another class.
981 In \addtoindex{Java}, an interface may \doublequote{extend}
982 \addtoindexx{extended type (Java)|see{inheritance entry}}
984 \addtoindexx{implementing type (Java)|see{inheritance entry}}
985 or more other interfaces, and a class may \doublequote{extend} another
986 class and/or \doublequote{implement} one or more interfaces. All of these
987 relationships may be described using the following. Note that
988 in \addtoindex{Java},
989 the distinction between extends and implements is
990 implied by the entities at the two ends of the relationship.}
992 A class type or interface type entry that describes a
993 derived, extended or implementing class or interface owns
994 \addtoindexx{implementing type (Java)|see{inheritance entry}}
995 debugging information entries describing each of the classes
996 or interfaces it is derived from, extending or implementing,
997 respectively, ordered as they were in the source program. Each
999 \addtoindexx{inheritance entry}
1001 tag \DWTAGinheritanceTARG.
1004 An inheritance entry
1005 \addtoindexx{type attribute}
1007 \addtoindexx{inheritance entry}
1009 \DWATtype{} attribute whose value is
1010 a reference to the debugging information entry describing the
1011 class or interface from which the parent class or structure
1012 of the inheritance entry is derived, extended or implementing.
1014 An inheritance entry
1015 \addtoindexx{inheritance entry}
1016 for a class that derives from or extends
1017 \hypertarget{chap:DWATdatamemberlocationinheritedmemberlocation}{}
1018 another class or struct also has
1019 \addtoindexx{data member location attribute}
1021 \DWATdatamemberlocation{}
1022 attribute, whose value describes the location of the beginning
1023 of the inherited type relative to the beginning address of the
1024 instance of the derived class. If that value is a constant, it is the offset
1025 in bytes from the beginning of the class to the beginning of
1026 the instance of the inherited type. Otherwise, the value must be a location
1027 description. In this latter case, the beginning address of
1028 the instance of the derived class is pushed on the expression stack before
1029 the \addtoindex{location description}
1030 is evaluated and the result of the
1031 evaluation is the location of the instance of the inherited type.
1033 \textit{The interpretation of the value of this attribute for
1034 inherited types is the same as the interpretation for data
1036 (see Section \referfol{chap:datamemberentries}). }
1039 \addtoindexx{inheritance entry}
1041 \hypertarget{chap:DWATaccessibilitycppinheritedmembers}{}
1043 \addtoindexx{accessibility attribute}
1045 \DWATaccessibility{}
1047 If no accessibility attribute is present, private access
1048 is assumed for an entry of a class and public access is
1049 assumed for an entry of a struct, union or interface.
1051 If\hypertarget{chap:DWATvirtualityvirtualityofbaseclass}{}
1052 the class referenced by the
1053 \addtoindexx{inheritance entry}
1054 inheritance entry serves
1055 as a \addtoindex{C++} virtual base class, the inheritance entry has a
1056 \DWATvirtuality{} attribute.
1058 \textit{For a \addtoindex{C++} virtual base, the
1059 \addtoindex{data member location attribute}
1060 will usually consist of a non-trivial
1061 \addtoindex{location description}.}
1063 \subsection{Access Declarations}
1064 \label{chap:accessdeclarations}
1066 \textit{In \addtoindex{C++}, a derived class may contain access declarations that
1067 \addtoindexx{access declaration entry}
1068 change the accessibility of individual class members from the
1069 overall accessibility specified by the inheritance declaration.
1070 A single access declaration may refer to a set of overloaded
1073 If a derived class or structure contains access declarations,
1074 each such declaration may be represented by a debugging
1075 information entry with the tag
1076 \DWTAGaccessdeclarationTARG.
1078 such entry is a child of the class or structure type entry.
1080 An access declaration entry has
1081 a \DWATname{} attribute,
1082 \addtoindexx{name attribute}
1084 value is a null\dash terminated string representing the name used
1085 in the declaration in the source program, including any class
1086 or structure qualifiers.
1088 An access declaration entry
1089 \hypertarget{chap:DWATaccessibilitycppbaseclasses}{}
1092 \DWATaccessibility{}
1093 attribute describing the declared accessibility of the named
1098 \subsection{Friends}
1099 \label{chap:friends}
1101 Each friend\addtoindexx{friend entry}
1102 declared by a structure, union or class
1103 \hypertarget{chap:DWATfriendfriendrelationship}{}
1104 type may be represented by a debugging information entry
1105 that is a child of the structure, union or class type entry;
1106 the friend entry has the tag \DWTAGfriendTARG.
1108 A friend entry has a \DWATfriendTARG{} attribute,
1109 \addtoindexx{friend attribute} whose value is
1110 a reference to the debugging information entry describing
1111 the declaration of the friend.
1114 \subsection{Data Member Entries}
1115 \label{chap:datamemberentries}
1117 A data member (as opposed to a member function) is
1118 represented by a debugging information entry with the
1119 tag \DWTAGmemberTARG.
1121 \addtoindexx{member entry (data)}
1122 member entry for a named member has
1123 a \DWATname{} attribute
1124 \addtoindexx{name attribute}
1125 whose value is a null\dash terminated
1126 string containing the member name as it appears in the source
1127 program. If the member entry describes an
1128 \addtoindex{anonymous union},
1129 the name attribute is omitted or the value of the attribute
1130 consists of a single zero byte.
1132 The data member entry has a
1133 \DWATtype{} attribute\addtoindexx{type attribute} to denote
1134 \addtoindexx{member entry (data)} the type of that member.
1136 A data member entry may have a \DWATaccessibility{}
1137 attribute.\addtoindexx{accessibility attribute}
1138 If no accessibility attribute is present, private
1139 access is assumed for an member of a class and public access
1140 is assumed for an member of a structure, union, or interface.
1143 \hypertarget{chap:DWATmutablemutablepropertyofmemberdata}{}
1145 \addtoindexx{member entry (data)}
1147 \addtoindexx{mutable attribute}
1148 have a \DWATmutable{} attribute,
1149 which is a \livelink{chap:classflag}{flag}.
1150 This attribute indicates whether the data
1151 member was declared with the mutable storage class specifier.
1153 The beginning of a data member
1154 \addtoindexx{beginning of a data member}
1155 is described relative to
1156 \addtoindexx{beginning of an object}
1157 the beginning of the object in which it is immediately
1158 contained. In general, the beginning is characterized by
1159 both an address and a bit offset within the byte at that
1160 address. When the storage for an entity includes all of
1161 the bits in the beginning byte, the beginning bit offset is
1164 Bit offsets in DWARF use the bit numbering and direction
1165 conventions that are appropriate to the current language on
1169 \addtoindexx{member entry (data)}
1170 corresponding to a data member that is
1171 \hypertarget{chap:DWATdatabitoffsetdatamemberbitlocation}{}
1173 \hypertarget{chap:DWATdatamemberlocationdatamemberlocation}{}
1174 in a structure, union or class may have either
1175 \addtoindexx{data member location attribute}
1177 \DWATdatamemberlocation{} attribute or a
1178 \DWATdatabitoffset{}
1179 attribute. If the beginning of the data member is the same as
1180 the beginning of the containing entity then neither attribute
1184 For a \DWATdatamemberlocation{} attribute
1185 \addtoindexx{data member location attribute}
1186 there are two cases:
1187 \begin{enumerate}[1. ]
1188 \item If the value is an \livelink{chap:classconstant}{integer constant},
1190 in bytes from the beginning of the containing entity. If
1191 the beginning of the containing entity has a non-zero bit
1192 offset then the beginning of the member entry has that same
1195 \item Otherwise, the value must be a \addtoindex{location description}.
1197 this case, the beginning of the containing entity must be byte
1198 aligned. The beginning address is pushed on the DWARF stack
1199 before the \addtoindex{location} description is evaluated; the result of
1200 the evaluation is the base address of the member entry.
1202 \textit{The push on the DWARF expression stack of the base address of
1203 the containing construct is equivalent to execution of the
1204 \DWOPpushobjectaddress{} operation
1205 (see Section \refersec{chap:stackoperations});
1206 \DWOPpushobjectaddress{} therefore
1207 is not needed at the
1208 beginning of a \addtoindex{location description} for a data member.
1210 result of the evaluation is a location---either an address or
1211 the name of a register, not an offset to the member.}
1213 \textit{A \DWATdatamemberlocation{}
1215 \addtoindexx{data member location attribute}
1216 that has the form of a
1217 \addtoindex{location description} is not valid for a data member contained
1218 in an entity that is not byte aligned because DWARF operations
1219 do not allow for manipulating or computing bit offsets.}
1224 For a \DWATdatabitoffset{} attribute,
1225 the value is an \livelink{chap:classconstant}{integer constant}
1226 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1227 that specifies the number of bits
1228 from the beginning of the containing entity to the beginning
1229 of the data member. This value must be greater than or equal
1230 to zero, but is not limited to less than the number of bits
1233 If the size of a data member is not the same as the size
1234 of the type given for the data member, the data member has
1235 either a \DWATbytesize\addtoindexx{byte size attribute}
1236 or a \DWATbitsize{} attribute\addtoindexx{bit size attribute} whose
1237 \livelink{chap:classconstant}{integer constant} value
1238 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1240 of storage needed to hold the value of the data member.
1242 \textit{For showing nested and packed records and arrays,
1243 see Appendix \refersec{app:pascalexample} and
1244 \refersec{app:ccppbitfieldexamples}.}
1247 \subsection{Member Function Entries}
1248 \label{chap:memberfunctionentries}
1250 A member function is represented by a
1251 \addtoindexx{member function entry}
1252 debugging information entry
1254 \addtoindexx{subprogram entry!as member function}
1255 tag \DWTAGsubprogram.
1256 The member function entry
1257 may contain the same attributes and follows the same rules
1258 as non\dash member global subroutine entries
1259 (see Section \refersec{chap:subroutineandentrypointentries}).
1262 \textit{In particular, if the member function entry is an
1263 instantiation of a member function template, it follows the
1264 same rules as function template instantiations (see Section
1265 \refersec{chap:functiontemplateinstantiations}).
1269 \addtoindexx{accessibility attribute}
1270 member function entry may have a
1271 \DWATaccessibility{}
1272 attribute. If no accessibility attribute is present, private
1273 access is assumed for an entry of a class and public access
1274 is assumed for an entry of a structure, union or interface.
1277 \hypertarget{chap:DWATvirtualityvirtualityoffunction}{}
1278 the member function entry describes a virtual function,
1279 then that entry has a
1280 \DWATvirtuality{} attribute.
1283 \hypertarget{chap:DWATexplicitexplicitpropertyofmemberfunction}{}
1284 the member function entry describes an explicit member
1285 function, then that entry has
1286 \addtoindexx{explicit attribute}
1288 \DWATexplicit{} attribute.
1291 \hypertarget{chap:DWATvtableelemlocationvirtualfunctiontablevtableslot}{}
1292 entry for a virtual function also has a
1293 \DWATvtableelemlocation{}
1294 \addtoindexi{attribute}{vtable element location attribute} whose value contains
1295 a \addtoindex{location description}
1296 yielding the address of the slot
1297 for the function within the virtual function table for the
1298 enclosing class. The address of an object of the enclosing
1299 type is pushed onto the expression stack before the location
1300 description is evaluated.
1303 \hypertarget{chap:DWATobjectpointerobjectthisselfpointerofmemberfunction}{}
1304 the member function entry describes a non\dash static member
1305 \addtoindexx{this pointer attribute|see{object pointer attribute}}
1306 function, then that entry
1307 \addtoindexx{self pointer attribute|see{object pointer attribute}}
1309 \addtoindexx{object pointer attribute}
1310 a \DWATobjectpointer{}
1312 whose value is a \livelink{chap:classreference}{reference}
1313 to the formal parameter entry
1314 that corresponds to the object for which the function is
1315 called. The name attribute of that formal parameter is defined
1316 by the current language (for example,
1317 \texttt{this} for \addtoindex{C++} or \texttt{self}
1318 for \addtoindex{Objective C}
1319 and some other languages). That parameter
1320 also has a \DWATartificial{} attribute whose value is true.
1322 Conversely, if the member function entry describes a static
1323 member function, the entry does not have
1324 \addtoindexx{object pointer attribute}
1326 \DWATobjectpointer{}
1329 \textit{In \addtoindex{C++}, non-static member functions can have const-volatile
1330 qualifiers, which affect the type of the first formal parameter (the
1331 \doublequote{\texttt{this}}-pointer).}
1333 If the member function entry describes a non\dash static member
1334 function that has a const\dash volatile qualification, then
1335 the entry describes a non\dash static member function whose
1336 object formal parameter has a type that has an equivalent
1337 const\dash volatile qualification.
1339 \textit{Beginning in \addtoindex{C++:2011 (ISO)}, non-static member
1340 functions can also have one of the ref-qualifiers, \& and \&\&.
1341 These do not change the type of the
1342 \doublequote{\texttt{this}}-pointer, but they do affect the types of
1343 object values on which the function can be invoked.}
1346 The member function entry may have an \DWATreferenceNAME{} attribute
1347 \livetarg{chap:DWATreferenceofnonstaticmember}{}
1348 to indicate a non-static member function that can only be called on
1349 lvalue objects, or the \DWATrvaluereferenceNAME{} attribute
1350 \livetarg{chap:DWATrvaluereferenceofnonstaticmember}{}
1351 to indicate that it can only be called on prvalues and xvalues.
1353 \textit{The lvalue, prvalue and xvalue concepts are defined in the
1354 \addtoindex{C++:2011} and later standards and not repeated or
1355 considered further in DWARF.}
1357 If a subroutine entry represents the defining declaration
1358 of a member function and that definition appears outside of
1359 the body of the enclosing class declaration, the subroutine
1361 \DWATspecification{} attribute,
1362 \addtoindexx{specification attribute}
1364 a reference to the debugging information entry representing
1365 the declaration of this function member. The referenced entry
1366 will be a child of some class (or structure) type entry.
1369 Subroutine entries containing the
1370 \DWATspecification{} attribute
1371 \addtoindexx{specification attribute}
1372 do not need to duplicate information provided
1373 by the declaration entry referenced by the specification
1374 attribute. In particular, such entries do not need to contain
1375 a name attribute giving the name of the function member whose
1376 definition they represent.
1377 Similarly, such entries do not need to contain a return type
1378 attribute, unless the return type on the declaration was
1379 unspecified (for example, the declaration used the
1380 \addtoindex{C++} \autoreturntype{} specifier).
1382 \textit{In \addtoindex{C++}, a member function may be declared
1383 as deleted. This prevents the compiler from generating a default
1384 implementation of a special member function such as a
1385 constructor or destructor, and can affect overload resolution
1386 when used on other member functions.}
1388 If the member function entry has been declared as deleted,
1389 \hypertarget{chap:DWATdeleted}{}
1390 then that entry has a \DWATdeletedNAME{}\livetarg{chap:DWATdeleteddef}{}
1391 attribute.\addtoindexx{deleted attribute}
1393 \textit{In \addtoindex{C++}, a special member function may be
1394 declared as defaulted, which explicitly declares a default
1395 compiler-generated implementation of the function. The
1396 declaration may have different effects on the calling
1397 convention used for objects of its class, depending on
1398 whether the default declaration is made inside or outside the
1401 If the member function has been declared as defaulted,
1402 then the entry has a \DWATdefaultedNAME{}\livetarg{chap:DWATdefaulteddef}{}
1403 attribute\addtoindexx{defaulted attribute}
1404 whose integer constant value indicates whether, and if so,
1405 how, that member is defaulted. The possible values and
1406 their meanings are shown in
1407 Table \referfol{tab:defaultedattributevaluenames}.
1411 \setlength{\extrarowheight}{0.1cm}
1412 \begin{longtable}{l|l}
1413 \caption{Defaulted attribute names} \label{tab:defaultedattributevaluenames} \\
1414 \hline \bfseries Defaulted attribute name & \bfseries Meaning \\ \hline
1416 \bfseries Defaulted attribute name & \bfseries Meaning \\ \hline
1418 \hline \emph{Continued on next page}
1421 \DWDEFAULTEDnoTARG & Not declared default \\
1422 \DWDEFAULTEDinclassTARG & Defaulted within the class \\
1423 \DWDEFAULTEDoutofclassTARG& Defaulted outside of the class \\
1428 \textit{An artificial member function (that is, a compiler-generated
1429 copy that does not appear in the source) does not have a
1430 \DWATdefaultedNAME{} attribute.}
1433 \subsection{Class Template Instantiations}
1434 \label{chap:classtemplateinstantiations}
1436 \textit{In \addtoindex{C++} a class template is a generic definition of a class
1437 type that may be instantiated when an instance of the class
1438 is declared or defined. The generic description of the class may include
1439 parameterized types, parameterized compile-time constant
1440 values, and/or parameterized run-time constant addresses.
1441 DWARF does not represent the generic template
1442 definition, but does represent each instantiation.}
1444 A class template instantiation is represented by a
1445 debugging information entry with the tag \DWTAGclasstype,
1446 \DWTAGstructuretype{} or
1447 \DWTAGuniontype. With the following
1448 exceptions, such an entry will contain the same attributes
1449 and have the same types of child entries as would an entry
1450 for a class type defined explicitly using the instantiation
1451 types and values. The exceptions are:
1453 \begin{enumerate}[1. ]
1454 \item Template parameters are described and referenced as
1455 specified in Section \refersec{chap:templateparameters}.
1458 \item If the compiler has generated a special compilation unit to
1460 \addtoindexx{template instantiation!and special compilation unit}
1461 template instantiation and that special compilation
1462 unit has a different name from the compilation unit containing
1463 the template definition, the name attribute for the debugging
1464 information entry representing the special compilation unit
1465 should be empty or omitted.
1468 \item If the class type entry representing the template
1469 instantiation or any of its child entries contains declaration
1470 coordinate attributes, those attributes should refer to
1471 the source for the template definition, not to any source
1472 generated artificially by the compiler.
1476 \subsection{Variant Entries}
1477 \label{chap:variantentries}
1479 A variant part of a structure is represented by a debugging
1480 information entry\addtoindexx{variant part entry} with the
1481 tag \DWTAGvariantpartTARG{} and is
1482 owned by the corresponding structure type entry.
1484 If the variant part has a discriminant, the discriminant is
1485 \hypertarget{chap:DWATdiscrdiscriminantofvariantpart}{}
1487 \addtoindexx{discriminant (entry)}
1488 separate debugging information entry which
1489 is a child of the variant part entry. This entry has the form
1491 \addtoindexx{member entry (data)!as discriminant}
1492 structure data member entry. The variant part entry will
1493 \addtoindexx{discriminant attribute}
1495 \DWATdiscr{} attribute
1496 whose value is a \livelink{chap:classreference}{reference} to
1497 the member entry for the discriminant.
1499 If the variant part does not have a discriminant (tag field),
1500 the variant part entry has
1501 \addtoindexx{type attribute}
1503 \DWATtype{} attribute to represent
1506 Each variant of a particular variant part is represented by
1507 \hypertarget{chap:DWATdiscrvaluediscriminantvalue}{}
1508 a debugging information entry\addtoindexx{variant entry} with the
1509 tag \DWTAGvariantTARG{}
1510 and is a child of the variant part entry. The value that
1511 selects a given variant may be represented in one of three
1512 ways. The variant entry may have a \DWATdiscrvalue{} attribute
1513 whose value represents the discriminant value selecting
1514 this variant. The value of this
1515 attribute is encoded as an LEB128 number. The number is signed
1516 if the tag type for the variant part containing this variant
1517 is a signed type. The number is unsigned if the tag type is
1522 \hypertarget{chap:DWATdiscrlistlistofdiscriminantvalues}{}
1523 the variant entry may contain
1524 \addtoindexx{discriminant list attribute}
1526 attribute, whose value represents a list of discriminant
1527 values. This list is represented by any of the
1528 \livelink{chap:classblock}{block} forms and may contain a
1529 mixture of discriminant values and discriminant ranges.
1530 Each item on the list is prefixed with a discriminant value
1531 descriptor that determines whether the list item represents
1532 a single label or a label range. A single case label is
1533 represented as an LEB128 number as defined above for
1534 \addtoindexx{discriminant value attribute}
1537 attribute. A label range is represented by
1538 two LEB128 numbers, the low value of the range followed by the
1539 high value. Both values follow the rules for signedness just
1540 described. The discriminant value descriptor is an integer
1541 constant that may have one of the values given in
1542 Table \refersec{tab:discriminantdescriptorvalues}.
1544 \begin{simplenametable}[1.4in]{Discriminant descriptor values}{tab:discriminantdescriptorvalues}
1545 \DWDSClabelTARG{} \\
1546 \DWDSCrangeTARG{} \\
1547 \end{simplenametable}
1549 If a variant entry has neither a \DWATdiscrvalue{}
1550 attribute nor a \DWATdiscrlist{} attribute, or if it has
1551 a \DWATdiscrlist{} attribute with 0 size, the variant is a
1554 The components selected by a particular variant are represented
1555 by debugging information entries owned by the corresponding
1556 variant entry and appear in the same order as the corresponding
1557 declarations in the source program.
1560 \section{Condition Entries}
1561 \label{chap:conditionentries}
1563 \textit{COBOL has the notion of
1564 \addtoindexx{level-88 condition, COBOL}
1565 a \doublequote{level\dash 88 condition} that
1566 associates a data item, called the conditional variable, with
1567 a set of one or more constant values and/or value ranges.
1568 % Note: the {} after \textquoteright (twice) is necessary to assure a following space separator
1569 Semantically, the condition is \textquoteleft true\textquoteright{}
1571 variable's value matches any of the described constants,
1572 and the condition is \textquoteleft false\textquoteright{} otherwise.}
1574 The \DWTAGconditionTARG{}
1575 debugging information entry\addtoindexx{condition entry}
1577 logical condition that tests whether a given data item\textquoteright s
1578 value matches one of a set of constant values. If a name
1579 has been given to the condition, the condition entry has a
1580 \DWATname{} attribute
1581 \addtoindexx{name attribute}
1582 whose value is a null\dash terminated string
1583 giving the condition name as it appears in the source program.
1586 The condition entry's parent entry describes the conditional
1587 variable; normally this will be a \DWTAGvariable,
1589 \DWTAGformalparameter{} entry.
1591 \addtoindexx{formal parameter entry}
1593 entry has an array type, the condition can test any individual
1594 element, but not the array as a whole. The condition entry
1595 implicitly specifies a \doublequote{comparison type} that is the
1596 type of an array element if the parent has an array type;
1597 otherwise it is the type of the parent entry.
1600 The condition entry owns \DWTAGconstant{} and/or
1601 \DWTAGsubrangetype{} entries that describe the constant
1602 values associated with the condition. If any child entry
1603 \addtoindexx{type attribute}
1605 a \DWATtype{} attribute,
1606 that attribute should describe a type
1607 compatible with the comparison type (according to the source
1608 language); otherwise the child\textquoteright s type is the same as the
1611 \textit{For conditional variables with alphanumeric types, COBOL
1612 permits a source program to provide ranges of alphanumeric
1613 constants in the condition. Normally a subrange type entry
1614 does not describe ranges of strings; however, this can be
1615 represented using bounds attributes that are references to
1616 constant entries describing strings. A subrange type entry may
1617 refer to constant entries that are siblings of the subrange
1621 \section{Enumeration Type Entries}
1622 \label{chap:enumerationtypeentries}
1624 \textit{An \doublequote{enumeration type} is a scalar that can assume one of
1625 a fixed number of symbolic values.}
1627 An enumeration type is represented by a debugging information
1629 \DWTAGenumerationtypeTARG.
1631 If a name has been given to the enumeration type in the source
1632 program, then the corresponding enumeration type entry has
1633 a \DWATname{} attribute
1634 \addtoindexx{name attribute}
1635 whose value is a null\dash terminated
1636 string containing the enumeration type name as it appears
1637 in the source program.
1639 The \addtoindex{enumeration type entry}
1641 \addtoindexx{type attribute}
1642 a \DWATtype{} attribute
1643 which refers to the underlying data type used to implement
1644 the enumeration. The entry also may have a
1645 \DWATbytesize{} attribute whose
1646 \livelink{chap:classconstant}{integer constant} value is the number of bytes
1647 required to hold an instance of the enumeration. If no \DWATbytesize{} attribute
1648 is present, the size for holding an instance of the enumeration is given by the size
1649 of the underlying data type.
1652 If an enumeration type has type safe
1653 \addtoindexx{type safe enumeration types}
1656 \begin{enumerate}[1. ]
1657 \item Enumerators are contained in the scope of the enumeration type, and/or
1659 \item Enumerators are not implicitly converted to another type
1662 then the \addtoindex{enumeration type entry} may
1663 \addtoindexx{enum class|see{type-safe enumeration}}
1664 have a \DWATenumclass{}
1665 attribute, which is a \livelink{chap:classflag}{flag}.
1666 In a language that offers only
1667 one kind of enumeration declaration, this attribute is not
1670 \textit{In \addtoindex{C} or \addtoindex{C++},
1671 the underlying type will be the appropriate
1672 integral type determined by the compiler from the properties of
1673 \hypertarget{chap:DWATenumclasstypesafeenumerationdefinition}{}
1674 the enumeration literal values.
1675 A \addtoindex{C++} type declaration written
1676 using enum class declares a strongly typed enumeration and
1677 is represented using \DWTAGenumerationtype{}
1678 in combination with \DWATenumclass.}
1680 Each enumeration literal is represented by a debugging
1681 \addtoindexx{enumeration literal|see{enumeration entry}}
1682 information entry with the
1683 tag \DWTAGenumeratorTARG.
1685 such entry is a child of the
1686 \addtoindex{enumeration type entry}, and the
1687 enumerator entries appear in the same order as the declarations
1688 of the enumeration literals in the source program.
1691 Each \addtoindex{enumerator entry} has a \DWATname{} attribute, whose
1692 \addtoindexx{name attribute}
1693 value is a null\dash terminated string containing the name of the
1694 \hypertarget{chap:DWATconstvalueenumerationliteralvalue}{}
1695 enumeration literal as it appears in the source program.
1696 Each enumerator entry also has a
1697 \DWATconstvalue{} attribute,
1698 whose value is the actual numeric value of the enumerator as
1699 represented on the target system.
1701 If the enumeration type occurs as the description of a
1702 \addtoindexx{enumeration type entry!as array dimension}
1703 dimension of an array type, and the stride for that dimension
1704 \hypertarget{chap:DWATbytestrideenumerationstridedimensionofarraytype}{}
1705 is different than what would otherwise be determined, then
1706 \hypertarget{chap:DWATbitstrideenumerationstridedimensionofarraytype}{}
1707 the enumeration type entry has either a
1709 or \DWATbitstride{} attribute
1710 \addtoindexx{bit stride attribute}
1711 which specifies the separation
1712 between successive elements along the dimension as described
1714 Section \refersec{chap:staticanddynamicvaluesofattributes}.
1716 \DWATbitstride{} attribute
1717 \addtoindexx{bit stride attribute}
1718 is interpreted as bits and the value of
1719 \addtoindexx{byte stride attribute}
1722 attribute is interpreted as bytes.
1725 \section{Subroutine Type Entries}
1726 \label{chap:subroutinetypeentries}
1728 \textit{It is possible in \addtoindex{C}
1729 to declare pointers to subroutines
1730 that return a value of a specific type. In both
1731 \addtoindex{C} and \addtoindex{C++},
1732 it is possible to declare pointers to subroutines that not
1733 only return a value of a specific type, but accept only
1734 arguments of specific types. The type of such pointers would
1735 be described with a \doublequote{pointer to} modifier applied to a
1736 user\dash defined type.}
1739 A subroutine type is represented by a debugging information
1741 \addtoindexx{subroutine type entry}
1742 tag \DWTAGsubroutinetypeTARG.
1744 been given to the subroutine type in the source program,
1745 then the corresponding subroutine type entry has
1746 a \DWATname{} attribute
1747 \addtoindexx{name attribute}
1748 whose value is a null\dash terminated string containing
1749 the subroutine type name as it appears in the source program.
1751 If the subroutine type describes a function that returns
1752 a value, then the subroutine type entry has
1753 \addtoindexx{type attribute}
1755 attribute to denote the type returned by the subroutine. If
1756 the types of the arguments are necessary to describe the
1757 subroutine type, then the corresponding subroutine type
1758 entry owns debugging information entries that describe the
1759 arguments. These debugging information entries appear in the
1760 order that the corresponding argument types appear in the
1763 \textit{In \addtoindex{C} there
1764 is a difference between the types of functions
1765 declared using function prototype style declarations and
1766 those declared using non\dash prototype declarations.}
1769 \hypertarget{chap:DWATprototypedsubroutineprototype}{}
1770 subroutine entry declared with a function prototype style
1771 declaration may have
1772 \addtoindexx{prototyped attribute}
1774 \DWATprototyped{} attribute, which is
1775 a \livelink{chap:classflag}{flag}.
1778 Each debugging information entry owned by a subroutine
1779 type entry corresponds to either a formal parameter or the sequence of
1780 unspecified parameters of the subprogram type:
1782 \begin{enumerate}[1. ]
1783 \item A formal parameter of a parameter list (that has a
1784 specific type) is represented by a debugging information entry
1785 with the tag \DWTAGformalparameter.
1786 Each formal parameter
1788 \addtoindexx{type attribute}
1789 a \DWATtype{} attribute that refers to the type of
1790 the formal parameter.
1792 \item The unspecified parameters of a variable parameter list
1793 \addtoindexx{unspecified parameters entry}
1795 \addtoindexx{\texttt{...} parameters|see{unspecified parameters entry}}
1796 represented by a debugging information entry with the
1797 tag \DWTAGunspecifiedparameters.
1800 \textit{\addtoindex{C++} const-volatile qualifiers are encoded as
1801 part of the type of the
1802 \doublequote{\texttt{this}}-pointer.
1803 \addtoindex{C++:2011 (ISO)} reference and rvalue-reference qualifiers are encoded using
1804 the \DWATreference{} and \DWATrvaluereference{} attributes, respectively.
1805 See also Section \refersec{chap:memberfunctionentries}.}
1808 A subroutine type entry may have the \DWATreference{} or
1809 \DWATrvaluereference{} attribute to indicate that it describes the
1810 type of a member function with reference or rvalue-reference
1811 semantics, respectively.
1814 \section{String Type Entries}
1815 \label{chap:stringtypeentries}
1817 \textit{A \doublequote{string} is a sequence of characters that have specific
1818 \addtoindexx{string type entry}
1819 semantics and operations that distinguish them from arrays of
1821 \addtoindex{Fortran} is one of the languages that has a string
1822 type. Note that \doublequote{string} in this context refers to a target
1823 machine concept, not the class string as used in this document
1824 (except for the name attribute).}
1826 A string type is represented by a debugging information entry
1827 with the tag \DWTAGstringtypeTARG.
1828 If a name has been given to
1829 the string type in the source program, then the corresponding
1830 string type entry has a
1831 \DWATname{} attribute
1832 \addtoindexx{name attribute}
1834 a null\dash terminated string containing the string type name as
1835 it appears in the source program.
1837 A string type entry may have a \DWATtype{}
1838 \livetargi{char:DWAATtypeofstringtype}{attribute}{type attribute!of string type entry}
1839 describing how each character is encoded and is to be interpreted.
1840 The value of this attribute is a \CLASSreference{} to a
1841 \DWTAGbasetype{} base type entry. If the attribute is absent,
1842 then the character is encoded using the system default.
1845 \addtoindex{Fortran 2003} language standard allows string
1846 types that are composed of different types of (same sized) characters.
1847 While there is no standard list of character kinds, the kinds
1848 \texttt{ASCII}\index{ASCII@\texttt{ASCII} (Fortran string kind)} (see \DWATEASCII),
1849 \texttt{ISO\_10646}\index{ISO\_10646@\texttt{ISO\_10646} (Fortran string kind)}
1850 \addtoindexx{ISO 10646 character set standard}
1852 \texttt{DEFAULT}\index{DEFAULT@\texttt{DEFAULT} (Fortran string kind)}
1856 The string type entry may have a
1857 \DWATbytesize{} attribute or
1859 attribute, whose value
1860 (see Section \refersec{chap:byteandbitsizes})
1862 storage needed to hold a value of the string type.
1865 \hypertarget{chap:DWATstringlengthstringlengthofstringtype}{}
1866 string type entry may also have a
1867 \DWATstringlength{} attribute
1869 \addtoindexx{string length attribute}
1871 \addtoindex{location description} yielding the location
1872 where the length of the string is stored in the program.
1873 If the \DWATstringlength{} attribute is not present, the size
1874 of the string is assumed to be the amount of storage that is
1875 allocated for the string (as specified by the \DWATbytesize{}
1876 or \DWATbitsize{} attribute).
1878 The string type entry may also have a
1879 \DWATstringlengthbytesizeNAME{} or
1880 \DWATstringlengthbitsizeNAME{} attribute,
1881 \addtoindexx{string length size attribute}
1882 \addtoindexx{string length attribute!size of length data}
1883 whose value (see Section \refersec{chap:byteandbitsizes})
1884 is the size of the data to be retrieved from the location
1885 referenced by the \DWATstringlength{} attribute. If no byte or bit
1886 size attribute is present, the size of the data to be retrieved
1888 \addtoindex{size of an address} on the target machine.
1891 \addtoindexx{DWARF Version 5} % Avoid italics
1892 \textit{Prior to DWARF Version 5, the meaning of a
1893 \DWATbytesize{} attribute depended on the presence of the
1894 \DWATstringlength{} attribute:
1896 \item If \DWATstringlength{} was present, \DWATbytesize{}
1897 specified the size of the length data to be retrieved
1898 from the location specified by the \DWATstringlength{} attribute.
1899 \item If \DWATstringlength{} was not present, \DWATbytesize{}
1900 specified the amount of storage allocated for objects
1903 In \DWARFVersionV{}, \DWATbytesize{} always specifies the amount of storage
1904 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 \DWTAGsettypeTARG.
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 \DWATname{} 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 \DWATtype{} 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 \DWATbytesize{} attribute, or
1934 \DWATbitsize{} 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. Objects of the subrange type can represent only a contiguous
1944 subset (range) of values from the type on which the subrange is defined.
1945 Subrange types may also be used to represent the bounds of array dimensions.}
1947 A subrange type is represented by a debugging information
1949 \DWTAGsubrangetypeTARG.\addtoindexx{subrange type entry}
1950 If a name has been given to the subrange type, then the
1951 subrange type entry has a
1952 \DWATname{} attribute\addtoindexx{name attribute}
1953 whose value is a null-terminated
1954 string containing the subrange type name as it appears in
1957 The tag \DWTAGgenericsubrange{}
1958 is used to describe arrays with a dynamic rank. See Section
1959 \refersec{chap:DWTAGgenericsubrange}.
1961 The subrange entry may have a
1962 \DWATtype{} attribute\addtoindexx{type attribute} to describe
1963 the type of object, called the basis type, of whose values
1964 this subrange is a subset.
1966 If the amount of storage allocated to hold each element of an
1967 object of the given subrange type is different from the amount
1968 of storage that is normally allocated to hold an individual
1969 object of the indicated element type, then the subrange
1971 \DWATbytesize{} attribute or
1973 attribute, whose value
1974 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1975 is the amount of storage needed to hold a value of the subrange type.
1978 \hypertarget{chap:DWATthreadsscaledupcarrayboundthreadsscalfactor}{}
1979 subrange entry may have a
1980 \DWATthreadsscaled{} attribute\addtoindexx{threads scaled attribute},
1981 which is a \livelink{chap:classflag}{flag}.
1982 If present, this attribute indicates whether
1983 this subrange represents a \addtoindex{UPC} array bound which is scaled
1984 by the runtime \texttt{THREADS} value (the number of \addtoindex{UPC} threads in
1985 this execution of the program).
1987 \textit{This allows the representation of a \addtoindex{UPC} shared array such as}
1989 \begin{lstlisting}[numbers=none]
1990 int shared foo[34*THREADS][10][20];
1995 \hypertarget{chap:DWATlowerboundlowerboundofsubrange}{}
1997 \hypertarget{chap:DWATupperboundupperboundofsubrange}{}
1998 entry may have the attributes
2000 \addtoindexx{lower bound attribute}
2001 and \DWATupperbound{}
2002 \addtoindexx{upper bound attribute} to specify, respectively, the lower
2003 and upper bound values of the subrange. The
2006 \hypertarget{chap:DWATcountelementsofsubrangetype}{}
2008 % FIXME: The following matches DWARF4: odd as there is no default count.
2009 \addtoindexx{count attribute!default}
2011 \addtoindexx{count attribute}
2013 \DWATcount{} attribute,
2015 value describes the number of elements in the subrange rather
2016 than the value of the last element. The value of each of
2017 these attributes is determined as described in
2018 Section \refersec{chap:staticanddynamicvaluesofattributes}.
2020 If the lower bound value is missing, the value is assumed to
2021 be a language\dash dependent default constant as defined in
2022 Table \refersec{tab:languageencodings}.
2023 \addtoindexx{lower bound attribute!default}
2025 If the upper bound and count are missing, then the upper bound value is
2026 \textit{unknown}.\addtoindexx{upper bound attribute!default unknown}
2028 If the subrange entry has no type attribute describing the
2029 basis type, the basis type is determined as follows:
2030 \begin{enumerate}[1. ]
2032 If there is a lower bound attribute that references an object,
2033 the basis type is assumed to be the same as the type of that object.
2035 Otherwise, if there is an upper bound or count attribute that references
2036 an object, the basis type is assumed to be the same as the type of that object.
2038 Otherwise, the type is
2039 assumed to be the same type, in the source language of the
2040 compilation unit containing the subrange entry, as a signed
2041 integer with the same size as an address on the target machine.
2044 If the subrange type occurs as the description of a dimension
2045 of an array type, and the stride for that dimension is
2046 \hypertarget{chap:DWATbytestridesubrangestridedimensionofarraytype}{}
2047 different than what would otherwise be determined, then
2048 \hypertarget{chap:DWATbitstridesubrangestridedimensionofarraytype}{}
2049 the subrange type entry has either
2050 \addtoindexx{byte stride attribute}
2052 \DWATbytestride{} or
2053 \DWATbitstride{} attribute
2054 \addtoindexx{bit stride attribute}
2055 which specifies the separation
2056 between successive elements along the dimension as described
2058 Section \refersec{chap:byteandbitsizes}.
2060 \textit{Note that the stride can be negative.}
2063 \section{Pointer to Member Type Entries}
2064 \label{chap:pointertomembertypeentries}
2066 \textit{In \addtoindex{C++}, a
2067 pointer to a data or function member of a class or
2068 structure is a unique type.}
2070 A debugging information entry representing the type of an
2071 object that is a pointer to a structure or class member has
2072 the tag \DWTAGptrtomembertypeTARG.
2074 If the \addtoindex{pointer to member type} has a name, the
2075 \addtoindexx{pointer to member type entry}
2076 pointer to member entry has a
2077 \DWATname{} attribute,
2078 \addtoindexx{name attribute}
2080 null\dash terminated string containing the type name as it appears
2081 in the source program.
2083 The \addtoindex{pointer to member} entry
2085 \addtoindexx{type attribute}
2086 a \DWATtype{} attribute to
2087 describe the type of the class or structure member to which
2088 objects of this type may point.
2090 The \addtoindexx{pointer to member} entry also
2091 \hypertarget{chap:DWATcontainingtypecontainingtypeofpointertomembertype}{}
2093 \DWATcontainingtype{}
2094 attribute, whose value is a \livelink{chap:classreference}{reference} to a debugging
2095 information entry for the class or structure to whose members
2096 objects of this type may point.
2098 The \addtoindex{pointer to member entry}
2099 \hypertarget{chap:DWATuselocationmemberlocationforpointertomembertype}{}
2101 \DWATuselocation{} attribute
2102 \addtoindexx{use location attribute}
2104 \addtoindex{location description} that computes the
2105 address of the member of the class to which the pointer to
2106 member entry points.
2108 \textit{The method used to find the address of a given member of a
2109 class or structure is common to any instance of that class
2110 or structure and to any instance of the pointer or member
2111 type. The method is thus associated with the type entry,
2112 rather than with each instance of the type.}
2114 The \DWATuselocation{} description is used in conjunction
2115 with the location descriptions for a particular object of the
2116 given \addtoindex{pointer to member type} and for a particular structure or
2117 class instance. The \DWATuselocation{}
2118 attribute expects two values to be
2119 \addtoindexi{pushed}{address!implicit push for member operator}
2120 onto the DWARF expression stack before
2121 the \DWATuselocation{} description is evaluated.
2123 \addtoindexi{pushed}{address!implicit push for member operator}
2124 is the value of the \addtoindex{pointer to member} object
2125 itself. The second value
2126 \addtoindexi{pushed}{address!implicit push for member operator}
2127 is the base address of the
2128 entire structure or union instance containing the member
2129 whose address is being calculated.
2132 \textit{For an expression such as}
2134 \begin{lstlisting}[numbers=none]
2137 \textit{where \texttt{mbr\_ptr} has some \addtoindex{pointer to member type}, a debugger should:}
2138 \begin{enumerate}[1. ]
2139 \item \textit{Push the value of \texttt{mbr\_ptr} onto the DWARF expression stack.}
2140 \item \textit{Push the base address of \texttt{object} onto the DWARF expression stack.}
2141 \item \textit{Evaluate the \DWATuselocation{} description
2142 given in the type of \texttt{mbr\_ptr}.}
2146 \section{File Type Entries}
2147 \label{chap:filetypeentries}
2149 \textit{Some languages, such as \addtoindex{Pascal},
2150 provide a data type to represent
2153 A file type is represented by a debugging information entry
2155 \addtoindexx{file type entry}
2158 If the file type has a name,
2159 the file type entry has a \DWATname{} attribute,
2160 \addtoindexx{name attribute}
2162 is a null\dash terminated string containing the type name as it
2163 appears in the source program.
2165 The file type entry has
2166 \addtoindexx{type attribute}
2167 a \DWATtype{} attribute describing
2168 the type of the objects contained in the file.
2170 The file type entry also has a
2171 \DWATbytesize{}\addtoindexx{byte size attribute} or
2172 \DWATbitsize{}\addtoindexx{bit size attribute} attribute, whose value
2173 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
2174 is the amount of storage need to hold a value of the file type.
2176 \section{Dynamic Type Entries}
2177 \label{chap:dynamictypeentries}
2178 \textit{Some languages such as
2179 \addtoindex{Fortran 90}, provide types whose values
2180 may be dynamically allocated or associated with a variable
2181 under explicit program control. However, unlike the
2182 pointer type in \addtoindex{C} or
2183 \addtoindex{C++}, the indirection involved in accessing
2184 the value of the variable is generally implicit, that is, not
2185 indicated as part of the program source.}
2187 A dynamic type entry is used to declare a dynamic type that is
2188 \doublequote{just like} another non-dynamic type without needing to
2189 replicate the full description of that other type.
2191 A dynamic type is represented by a debugging information entry
2192 with the tag \DWTAGdynamictypeTARG. If a name has been given to the
2193 dynamic type, then the dynamic type has a \DWATname{} attribute
2194 whose value is a null-terminated string containing the dynamic
2195 type name as it appears in the source.
2197 A dynamic type entry has a \DWATtype{} attribute whose value is a
2198 reference to the type of the entities that are dynamically allocated.
2200 A dynamic type entry also has a \DWATdatalocation, and may also
2201 have \DWATallocated{} and/or \DWATassociated{} attributes as
2202 described in Section \refersec{chap:dynamicpropertiesoftypes}.
2203 A \DWATdatalocation, \DWATallocated{} or \DWATassociated{} attribute
2204 may not occur on a dynamic type entry if the same kind of attribute
2205 already occurs on the type referenced by the \DWATtype{} attribute.
2209 \section{Template Alias Entries}
2210 \label{chap:templatealiasentries}
2212 \textit{In \addtoindex{C++}, a template alias is a form of typedef that has template
2213 parameters. DWARF does not represent the template alias definition
2214 but does represent instantiations of the alias.}
2216 A type named using a template alias is represented
2217 by a debugging information entry
2218 \addtoindexx{template alias entry}
2220 \DWTAGtemplatealiasTARG.
2221 The template alias entry has a
2222 \DWATname{} attribute
2223 \addtoindexx{name attribute}
2224 whose value is a null\dash terminated string
2225 containing the name of the template alias as it appears in
2227 The template alias entry has child entries describing the template
2228 actual parameters (see Section \refersec{chap:templateparameters}).
2231 \section{Dynamic Properties of Types}
2232 \label{chap:dynamicpropertiesoftypes}
2233 \textit{The \DWATdatalocation, \DWATallocated{} and \DWATassociated{}
2234 attributes described in this section are motivated for use with
2235 \DWTAGdynamictype{} entries but can be used for any other type as well.}
2238 \subsection{Data Location}
2239 \label{chap:datalocation}
2241 \textit{Some languages may represent objects using descriptors to hold
2242 information, including a location and/or run\dash time parameters,
2243 about the data that represents the value for that object.}
2245 \hypertarget{chap:DWATdatalocationindirectiontoactualdata}{}
2246 The \DWATdatalocation{}
2247 attribute may be used with any
2248 \addtoindexx{data location attribute}
2249 type that provides one or more levels of
2250 \addtoindexx{hidden indirection|see{data location attribute}}
2252 and/or run\dash time parameters in its representation. Its value
2253 is a \addtoindex{location description}.
2254 The result of evaluating this
2255 description yields the location of the data for an object.
2256 When this attribute is omitted, the address of the data is
2257 the same as the address of the object.
2260 \textit{This location description will typically begin with
2261 \DWOPpushobjectaddress{}
2262 which loads the address of the
2263 object which can then serve as a descriptor in subsequent
2264 calculation. For an example using
2266 for a \addtoindex{Fortran 90 array}, see
2267 Appendix \refersec{app:fortranarrayexample}.}
2269 \subsection{Allocation and Association Status}
2270 \label{chap:allocationandassociationstatus}
2272 \textit{Some languages, such as \addtoindex{Fortran 90},
2273 provide types whose values
2274 may be dynamically allocated or associated with a variable
2275 under explicit program control.}
2277 \hypertarget{chap:DWATallocatedallocationstatusoftypes}{}
2278 The \DWATallocated{} attribute\addtoindexx{allocated attribute}
2279 may be used with any
2280 type for which objects of the type can be explicitly allocated
2281 and deallocated. The presence of the attribute indicates that
2282 objects of the type are allocatable and deallocatable. The
2283 integer value of the attribute (see below) specifies whether
2284 an object of the type is
2285 currently allocated or not.
2288 \hypertarget{chap:DWATassociatedassociationstatusoftypes}{}
2290 \DWATassociated{} attribute
2292 \addtoindexx{associated attribute}
2293 optionally be used with
2294 any type for which objects of the type can be dynamically
2295 associated with other objects. The presence of the attribute
2296 indicates that objects of the type can be associated. The
2297 integer value of the attribute (see below) indicates whether
2298 an object of the type is currently associated or not.
2300 The value of these attributes is determined as described in
2301 Section \refersec{chap:staticanddynamicvaluesofattributes}.
2303 A non\dash zero value is interpreted as allocated or associated,
2304 and zero is interpreted as not allocated or not associated.
2306 \textit{For \addtoindex{Fortran 90},
2307 if the \DWATassociated{}
2308 attribute is present,
2309 the type has the POINTER property where either the parent
2310 variable is never associated with a dynamic object or the
2311 implementation does not track whether the associated object
2312 is static or dynamic. If the \DWATallocated{} attribute is
2313 present and the \DWATassociated{} attribute is not, the type
2314 has the ALLOCATABLE property. If both attributes are present,
2315 then the type should be assumed to have the POINTER property
2316 (and not ALLOCATABLE); the \DWATallocated{} attribute may then
2317 be used to indicate that the association status of the object
2318 resulted from execution of an ALLOCATE statement rather than
2319 pointer assignment.}
2321 \textit{For examples using
2322 \DWATallocated{} for \addtoindex{Ada} and
2323 \addtoindex{Fortran 90}
2325 see Appendix \refersec{app:aggregateexamples}.}
2327 \subsection{Array Rank}
2328 \label{chap:DWATrank}
2329 \addtoindexx{array!assumed-rank}
2330 \addtoindexx{assumed-rank array|see{array, assumed-rank}}
2331 \textit{The Fortran language supports \doublequote{assumed-rank arrays}. The
2332 rank (the number of dimensions) of an assumed-rank array is unknown
2333 at compile time. The Fortran runtime stores the rank in an array
2337 \hypertarget{chap:DWATrankofdynamicarray}{\DWATrankINDX}
2338 attribute indicates that an array's rank
2339 (number of dimensions) is dynamic, and therefore unknown at compile
2340 time. The value of the \DWATrankNAME{} attribute is either an integer constant
2341 or a DWARF expression whose evaluation yields the dynamic rank.
2343 The bounds of an array with dynamic rank are described using a
2344 \DWTAGgenericsubrange{} entry, which
2345 is the dynamic rank array equivalent of
2346 \DWTAGsubrangetype. The
2347 difference is that a \DWTAGgenericsubrange{} entry contains generic
2348 lower/upper bound and stride expressions that need to be evaluated for
2349 each dimension. Before any expression contained in a
2350 \DWTAGgenericsubrange{} can be evaluated, the dimension for which the
2351 expression is to be evaluated needs to be pushed onto the stack. The
2352 expression will use it to find the offset of the respective field in
2353 the array descriptor metadata.
2355 \textit{A producer is free to choose any layout for the
2356 array descriptor. In particular, the upper and lower bounds and
2357 stride values do not need to be bundled into a structure or record,
2358 but could be laid end to end in the containing descriptor, pointed
2359 to by the descriptor, or even allocated independently of the
2362 Dimensions are enumerated $0$ to $\mathit{rank}-1$ in source program
2365 \textit{For an example in Fortran 2008, see
2366 Section~\refersec{app:assumedrankexample}.}