2 \label{chap:typeentries}
3 This section presents the debugging information entries
4 that describe program types: base types, modified types and
5 user\dash defined types.
7 If the scope of the declaration of a named type begins after
8 \hypertarget{chap:DWATstartscopetypedeclaration}
9 the low pc value for the scope most closely enclosing the
10 declaration, the declaration may have a
11 \livelink{chap:DWATstartscope}{DW\_AT\_start\_scope}
12 attribute as described for objects in
13 Section \refersec{chap:dataobjectentries}.
15 \section{Base Type Entries}
16 \label{chap:basetypeentries}
18 \textit{A base type is a data type that is not defined in terms of
20 \addtoindexx{fundamental type|see{base type entry}}
21 Each programming language has a set of base
22 types that are considered to be built into that language.}
24 A base type is represented by a debugging information entry
26 \livetarg{chap:DWTAGbasetype}{DW\_TAG\_base\_type}.
28 A \addtoindex{base type entry}
29 has a \livelink{chap:DWATname}{DW\_AT\_name} attribute
31 \addtoindexx{name attribute}
33 a null\dash terminated string containing the name of the base type
34 as recognized by the programming language of the compilation
35 unit containing the base type entry.
38 \addtoindexx{encoding attribute}
39 a \livelink{chap:DWATencoding}{DW\_AT\_encoding} attribute describing
40 how the base type is encoded and is to be interpreted. The
41 value of this attribute is an
42 \livelink{chap:classconstant}{integer constant}. The set of
43 values and their meanings for the
44 \livelink{chap:DWATencoding}{DW\_AT\_encoding} attribute
46 Table \refersec{tab:encodingattributevalues}
50 may have a \livelink{chap:DWATendianity}{DW\_AT\_endianity} attribute
51 \addtoindexx{endianity attribute}
53 Section \refersec{chap:dataobjectentries}.
54 If omitted, the encoding assumes the representation that
55 is the default for the target architecture.
58 \hypertarget{chap:DWATbytesizedataobjectordatatypesize}
59 either a \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size} attribute
60 \hypertarget{chap:DWATbitsizebasetypebitsize}
61 or a \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} attribute
62 \addtoindexx{bit size attribute}
63 whose \livelink{chap:classconstant}{integer constant} value
64 (see Section \refersec{chap:byteandbitsizes})
65 is the amount of storage needed to hold
69 \textit{For example, the
70 \addtoindex{C} type \texttt{int} on a machine that uses 32\dash bit
71 integers is represented by a base type entry with a name
72 attribute whose value is \doublequote{int}, an encoding attribute
73 whose value is \livelink{chap:DWATEsigned}{DW\_ATE\_signed}
74 and a byte size attribute whose value is 4.}
76 If the value of an object of the given type does not fully
77 occupy the storage described by a byte size attribute,
78 \hypertarget{chap:DWATdatabitoffsetbasetypebitlocation}
79 the base type entry may also have
80 \addtoindexx{bit size attribute}
82 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} and a
83 \livelink{chap:DWATdatabitoffset}{DW\_AT\_data\_bit\_offset} attribute,
85 \addtoindexx{data bit offset attribute}
87 \livelink{chap:classconstant}{integer constant} values
88 (see Section \refersec{chap:staticanddynamicvaluesofattributes}).
90 attribute describes the actual size in bits used to represent
91 values of the given type. The data bit offset attribute is the
92 offset in bits from the beginning of the containing storage to
93 the beginning of the value. Bits that are part of the offset
94 are padding. The data bit offset uses the bit numbering and
95 direction conventions that are appropriate to the current
97 target system to locate the beginning of the storage and
98 value. If this attribute is omitted a default data bit offset
102 \livelink{chap:DWATdatabitoffset}{DW\_AT\_data\_bit\_offset}
104 \addtoindexx{bit offset attribute}
106 \addtoindexx{data bit offset attribute}
108 \addtoindex{DWARF Version 4} and
109 is also used for bit field members
110 (see Section \refersec{chap:datamemberentries}).
112 \hypertarget{chap:DWATbitoffsetbasetypebitlocation}
113 replaces the attribute
114 \livelink{chap:DWATbitoffset}{DW\_AT\_bit\_offset}
116 \addtoindexx{bit offset attribute (V3)}
117 types as defined in DWARF V3 and earlier. The earlier attribute
118 is defined in a manner suitable for bit field members on
119 big\dash endian architectures but which is wasteful for use on
120 little\dash endian architectures.}
122 \textit{The attribute \livelink{chap:DWATbitoffset}{DW\_AT\_bit\_offset} is
124 \addtoindex{DWARF Version 4}
125 for use in base types, but implementations may continue to
126 support its use for compatibility.}
129 \addtoindex{DWARF Version 3}
130 definition of these attributes is as follows.}
131 \begin{myindentpara}{1cm}
132 \textit{A base type entry has a \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size}
133 attribute, whose value
134 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
135 is the size in bytes of the storage unit
136 used to represent an object of the given type.}
138 \textit{If the value of an object of the given type does not fully
139 occupy the storage unit described by the byte size attribute,
140 the base type entry may have a
141 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} attribute
142 \addtoindexx{bit size attribute (V3)}
144 \livelink{chap:DWATbitoffset}{DW\_AT\_bit\_offset} attribute, both of whose values
145 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
146 are integers. The bit size attribute describes the actual
147 size in bits used to represent a value of the given type.
148 The bit offset attribute describes the offset in bits of the
149 high order bit of a value of the given type from the high
150 order bit of the storage unit used to contain that value.}
156 \addtoindexx{DWARF Version 3}
158 \addtoindexx{DWARF Version 4} and 4, note that DWARF V4
159 defines the following combinations of attributes:}
162 \item \textit{\livelink{chap:DWATbytesize}{DW\_AT\_byte\_size}}
163 \item \textit{\livelink{chap:DWATbitsize}{DW\_AT\_bit\_size}}
164 \item \textit{\livelink{chap:DWATbytesize}{DW\_AT\_byte\_size},
165 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size}
166 and optionally \livelink{chap:DWATdatabitoffset}{DW\_AT\_data\_bit\_offset}}
168 \textit{DWARF V3 defines the following combinations:}
169 \addtoindexx{DWARF Version 3}
170 % FIXME: the figure below interferes with the following
171 % bullet list, which looks horrible as a result.
173 \item \textit{\livelink{chap:DWATbytesize}{DW\_AT\_byte\_size}}
174 \item \textit{\livelink{chap:DWATbytesize}{DW\_AT\_byte\_size},
175 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} and
176 \livelink{chap:DWATbitoffset}{DW\_AT\_bit\_offset}}
180 \caption{Encoding attribute values}
181 \label{tab:encodingattributevalues}
183 \begin{tabular}{l|p{8cm}}
185 Name&Meaning\\ \hline
186 \livetarg{chap:DWATEaddress}{DW\_ATE\_address} & linear machine address (for segmented\break
188 Section \refersec{chap:segmentedaddresses}) \\
189 \livetarg{chap:DWATEboolean}{DW\_ATE\_boolean}& true or false \\
191 \livetarg{chap:DWATEcomplexfloat}{DW\_ATE\_complex\_float}& complex binary
192 floating\dash point number \\
193 \livetarg{chap:DWATEfloat}{DW\_ATE\_float} & binary floating\dash point number \\
194 \livetarg{chap:DWATEimaginaryfloat}{DW\_ATE\_imaginary\_float}& imaginary binary
195 floating\dash point number \\
196 \livetarg{chap:DWATEsigned}{DW\_ATE\_signed}& signed binary integer \\
197 \livetarg{chap:DWATEsignedchar}{DW\_ATE\_signed\_char}& signed character \\
198 \livetarg{chap:DWATEunsigned}{DW\_ATE\_unsigned} & unsigned binary integer \\
199 \livetarg{chap:DWATEunsignedchar}{DW\_ATE\_unsigned\_char} & unsigned character \\
200 \livetarg{chap:DWATEpackeddecimal}{DW\_ATE\_packed\_decimal} & packed decimal \\
201 \livetarg{chap:DWATEnumericstring}{DW\_ATE\_numeric\_string}& numeric string \\
202 \livetarg{chap:DWATEedited}{DW\_ATE\_edited} & edited string \\
203 \livetarg{chap:DWATEsignedfixed}{DW\_ATE\_signed\_fixed} & signed fixed\dash point scaled integer \\
204 \livetarg{chap:DWATEunsignedfixed}{DW\_ATE\_unsigned\_fixed}& unsigned fixed\dash point scaled integer \\
205 \livetarg{chap:DWATEdecimalfloat}{DW\_ATE\_decimal\_float} & decimal floating\dash point number \\
206 \livetarg{chap:DWATEUTF}{DW\_ATE\_UTF} & \addtoindex{Unicode} character \\
211 \textit{The \livelink{chap:DWATEdecimalfloat}{DW\_ATE\_decimal\_float} encoding is intended for
212 floating\dash point representations that have a power\dash of\dash ten
213 exponent, such as that specified in IEEE 754R.}
215 \textit{The \livelink{chap:DWATEUTF}{DW\_ATE\_UTF} encoding is intended for \addtoindex{Unicode}
216 string encodings (see the Universal Character Set standard,
217 ISO/IEC 10646\dash 1:1993). For example, the
218 \addtoindex{C++} type char16\_t is
219 represented by a base type entry with a name attribute whose
220 value is \doublequote{char16\_t}, an encoding attribute whose value
221 is \livelink{chap:DWATEUTF}{DW\_ATE\_UTF} and a byte size attribute whose value is 2.}
224 \livelink{chap:DWATEpackeddecimal}{DW\_ATE\_packed\_decimal}
226 \livelink{chap:DWATEnumericstring}{DW\_ATE\_numeric\_string}
228 represent packed and unpacked decimal string numeric data
229 types, respectively, either of which may be
231 \addtoindexx{decimal scale attribute}
233 \addtoindexx{decimal sign attribute}
235 \addtoindexx{digit count attribute}
237 \hypertarget{chap:DWATdecimalsigndecimalsignrepresentation}
239 \hypertarget{chap:DWATdigitcountdigitcountforpackeddecimalornumericstringtype}
240 base types are used in combination with
241 \livelink{chap:DWATdecimalsign}{DW\_AT\_decimal\_sign},
242 \livelink{chap:DWATdigitcount}{DW\_AT\_digit\_count} and
243 \livelink{chap:DWATdecimalscale}{DW\_AT\_decimal\_scale}
246 A \livelink{chap:DWATdecimalsign}{DW\_AT\_decimal\_sign} attribute
247 \addtoindexx{decimal sign attribute}
248 is an \livelink{chap:classconstant}{integer constant} that
249 conveys the representation of the sign of the decimal type
250 (see Table \refersec{tab:decimalsignattributevalues}).
251 Its \livelink{chap:classconstant}{integer constant} value is interpreted to
252 mean that the type has a leading overpunch, trailing overpunch,
253 leading separate or trailing separate sign representation or,
254 alternatively, no sign at all.
257 \caption{Decimal sign attribute values}
258 \label{tab:decimalsignattributevalues}
260 \begin{tabular}{l|p{9cm}}
264 \livetarg{chap:DWDSunsigned}{DW\_DS\_unsigned} & Unsigned \\
265 \livetarg{chap:DWDSleadingoverpunch}{DW\_DS\_leading\_overpunch} & Sign
266 is encoded in the most significant digit in a target\dash dependent manner \\
267 \livetarg{chap:DWDStrailingoverpunch}{DW\_DS\_trailing\_overpunch} & Sign
268 is encoded in the least significant digit in a target\dash dependent manner \\
269 \livetarg{chap:DWDSleadingseparate}{DW\_DS\_leading\_separate}
270 & Decimal type: Sign is a \doublequote{+} or \doublequote{-} character
271 to the left of the most significant digit. \\
272 \livetarg{chap:DWDStrailingseparate}{DW\_DS\_trailing\_separate}
273 & Decimal type: Sign is a \doublequote{+} or \doublequote{-} character
274 to the right of the least significant digit. \\
275 &Packed decimal type: Least significant nibble contains
276 a target\dash dependent value
277 indicating positive or negative. \\
283 \livelink{chap:DWATdigitcount}{DW\_AT\_digit\_count}
285 \addtoindexx{digit count attribute}
286 is an \livelink{chap:classconstant}{integer constant}
287 value that represents the number of digits in an instance of
290 \hypertarget{chap:DWATdecimalscaledecimalscalefactor}
291 The \livelink{chap:DWATdecimalscale}{DW\_AT\_decimal\_scale}
293 \addtoindexx{decimal scale attribute}
294 is an integer constant value
295 that represents the exponent of the base ten scale factor to
296 be applied to an instance of the type. A scale of zero puts the
297 decimal point immediately to the right of the least significant
298 digit. Positive scale moves the decimal point to the right
299 and implies that additional zero digits on the right are not
300 stored in an instance of the type. Negative scale moves the
301 decimal point to the left; if the absolute value of the scale
302 is larger than the digit count, this implies additional zero
303 digits on the left are not stored in an instance of the type.
305 The \livelink{chap:DWATEedited}{DW\_ATE\_edited}
307 \hypertarget{chap:DWATpicturestringpicturestringfornumericstringtype}
308 type is used to represent an edited
309 numeric or alphanumeric data type. It is used in combination
310 with a \livelink{chap:DWATpicturestring}{DW\_AT\_picture\_string} attribute whose value is a
311 null\dash terminated string containing the target\dash dependent picture
312 string associated with the type.
314 If the edited base type entry describes an edited numeric
315 data type, the edited type entry has a \livelink{chap:DWATdigitcount}{DW\_AT\_digit\_count} and a
316 \livelink{chap:DWATdecimalscale}{DW\_AT\_decimal\_scale} attribute.
317 \addtoindexx{decimal scale attribute}
318 These attributes have the same
319 interpretation as described for the
320 \livelink{chap:DWATEpackeddecimal}{DW\_ATE\_packed\_decimal} and
321 \livelink{chap:DWATEnumericstring}{DW\_ATE\_numeric\_string} base
322 types. If the edited type entry
323 describes an edited alphanumeric data type, the edited type
324 entry does not have these attributes.
327 \textit{The presence or absence of the \livelink{chap:DWATdigitcount}{DW\_AT\_digit\_count} and
328 \livelink{chap:DWATdecimalscale}{DW\_AT\_decimal\_scale} attributes
329 \addtoindexx{decimal scale attribute}
330 allows a debugger to easily
331 distinguish edited numeric from edited alphanumeric, although
332 in principle the digit count and scale are derivable by
333 interpreting the picture string.}
335 The \livelink{chap:DWATEsignedfixed}{DW\_ATE\_signed\_fixed} and \livelink{chap:DWATEunsignedfixed}{DW\_ATE\_unsigned\_fixed} entries
336 describe signed and unsigned fixed\dash point binary data types,
339 The fixed binary type entries have
340 \addtoindexx{digit count attribute}
342 \livelink{chap:DWATdigitcount}{DW\_AT\_digit\_count}
343 attribute with the same interpretation as described for the
344 \livelink{chap:DWATEpackeddecimal}{DW\_ATE\_packed\_decimal} and \livelink{chap:DWATEnumericstring}{DW\_ATE\_numeric\_string} base types.
346 For a data type with a decimal scale factor, the fixed binary
348 \livelink{chap:DWATdecimalscale}{DW\_AT\_decimal\_scale} attribute
349 \addtoindexx{decimal scale attribute}
351 interpretation as described for the
352 \livelink{chap:DWATEpackeddecimal}{DW\_ATE\_packed\_decimal}
353 and \livelink{chap:DWATEnumericstring}{DW\_ATE\_numeric\_string} base types.
355 \hypertarget{chap:DWATbinaryscalebinaryscalefactorforfixedpointtype}
356 For a data type with a binary scale factor, the fixed
357 \addtoindexx{binary scale attribute}
358 binary type entry has a
359 \livelink{chap:DWATbinaryscale}{DW\_AT\_binary\_scale} attribute.
361 \livelink{chap:DWATbinaryscale}{DW\_AT\_binary\_scale} attribute
362 is an \livelink{chap:classconstant}{integer constant} value
363 that represents the exponent of the base two scale factor to
364 be applied to an instance of the type. Zero scale puts the
365 binary point immediately to the right of the least significant
366 bit. Positive scale moves the binary point to the right and
367 implies that additional zero bits on the right are not stored
368 in an instance of the type. Negative scale moves the binary
369 point to the left; if the absolute value of the scale is
370 larger than the number of bits, this implies additional zero
371 bits on the left are not stored in an instance of the type.
374 \hypertarget{chap:DWATsmallscalefactorforfixedpointtype}
375 a data type with a non\dash decimal and non\dash binary scale factor,
376 the fixed binary type entry has a
377 \livelink{chap:DWATsmall}{DW\_AT\_small} attribute which
378 \addtoindexx{small attribute}
380 \livelink{chap:DWTAGconstant}{DW\_TAG\_constant} entry. The scale factor value
381 is interpreted in accordance with the value defined by the
382 \livelink{chap:DWTAGconstant}{DW\_TAG\_constant} entry. The value represented is the product
383 of the integer value in memory and the associated constant
386 \textit{The \livelink{chap:DWATsmall}{DW\_AT\_small} attribute
387 is defined with the \addtoindex{Ada} \texttt{small}
390 \section{Unspecified Type Entries}
391 \label{chap:unspecifiedtypeentries}
392 \addtoindexx{unspecified type entry}
393 \addtoindexx{void type|see{unspecified type entry}}
394 Some languages have constructs in which a type
395 may be left unspecified or the absence of a type
396 may be explicitly indicated.
398 An unspecified (implicit, unknown, ambiguous or nonexistent)
399 type is represented by a debugging information entry with
400 the tag \livetarg{chap:DWTAGunspecifiedtype}{DW\_TAG\_unspecified\_type}.
401 If a name has been given
402 to the type, then the corresponding unspecified type entry
403 has a \livelink{chap:DWATname}{DW\_AT\_name} attribute
404 \addtoindexx{name attribute}
406 a null\dash terminated
407 string containing the name as it appears in the source program.
409 The interpretation of this debugging information entry is
410 intentionally left flexible to allow it to be interpreted
411 appropriately in different languages. For example, in
412 \addtoindex{C} and \addtoindex{C++}
413 the language implementation can provide an unspecified type
414 entry with the name \doublequote{void} which can be referenced by the
415 type attribute of pointer types and typedef declarations for
417 Sections \refersec{chap:typemodifierentries} and
418 %The following reference was valid, so the following is probably correct.
419 Section \refersec{chap:typedefentries},
420 respectively). As another
421 example, in \addtoindex{Ada} such an unspecified type entry can be referred
422 to by the type attribute of an access type where the denoted
423 \addtoindexx{incomplete type (Ada)}
424 type is incomplete (the name is declared as a type but the
425 definition is deferred to a separate compilation unit).
427 \section{Type Modifier Entries}
428 \label{chap:typemodifierentries}
429 \addtoindexx{type modifier entry}
431 A base or user\dash defined type may be modified in different ways
432 in different languages. A type modifier is represented in
433 DWARF by a debugging information entry with one of the tags
434 given in Table \refersec{tab:typemodifiertags}.
435 \addtoindexx{type modifier|see{constant type entry}}
436 \addtoindexx{type modifier|see{reference type entry}}
437 \addtoindexx{type modifier|see{restricted type entry}}
438 \addtoindexx{type modifier|see{packed type entry}}
439 \addtoindexx{type modifier|see{pointer type entry}}
440 \addtoindexx{type modifier|see{shared type entry}}
441 \addtoindexx{type modifier|see{volatile type entry}}
443 If a name has been given to the modified type in the source
444 program, then the corresponding modified type entry has
445 a \livelink{chap:DWATname}{DW\_AT\_name} attribute
446 \addtoindexx{name attribute}
447 whose value is a null\dash terminated
448 string containing the modified type name as it appears in
451 Each of the type modifier entries has
452 \addtoindexx{type attribute}
454 \livelink{chap:DWATtype}{DW\_AT\_type} attribute,
455 whose value is a \livelink{chap:classreference}{reference}
456 to a debugging information entry
457 describing a base type, a user-defined type or another type
460 A modified type entry describing a
461 \addtoindexx{pointer type entry}
462 pointer or \addtoindex{reference type}
463 (using \livelink{chap:DWTAGpointertype}{DW\_TAG\_pointer\_type},
464 \livelink{chap:DWTAGreferencetype}{DW\_TAG\_reference\_type} or
465 \livelink{chap:DWTAGrvaluereferencetype}{DW\_TAG\_rvalue\_reference\_type})
466 % Another instance of no-good-place-to-put-index entry.
468 \addtoindexx{address class!attribute}
470 \hypertarget{chap:DWATadressclasspointerorreferencetypes}
472 \livelink{chap:DWATaddressclass}{DW\_AT\_address\_class}
473 attribute to describe how objects having the given pointer
474 or reference type ought to be dereferenced.
476 A modified type entry describing a \addtoindex{UPC} shared qualified type
477 (using \livelink{chap:DWTAGsharedtype}{DW\_TAG\_shared\_type}) may have a
478 \livelink{chap:DWATcount}{DW\_AT\_count} attribute
479 \addtoindexx{count attribute}
480 whose value is a constant expressing the (explicit or implied) blocksize specified for the
481 type in the source. If no count attribute is present, then the \doublequote{infinite}
482 blocksize is assumed.
484 When multiple type modifiers are chained together to modify
485 a base or user-defined type, the tree ordering reflects the
487 \addtoindexx{reference type entry, lvalue|see{reference type entry}}
489 \addtoindexx{reference type entry, rvalue|see{rvalue reference type entry}}
491 \addtoindexx{parameter|see{macro formal parameter list}}
493 \addtoindexx{parameter|see{\textit{this} parameter}}
495 \addtoindexx{parameter|see{variable parameter attribute}}
497 \addtoindexx{parameter|see{optional parameter attribute}}
499 \addtoindexx{parameter|see{unspecified parameters entry}}
501 \addtoindexx{parameter|see{template value parameter entry}}
503 \addtoindexx{parameter|see{template type parameter entry}}
505 \addtoindexx{parameter|see{formal parameter entry}}
509 \caption{Type modifier tags}
510 \label{tab:typemodifiertags}
512 \begin{tabular}{l|p{9cm}}
514 Name&Meaning\\ \hline
515 \livetarg{chap:DWTAGconsttype}{DW\_TAG\_const\_type} & C or C++ const qualified type
516 \addtoindexx{const qualified type entry} \addtoindexx{C} \addtoindexx{C++} \\
517 \livetarg{chap:DWTAGpackedtype}{DW\_TAG\_packed\_type}& \addtoindex{Pascal} or Ada packed type\addtoindexx{packed type entry}
518 \addtoindexx{packed qualified type entry} \addtoindexx{Ada} \addtoindexx{Pascal} \\
519 \livetarg{chap:DWTAGpointertype}{DW\_TAG\_pointer\_type} & Pointer to an object of
520 the type being modified \addtoindexx{pointer qualified type entry} \\
521 \livetarg{chap:DWTAGreferencetype}{DW\_TAG\_reference\_type}& C++ (lvalue) reference
522 to an object of the type
523 \addtoindexx{reference type entry}
525 \addtoindexx{reference qualified type entry} \\
526 \livetarg{chap:DWTAGrestricttype}{DW\_TAG\_restrict\_type}& \addtoindex{C}
528 \addtoindexx{restricted type entry}
530 \addtoindexx{restrict qualified type} \\
531 \livetarg{chap:DWTAGrvaluereferencetype}{DW\_TAG\_rvalue\_reference\_type} & C++
532 \addtoindexx{rvalue reference type entry}
534 \addtoindexx{restricted type entry}
535 reference to an object of the type being modified
536 \addtoindexx{rvalue reference qualified type entry} \\
537 \livetarg{chap:DWTAGsharedtype}{DW\_TAG\_shared\_type}&\addtoindex{UPC} shared qualified type
538 \addtoindexx{shared qualified type entry} \\
539 \livetarg{chap:DWTAGvolatiletype}{DW\_TAG\_volatile\_type}&C or C++ volatile qualified type
540 \addtoindexx{volatile qualified type entry} \\
545 %The following clearpage prevents splitting the example across pages.
546 \textit{As examples of how type modifiers are ordered, consider the following
547 \addtoindex{C} declarations:}
548 \begin{lstlisting}[numbers=none]
549 const unsigned char * volatile p;
551 \textit{which represents a volatile pointer to a constant
552 character. This is encoded in DWARF as:}
556 \livelink{chap:DWTAGvariable}{DW\_TAG\_variable}(p) -->
557 \livelink{chap:DWTAGvolatiletype}{DW\_TAG\_volatile\_type} -->
558 \livelink{chap:DWTAGpointertype}{DW\_TAG\_pointer\_type} -->
559 \livelink{chap:DWTAGconsttype}{DW\_TAG\_const\_type} -->
560 \livelink{chap:DWTAGbasetype}{DW\_TAG\_base\_type}(unsigned char)
565 \textit{On the other hand}
566 \begin{lstlisting}[numbers=none]
567 volatile unsigned char * const restrict p;
569 \textit{represents a restricted constant
570 pointer to a volatile character. This is encoded as:}
574 \livelink{chap:DWTAGvariable}{DW\_TAG\_variable}(p) -->
575 \livelink{chap:DWTAGrestricttype}{DW\_TAG\_restrict\_type} -->
576 \livelink{chap:DWTAGconsttype}{DW\_TAG\_const\_type} -->
577 \livelink{chap:DWTAGpointertype}{DW\_TAG\_pointer\_type} -->
578 \livelink{chap:DWTAGvolatiletype}{DW\_TAG\_volatile\_type} -->
579 \livelink{chap:DWTAGbasetype}{DW\_TAG\_base\_type}(unsigned char)
583 \section{Typedef Entries}
584 \label{chap:typedefentries}
585 A named type that is defined in terms of another type
586 definition is represented by a debugging information entry with
587 \addtoindexx{typedef entry}
588 the tag \livetarg{chap:DWTAGtypedef}{DW\_TAG\_typedef}.
589 The typedef entry has a \livelink{chap:DWATname}{DW\_AT\_name} attribute
590 \addtoindexx{name attribute}
591 whose value is a null\dash terminated string containing
592 the name of the typedef as it appears in the source program.
594 The typedef entry may also contain
595 \addtoindexx{type attribute}
597 \livelink{chap:DWATtype}{DW\_AT\_type} attribute whose
598 value is a \livelink{chap:classreference}{reference}
599 to the type named by the typedef. If
600 the debugging information entry for a typedef represents
601 a declaration of the type that is not also a definition,
602 it does not contain a type attribute.
604 \textit{Depending on the language, a named type that is defined in
605 terms of another type may be called a type alias, a subtype,
606 a constrained type and other terms. A type name declared with
607 no defining details may be termed an
608 \addtoindexx{incomplete type}
609 incomplete, forward or hidden type.
610 While the DWARF \livelink{chap:DWTAGtypedef}{DW\_TAG\_typedef} entry was
611 originally inspired by the like named construct in
612 \addtoindex{C} and \addtoindex{C++},
613 it is broadly suitable for similar constructs (by whatever
614 source syntax) in other languages.}
616 \section{Array Type Entries}
617 \label{chap:arraytypeentries}
619 \textit{Many languages share the concept of an \doublequote{array,} which is
620 \addtoindexx{array type entry}
621 a table of components of identical type.}
623 An array type is represented by a debugging information entry
624 with the tag \livetarg{chap:DWTAGarraytype}{DW\_TAG\_array\_type}.
625 If a name has been given to
626 \addtoindexx{array!declaration of type}
627 the array type in the source program, then the corresponding
628 array type entry has a \livelink{chap:DWATname}{DW\_AT\_name} attribute
629 \addtoindexx{name attribute}
631 null\dash terminated string containing the array type name as it
632 appears in the source program.
635 \hypertarget{chap:DWATorderingarrayrowcolumnordering}
636 array type entry describing a multidimensional array may
637 \addtoindexx{array!element ordering}
638 have a \livelink{chap:DWATordering}{DW\_AT\_ordering} attribute whose
639 \livelink{chap:classconstant}{integer constant} value is
640 interpreted to mean either row-major or column-major ordering
641 of array elements. The set of values and their meanings
642 for the ordering attribute are listed in
643 Table \refersec{tab:arrayordering}.
645 ordering attribute is present, the default ordering for the
646 source language (which is indicated by the
647 \livelink{chap:DWATlanguage}{DW\_AT\_language}
649 \addtoindexx{language attribute}
650 of the enclosing compilation unit entry) is assumed.
652 \begin{simplenametable}[1.6in]{Array ordering}{tab:arrayordering}
653 \livetarg{chap:DWORDcolmajor}{DW\_ORD\_col\_major} \\
654 \livetarg{chap:DWORDrowmajor}{DW\_ORD\_row\_major} \\
655 \end{simplenametable}
657 The ordering attribute may optionally appear on one-dimensional
658 arrays; it will be ignored.
660 An array type entry has
661 \addtoindexx{type attribute}
662 a \livelink{chap:DWATtype}{DW\_AT\_type} attribute
664 \addtoindexx{array!element type}
665 the type of each element of the array.
667 If the amount of storage allocated to hold each element of an
668 object of the given array type is different from the amount
669 \addtoindexx{stride attribute|see{bit stride attribute or byte stride attribute}}
670 of storage that is normally allocated to hold an individual
671 \hypertarget{chap:DWATbitstridearrayelementstrideofarraytype}
673 \hypertarget{chap:DWATbytestridearrayelementstrideofarraytype}
674 indicated element type, then the array type
675 \addtoindexx{bit stride attribute}
677 \livelink{chap:DWATbytestride}{DW\_AT\_byte\_stride}
679 \addtoindexx{byte stride attribute}
680 a \livelink{chap:DWATbitstride}{DW\_AT\_bit\_stride}
682 \addtoindexx{bit stride attribute}
684 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
686 element of the array.
688 The array type entry may have either a \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size} or a
689 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} attribute
690 (see Section \refersec{chap:byteandbitsizes}),
692 amount of storage needed to hold an instance of the array type.
694 \textit{If the size of the array can be determined statically at
695 compile time, this value can usually be computed by multiplying
696 the number of array elements by the size of each element.}
699 Each array dimension is described by a debugging information
700 entry with either the
701 \addtoindexx{subrange type entry!as array dimension}
702 tag \livelink{chap:DWTAGsubrangetype}{DW\_TAG\_subrange\_type} or the
703 \addtoindexx{enumeration type entry!as array dimension}
705 \livelink{chap:DWTAGenumerationtype}{DW\_TAG\_enumeration\_type}. These entries are
707 array type entry and are ordered to reflect the appearance of
708 the dimensions in the source program (i.e., leftmost dimension
709 first, next to leftmost second, and so on).
711 \textit{In languages that have no concept of a
712 \doublequote{multidimensional array} (for example,
713 \addtoindex{C}), an array of arrays may
714 be represented by a debugging information entry for a
715 multidimensional array.}
718 Other attributes especially applicable to arrays are
719 \livelink{chap:DWATallocated}{DW\_AT\_allocated},
720 \livelink{chap:DWATassociated}{DW\_AT\_associated} and
721 \livelink{chap:DWATdatalocation}{DW\_AT\_data\_location},
722 which are described in
723 Section \refersec{chap:dynamictypeproperties}.
724 For relevant examples, see also Appendix \refersec{app:fortran90example}.
726 \section{Structure, Union, Class and Interface Type Entries}
727 \label{chap:structureunionclassandinterfacetypeentries}
729 \textit{The languages
731 \addtoindex{C++}, and
732 \addtoindex{Pascal}, among others, allow the
733 programmer to define types that are collections of related
734 \addtoindexx{structure type entry}
736 In \addtoindex{C} and \addtoindex{C++}, these collections are called
737 \doublequote{structures.}
738 In \addtoindex{Pascal}, they are called \doublequote{records.}
739 The components may be of different types. The components are
740 called \doublequote{members} in \addtoindex{C} and
741 \addtoindex{C++}, and \doublequote{fields} in \addtoindex{Pascal}.}
743 \textit{The components of these collections each exist in their
744 own space in computer memory. The components of a C or C++
745 \doublequote{union} all coexist in the same memory.}
747 \textit{\addtoindex{Pascal} and
748 other languages have a \doublequote{discriminated union,}
749 \addtoindexx{discriminated union|see {variant entry}}
750 also called a \doublequote{variant record.} Here, selection of a
751 number of alternative substructures (\doublequote{variants}) is based
752 on the value of a component that is not part of any of those
753 substructures (the \doublequote{discriminant}).}
755 \textit{\addtoindex{C++} and
756 \addtoindex{Java} have the notion of \doublequote{class,} which is in some
757 ways similar to a structure. A class may have \doublequote{member
758 functions} which are subroutines that are within the scope
759 of a class or structure.}
761 \textit{The \addtoindex{C++} notion of
762 structure is more general than in \addtoindex{C}, being
763 equivalent to a class with minor differences. Accordingly,
764 in the following discussion statements about
765 \addtoindex{C++} classes may
766 be understood to apply to \addtoindex{C++} structures as well.}
768 \subsection{Structure, Union and Class Type Entries}
769 \label{chap:structureunionandclasstypeentries}
772 Structure, union, and class types are represented by debugging
773 \addtoindexx{structure type entry}
775 \addtoindexx{union type entry}
777 \addtoindexx{class type entry}
779 \livetarg{chap:DWTAGstructuretype}{DW\_TAG\_structure\_type},
780 \livetarg{chap:DWTAGuniontype}{DW\_TAG\_union\_type},
781 and \livetarg{chap:DWTAGclasstype}{DW\_TAG\_class\_type},
782 respectively. If a name has been given to the structure,
783 union, or class in the source program, then the corresponding
784 structure type, union type, or class type entry has a
785 \livelink{chap:DWATname}{DW\_AT\_name} attribute
786 \addtoindexx{name attribute}
787 whose value is a null\dash terminated string
788 containing the type name as it appears in the source program.
790 The members of a structure, union, or class are represented
791 by debugging information entries that are owned by the
792 corresponding structure type, union type, or class type entry
793 and appear in the same order as the corresponding declarations
794 in the source program.
796 A structure type, union type or class type entry may have
797 either a \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size} or a
798 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} attribute
799 \hypertarget{chap:DWATbitsizedatamemberbitsize}
800 (see Section \refersec{chap:byteandbitsizes}),
801 whose value is the amount of storage needed
802 to hold an instance of the structure, union or class type,
803 including any padding.
805 An incomplete structure, union or class type
806 \addtoindexx{incomplete structure/union/class}
808 \addtoindexx{incomplete type}
809 represented by a structure, union or class
810 entry that does not have a byte size attribute and that has
811 \addtoindexx{declaration attribute}
812 a \livelink{chap:DWATdeclaration}{DW\_AT\_declaration} attribute.
814 If the complete declaration of a type has been placed in
815 \hypertarget{chap:DWATsignaturetypesignature}
816 a separate \addtoindex{type unit}
817 (see Section \refersec{chap:separatetypeunitentries}),
818 an incomplete declaration
819 \addtoindexx{incomplete type}
820 of that type in the compilation unit may provide
821 the unique 64\dash bit signature of the type using
822 \addtoindexx{type signature}
823 a \livelink{chap:DWATsignature}{DW\_AT\_signature}
826 If a structure, union or class entry represents the definition
827 of a structure, union or class member corresponding to a prior
828 incomplete structure, union or class, the entry may have a
829 \livelink{chap:DWATspecification}{DW\_AT\_specification} attribute
830 \addtoindexx{specification attribute}
831 whose value is a \livelink{chap:classreference}{reference} to
832 the debugging information entry representing that incomplete
835 Structure, union and class entries containing the
836 \livelink{chap:DWATspecification}{DW\_AT\_specification} attribute
837 \addtoindexx{specification attribute}
838 do not need to duplicate
839 information provided by the declaration entry referenced by the
840 specification attribute. In particular, such entries do not
841 need to contain an attribute for the name of the structure,
842 union or class they represent if such information is already
843 provided in the declaration.
845 \textit{For \addtoindex{C} and \addtoindex{C++},
847 \addtoindexx{data member|see {member entry (data)}}
848 member declarations occurring within
849 the declaration of a structure, union or class type are
850 considered to be \doublequote{definitions} of those members, with
851 the exception of \doublequote{static} data members, whose definitions
852 appear outside of the declaration of the enclosing structure,
853 union or class type. Function member declarations appearing
854 within a structure, union or class type declaration are
855 definitions only if the body of the function also appears
856 within the type declaration.}
858 If the definition for a given member of the structure, union
859 or class does not appear within the body of the declaration,
860 that member also has a debugging information entry describing
861 its definition. That latter entry has a
862 \livelink{chap:DWATspecification}{DW\_AT\_specification} attribute
863 \addtoindexx{specification attribute}
864 referencing the debugging information entry
865 owned by the body of the structure, union or class entry and
866 representing a non\dash defining declaration of the data, function
867 or type member. The referenced entry will not have information
868 about the location of that member (low and high pc attributes
869 for function members, location descriptions for data members)
870 and will have a \livelink{chap:DWATdeclaration}{DW\_AT\_declaration} attribute.
873 \textit{Consider a nested class whose
874 definition occurs outside of the containing class definition, as in:}
876 \begin{lstlisting}[numbers=none]
883 \textit{The two different structs can be described in
884 different compilation units to
885 facilitate DWARF space compression
886 (see Appendix \refersec{app:usingcompilationunits}).}
888 \subsection{Interface Type Entries}
889 \label{chap:interfacetypeentries}
891 \textit{The \addtoindex{Java} language defines \doublequote{interface} types.
893 \addtoindexx{interface type entry}
894 in \addtoindex{Java} is similar to a \addtoindex{C++} or
895 \addtoindex{Java} class with only abstract
896 methods and constant data members.}
899 \addtoindexx{interface type entry}
900 are represented by debugging information
902 tag \livetarg{chap:DWTAGinterfacetype}{DW\_TAG\_interface\_type}.
904 An interface type entry has
905 a \livelink{chap:DWATname}{DW\_AT\_name} attribute,
906 \addtoindexx{name attribute}
908 value is a null\dash terminated string containing the type name
909 as it appears in the source program.
911 The members of an interface are represented by debugging
912 information entries that are owned by the interface type
913 entry and that appear in the same order as the corresponding
914 declarations in the source program.
916 \subsection{Derived or Extended Structs, Classes and Interfaces}
917 \label{chap:derivedorextendedstructsclasesandinterfaces}
919 \textit{In \addtoindex{C++}, a class (or struct)
921 \addtoindexx{derived type (C++)|see{inheritance entry}}
922 be \doublequote{derived from} or be a
923 \doublequote{subclass of} another class.
924 In \addtoindex{Java}, an interface may \doublequote{extend}
925 \addtoindexx{extended type (Java)|see{inheritance entry}}
927 \addtoindexx{implementing type (Java)|see{inheritance entry}}
928 or more other interfaces, and a class may \doublequote{extend} another
929 class and/or \doublequote{implement} one or more interfaces. All of these
930 relationships may be described using the following. Note that
931 in \addtoindex{Java},
932 the distinction between extends and implements is
933 implied by the entities at the two ends of the relationship.}
935 A class type or interface type entry that describes a
936 derived, extended or implementing class or interface owns
937 \addtoindexx{implementing type (Java)|see{inheritance entry}}
938 debugging information entries describing each of the classes
939 or interfaces it is derived from, extending or implementing,
940 respectively, ordered as they were in the source program. Each
942 \addtoindexx{inheritance entry}
944 tag \livetarg{chap:DWTAGinheritance}{DW\_TAG\_inheritance}.
947 \addtoindexx{type attribute}
949 \addtoindexx{inheritance entry}
951 \livelink{chap:DWATtype}{DW\_AT\_type} attribute whose value is
952 a reference to the debugging information entry describing the
953 class or interface from which the parent class or structure
954 of the inheritance entry is derived, extended or implementing.
957 \addtoindexx{inheritance entry}
958 for a class that derives from or extends
959 \hypertarget{chap:DWATdatamemberlocationinheritedmemberlocation}
960 another class or struct also has
961 \addtoindexx{data member location attribute}
963 \livelink{chap:DWATdatamemberlocation}{DW\_AT\_data\_member\_location}
964 attribute, whose value describes the location of the beginning
965 of the inherited type relative to the beginning address of the
966 instance of the derived class. If that value is a constant, it is the offset
967 in bytes from the beginning of the class to the beginning of
968 the instance of the inherited type. Otherwise, the value must be a location
969 description. In this latter case, the beginning address of
970 the instance of the derived class is pushed on the expression stack before
971 the \addtoindex{location description}
972 is evaluated and the result of the
973 evaluation is the location of the instance of the inherited type.
975 \textit{The interpretation of the value of this attribute for
976 inherited types is the same as the interpretation for data
978 (see Section \referfol{chap:datamemberentries}). }
981 \addtoindexx{inheritance entry}
983 \hypertarget{chap:DWATaccessibilitycppinheritedmembers}
985 \addtoindexx{accessibility attribute}
987 \livelink{chap:DWATaccessibility}{DW\_AT\_accessibility}
989 If no accessibility attribute
990 is present, private access is assumed for an entry of a class
991 and public access is assumed for an entry of an interface,
995 \hypertarget{chap:DWATvirtualityvirtualityofbaseclass}
996 the class referenced by the
997 \addtoindexx{inheritance entry}
998 inheritance entry serves
999 as a \addtoindex{C++} virtual base class, the inheritance entry has a
1000 \livelink{chap:DWATvirtuality}{DW\_AT\_virtuality} attribute.
1002 \textit{For a \addtoindex{C++} virtual base, the
1003 \addtoindex{data member location attribute}
1004 will usually consist of a non-trivial
1005 \addtoindex{location description}.}
1007 \subsection{Access Declarations}
1008 \label{chap:accessdeclarations}
1010 \textit{In \addtoindex{C++}, a derived class may contain access declarations that
1011 \addtoindexx{access declaration entry}
1012 change the accessibility of individual class members from the
1013 overall accessibility specified by the inheritance declaration.
1014 A single access declaration may refer to a set of overloaded
1017 If a derived class or structure contains access declarations,
1018 each such declaration may be represented by a debugging
1019 information entry with the tag
1020 \livetarg{chap:DWTAGaccessdeclaration}{DW\_TAG\_access\_declaration}.
1022 such entry is a child of the class or structure type entry.
1024 An access declaration entry has
1025 a \livelink{chap:DWATname}{DW\_AT\_name} attribute,
1026 \addtoindexx{name attribute}
1028 value is a null\dash terminated string representing the name used
1029 in the declaration in the source program, including any class
1030 or structure qualifiers.
1032 An access declaration entry
1033 \hypertarget{chap:DWATaccessibilitycppbaseclasses}
1036 \livelink{chap:DWATaccessibility}{DW\_AT\_accessibility}
1037 attribute describing the declared accessibility of the named
1042 \subsection{Friends}
1043 \label{chap:friends}
1045 Each \doublequote{friend}
1046 \addtoindexx{friend entry}
1047 declared by a structure, union or class
1048 \hypertarget{chap:DWATfriendfriendrelationship}
1049 type may be represented by a debugging information entry
1050 that is a child of the structure, union or class type entry;
1051 the friend entry has the
1052 tag \livetarg{chap:DWTAGfriend}{DW\_TAG\_friend}.
1055 \addtoindexx{friend attribute}
1056 a \livelink{chap:DWATfriend}{DW\_AT\_friend} attribute, whose value is
1057 a reference to the debugging information entry describing
1058 the declaration of the friend.
1061 \subsection{Data Member Entries}
1062 \label{chap:datamemberentries}
1064 A data member (as opposed to a member function) is
1065 represented by a debugging information entry with the
1066 tag \livetarg{chap:DWTAGmember}{DW\_TAG\_member}.
1068 \addtoindexx{member entry (data)}
1069 member entry for a named member has
1070 a \livelink{chap:DWATname}{DW\_AT\_name} attribute
1071 \addtoindexx{name attribute}
1072 whose value is a null\dash terminated
1073 string containing the member name as it appears in the source
1074 program. If the member entry describes an
1075 \addtoindex{anonymous union},
1076 the name attribute is omitted or the value of the attribute
1077 consists of a single zero byte.
1079 The data member entry has
1080 \addtoindexx{type attribute}
1082 \livelink{chap:DWATtype}{DW\_AT\_type} attribute to denote
1083 \addtoindexx{member entry (data)}
1084 the type of that member.
1086 A data member entry may
1087 \addtoindexx{accessibility attribute}
1089 \livelink{chap:DWATaccessibility}{DW\_AT\_accessibility}
1090 attribute. If no accessibility attribute is present, private
1091 access is assumed for an entry of a class and public access
1092 is assumed for an entry of a structure, union, or interface.
1095 \hypertarget{chap:DWATmutablemutablepropertyofmemberdata}
1097 \addtoindexx{member entry (data)}
1099 \addtoindexx{mutable attribute}
1100 have a \livelink{chap:DWATmutable}{DW\_AT\_mutable} attribute,
1101 which is a \livelink{chap:classflag}{flag}.
1102 This attribute indicates whether the data
1103 member was declared with the mutable storage class specifier.
1105 The beginning of a data member
1106 \addtoindexx{beginning of a data member}
1107 is described relative to
1108 \addtoindexx{beginning of an object}
1109 the beginning of the object in which it is immediately
1110 contained. In general, the beginning is characterized by
1111 both an address and a bit offset within the byte at that
1112 address. When the storage for an entity includes all of
1113 the bits in the beginning byte, the beginning bit offset is
1116 Bit offsets in DWARF use the bit numbering and direction
1117 conventions that are appropriate to the current language on
1121 \addtoindexx{member entry (data)}
1122 corresponding to a data member that is
1123 \hypertarget{chap:DWATdatabitoffsetdatamemberbitlocation}
1125 \hypertarget{chap:DWATdatamemberlocationdatamemberlocation}
1126 in a structure, union or class may have either
1127 \addtoindexx{data member location attribute}
1129 \livelink{chap:DWATdatamemberlocation}{DW\_AT\_data\_member\_location} attribute or a
1130 \livelink{chap:DWATdatabitoffset}{DW\_AT\_data\_bit\_offset}
1131 attribute. If the beginning of the data member is the same as
1132 the beginning of the containing entity then neither attribute
1136 For a \livelink{chap:DWATdatamemberlocation}{DW\_AT\_data\_member\_location} attribute
1137 \addtoindexx{data member location attribute}
1138 there are two cases:
1139 \begin{enumerate}[1. ]
1140 \item If the value is an \livelink{chap:classconstant}{integer constant},
1142 in bytes from the beginning of the containing entity. If
1143 the beginning of the containing entity has a non-zero bit
1144 offset then the beginning of the member entry has that same
1147 \item Otherwise, the value must be a \addtoindex{location description}.
1149 this case, the beginning of the containing entity must be byte
1150 aligned. The beginning address is pushed on the DWARF stack
1151 before the \addtoindex{location} description is evaluated; the result of
1152 the evaluation is the base address of the member entry.
1154 \textit{The push on the DWARF expression stack of the base address of
1155 the containing construct is equivalent to execution of the
1156 \livelink{chap:DWOPpushobjectaddress}{DW\_OP\_push\_object\_address} operation
1157 (see Section \refersec{chap:stackoperations});
1158 \livelink{chap:DWOPpushobjectaddress}{DW\_OP\_push\_object\_address} therefore
1159 is not needed at the
1160 beginning of a \addtoindex{location description} for a data member.
1162 result of the evaluation is a location---either an address or
1163 the name of a register, not an offset to the member.}
1165 \textit{A \livelink{chap:DWATdatamemberlocation}{DW\_AT\_data\_member\_location}
1167 \addtoindexx{data member location attribute}
1168 that has the form of a
1169 \addtoindex{location description} is not valid for a data member contained
1170 in an entity that is not byte aligned because DWARF operations
1171 do not allow for manipulating or computing bit offsets.}
1175 For a \livelink{chap:DWATdatabitoffset}{DW\_AT\_data\_bit\_offset} attribute,
1176 the value is an \livelink{chap:classconstant}{integer constant}
1177 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1178 that specifies the number of bits
1179 from the beginning of the containing entity to the beginning
1180 of the data member. This value must be greater than or equal
1181 to zero, but is not limited to less than the number of bits
1184 If the size of a data member is not the same as the size
1185 of the type given for the data member, the data member has
1186 \addtoindexx{bit size attribute}
1187 either a \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size}
1188 or a \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} attribute whose
1189 \livelink{chap:classconstant}{integer constant} value
1190 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1192 of storage needed to hold the value of the data member.
1194 \textit{Bit fields in \addtoindex{C} and \addtoindex{C++}
1196 \addtoindexx{bit fields}
1198 \addtoindexx{data bit offset}
1200 \addtoindexx{data bit size}
1202 \livelink{chap:DWATdatabitoffset}{DW\_AT\_data\_bit\_offset} and
1203 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} attributes.}
1206 \textit{This Standard uses the following bit numbering and direction
1207 conventions in examples. These conventions are for illustrative
1208 purposes and other conventions may apply on particular
1211 \item \textit{For big\dash endian architectures, bit offsets are
1212 counted from high-order to low\dash order bits within a byte (or
1213 larger storage unit); in this case, the bit offset identifies
1214 the high\dash order bit of the object.}
1216 \item \textit{For little\dash endian architectures, bit offsets are
1217 counted from low\dash order to high\dash order bits within a byte (or
1218 larger storage unit); in this case, the bit offset identifies
1219 the low\dash order bit of the object.}
1223 \textit{In either case, the bit so identified is defined as the
1224 \addtoindexx{beginning of an object}
1225 beginning of the object.}
1227 \textit{For example, take one possible representation of the following
1228 \addtoindex{C} structure definition
1229 in both big\dash and little\dash endian byte orders:}
1240 \textit{Figures \referfol{fig:bigendiandatabitoffsets} and
1241 \refersec{fig:littleendiandatabitoffsets}
1242 show the structure layout
1243 and data bit offsets for example big\dash\ and little\dash endian
1244 architectures, respectively. Both diagrams show a structure
1245 that begins at address A and whose size is four bytes. Also,
1246 high order bits are to the left and low order bits are to
1258 Addresses increase ->
1259 | A | A + 1 | A + 2 | A + 3 |
1261 Data bit offsets increase ->
1262 +---------------+---------------+---------------+---------------+
1263 |0 4|5 10|11 15|16 23|24 31|
1264 | j | k | m | n | <pad> |
1266 +---------------------------------------------------------------+
1270 \caption{Big-endian data bit offsets}
1271 \label{fig:bigendiandatabitoffsets}
1282 <- Addresses increase
1283 | A + 3 | A + 2 | A + 1 | A |
1285 <- Data bit offsets increase
1286 +---------------+---------------+---------------+---------------+
1287 |31 24|23 16|15 11|10 5|4 0|
1288 | <pad> | n | m | k | j |
1290 +---------------------------------------------------------------+
1294 \caption{Little-endian data bit offsets}
1295 \label{fig:littleendiandatabitoffsets}
1298 \textit{Note that data member bit offsets in this example are the
1299 same for both big\dash\ and little\dash endian architectures even
1300 though the fields are allocated in different directions
1301 (high\dash order to low-order versus low\dash order to high\dash order);
1302 the bit naming conventions for memory and/or registers of
1303 the target architecture may or may not make this seem natural.}
1305 \textit{For a more extensive example showing nested and packed records
1307 Appendix \refersec{app:pascalexample}.}
1309 \textit{Attribute \livelink{chap:DWATdatabitoffset}{DW\_AT\_data\_bit\_offset}
1311 \addtoindex{DWARF Version 4}
1312 and is also used for base types
1314 \refersec{chap:basetypeentries}).
1316 \livetarg{chap:DWATbitoffsetdatamemberbitlocation}{}
1317 attributes \livelink{chap:DWATbitoffset}{DW\_AT\_bit\_offset} and
1318 \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size} when used to
1319 identify the beginning of bit field data members as defined
1320 in DWARF V3 and earlier. The earlier attributes are defined
1321 in a manner suitable for bit field members on big-endian
1322 architectures but which is either awkward or incomplete for
1323 use on little-endian architectures.
1324 (\livelink{chap:DWATbytesize}{DW\_AT\_byte\_size} also
1325 has other uses that are not affected by this change.)}
1327 \textit{The \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size},
1328 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} and
1329 \livelink{chap:DWATbitoffset}{DW\_AT\_bit\_offset}
1330 attribute combination is deprecated for data members in DWARF
1331 Version 4, but implementations may continue to support this
1332 use for compatibility.}
1335 \addtoindex{DWARF Version 3}
1336 definitions of these attributes are
1338 \begin{myindentpara}{1cm}
1339 \textit{If the data member entry describes a bit field, then that
1340 entry has the following attributes:}
1343 \item \textit{A \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size}
1344 attribute whose value
1345 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1346 is the number of bytes that contain an instance of the
1347 bit field and any padding bits.}
1349 \textit{The byte size attribute may be omitted if the size of the
1350 object containing the bit field can be inferred from the type
1351 attribute of the data member containing the bit field.}
1353 \item \textit{A \livelink{chap:DWATbitoffset}{DW\_AT\_bit\_offset}
1355 \addtoindexx{bit offset attribute (V3)}
1357 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1358 is the number of bits to the left of the leftmost
1359 (most significant) bit of the bit field value.}
1361 \item \textit{A \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size}
1363 \addtoindexx{bit size attribute (V3)}
1365 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1366 is the number of bits occupied by the bit field value.}
1371 \addtoindex{location description} for a bit field calculates the address
1372 of an anonymous object containing the bit field. The address
1373 is relative to the structure, union, or class that most closely
1374 encloses the bit field declaration. The number of bytes in this
1375 anonymous object is the value of the byte size attribute of
1376 the bit field. The offset (in bits) from the most significant
1377 bit of the anonymous object to the most significant bit of
1378 the bit field is the value of the bit offset attribute.}
1382 \textit{Diagrams similar to the above that show the use of the
1383 \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size},
1384 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} and
1385 \livelink{chap:DWATbitoffset}{DW\_AT\_bit\_offset} attribute
1386 combination may be found in the
1387 \addtoindex{DWARF Version 3} Standard.}
1389 \textit{In comparing
1390 DWARF Versions 3 and 4,
1391 \addtoindexx{DWARF Version 3}
1392 \addtoindexx{DWARF Version 4}
1394 defines the following combinations of attributes:}
1396 \item \textit{either \livelink{chap:DWATdatamemberlocation}{DW\_AT\_data\_member\_location}
1398 \livelink{chap:DWATdatabitoffset}{DW\_AT\_data\_bit\_offset}
1399 (to specify the beginning of the data member)}
1401 \textit{optionally together with}
1403 \item \textit{either \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size} or
1404 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} (to
1405 specify the size of the data member)}
1407 \textit{DWARF V3 defines the following combinations:}
1409 \item \textit{\livelink{chap:DWATdatamemberlocation}{DW\_AT\_data\_member\_location}
1410 (to specify the beginning
1411 of the data member, except this specification is only partial
1412 in the case of a bit field) }
1414 \textit{optionally together with}
1416 \item \textit{\livelink{chap:DWATbytesize}{DW\_AT\_byte\_size},
1417 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} and
1418 \livelink{chap:DWATbitoffset}{DW\_AT\_bit\_offset}
1419 (to further specify the beginning of a bit field data member
1420 as well as specify the size of the data member) }
1423 \subsection{Member Function Entries}
1424 \label{chap:memberfunctionentries}
1426 A member function is represented by a
1427 \addtoindexx{member function entry}
1428 debugging information entry
1430 \addtoindexx{subprogram entry!as member function}
1431 tag \livelink{chap:DWTAGsubprogram}{DW\_TAG\_subprogram}.
1432 The member function entry
1433 may contain the same attributes and follows the same rules
1434 as non\dash member global subroutine entries
1435 (see Section \refersec{chap:subroutineandentrypointentries}).
1438 \addtoindexx{accessibility attribute}
1439 member function entry may have a
1440 \livelink{chap:DWATaccessibility}{DW\_AT\_accessibility}
1441 attribute. If no accessibility attribute is present, private
1442 access is assumed for an entry of a class and public access
1443 is assumed for an entry of a structure, union or interface.
1446 \hypertarget{chap:DWATvirtualityvirtualityoffunction}
1447 the member function entry describes a virtual function,
1448 then that entry has a
1449 \livelink{chap:DWATvirtuality}{DW\_AT\_virtuality} attribute.
1452 \hypertarget{chap:DWATexplicitexplicitpropertyofmemberfunction}
1453 the member function entry describes an explicit member
1454 function, then that entry has
1455 \addtoindexx{explicit attribute}
1457 \livelink{chap:DWATexplicit}{DW\_AT\_explicit} attribute.
1460 \hypertarget{chap:DWATvtableelemlocationvirtualfunctiontablevtableslot}
1461 entry for a virtual function also has a
1462 \livelink{chap:DWATvtableelemlocation}{DW\_AT\_vtable\_elem\_location}
1463 \addtoindexi{attribute}{vtable element location attribute} whose value contains
1464 a \addtoindex{location description}
1465 yielding the address of the slot
1466 for the function within the virtual function table for the
1467 enclosing class. The address of an object of the enclosing
1468 type is pushed onto the expression stack before the location
1469 description is evaluated.
1472 \hypertarget{chap:DWATobjectpointerobjectthisselfpointerofmemberfunction}
1473 the member function entry describes a non\dash static member
1474 \addtoindexx{this pointer attribute|see{object pointer attribute}}
1475 function, then that entry
1476 \addtoindexx{self pointer attribute|see{object pointer attribute}}
1478 \addtoindexx{object pointer attribute}
1479 a \livelink{chap:DWATobjectpointer}{DW\_AT\_object\_pointer}
1481 whose value is a \livelink{chap:classreference}{reference}
1482 to the formal parameter entry
1483 that corresponds to the object for which the function is
1484 called. The name attribute of that formal parameter is defined
1485 by the current language (for example,
1486 \texttt{this} for \addtoindex{C++} or \texttt{self}
1487 for \addtoindex{Objective C}
1488 and some other languages). That parameter
1489 also has a \livelink{chap:DWATartificial}{DW\_AT\_artificial} attribute whose value is true.
1491 Conversely, if the member function entry describes a static
1492 member function, the entry does not have
1493 \addtoindexx{object pointer attribute}
1495 \livelink{chap:DWATobjectpointer}{DW\_AT\_object\_pointer}
1498 If the member function entry describes a non\dash static member
1499 function that has a const\dash volatile qualification, then
1500 the entry describes a non\dash static member function whose
1501 object formal parameter has a type that has an equivalent
1502 const\dash volatile qualification.
1504 If a subroutine entry represents the defining declaration
1505 of a member function and that definition appears outside of
1506 the body of the enclosing class declaration, the subroutine
1508 \livelink{chap:DWATspecification}{DW\_AT\_specification} attribute,
1509 \addtoindexx{specification attribute}
1511 a reference to the debugging information entry representing
1512 the declaration of this function member. The referenced entry
1513 will be a child of some class (or structure) type entry.
1515 Subroutine entries containing the
1516 \livelink{chap:DWATspecification}{DW\_AT\_specification} attribute
1517 \addtoindexx{specification attribute}
1518 do not need to duplicate information provided
1519 by the declaration entry referenced by the specification
1520 attribute. In particular, such entries do not need to contain
1521 attributes for the name or return type of the function member
1522 whose definition they represent.
1525 \subsection{Class Template Instantiations}
1526 \label{chap:classtemplateinstantiations}
1528 \textit{In \addtoindex{C++} a class template is a generic definition of a class
1529 type that may be instantiated when an instance of the class
1530 is declared or defined. The generic description of the
1531 class may include both parameterized types and parameterized
1532 constant values. DWARF does not represent the generic template
1533 definition, but does represent each instantiation.}
1535 A class template instantiation is represented by a
1536 debugging information entry with the tag \livelink{chap:DWTAGclasstype}{DW\_TAG\_class\_type},
1537 \livelink{chap:DWTAGstructuretype}{DW\_TAG\_structure\_type} or
1538 \livelink{chap:DWTAGuniontype}{DW\_TAG\_union\_type}. With five
1539 exceptions, such an entry will contain the same attributes
1540 and have the same types of child entries as would an entry
1541 for a class type defined explicitly using the instantiation
1542 types and values. The exceptions are:
1544 \begin{enumerate}[1. ]
1545 \item Each formal parameterized type declaration appearing in the
1546 template definition is represented by a debugging information
1548 \livelink{chap:DWTAGtemplatetypeparameter}{DW\_TAG\_template\_type\_parameter}. Each
1549 such entry may have a \livelink{chap:DWATname}{DW\_AT\_name} attribute,
1550 \addtoindexx{name attribute}
1552 a null\dash terminated string containing the name of the formal
1553 type parameter as it appears in the source program. The
1554 template type parameter entry also has
1555 \addtoindexx{type attribute}
1557 \livelink{chap:DWATtype}{DW\_AT\_type} attribute
1558 describing the actual type by which the formal is replaced
1559 for this instantiation.
1561 \item Each formal parameterized value declaration appearing in the
1562 template definition is represented by a
1563 debugging information entry with the
1564 \addtoindexx{template value parameter entry}
1565 tag \livetarg{chap:DWTAGtemplatevalueparameter}{DW\_TAG\_template\_value\_parameter}.
1567 such entry may have a
1568 \livelink{chap:DWATname}{DW\_AT\_name} attribute,
1569 \addtoindexx{name attribute}
1571 a null\dash terminated string containing the name of the formal
1572 value parameter as it appears in the source program.
1574 \hypertarget{chap:DWATconstvaluetemplatevalueparameter}
1575 template value parameter entry
1576 \addtoindexx{template value parameter entry}
1578 \addtoindexx{type attribute}
1580 \livelink{chap:DWATtype}{DW\_AT\_type} attribute
1581 describing the type of the parameterized value. Finally,
1582 the template value parameter entry has a
1583 \livelink{chap:DWATconstvalue}{DW\_AT\_const\_value}
1584 attribute, whose value is the actual constant value of the
1585 value parameter for this instantiation as represented on the
1586 target architecture.
1589 \item The class type entry and each of its child entries reference
1590 a \addtoindex{template type parameter entry} in any circumstance where the
1591 source template definition references a formal parameterized
1593 Similarly, the class type entry and each of its child
1594 entries reference a template value parameter entry in any
1595 circumstance where the source template definition references
1596 a formal parameterized value.
1599 \item If the compiler has generated a special compilation unit to
1601 \addtoindexx{template instantiation!and special compilation unit}
1602 template instantiation and that special compilation
1603 unit has a different name from the compilation unit containing
1604 the template definition, the name attribute for the debugging
1605 information entry representing the special compilation unit
1606 should be empty or omitted.
1609 \item If the class type entry representing the template
1610 instantiation or any of its child entries contains declaration
1611 coordinate attributes, those attributes should refer to
1612 the source for the template definition, not to any source
1613 generated artificially by the compiler.
1617 \subsection{Variant Entries}
1618 \label{chap:variantentries}
1620 A variant part of a structure is represented by a debugging
1621 information entry\addtoindexx{variant part entry} with the
1622 tag \livetarg{chap:DWTAGvariantpart}{DW\_TAG\_variant\_part} and is
1623 owned by the corresponding structure type entry.
1625 If the variant part has a discriminant, the discriminant is
1626 \hypertarget{chap:DWATdiscrdiscriminantofvariantpart}
1628 \addtoindexx{discriminant (entry)}
1629 separate debugging information entry which
1630 is a child of the variant part entry. This entry has the form
1632 \addtoindexx{member entry (data)!as discriminant}
1633 structure data member entry. The variant part entry will
1634 \addtoindexx{discriminant attribute}
1636 \livelink{chap:DWATdiscr}{DW\_AT\_discr} attribute
1637 whose value is a \livelink{chap:classreference}{reference} to
1638 the member entry for the discriminant.
1640 If the variant part does not have a discriminant (tag field),
1641 the variant part entry has
1642 \addtoindexx{type attribute}
1644 \livelink{chap:DWATtype}{DW\_AT\_type} attribute to represent
1647 Each variant of a particular variant part is represented by
1648 \hypertarget{chap:DWATdiscrvaluediscriminantvalue}
1649 a debugging information entry\addtoindexx{variant entry} with the
1650 tag \livetarg{chap:DWTAGvariant}{DW\_TAG\_variant}
1651 and is a child of the variant part entry. The value that
1652 selects a given variant may be represented in one of three
1653 ways. The variant entry may have a
1654 \livelink{chap:DWATdiscrvalue}{DW\_AT\_discr\_value} attribute
1655 whose value represents a single case label. The value of this
1656 attribute is encoded as an LEB128 number. The number is signed
1657 if the tag type for the variant part containing this variant
1658 is a signed type. The number is unsigned if the tag type is
1663 \hypertarget{chap:DWATdiscrlistlistofdiscriminantvalues}
1664 the variant entry may contain
1665 \addtoindexx{discriminant list attribute}
1667 \livelink{chap:DWATdiscrlist}{DW\_AT\_discr\_list}
1668 attribute, whose value represents a list of discriminant
1669 values. This list is represented by any of the
1670 \livelink{chap:classblock}{block} forms and
1671 may contain a mixture of case labels and label ranges. Each
1672 item on the list is prefixed with a discriminant value
1673 descriptor that determines whether the list item represents
1674 a single label or a label range. A single case label is
1675 represented as an LEB128 number as defined above for
1676 \addtoindexx{discriminant value attribute}
1678 \livelink{chap:DWATdiscrvalue}{DW\_AT\_discr\_value}
1679 attribute. A label range is represented by
1680 two LEB128 numbers, the low value of the range followed by the
1681 high value. Both values follow the rules for signedness just
1682 described. The discriminant value descriptor is an integer
1683 constant that may have one of the values given in
1684 Table \refersec{tab:discriminantdescriptorvalues}.
1686 \begin{simplenametable}[1.4in]{Discriminant descriptor values}{tab:discriminantdescriptorvalues}
1687 \livetarg{chap:DWDSClabel}{DW\_DSC\_label} \\
1688 \livetarg{chap:DWDSCrange}{DW\_DSC\_range} \\
1689 \end{simplenametable}
1691 If a variant entry has neither a \livelink{chap:DWATdiscrvalue}{DW\_AT\_discr\_value}
1692 attribute nor a \livelink{chap:DWATdiscrlist}{DW\_AT\_discr\_list} attribute, or if it has
1693 a \livelink{chap:DWATdiscrlist}{DW\_AT\_discr\_list} attribute with 0 size, the variant is a
1696 The components selected by a particular variant are represented
1697 by debugging information entries owned by the corresponding
1698 variant entry and appear in the same order as the corresponding
1699 declarations in the source program.
1701 \section{Condition Entries}
1702 \label{chap:conditionentries}
1704 \textit{COBOL has the notion of
1705 \addtoindexx{level-88 condition, COBOL}
1706 a \doublequote{level\dash 88 condition} that
1707 associates a data item, called the conditional variable, with
1708 a set of one or more constant values and/or value ranges.
1709 % Note: the {} after \textquoteright (twice) is necessary to assure a following space separator
1710 Semantically, the condition is \textquoteleft true\textquoteright{}
1712 variable's value matches any of the described constants,
1713 and the condition is \textquoteleft false\textquoteright{} otherwise.}
1715 The \livetarg{chap:DWTAGcondition}{DW\_TAG\_condition}
1716 debugging information entry\addtoindexx{condition entry}
1718 logical condition that tests whether a given data item\textquoteright s
1719 value matches one of a set of constant values. If a name
1720 has been given to the condition, the condition entry has a
1721 \livelink{chap:DWATname}{DW\_AT\_name} attribute
1722 \addtoindexx{name attribute}
1723 whose value is a null\dash terminated string
1724 giving the condition name as it appears in the source program.
1726 The condition entry's parent entry describes the conditional
1727 variable; normally this will be a \livelink{chap:DWTAGvariable}{DW\_TAG\_variable},
1728 \livelink{chap:DWTAGmember}{DW\_TAG\_member} or
1729 \livelink{chap:DWTAGformalparameter}{DW\_TAG\_formal\_parameter} entry.
1731 \addtoindexx{formal parameter entry}
1733 entry has an array type, the condition can test any individual
1734 element, but not the array as a whole. The condition entry
1735 implicitly specifies a \doublequote{comparison type} that is the
1736 type of an array element if the parent has an array type;
1737 otherwise it is the type of the parent entry.
1740 The condition entry owns \livelink{chap:DWTAGconstant}{DW\_TAG\_constant} and/or
1741 \livelink{chap:DWTAGsubrangetype}{DW\_TAG\_subrange\_type} entries that describe the constant
1742 values associated with the condition. If any child entry
1743 \addtoindexx{type attribute}
1745 a \livelink{chap:DWATtype}{DW\_AT\_type} attribute,
1746 that attribute should describe a type
1747 compatible with the comparison type (according to the source
1748 language); otherwise the child\textquoteright s type is the same as the
1751 \textit{For conditional variables with alphanumeric types, COBOL
1752 permits a source program to provide ranges of alphanumeric
1753 constants in the condition. Normally a subrange type entry
1754 does not describe ranges of strings; however, this can be
1755 represented using bounds attributes that are references to
1756 constant entries describing strings. A subrange type entry may
1757 refer to constant entries that are siblings of the subrange
1761 \section{Enumeration Type Entries}
1762 \label{chap:enumerationtypeentries}
1764 \textit{An \doublequote{enumeration type} is a scalar that can assume one of
1765 a fixed number of symbolic values.}
1767 An enumeration type is represented by a debugging information
1769 \livetarg{chap:DWTAGenumerationtype}{DW\_TAG\_enumeration\_type}.
1771 If a name has been given to the enumeration type in the source
1772 program, then the corresponding enumeration type entry has
1773 a \livelink{chap:DWATname}{DW\_AT\_name} attribute
1774 \addtoindexx{name attribute}
1775 whose value is a null\dash terminated
1776 string containing the enumeration type name as it appears
1777 in the source program. This entry also has a
1778 \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size}
1779 attribute whose \livelink{chap:classconstant}{integer constant}
1780 value is the number of bytes
1781 required to hold an instance of the enumeration.
1783 The \addtoindex{enumeration type entry}
1785 \addtoindexx{type attribute}
1786 a \livelink{chap:DWATtype}{DW\_AT\_type} attribute
1787 which refers to the underlying data type used to implement
1790 If an enumeration type has type safe
1791 \addtoindexx{type safe enumeration types}
1794 \begin{enumerate}[1. ]
1795 \item Enumerators are contained in the scope of the enumeration type, and/or
1797 \item Enumerators are not implicitly converted to another type
1800 then the \addtoindex{enumeration type entry} may
1801 \addtoindexx{enum class|see{type-safe enumeration}}
1802 have a \livelink{chap:DWATenumclass}{DW\_AT\_enum\_class}
1803 attribute, which is a \livelink{chap:classflag}{flag}.
1804 In a language that offers only
1805 one kind of enumeration declaration, this attribute is not
1808 \textit{In \addtoindex{C} or \addtoindex{C++},
1809 the underlying type will be the appropriate
1810 integral type determined by the compiler from the properties of
1811 \hypertarget{chap:DWATenumclasstypesafeenumerationdefinition}
1812 the enumeration literal values.
1813 A \addtoindex{C++} type declaration written
1814 using enum class declares a strongly typed enumeration and
1815 is represented using \livelink{chap:DWTAGenumerationtype}{DW\_TAG\_enumeration\_type}
1816 in combination with \livelink{chap:DWATenumclass}{DW\_AT\_enum\_class}.}
1818 Each enumeration literal is represented by a debugging
1819 \addtoindexx{enumeration literal|see{enumeration entry}}
1820 information entry with the
1821 tag \livetarg{chap:DWTAGenumerator}{DW\_TAG\_enumerator}.
1823 such entry is a child of the
1824 \addtoindex{enumeration type entry}, and the
1825 enumerator entries appear in the same order as the declarations
1826 of the enumeration literals in the source program.
1828 Each \addtoindex{enumerator entry} has a
1829 \livelink{chap:DWATname}{DW\_AT\_name} attribute, whose
1830 \addtoindexx{name attribute}
1831 value is a null\dash terminated string containing the name of the
1832 \hypertarget{chap:DWATconstvalueenumerationliteralvalue}
1833 enumeration literal as it appears in the source program.
1834 Each enumerator entry also has a
1835 \livelink{chap:DWATconstvalue}{DW\_AT\_const\_value} attribute,
1836 whose value is the actual numeric value of the enumerator as
1837 represented on the target system.
1840 If the enumeration type occurs as the description of a
1841 \addtoindexx{enumeration type endry!as array dimension}
1842 dimension of an array type, and the stride for that dimension
1843 \hypertarget{chap:DWATbytestrideenumerationstridedimensionofarraytype}
1844 is different than what would otherwise be determined, then
1845 \hypertarget{chap:DWATbitstrideenumerationstridedimensionofarraytype}
1846 the enumeration type entry has either a
1847 \livelink{chap:DWATbytestride}{DW\_AT\_byte\_stride}
1848 or \livelink{chap:DWATbitstride}{DW\_AT\_bit\_stride} attribute
1849 \addtoindexx{bit stride attribute}
1850 which specifies the separation
1851 between successive elements along the dimension as described
1853 Section \refersec{chap:staticanddynamicvaluesofattributes}.
1855 \livelink{chap:DWATbitstride}{DW\_AT\_bit\_stride} attribute
1856 \addtoindexx{bit stride attribute}
1857 is interpreted as bits and the value of
1858 \addtoindexx{byte stride attribute}
1860 \livelink{chap:DWATbytestride}{DW\_AT\_byte\_stride}
1861 attribute is interpreted as bytes.
1864 \section{Subroutine Type Entries}
1865 \label{chap:subroutinetypeentries}
1867 \textit{It is possible in \addtoindex{C}
1868 to declare pointers to subroutines
1869 that return a value of a specific type. In both
1870 \addtoindex{C} and \addtoindex{C++},
1871 it is possible to declare pointers to subroutines that not
1872 only return a value of a specific type, but accept only
1873 arguments of specific types. The type of such pointers would
1874 be described with a \doublequote{pointer to} modifier applied to a
1875 user\dash defined type.}
1877 A subroutine type is represented by a debugging information
1879 \addtoindexx{subroutine type entry}
1880 tag \livetarg{chap:DWTAGsubroutinetype}{DW\_TAG\_subroutine\_type}.
1882 been given to the subroutine type in the source program,
1883 then the corresponding subroutine type entry has
1884 a \livelink{chap:DWATname}{DW\_AT\_name} attribute
1885 \addtoindexx{name attribute}
1886 whose value is a null\dash terminated string containing
1887 the subroutine type name as it appears in the source program.
1889 If the subroutine type describes a function that returns
1890 a value, then the subroutine type entry has
1891 \addtoindexx{type attribute}
1892 a \livelink{chap:DWATtype}{DW\_AT\_type}
1893 attribute to denote the type returned by the subroutine. If
1894 the types of the arguments are necessary to describe the
1895 subroutine type, then the corresponding subroutine type
1896 entry owns debugging information entries that describe the
1897 arguments. These debugging information entries appear in the
1898 order that the corresponding argument types appear in the
1901 \textit{In \addtoindex{C} there
1902 is a difference between the types of functions
1903 declared using function prototype style declarations and
1904 those declared using non\dash prototype declarations.}
1907 \hypertarget{chap:DWATprototypedsubroutineprototype}
1908 subroutine entry declared with a function prototype style
1909 declaration may have
1910 \addtoindexx{prototyped attribute}
1912 \livelink{chap:DWATprototyped}{DW\_AT\_prototyped} attribute, which is
1913 a \livelink{chap:classflag}{flag}.
1915 Each debugging information entry owned by a subroutine
1916 type entry corresponds to either a formal parameter or the sequence of
1917 unspecified parameters of the subprogram type:
1919 \begin{enumerate}[1. ]
1920 \item A formal parameter of a parameter list (that has a
1921 specific type) is represented by a debugging information entry
1922 with the tag \livelink{chap:DWTAGformalparameter}{DW\_TAG\_formal\_parameter}.
1923 Each formal parameter
1925 \addtoindexx{type attribute}
1926 a \livelink{chap:DWATtype}{DW\_AT\_type} attribute that refers to the type of
1927 the formal parameter.
1929 \item The unspecified parameters of a variable parameter list
1930 \addtoindexx{unspecified parameters entry}
1932 \addtoindexx{\texttt{...} parameters|see{unspecified parameters entry}}
1933 represented by a debugging information entry with the
1934 tag \livelink{chap:DWTAGunspecifiedparameters}{DW\_TAG\_unspecified\_parameters}.
1939 \section{String Type Entries}
1940 \label{chap:classstringtypeentries}
1942 \textit{A \doublequote{string} is a sequence of characters that have specific
1943 \addtoindexx{string type entry}
1944 semantics and operations that separate them from arrays of
1946 \addtoindex{Fortran} is one of the languages that has a string
1947 type. Note that \doublequote{string} in this context refers to a target
1948 machine concept, not the class string as used in this document
1949 (except for the name attribute).}
1951 A string type is represented by a debugging information entry
1952 with the tag \livetarg{chap:DWTAGstringtype}{DW\_TAG\_string\_type}.
1953 If a name has been given to
1954 the string type in the source program, then the corresponding
1955 string type entry has a \livelink{chap:DWATname}{DW\_AT\_name} attribute
1956 \addtoindexx{name attribute}
1958 a null\dash terminated string containing the string type name as
1959 it appears in the source program.
1962 \hypertarget{chap:DWATstringlengthstringlengthofstringtype}
1963 string type entry may have a
1964 \livelink{chap:DWATstringlength}{DW\_AT\_string\_length} attribute
1966 \addtoindexx{string length attribute}
1968 \addtoindex{location description} yielding the location
1969 where the length of the string is stored in the program. The
1970 string type entry may also have a \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size} attribute
1971 or \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} attribute, whose value
1972 (see Section \refersec{chap:byteandbitsizes})
1973 is the size of the data to be retrieved from the location
1974 referenced by the string length attribute. If no (byte or bit)
1975 size attribute is present, the size of the data to be retrieved
1977 \addtoindex{size of an address} on the target machine.Fif the amount
1980 If no string length attribute is present, the string type
1981 entry may have a \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size} attribute or
1982 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size}
1983 attribute, whose value
1984 (see Section \refersec{chap:byteandbitsizes})
1986 storage needed to hold a value of the string type.
1989 \section{Set Type Entries}
1990 \label{chap:settypeentries}
1992 \textit{\addtoindex{Pascal} provides the concept of a \doublequote{set,} which represents
1993 a group of values of ordinal type.}
1995 A set is represented by a debugging information entry with
1996 the tag \livetarg{chap:DWTAGsettype}{DW\_TAG\_set\_type}.
1997 \addtoindexx{set type entry}
1998 If a name has been given to the
1999 set type, then the set type entry has
2000 a \livelink{chap:DWATname}{DW\_AT\_name} attribute
2001 \addtoindexx{name attribute}
2002 whose value is a null\dash terminated string containing the
2003 set type name as it appears in the source program.
2005 The set type entry has
2006 \addtoindexx{type attribute}
2007 a \livelink{chap:DWATtype}{DW\_AT\_type} attribute to denote the
2008 type of an element of the set.
2011 If the amount of storage allocated to hold each element of an
2012 object of the given set type is different from the amount of
2013 storage that is normally allocated to hold an individual object
2014 of the indicated element type, then the set type entry has
2015 either a \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size} attribute, or
2016 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} attribute
2017 whose value (see Section \refersec{chap:byteandbitsizes}) is
2018 the amount of storage needed to hold a value of the set type.
2021 \section{Subrange Type Entries}
2022 \label{chap:subrangetypeentries}
2024 \textit{Several languages support the concept of a \doublequote{subrange}
2025 type object. These objects can represent a subset of the
2026 values that an object of the basis type for the subrange can
2028 Subrange type entries may also be used to represent
2029 the bounds of array dimensions.}
2031 A subrange type is represented by a debugging information
2033 \addtoindexx{subrange type entry}
2034 tag \livetarg{chap:DWTAGsubrangetype}{DW\_TAG\_subrange\_type}.
2036 given to the subrange type, then the subrange type entry
2037 has a \livelink{chap:DWATname}{DW\_AT\_name} attribute
2038 \addtoindexx{name attribute}
2039 whose value is a null\dash terminated
2040 string containing the subrange type name as it appears in
2043 The subrange entry may have
2044 \addtoindexx{type attribute}
2045 a \livelink{chap:DWATtype}{DW\_AT\_type} attribute to describe
2046 the type of object, called the basis type, of whose values
2047 this subrange is a subset.
2049 If the amount of storage allocated to hold each element of an
2050 object of the given subrange type is different from the amount
2051 of storage that is normally allocated to hold an individual
2052 object of the indicated element type, then the subrange
2054 \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size} attribute or
2055 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size}
2056 attribute, whose value
2057 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
2059 storage needed to hold a value of the subrange type.
2062 \hypertarget{chap:DWATthreadsscaledupcarrayboundthreadsscalfactor}
2063 subrange entry may have
2064 \addtoindexx{threads scaled attribute}
2066 \livelink{chap:DWATthreadsscaled}{DW\_AT\_threads\_scaled} attribute,
2067 which is a \livelink{chap:classflag}{flag}.
2068 If present, this attribute indicates whether
2069 this subrange represents a \addtoindex{UPC} array bound which is scaled
2070 by the runtime THREADS value (the number of UPC threads in
2071 this execution of the program).
2073 \textit{This allows the representation of a \addtoindex{UPC} shared array such as}
2075 \begin{lstlisting}[numbers=none]
2076 int shared foo[34*THREADS][10][20];
2080 \hypertarget{chap:DWATlowerboundlowerboundofsubrange}
2082 \hypertarget{chap:DWATupperboundupperboundofsubrange}
2083 entry may have the attributes
2084 \livelink{chap:DWATlowerbound}{DW\_AT\_lower\_bound}
2085 \addtoindexx{lower bound attribute}
2086 and \livelink{chap:DWATupperbound}{DW\_AT\_upper\_bound}
2087 \addtoindexx{upper bound attribute} to specify, respectively, the lower
2088 and upper bound values of the subrange. The
2089 \livelink{chap:DWATupperbound}{DW\_AT\_upper\_bound}
2091 \hypertarget{chap:DWATcountelementsofsubrangetype}
2093 % FIXME: The following matches DWARF4: odd as there is no default count.
2094 \addtoindexx{count attribute!default}
2096 \addtoindexx{count attribute}
2098 \livelink{chap:DWATcount}{DW\_AT\_count} attribute,
2100 value describes the number of elements in the subrange rather
2101 than the value of the last element. The value of each of
2102 these attributes is determined as described in
2103 Section \refersec{chap:staticanddynamicvaluesofattributes}.
2105 If the lower bound value is missing, the value is assumed to
2106 be a language\dash dependent default constant.
2107 \addtoindexx{lower bound attribute!default}
2108 The default lower bound is 0 for
2109 \addtoindex{C}, \addtoindex{C++},
2112 \addtoindex{Objective C},
2113 \addtoindex{Objective C++},
2114 \addtoindex{Python}, and
2116 The default lower bound is 1 for
2117 \addtoindex{Ada}, \addtoindex{COBOL},
2118 \addtoindex{Fortran},
2119 \addtoindex{Modula-2},
2120 \addtoindex{Pascal} and
2123 \textit{No other default lower bound values are currently defined.}
2125 If the upper bound and count are missing, then the upper bound value is
2126 \textit{unknown}.\addtoindexx{upper bound attribute!default unknown}
2128 If the subrange entry has no type attribute describing the
2129 basis type, the basis type is determined as follows:
2130 \begin{enumerate}[1. ]
2132 If there is a lower bound attribute that references an object,
2133 the basis type is assumed to be the same as the type of that object.
2135 Otherwise, if there is an upper bound or count attribute that references
2136 an object, the basis type is assumed to be the same as the type of that object.
2138 Otherwise, the type is
2139 assumed to be the same type, in the source language of the
2140 compilation unit containing the subrange entry, as a signed
2141 integer with the same size as an address on the target machine.
2144 If the subrange type occurs as the description of a dimension
2145 of an array type, and the stride for that dimension is
2146 \hypertarget{chap:DWATbytestridesubrangestridedimensionofarraytype}
2147 different than what would otherwise be determined, then
2148 \hypertarget{chap:DWATbitstridesubrangestridedimensionofarraytype}
2149 the subrange type entry has either
2150 \addtoindexx{byte stride attribute}
2152 \livelink{chap:DWATbytestride}{DW\_AT\_byte\_stride} or
2153 \livelink{chap:DWATbitstride}{DW\_AT\_bit\_stride} attribute
2154 \addtoindexx{bit stride attribute}
2155 which specifies the separation
2156 between successive elements along the dimension as described
2158 Section \refersec{chap:byteandbitsizes}.
2160 \textit{Note that the stride can be negative.}
2162 \section{Pointer to Member Type Entries}
2163 \label{chap:pointertomembertypeentries}
2165 \textit{In \addtoindex{C++}, a
2166 pointer to a data or function member of a class or
2167 structure is a unique type.}
2169 A debugging information entry representing the type of an
2170 object that is a pointer to a structure or class member has
2171 the tag \livetarg{chap:DWTAGptrtomembertype}{DW\_TAG\_ptr\_to\_member\_type}.
2173 If the \addtoindex{pointer to member type} has a name, the
2174 \addtoindexx{pointer to member type entry}
2175 pointer to member entry has a
2176 \livelink{chap:DWATname}{DW\_AT\_name} attribute,
2177 \addtoindexx{name attribute}
2179 null\dash terminated string containing the type name as it appears
2180 in the source program.
2182 The \addtoindex{pointer to member} entry
2184 \addtoindexx{type attribute}
2185 a \livelink{chap:DWATtype}{DW\_AT\_type} attribute to
2186 describe the type of the class or structure member to which
2187 objects of this type may point.
2189 The \addtoindexx{pointer to member} entry also
2190 \hypertarget{chap:DWATcontainingtypecontainingtypeofpointertomembertype}
2192 \livelink{chap:DWATcontainingtype}{DW\_AT\_containing\_type}
2193 attribute, whose value is a \livelink{chap:classreference}{reference} to a debugging
2194 information entry for the class or structure to whose members
2195 objects of this type may point.
2197 The \addtoindex{pointer to member entry}
2198 \hypertarget{chap:DWATuselocationmemberlocationforpointertomembertype}
2200 \livelink{chap:DWATuselocation}{DW\_AT\_use\_location} attribute
2201 \addtoindexx{use location attribute}
2203 \addtoindex{location description} that computes the
2204 address of the member of the class to which the pointer to
2205 member entry points.
2207 \textit{The method used to find the address of a given member of a
2208 class or structure is common to any instance of that class
2209 or structure and to any instance of the pointer or member
2210 type. The method is thus associated with the type entry,
2211 rather than with each instance of the type.}
2213 The \livelink{chap:DWATuselocation}{DW\_AT\_use\_location} description is used in conjunction
2214 with the location descriptions for a particular object of the
2215 given \addtoindex{pointer to member type} and for a particular structure or
2216 class instance. The \livelink{chap:DWATuselocation}{DW\_AT\_use\_location}
2217 attribute expects two values to be
2218 \addtoindexi{pushed}{address!implicit push for member operator}
2219 onto the DWARF expression stack before
2220 the \livelink{chap:DWATuselocation}{DW\_AT\_use\_location} description is evaluated.
2222 \addtoindexi{pushed}{address!implicit push for member operator}
2223 is the value of the \addtoindex{pointer to member} object
2224 itself. The second value
2225 \addtoindexi{pushed}{address!implicit push for member operator}
2226 is the base address of the
2227 entire structure or union instance containing the member
2228 whose address is being calculated.
2231 \textit{For an expression such as}
2233 \begin{lstlisting}[numbers=none]
2236 \textit{where \texttt{mbr\_ptr} has some \addtoindex{pointer to member type}, a debugger should:}
2238 \item \textit{Push the value of \texttt{mbr\_ptr} onto the DWARF expression stack.}
2239 \item \textit{Push the base address of \texttt{object} onto the DWARF expression stack.}
2240 \item \textit{Evaluate the \livelink{chap:DWATuselocation}{DW\_AT\_use\_location} description
2241 given in the type of \texttt{mbr\_ptr}.}
2245 \section{File Type Entries}
2246 \label{chap:filetypeentries}
2248 \textit{Some languages, such as \addtoindex{Pascal},
2249 provide a data type to represent
2252 A file type is represented by a debugging information entry
2254 \addtoindexx{file type entry}
2256 \livetarg{chap:DWTAGfiletype}{DW\_TAG\_file\_type}.
2257 If the file type has a name,
2258 the file type entry has a \livelink{chap:DWATname}{DW\_AT\_name} attribute,
2259 \addtoindexx{name attribute}
2261 is a null\dash terminated string containing the type name as it
2262 appears in the source program.
2264 The file type entry has
2265 \addtoindexx{type attribute}
2266 a \livelink{chap:DWATtype}{DW\_AT\_type} attribute describing
2267 the type of the objects contained in the file.
2269 The file type entry also
2270 \addtoindexx{byte size}
2272 \addtoindexx{bit size}
2274 \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size} or
2275 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size} attribute, whose value
2276 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
2277 is the amount of storage need to hold a value of the file type.
2279 \section{Dynamic Type Properties}
2280 \label{chap:dynamictypeproperties}
2281 \subsection{Data Location}
2282 \label{chap:datalocation}
2284 \textit{Some languages may represent objects using descriptors to hold
2285 information, including a location and/or run\dash time parameters,
2286 about the data that represents the value for that object.}
2288 \hypertarget{chap:DWATdatalocationindirectiontoactualdata}
2289 The \livelink{chap:DWATdatalocation}{DW\_AT\_data\_location}
2290 attribute may be used with any
2291 \addtoindexx{data location attribute}
2292 type that provides one or more levels of
2293 \addtoindexx{hidden indirection|see{data location attribute}}
2295 and/or run\dash time parameters in its representation. Its value
2296 is a \addtoindex{location description}.
2297 The result of evaluating this
2298 description yields the location of the data for an object.
2299 When this attribute is omitted, the address of the data is
2300 the same as the address of the object.
2303 \textit{This location description will typically begin with
2304 \livelink{chap:DWOPpushobjectaddress}{DW\_OP\_push\_object\_address}
2305 which loads the address of the
2306 object which can then serve as a descriptor in subsequent
2307 calculation. For an example using
2308 \livelink{chap:DWATdatalocation}{DW\_AT\_data\_location}
2309 for a \addtoindex{Fortran 90 array}, see
2310 Appendix \refersec{app:fortran90example}.}
2312 \subsection{Allocation and Association Status}
2313 \label{chap:allocationandassociationstatus}
2315 \textit{Some languages, such as \addtoindex{Fortran 90},
2316 provide types whose values
2317 may be dynamically allocated or associated with a variable
2318 under explicit program control.}
2320 \hypertarget{chap:DWATallocatedallocationstatusoftypes}
2322 \livelink{chap:DWATallocated}{DW\_AT\_allocated}
2324 \addtoindexx{allocated attribute}
2325 may optionally be used with any
2326 type for which objects of the type can be explicitly allocated
2327 and deallocated. The presence of the attribute indicates that
2328 objects of the type are allocatable and deallocatable. The
2329 integer value of the attribute (see below) specifies whether
2330 an object of the type is
2331 currently allocated or not.
2333 \hypertarget{chap:DWATassociatedassociationstatusoftypes}
2335 \livelink{chap:DWATassociated}{DW\_AT\_associated} attribute
2337 \addtoindexx{associated attribute}
2338 optionally be used with
2339 any type for which objects of the type can be dynamically
2340 associated with other objects. The presence of the attribute
2341 indicates that objects of the type can be associated. The
2342 integer value of the attribute (see below) indicates whether
2343 an object of the type is currently associated or not.
2345 \textit{While these attributes are defined specifically with
2346 \addtoindex{Fortran 90} ALLOCATABLE and POINTER types
2347 in mind, usage is not limited
2348 to just that language.}
2350 The value of these attributes is determined as described in
2351 Section \refersec{chap:staticanddynamicvaluesofattributes}.
2353 A non\dash zero value is interpreted as allocated or associated,
2354 and zero is interpreted as not allocated or not associated.
2356 \textit{For \addtoindex{Fortran 90},
2357 if the \livelink{chap:DWATassociated}{DW\_AT\_associated}
2358 attribute is present,
2359 the type has the POINTER property where either the parent
2360 variable is never associated with a dynamic object or the
2361 implementation does not track whether the associated object
2362 is static or dynamic. If the \livelink{chap:DWATallocated}{DW\_AT\_allocated} attribute is
2363 present and the \livelink{chap:DWATassociated}{DW\_AT\_associated} attribute is not, the type
2364 has the ALLOCATABLE property. If both attributes are present,
2365 then the type should be assumed to have the POINTER property
2366 (and not ALLOCATABLE); the \livelink{chap:DWATallocated}{DW\_AT\_allocated} attribute may then
2367 be used to indicate that the association status of the object
2368 resulted from execution of an ALLOCATE statement rather than
2369 pointer assignment.}
2371 \textit{For examples using
2372 \livelink{chap:DWATallocated}{DW\_AT\_allocated} for \addtoindex{Ada} and
2373 \addtoindex{Fortran 90}
2375 see Appendix \refersec{app:aggregateexamples}.}
2379 \section{Template Alias Entries}
2380 \label{chap:templatealiasentries}
2382 A type named using a template alias is represented
2383 by a debugging information entry
2384 \addtoindexx{template alias entry}
2386 \livetarg{chap:DWTAGtemplatealias}{DW\_TAG\_template\_alias}.
2387 The template alias entry has a
2388 \livelink{chap:DWATname}{DW\_AT\_name} attribute
2389 \addtoindexx{name attribute}
2390 whose value is a null\dash terminated string
2391 containing the name of the template alias as it appears in
2392 the source program. The template alias entry also contains
2393 \addtoindexx{type attribute}
2395 \livelink{chap:DWATtype}{DW\_AT\_type} attribute
2396 whose value is a \livelink{chap:classreference}{reference}
2397 to the type named by the template alias.
2400 The template alias entry has the following child entries:
2401 \begin{enumerate}[1. ]
2402 \item Each formal parameterized type declaration appearing
2403 in the template alias declaration is represented
2404 by a debugging information entry with the tag
2405 \livelink{chap:DWTAGtemplatetypeparameter}{DW\_TAG\_template\_type\_parameter}.
2406 Each such entry may have
2407 a \livelink{chap:DWATname}{DW\_AT\_name} attribute,
2408 \addtoindexx{name attribute}
2409 whose value is a null\dash terminated
2410 string containing the name of the formal type parameter as it
2411 appears in the source program. The template type parameter
2413 \addtoindexx{type attribute}
2414 a \livelink{chap:DWATtype}{DW\_AT\_type} attribute
2415 describing the actual
2416 type by which the formal is replaced for this instantiation.
2418 \item Each formal parameterized value declaration
2419 appearing in the template alias declaration is
2420 represented by a debugging information entry with the tag
2421 \livelink{chap:DWTAGtemplatevalueparameter}{DW\_TAG\_template\_value\_parameter}.
2422 Each such entry may have
2423 a \livelink{chap:DWATname}{DW\_AT\_name} attribute,
2424 \addtoindexx{name attribute}
2425 whose value is a null\dash terminated
2426 string containing the name of the formal value parameter
2427 as it appears in the source program. The template value
2428 parameter entry also has
2429 \addtoindexx{type attribute}
2430 a \livelink{chap:DWATtype}{DW\_AT\_type} attribute describing
2431 the type of the parameterized value. Finally, the template
2432 value parameter entry has a \livelink{chap:DWATconstvalue}{DW\_AT\_const\_value}
2433 attribute, whose value is the actual constant value of the value parameter for
2434 this instantiation as represented on the target architecture.