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 integer constant. The set of
42 values and their meanings for the \livelink{chap:DWATencoding}{DW\-\_AT\-\_encoding} attribute
44 Figure \refersec{fig:encodingattributevalues}
48 may have a \livelink{chap:DWATendianity}{DW\-\_AT\-\_endianity} attribute
49 \addtoindexx{endianity attribute}
51 Section \refersec{chap:dataobjectentries}.
52 If omitted, the encoding assumes the representation that
53 is the default for the target architecture.
56 \hypertarget{chap:DWATbytesizedataobjectordatatypesize}
57 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute
58 \hypertarget{chap:DWATbitsizebasetypebitsize}
59 or a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
60 \addtoindex{bit size attribute}
61 whose integer constant value
62 (see Section \refersec{chap:byteandbitsizes})
63 is the amount of storage needed to hold
66 \textit{For example, the
67 \addtoindex{C} type int on a machine that uses 32\dash bit
68 integers is represented by a base type entry with a name
69 attribute whose value is “int”, an encoding attribute
70 whose value is \livelink{chap:DWATEsigned}{DW\-\_ATE\-\_signed}
71 and a byte size attribute whose value is 4.}
73 If the value of an object of the given type does not fully
74 occupy the storage described by a byte size attribute,
75 \hypertarget{chap:DWATdatabitoffsetbasetypebitlocation}
76 the base type entry may also have
77 \addtoindexx{bit size attribute}
79 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and a
80 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} attribute,
82 \addtoindexx{data bit offset attribute}
84 integer constant values (
85 see Section \refersec{chap:staticanddynamicvaluesofattributes}).
87 attribute describes the actual size in bits used to represent
88 values of the given type. The data bit offset attribute is the
89 offset in bits from the beginning of the containing storage to
90 the beginning of the value. Bits that are part of the offset
91 are padding. The data bit offset uses the bit numbering and
92 direction conventions that are appropriate to the current
94 target system to locate the beginning of the storage and
95 value. If this attribute is omitted a default data bit offset
99 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
101 \addtoindexx{bit offset attribute}
103 \addtoindexx{data bit offset attribute}
105 \addtoindex{DWARF Version 4} and
106 is also used for bit field members
107 (see Section \refersec{chap:datamemberentries}).
109 \hypertarget{chap:DWATbitoffsetbasetypebitlocation}
110 replaces the attribute
111 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
113 \addtoindexx{bit offset attribute (V3)}
114 types as defined in DWARF V3 and earlier. The earlier attribute
115 is defined in a manner suitable for bit field members on
116 big\dash endian architectures but which is wasteful for use on
117 little\dash endian architectures.}
119 \textit{The attribute \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} is
121 \addtoindex{DWARF Version 4}
122 for use in base types, but implementations may continue to
123 support its use for compatibility.}
126 \addtoindex{DWARF Version 3}
127 definition of these attributes is as follows.}
129 \begin{myindentpara}{1cm}
130 \textit{A base type entry has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
131 attribute, whose value
132 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
133 is the size in bytes of the storage unit
134 used to represent an object of the given type.}
136 \textit{If the value of an object of the given type does not fully
137 occupy the storage unit described by the byte size attribute,
138 the base type entry may have a
139 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
140 \addtoindexx{bit size attribute (V3)}
142 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} attribute, both of whose values
143 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
144 are integers. The bit size attribute describes the actual
145 size in bits used to represent a value of the given type.
146 The bit offset attribute describes the offset in bits of the
147 high order bit of a value of the given type from the high
148 order bit of the storage unit used to contain that value.}
153 \addtoindexx{DWARF Version 3}
155 \addtoindexx{DWARF Version 4} and
156 4, note that DWARF V4
157 defines the following combinations of attributes:}
160 \item \textit{DW\-\_AT\-\_byte\-\_size}
161 \item \textit{DW\-\_AT\-\_bit\-\_size}
162 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
163 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
164 and optionally \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}}
167 \addtoindexx{DWARF Version 3}
168 defines the following combinations:
169 % FIXME: the figure below interferes with the following
170 % bullet list, which looks horrible as a result.
172 \item \textit{DW\-\_AT\-\_byte\-\_size}
173 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
174 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
175 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}}
178 \begin{figure}[!here]
180 \begin{tabular}{lp{9cm}}
181 Name&Meaning\\ \hline
182 \livetarg{chap:DWATEaddress}{DW\-\_ATE\-\_address} & linear machine address (for
183 segmented addresses see
184 Section \refersec{chap:segmentedaddresses}) \\
185 \livetarg{chap:DWATEboolean}{DW\-\_ATE\-\_boolean}& true or false \\
187 \livetarg{chap:DWATEcomplexfloat}{DW\-\_ATE\-\_complex\-\_float}& complex binary
188 floating\dash point number \\
189 \livetarg{chap:DWATEfloat}{DW\-\_ATE\-\_float} & binary floating\dash point number \\
190 \livetarg{chap:DWATEimaginaryfloat}{DW\-\_ATE\-\_imaginary\-\_float}& imaginary binary
191 floating\dash point number \\
192 \livetarg{chap:DWATEsigned}{DW\-\_ATE\-\_signed}& signed binary integer \\
193 \livetarg{chap:DWATEsignedchar}{DW\-\_ATE\-\_signed\-\_char}& signed character \\
194 \livetarg{chap:DWATEunsigned}{DW\-\_ATE\-\_unsigned} & unsigned binary integer \\
195 \livetarg{chap:DWATEunsignedchar}{DW\-\_ATE\-\_unsigned\-\_char} & unsigned character \\
196 \livetarg{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} & packed decimal \\
197 \livetarg{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string}& numeric string \\
198 \livetarg{chap:DWATEedited}{DW\-\_ATE\-\_edited} & edited string \\
199 \livetarg{chap:DWATEsignedfixed}{DW\-\_ATE\-\_signed\-\_fixed} & signed fixed\dash point scaled integer \\
200 \livetarg{chap:DWATEunsignedfixed}{DW\-\_ATE\-\_unsigned\-\_fixed}& unsigned fixed\dash point scaled integer \\
201 \livetarg{chap:DWATEdecimalfloat}{DW\-\_ATE\-\_decimal\-\_float} & decimal floating\dash point number \\
202 \livetarg{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} & Unicode character \\
204 \caption{Encoding attribute values}
205 \label{fig:encodingattributevalues}
208 \textit{The \livelink{chap:DWATEdecimalfloat}{DW\-\_ATE\-\_decimal\-\_float} encoding is intended for
209 floating\dash point representations that have a power\dash of\dash ten
210 exponent, such as that specified in IEEE 754R.}
212 \textit{The \livelink{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} encoding is intended for Unicode string
213 encodings (see the Universal Character Set standard,
214 ISO/IEC 10646\dash 1:1993). For example, the
215 \addtoindex{C++} type char16\_t is
216 represented by a base type entry with a name attribute whose
217 value is “char16\_t”, an encoding attribute whose value
218 is \livelink{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} and a byte size attribute whose value is 2.}
221 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal}
223 \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string}
225 represent packed and unpacked decimal string numeric data
226 types, respectively, either of which may be
228 \addtoindexx{decimal scale attribute}
230 \addtoindexx{decimal sign attribute}
232 \addtoindexx{digit count attribute}
234 \hypertarget{chap:DWATdecimalsigndecimalsignrepresentation}
236 \hypertarget{chap:DWATdigitcountdigitcountforpackeddecimalornumericstringtype}
237 base types are used in combination with
238 \livelink{chap:DWATdecimalsign}{DW\-\_AT\-\_decimal\-\_sign},
239 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and
240 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale}
243 A \livelink{chap:DWATdecimalsign}{DW\-\_AT\-\_decimal\-\_sign} attribute
244 \addtoindexx{decimal sign attribute}
245 is an integer constant that
246 conveys the representation of the sign of the decimal type
247 (see Figure \refersec{fig:decimalsignattributevalues}).
248 Its integer constant value is interpreted to
249 mean that the type has a leading overpunch, trailing overpunch,
250 leading separate or trailing separate sign representation or,
251 alternatively, no sign at all.
254 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count}
256 \addtoindexx{digit count attribute}
257 is an integer constant
258 value that represents the number of digits in an instance of
261 \hypertarget{chap:DWATdecimalscaledecimalscalefactor}
262 The \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale}
264 \addtoindexx{decimal scale attribute}
265 is an integer constant value
266 that represents the exponent of the base ten scale factor to
267 be applied to an instance of the type. A scale of zero puts the
268 decimal point immediately to the right of the least significant
269 digit. Positive scale moves the decimal point to the right
270 and implies that additional zero digits on the right are not
271 stored in an instance of the type. Negative scale moves the
272 decimal point to the left; if the absolute value of the scale
273 is larger than the digit count, this implies additional zero
274 digits on the left are not stored in an instance of the type.
276 The \livelink{chap:DWATEedited}{DW\-\_ATE\-\_edited}
278 \hypertarget{chap:DWATpicturestringpicturestringfornumericstringtype}
279 type is used to represent an edited
280 numeric or alphanumeric data type. It is used in combination
281 with an \livelink{chap:DWATpicturestring}{DW\-\_AT\-\_picture\-\_string} attribute whose value is a
282 null\dash terminated string containing the target\dash dependent picture
283 string associated with the type.
285 If the edited base type entry describes an edited numeric
286 data type, the edited type entry has a \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and a
287 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attribute.
288 \addtoindexx{decimal scale attribute}
289 These attributes have the same
290 interpretation as described for the
291 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} and
292 \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base
293 types. If the edited type entry
294 describes an edited alphanumeric data type, the edited type
295 entry does not have these attributes.
298 \textit{The presence or absence of the \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and
299 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attributes
300 \addtoindexx{decimal scale attribute}
301 allows a debugger to easily
302 distinguish edited numeric from edited alphanumeric, although
303 in principle the digit count and scale are derivable by
304 interpreting the picture string.}
306 The \livelink{chap:DWATEsignedfixed}{DW\-\_ATE\-\_signed\-\_fixed} and \livelink{chap:DWATEunsignedfixed}{DW\-\_ATE\-\_unsigned\-\_fixed} entries
307 describe signed and unsigned fixed\dash point binary data types,
310 The fixed binary type entries have
311 \addtoindexx{digit count attribute}
313 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count}
314 attribute with the same interpretation as described for the
315 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} and \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base types.
317 For a data type with a decimal scale factor, the fixed binary
319 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attribute
320 \addtoindexx{decimal scale attribute}
322 interpretation as described for the
323 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal}
324 and \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base types.
326 \hypertarget{chap:DWATbinaryscalebinaryscalefactorforfixedpointtype}
327 For a data type with a binary scale factor, the fixed
328 \addtoindexx{binary scale attribute}
329 binary type entry has a
330 \livelink{chap:DWATbinaryscale}{DW\-\_AT\-\_binary\-\_scale} attribute.
332 \livelink{chap:DWATbinaryscale}{DW\-\_AT\-\_binary\-\_scale} attribute
333 is an integer constant value
334 that represents the exponent of the base two scale factor to
335 be applied to an instance of the type. Zero scale puts the
336 binary point immediately to the right of the least significant
337 bit. Positive scale moves the binary point to the right and
338 implies that additional zero bits on the right are not stored
339 in an instance of the type. Negative scale moves the binary
340 point to the left; if the absolute value of the scale is
341 larger than the number of bits, this implies additional zero
342 bits on the left are not stored in an instance of the type.
345 \hypertarget{chap:DWATsmallscalefactorforfixedpointtype}
346 a data type with a non\dash decimal and non\dash binary scale factor,
347 the fixed binary type entry has a
348 \livelink{chap:DWATsmall}{DW\-\_AT\-\_small} attribute which
349 \addtoindexx{small attribute}
351 \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} entry. The scale factor value
352 is interpreted in accordance with the value defined by the
353 \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} entry. The value represented is the product
354 of the integer value in memory and the associated constant
357 \textit{The \livelink{chap:DWATsmall}{DW\-\_AT\-\_small} attribute
358 is defined with the \addtoindex{Ada} small
363 \begin{tabular}{lp{9cm}}
364 Name&Meaning\\ \hline
365 \livetarg{chap:DWDSunsigned}{DW\-\_DS\-\_unsigned} & unsigned \\
366 \livetarg{chap:DWDSleadingoverpunch}{DW\-\_DS\-\_leading\-\_overpunch} & Sign
367 is encoded in the most significant digit in a target\dash dependent manner \\
368 \livetarg{chap:DWDStrailingoverpunch}{DW\-\_DS\-\_trailing\-\_overpunch} & Sign
369 is encoded in the least significant digit in a target\dash dependent manner \\
370 \livetarg{chap:DWDSleadingseparate}{DW\-\_DS\-\_leading\-\_separate}
371 & Decimal type: Sign is a ``+'' or ``-'' character
372 to the left of the most significant digit. \\
373 \livetarg{chap:DWDStrailingseparate}{DW\-\_DS\-\_trailing\-\_separate}
374 & Decimal type: Sign is a ``+'' or ``-'' character
375 to the right of the least significant digit. \\
376 &Packed decimal type: Least significant nibble contains
377 a target\dash dependent value
378 indicating positive or negative. \\
380 \caption{Decimal sign attribute values}
381 \label{fig:decimalsignattributevalues}
384 \section{Unspecified Type Entries}
385 \label{chap:unspecifiedtypeentries}
386 \addtoindexx{unspecified type entry}
387 \addtoindexx{void type|see{unspecified type entry}}
388 Some languages have constructs in which a type
389 may be left unspecified or the absence of a type
390 may be explicitly indicated.
392 An unspecified (implicit, unknown, ambiguous or nonexistent)
393 type is represented by a debugging information entry with
394 the tag \livetarg{chap:DWTAGunspecifiedtype}{DW\-\_TAG\-\_unspecified\-\_type}.
395 If a name has been given
396 to the type, then the corresponding unspecified type entry
397 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
398 \addtoindexx{name attribute}
400 a null\dash terminated
401 string containing the name as it appears in the source program.
403 The interpretation of this debugging information entry is
404 intentionally left flexible to allow it to be interpreted
405 appropriately in different languages. For example, in
406 \addtoindex{C} and \addtoindex{C++}
407 the language implementation can provide an unspecified type
408 entry with the name “void” which can be referenced by the
409 type attribute of pointer types and typedef declarations for
411 % FIXME: the following reference was wrong in DW4 so DavidA guessed
413 Sections \refersec{chap:unspecifiedtypeentries} and
414 %The following reference was valid, so the following is probably correct.
415 Section \refersec{chap:typedefentries},
416 respectively). As another
417 example, in \addtoindex{Ada} such an unspecified type entry can be referred
418 to by the type attribute of an access type where the denoted
419 \addtoindexx{incomplete type (Ada)}
420 type is incomplete (the name is declared as a type but the
421 definition is deferred to a separate compilation unit).
423 \section{Type Modifier Entries}
424 \label{chap:typemodifierentries}
425 \addtoindexx{type modifier entry}
427 A base or user\dash defined type may be modified in different ways
428 in different languages. A type modifier is represented in
429 DWARF by a debugging information entry with one of the tags
431 Figure \refersec{fig:typemodifiertags}.
433 If a name has been given to the modified type in the source
434 program, then the corresponding modified type entry has
435 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
436 \addtoindexx{name attribute}
437 whose value is a null\dash terminated
438 string containing the modified type name as it appears in
441 Each of the type modifier entries has a
442 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute,
443 whose value is a reference to a debugging information entry
444 describing a base type, a user-defined type or another type
447 A modified type entry describing a
448 \addtoindexx{pointer type entry}
449 pointer or \addtoindex{reference type}
450 (using \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type},
451 \livelink{chap:DWTAGreferencetype}{DW\-\_TAG\-\_reference\-\_type} or
452 \livelink{chap:DWTAGrvaluereferencetype}{DW\-\_TAG\-\_rvalue\-\_reference\-\_type})
453 % Another instance of no-good-place-to-put-index entry.
455 \addtoindexx{address class!attribute}
457 \hypertarget{chap:DWATadressclasspointerorreferencetypes}
459 \livelink{chap:DWATaddressclass}{DW\-\_AT\-\_address\-\_class}
460 attribute to describe how objects having the given pointer
461 or reference type ought to be dereferenced.
463 A modified type entry describing a shared qualified type
464 (using \livelink{chap:DWTAGsharedtype}{DW\-\_TAG\-\_shared\-\_type}) may have a
465 \livelink{chap:DWATcount}{DW\-\_AT\-\_count} attribute
466 \addtoindexx{count attribute}
467 whose value is a constant expressing the blocksize of the
468 type. If no count attribute is present, then the “infinite”
469 blocksize is assumed.
471 When multiple type modifiers are chained together to modify
472 a base or user-defined type, the tree ordering reflects the
474 \addtoindexx{reference type entry, lvalue|see{reference type entry}}
476 \addtoindexx{reference type entry, rvalue|see{rvalue reference type entry}}
478 \addtoindexx{parameter|see{macro formal parameter list}}
480 \addtoindexx{parameter|see{\textit{this} parameter}}
482 \addtoindexx{parameter|see{variable parameter attribute}}
484 \addtoindexx{parameter|see{optional parameter attribute}}
486 \addtoindexx{parameter|see{unspecified parameters entry}}
488 \addtoindexx{parameter|see{template value parameter entry}}
490 \addtoindexx{parameter|see{template type parameter entry}}
492 \addtoindexx{parameter|see{formal parameter entry}}
497 \begin{tabular}{lp{9cm}}
498 Name&Meaning\\ \hline
499 \livetarg{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} & C or C++ const qualified type
500 \addtoindexx{const qualified type entry} \addtoindexx{C} \addtoindexx{C++} \\
501 \livetarg{chap:DWTAGpackedtype}{DW\-\_TAG\-\_packed\-\_type}& \addtoindex{Pascal} or Ada packed type\addtoindexx{packed type entry}
502 \addtoindexx{packed qualified type entry} \addtoindexx{Ada} \addtoindexx{Pascal} \\
503 \livetarg{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} & Pointer to an object of
504 the type being modified \addtoindexx{pointer qualified type entry} \\
505 \livetarg{chap:DWTAGreferencetype}{DW\-\_TAG\-\_reference\-\_type}& C++ (lvalue) reference
506 to an object of the type
507 \addtoindexx{reference type entry} \\
509 \addtoindexx{reference qualified type entry} \\
510 \livetarg{chap:DWTAGrestricttype}{DW\-\_TAG\-\_restrict\-\_type}& \addtoindex{C}
512 \addtoindexx{restricted type entry} \\
514 \addtoindexx{restrict qualified type} \\
515 \livetarg{chap:DWTAGrvaluereferencetype}{DW\-\_TAG\-\_rvalue\-\_reference\-\_type} & C++
516 \addtoindexx{rvalue reference type entry}
518 \addtoindexx{restricted type entry}
519 reference to an object of the type being modified
520 \addtoindexx{rvalue reference qualified type entry} \\
521 \livetarg{chap:DWTAGsharedtype}{DW\-\_TAG\-\_shared\-\_type}&UPC shared qualified type
522 \addtoindexx{shared qualified type entry} \\
523 \livetarg{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type}&C or C++ volatile qualified type
524 \addtoindex{volatile qualified type entry} \\
526 \caption{Type modifier tags}
527 \label{fig:typemodifiertags}
530 %The following clearpage prevents splitting the example across pages.
532 \textit{As examples of how type modifiers are ordered, take the following C
536 const unsigned char * volatile p;
537 which represents a volatile pointer to a constant
538 character. This is encoded in DWARF as:
539 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}(p) -->
540 \livelink{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type} -->
541 \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} -->
542 \livelink{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} -->
543 \livelink{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}(unsigned char)
545 volatile unsigned char * const restrict p;
546 on the other hand, represents a restricted constant
547 pointer to a volatile character. This is encoded as:
548 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}(p) -->
549 \livelink{chap:DWTAGrestricttype}{DW\-\_TAG\-\_restrict\-\_type} -->
550 \livelink{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} -->
551 \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} -->
552 \livelink{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type} -->
553 \livelink{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}(unsigned char)
557 \section{Typedef Entries}
558 \label{chap:typedefentries}
559 A named type that is defined in terms of another type
560 definition is represented by a debugging information entry with
561 the tag \livetarg{chap:DWTAGtypedef}{DW\-\_TAG\-\_typedef}.
562 The typedef entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
563 \addtoindexx{name attribute}
564 whose value is a null\dash terminated string containing
565 the name of the typedef as it appears in the source program.
567 The typedef entry may also contain a
568 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose
569 value is a reference to the type named by the typedef. If
570 the debugging information entry for a typedef represents
571 a declaration of the type that is not also a definition,
572 it does not contain a type attribute.
574 \textit{Depending on the language, a named type that is defined in
575 terms of another type may be called a type alias, a subtype,
576 a constrained type and other terms. A type name declared with
577 no defining details may be termed an
578 \addtoindexx{incomplete type}
579 incomplete, forward or hidden type.
580 While the DWARF \livelink{chap:DWTAGtypedef}{DW\-\_TAG\-\_typedef} entry was
581 originally inspired by the like named construct in
582 \addtoindex{C} and \addtoindex{C++},
583 it is broadly suitable for similar constructs (by whatever
584 source syntax) in other languages.}
586 \section{Array Type Entries}
587 \label{chap:arraytypeentries}
589 Many languages share the concept of an ``array,'' which is
590 \addtoindexx{array type entry}
591 a table of components of identical type.
593 An array type is represented by a debugging information entry
594 with the tag \livetarg{chap:DWTAGarraytype}{DW\-\_TAG\-\_array\-\_type}.
597 \addtoindexx{array!declaration of type}
598 the array type in the source program, then the corresponding
599 array type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
600 \addtoindexx{name attribute}
602 null\dash terminated string containing the array type name as it
603 appears in the source program.
606 \hypertarget{chap:DWATorderingarrayrowcolumnordering}
607 array type entry describing a multidimensional array may
608 \addtoindexx{array!element ordering}
609 have a \livelink{chap:DWATordering}{DW\-\_AT\-\_ordering} attribute whose integer constant value is
610 interpreted to mean either row-major or column-major ordering
611 of array elements. The set of values and their meanings
612 for the ordering attribute are listed in
613 Figure \refersec{fig:arrayordering}.
615 ordering attribute is present, the default ordering for the
616 source language (which is indicated by the
617 \livelink{chap:DWATlanguage}{DW\-\_AT\-\_language}
619 \addtoindexx{language attribute}
620 of the enclosing compilation unit entry) is assumed.
623 \autorows[0pt]{c}{1}{l}{
624 \livetarg{chap:DWORDcolmajor}{DW\-\_ORD\-\_col\-\_major},
625 \livetarg{chap:DWORDrowmajor}{DW\-\_ORD\-\_row\-\_major}
627 \caption{Array ordering}\label{fig:arrayordering}
630 The ordering attribute may optionally appear on one-dimensional
631 arrays; it will be ignored.
633 An array type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
634 \addtoindexx{array!element type}
636 the type of each element of the array.
638 If the amount of storage allocated to hold each element of an
639 object of the given array type is different from the amount
640 \addtoindexx{stride attribute|see{bit stride attribute or byte stride attribute}}
641 of storage that is normally allocated to hold an individual
642 \hypertarget{chap:DWATbitstridearrayelementstrideofarraytype}
644 \hypertarget{chap:DWATbytestridearrayelementstrideofarraytype}
645 indicated element type, then the array type
646 \addtoindexx{bit stride attribute}
648 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
650 \addtoindexx{byte stride attribute}
651 a \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride}
653 \addtoindexx{bit stride attribute}
655 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
657 element of the array.
659 The array type entry may have either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a
660 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
661 (see Section \refersec{chap:byteandbitsizes}),
663 amount of storage needed to hold an instance of the array type.
665 \textit{If the size of the array can be determined statically at
666 compile time, this value can usually be computed by multiplying
667 the number of array elements by the size of each element.}
670 Each array dimension is described by a debugging information
671 entry with either the
672 \addtoindexx{subrange type entry!as array dimension}
673 tag \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} or the
674 \addtoindexx{enumeration type entry!as array dimension}
676 \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}. These entries are
678 array type entry and are ordered to reflect the appearance of
679 the dimensions in the source program (i.e., leftmost dimension
680 first, next to leftmost second, and so on).
682 In languages, such as C, in which there is no concept of
683 a “multidimensional array”, an array of arrays may
684 be represented by a debugging information entry for a
685 multidimensional array.
687 Other attributes especially applicable to arrays are
688 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated},
689 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} and
690 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location},
691 which are described in
692 Section \refersec{chap:dynamictypeproperties}.
693 For relevant examples,
695 Appendix \refersec{app:fortran90example}.
697 \section{ Structure, Union, Class and Interface Type Entries}
698 \label{chap:structureunionclassandinterfacetypeentries}
700 \textit{The languages
702 \addtoindex{C++}, and
703 \addtoindex{Pascal}, among others, allow the
704 programmer to define types that are collections of related
705 \addtoindexx{structure type entry}
707 In \addtoindex{C} and \addtoindex{C++}, these collections are called
709 In \addtoindex{Pascal}, they are called “records.”
710 The components may be of different types. The components are
711 called “members” in \addtoindex{C} and
712 \addtoindex{C++}, and “fields” in \addtoindex{Pascal}.}
714 \textit{The components of these collections each exist in their
715 own space in computer memory. The components of a C or C++
716 “union” all coexist in the same memory.}
718 \textit{\addtoindex{Pascal} and
719 other languages have a “discriminated union,”
720 \addtoindex{discriminated union|see {variant entry}}
721 also called a “variant record.” Here, selection of a
722 number of alternative substructures (“variants”) is based
723 on the value of a component that is not part of any of those
724 substructures (the “discriminant”).}
726 \textit{\addtoindex{C++} and
727 \addtoindex{Java} have the notion of ``class'', which is in some
728 ways similar to a structure. A class may have “member
729 functions” which are subroutines that are within the scope
730 of a class or structure.}
732 \textit{The \addtoindex{C++} notion of
733 structure is more general than in \addtoindex{C}, being
734 equivalent to a class with minor differences. Accordingly,
735 in the following discussion statements about
736 \addtoindex{C++} classes may
737 be understood to apply to \addtoindex{C++} structures as well.}
739 \subsection{Structure, Union and Class Type Entries}
740 \label{chap:structureunionandclasstypeentries}
743 Structure, union, and class types are represented by debugging
744 \addtoindexx{structure type entry}
746 \addtoindexx{union type entry}
748 \addtoindexx{class type entry}
750 \livetarg{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type},
751 \livetarg{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type},
752 and \livetarg{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
753 respectively. If a name has been given to the structure,
754 union, or class in the source program, then the corresponding
755 structure type, union type, or class type entry has a
756 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
757 \addtoindexx{name attribute}
758 whose value is a null\dash terminated string
759 containing the type name as it appears in the source program.
761 The members of a structure, union, or class are represented
762 by debugging information entries that are owned by the
763 corresponding structure type, union type, or class type entry
764 and appear in the same order as the corresponding declarations
765 in the source program.
767 A structure type, union type or class type entry may have
768 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a
769 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
770 \hypertarget{chap:DWATbitsizedatamemberbitsize}
771 (see Section \refersec{chap:byteandbitsizes}),
772 whose value is the amount of storage needed
773 to hold an instance of the structure, union or class type,
774 including any padding.
775 An incomplete structure, union or class type
776 \addtoindexx{incomplete structure/union/class}
778 \addtoindexx{incomplete type}
779 represented by a structure, union or class
780 entry that does not have a byte size attribute and that has
781 \addtoindexx{declaration attribute}
782 a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
784 If the complete declaration of a type has been placed in
785 \hypertarget{chap:DWATsignaturetypesignature}
787 (see Section \refersec{chap:separatetypeunitentries}),
788 an incomplete declaration
789 \addtoindexx{incomplete type}
790 of that type in the compilation unit may provide
791 the unique 64\dash bit signature of the type using a \livelink{chap:DWATsignature}{DW\-\_AT\-\_signature}
794 If a structure, union or class entry represents the definition
795 of a structure, class or union member corresponding to a prior
796 incomplete structure, class or union, the entry may have a
797 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute
798 \addtoindexx{specification attribute}
799 whose value is a reference to
800 the debugging information entry representing that incomplete
803 Structure, union and class entries containing the
804 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute
805 \addtoindexx{specification attribute}
806 do not need to duplicate
807 information provided by the declaration entry referenced by the
808 specification attribute. In particular, such entries do not
809 need to contain an attribute for the name of the structure,
810 class or union they represent if such information is already
811 provided in the declaration.
813 \textit{For \addtoindex{C} and \addtoindex{C++},
815 \addtoindexx{data member|see {member entry (data)}}
816 member declarations occurring within
817 the declaration of a structure, union or class type are
818 considered to be “definitions” of those members, with
819 the exception of “static” data members, whose definitions
820 appear outside of the declaration of the enclosing structure,
821 union or class type. Function member declarations appearing
822 within a structure, union or class type declaration are
823 definitions only if the body of the function also appears
824 within the type declaration.}
826 If the definition for a given member of the structure, union
827 or class does not appear within the body of the declaration,
828 that member also has a debugging information entry describing
829 its definition. That latter entry has a
830 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute
831 \addtoindexx{specification attribute}
832 referencing the debugging information entry
833 owned by the body of the structure, union or class entry and
834 representing a non\dash defining declaration of the data, function
835 or type member. The referenced entry will not have information
836 about the location of that member (low and high pc attributes
837 for function members, location descriptions for data members)
838 and will have a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
840 \textit{Consider a nested class whose
841 definition occurs outside of the containing class definition, as in:}
850 \textit{The two different structs can be described in
851 different compilation units to
852 facilitate DWARF space compression
853 (see Appendix \refersec{app:usingcompilationunits}).}
855 \subsection{Interface Type Entries}
856 \label{chap:interfacetypeentries}
858 \textit{The \addtoindex{Java} language defines ``interface'' types.
860 \addtoindex{interface type entry}
861 in \addtoindex{Java} is similar to a \addtoindex{C++} or
862 \addtoindex{Java} class with only abstract
863 methods and constant data members.}
866 \addtoindexx{interface type entry}
867 are represented by debugging information
869 tag \livetarg{chap:DWTAGinterfacetype}{DW\-\_TAG\-\_interface\-\_type}.
871 An interface type entry has
872 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
873 \addtoindexx{name attribute}
875 value is a null\dash terminated string containing the type name
876 as it appears in the source program.
878 The members of an interface are represented by debugging
879 information entries that are owned by the interface type
880 entry and that appear in the same order as the corresponding
881 declarations in the source program.
883 \subsection{Derived or Extended Structs, Classes and Interfaces}
884 \label{chap:derivedorextendedstructsclasesandinterfaces}
886 \textit{In \addtoindex{C++}, a class (or struct)
888 \addtoindexx{derived type (C++)|see{inheritance entry}}
889 be ``derived from'' or be a
890 ``subclass of'' another class.
891 In \addtoindex{Java}, an interface may ``extend''
892 \addtoindexx{extended type (Java)|see{inheritance entry}}
894 \addtoindexx{implementing type (Java)|see{inheritance entry}}
895 or more other interfaces, and a class may ``extend'' another
896 class and/or ``implement'' one or more interfaces. All of these
897 relationships may be described using the following. Note that
898 in \addtoindex{Java},
899 the distinction between extends and implements is
900 implied by the entities at the two ends of the relationship.}
902 A class type or interface type entry that describes a
903 derived, extended or implementing class or interface owns
904 addtoindexx{implementing type (Java)|see{inheritance entry}}
905 debugging information entries describing each of the classes
906 or interfaces it is derived from, extending or implementing,
907 respectively, ordered as they were in the source program. Each
909 \addtoindexx{inheritance entry}
911 tag \livetarg{chap:DWTAGinheritance}{DW\-\_TAG\-\_inheritance}.
913 An inheritance entry has
914 \addtoindexx{inheritance entry}
916 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is
917 a reference to the debugging information entry describing the
918 class or interface from which the parent class or structure
919 of the inheritance entry is derived, extended or implementing.
922 \addtoindexx{inheritance entry}
923 for a class that derives from or extends
924 \hypertarget{chap:DWATdatamemberlocationinheritedmemberlocation}
925 another class or struct also has
926 \addtoindexx{data member location attribute}
928 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
929 attribute, whose value describes the location of the beginning
930 of the inherited type relative to the beginning address of the
931 derived class. If that value is a constant, it is the offset
932 in bytes from the beginning of the class to the beginning of
933 the inherited type. Otherwise, the value must be a location
934 description. In this latter case, the beginning address of
935 the derived class is pushed on the expression stack before
936 the \addtoindex{location description}
937 is evaluated and the result of the
938 evaluation is the location of the inherited type.
940 \textit{The interpretation of the value of this attribute for
941 inherited types is the same as the interpretation for data
943 (see Section \refersec{chap:datamemberentries}). }
946 \addtoindexx{inheritance entry}
948 \hypertarget{chap:DWATaccessibilitycppinheritedmembers}
950 \addtoindexx{accessibility attribute}
952 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
954 If no accessibility attribute
955 is present, private access is assumed for an entry of a class
956 and public access is assumed for an entry of an interface,
960 \hypertarget{chap:DWATvirtualityvirtualityofbaseclass}
961 the class referenced by the
962 \addtoindexx{inheritance entry}
963 inheritance entry serves
964 as a \addtoindex{C++} virtual base class, the inheritance entry has a
965 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
967 \textit{For a \addtoindex{C++} virtual base, the
968 \addtoindex{data member location attribute}
969 will usually consist of a non-trivial
970 \addtoindex{location description}.}
972 \subsection{Access Declarations}
973 \label{chap:accessdeclarations}
975 \textit{In \addtoindex{C++}, a derived class may contain access declarations that
976 \addtoindex{access declaration entry}
977 change the accessibility of individual class members from the
978 overall accessibility specified by the inheritance declaration.
979 A single access declaration may refer to a set of overloaded
982 If a derived class or structure contains access declarations,
983 each such declaration may be represented by a debugging
984 information entry with the tag
985 \livetarg{chap:DWTAGaccessdeclaration}{DW\-\_TAG\-\_access\-\_declaration}.
987 such entry is a child of the class or structure type entry.
989 An access declaration entry has
990 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
991 \addtoindexx{name attribute}
993 value is a null\dash terminated string representing the name used
994 in the declaration in the source program, including any class
995 or structure qualifiers.
997 An access declaration entry
998 \hypertarget{chap:DWATaccessibilitycppbaseclasses}
1001 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
1002 attribute describing the declared accessibility of the named
1006 \subsection{Friends}
1007 \label{chap:friends}
1010 \addtoindexx{friend entry}
1011 declared by a structure, union or class
1012 \hypertarget{chap:DWATfriendfriendrelationship}
1013 type may be represented by a debugging information entry
1014 that is a child of the structure, union or class type entry;
1015 the friend entry has the
1016 tag \livetarg{chap:DWTAGfriend}{DW\-\_TAG\-\_friend}.
1019 \addtoindexx{friend attribute}
1020 a \livelink{chap:DWATfriend}{DW\-\_AT\-\_friend} attribute, whose value is
1021 a reference to the debugging information entry describing
1022 the declaration of the friend.
1025 \subsection{Data Member Entries}
1026 \label{chap:datamemberentries}
1028 A data member (as opposed to a member function) is
1029 represented by a debugging information entry with the
1030 tag \livetarg{chap:DWTAGmember}{DW\-\_TAG\-\_member}.
1032 \addtoindexx{member entry (data)}
1033 member entry for a named member has
1034 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1035 \addtoindexx{name attribute}
1036 whose value is a null\dash terminated
1037 string containing the member name as it appears in the source
1038 program. If the member entry describes an
1039 \addtoindex{anonymous union},
1041 name attribute is omitted or consists of a single zero byte.
1043 The data member entry has a
1044 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote
1045 \addtoindexx{member entry (data)}
1046 the type of that member.
1048 A data member entry may
1049 \addtoindexx{accessibility attribute}
1051 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
1052 attribute. If no accessibility attribute is present, private
1053 access is assumed for an entry of a class and public access
1054 is assumed for an entry of a structure, union, or interface.
1057 \hypertarget{chap:DWATmutablemutablepropertyofmemberdata}
1059 \addtoindexx{member entry (data)}
1061 \addtoindexx{mutable attribute}
1062 have a \livelink{chap:DWATmutable}{DW\-\_AT\-\_mutable} attribute,
1063 which is a \livelink{chap:flag}{flag}.
1064 This attribute indicates whether the data
1065 member was declared with the mutable storage class specifier.
1067 The beginning of a data member
1068 \addtoindex{beginning of a data member}
1069 is described relative to
1070 \addtoindexx{beginning of an object}
1071 the beginning of the object in which it is immediately
1072 contained. In general, the beginning is characterized by
1073 both an address and a bit offset within the byte at that
1074 address. When the storage for an entity includes all of
1075 the bits in the beginning byte, the beginning bit offset is
1078 Bit offsets in DWARF use the bit numbering and direction
1079 conventions that are appropriate to the current language on
1083 \addtoindexx{member entry (data)}
1084 corresponding to a data member that is
1085 \hypertarget{chap:DWATdatabitoffsetdatamemberbitlocation}
1087 \hypertarget{chap:DWATdatamemberlocationdatamemberlocation}
1088 in a structure, union or class may have either
1089 \addtoindexx{data member location attribute}
1091 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute or a
1092 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1093 attribute. If the beginning of the data member is the same as
1094 the beginning of the containing entity then neither attribute
1097 For a \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute
1098 \addtoindexx{data member location attribute}
1099 there are two cases:
1101 \begin{enumerate}[1.]
1103 \item If the value is an integer constant, it is the offset
1104 in bytes from the beginning of the containing entity. If
1105 the beginning of the containing entity has a non-zero bit
1106 offset then the beginning of the member entry has that same
1109 \item Otherwise, the value must be a \addtoindex{location description}.
1111 this case, the beginning of the containing entity must be byte
1112 aligned. The beginning address is pushed on the DWARF stack
1113 before the \addtoindex{location} description is evaluated; the result of
1114 the evaluation is the base address of the member entry.
1116 \textit{The push on the DWARF expression stack of the base address of
1117 the containing construct is equivalent to execution of the
1118 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} operation
1119 (see Section \refersec{chap:stackoperations});
1120 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} therefore
1121 is not needed at the
1122 beginning of a \addtoindex{location description} for a data member.
1124 result of the evaluation is a location--either an address or
1125 the name of a register, not an offset to the member.}
1127 \textit{A \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1129 \addtoindexx{data member location attribute}
1130 that has the form of a
1131 \addtoindex{location description} is not valid for a data member contained
1132 in an entity that is not byte aligned because DWARF operations
1133 do not allow for manipulating or computing bit offsets.}
1137 For a \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} attribute,
1138 the value is an integer constant
1139 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1140 that specifies the number of bits
1141 from the beginning of the containing entity to the beginning
1142 of the data member. This value must be greater than or equal
1143 to zero, but is not limited to less than the number of bits
1146 If the size of a data member is not the same as the size
1147 of the type given for the data member, the data member has
1148 \addtoindexx{bit size attribute}
1149 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1150 or a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute whose
1151 integer constant value
1152 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1154 of storage needed to hold the value of the data member.
1156 \textit{\addtoindex{C} and \addtoindex{C++}
1158 \addtoindex{bit fields}
1160 \addtoindexx{data bit offset}
1162 \addtoindexx{data bit size}
1164 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} and
1165 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attributes.}
1167 \textit{This Standard uses the following bit numbering and direction
1168 conventions in examples. These conventions are for illustrative
1169 purposes and other conventions may apply on particular
1174 \item \textit{For big\dash endian architectures, bit offsets are
1175 counted from high-order to low\dash order bits within a byte (or
1176 larger storage unit); in this case, the bit offset identifies
1177 the high\dash order bit of the object.}
1179 \item \textit{For little\dash endian architectures, bit offsets are
1180 counted from low\dash order to high\dash order bits within a byte (or
1181 larger storage unit); in this case, the bit offset identifies
1182 the low\dash order bit of the object.}
1186 \textit{In either case, the bit so identified is defined as the
1187 \addtoindexx{beginning of an object}
1188 beginning of the object.}
1190 \textit{For example, take one possible representation of the following
1191 \addtoindex{C} structure definition
1192 in both big\dash and little\dash endian byte orders:}
1203 \textit{The following diagrams show the structure layout
1204 and data bit offsets for example big\dash\ and little\dash endian
1205 architectures, respectively. Both diagrams show a structure
1206 that begins at address A and whose size is four bytes. Also,
1207 high order bits are to the left and low order bits are to
1210 \textit{Big\dash Endian Data Bit Offsets:}
1218 Addresses increase ->
1219 | A | A + 1 | A + 2 | A + 3 |
1221 Data bit offsets increase ->
1222 +---------------+---------------+---------------+---------------+
1223 |0 4|5 10|11 15|16 23|24 31|
1224 | j | k | m | n | <pad> |
1226 +---------------------------------------------------------------+
1229 \textit{Little\dash Endian Data Bit Offsets:}
1235 <- Addresses increase
1236 | A | A + 1 | A + 2 | A + 3 |
1238 <- Data bit offsets increase
1240 +---------------+---------------+---------------+---------------+
1241 |31 24|23 16|15 11|10 5|4 0|
1242 | <pad> | n | m | k | j |
1244 +---------------------------------------------------------------+
1248 \textit{Note that data member bit offsets in this example are the
1249 same for both big\dash\ and little\dash endian architectures even
1250 though the fields are allocated in different directions
1251 (high\dash order to low-order versus low\dash order to high\dash order);
1252 the bit naming conventions for memory and/or registers of
1253 the target architecture may or may not make this seem natural.}
1255 \textit{For a more extensive example showing nested and packed records
1257 Appendix \refersec{app:pascalexample}.}
1259 \textit{Attribute \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1261 \addtoindex{DWARF Version 4}
1262 and is also used for base types
1264 \refersec{chap:basetypeentries}).
1266 \livetarg{chap:DWATbitoffsetdatamemberbitlocation}
1267 attributes \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} and
1268 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} when used to
1269 identify the beginning of bit field data members as defined
1270 in DWARF V3 and earlier. The earlier attributes are defined
1271 in a manner suitable for bit field members on big-endian
1272 architectures but which is either awkward or incomplete for
1273 use on little-endian architectures.
1274 (\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} also
1275 has other uses that are not affected by this change.)}
1277 \textit{The \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1278 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1279 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1280 attribute combination is deprecated for data members in DWARF
1281 Version 4, but implementations may continue to support this
1282 use for compatibility.}
1285 \addtoindex{DWARF Version 3}
1286 definitions of these attributes are
1289 \begin{myindentpara}{1cm}
1290 \textit{If the data member entry describes a bit field, then that
1291 entry has the following attributes:}
1294 \item \textit{A \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1295 attribute whose value
1296 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1297 is the number of bytes that contain an instance of the
1298 bit field and any padding bits.}
1300 \textit{The byte size attribute may be omitted if the size of the
1301 object containing the bit field can be inferred from the type
1302 attribute of the data member containing the bit field.}
1304 \item \textit{A \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1306 \addtoindexx{bit offset attribute (V3)}
1308 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1309 is the number of bits to the left of the leftmost
1310 (most significant) bit of the bit field value.}
1312 \item \textit{A \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1314 \addtoindexx{bit size attribute (V3)}
1316 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1317 is the number of bits occupied by the bit field value.}
1322 \addtoindex{location description} for a bit field calculates the address
1323 of an anonymous object containing the bit field. The address
1324 is relative to the structure, union, or class that most closely
1325 encloses the bit field declaration. The number of bytes in this
1326 anonymous object is the value of the byte size attribute of
1327 the bit field. The offset (in bits) from the most significant
1328 bit of the anonymous object to the most significant bit of
1329 the bit field is the value of the bit offset attribute.}
1333 \textit{Diagrams similar to the above that show the use of the
1334 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1335 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1336 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} attribute
1337 combination may be found in the
1338 \addtoindex{DWARF Version 3} Standard.}
1340 \textit{In comparing
1342 \addtoindexx{DWARF Version 3}
1344 \addtoindexx{DWARF Version 4}
1345 4, note that DWARF V4
1346 defines the following combinations of attributes:}
1349 \item \textit{either \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1351 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1352 (to specify the beginning of the data member)}
1354 % FIXME: the indentation of the following line is suspect.
1355 \textit{optionally together with}
1357 \item \textit{either \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or
1358 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} (to
1359 specify the size of the data member)}
1363 \textit{DWARF V3 defines the following combinations}
1366 \item \textit{\livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1367 (to specify the beginning
1368 of the data member, except this specification is only partial
1369 in the case of a bit field) }
1371 % FIXME: the indentation of the following line is suspect.
1372 \textit{optionally together with}
1374 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1375 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1376 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1377 (to further specify the beginning of a bit field data member
1378 as well as specify the size of the data member) }
1381 \subsection{Member Function Entries}
1382 \label{chap:memberfunctionentries}
1384 A member function is represented by a
1385 \addtoindexx{member function entry}
1386 debugging information entry
1388 \addtoindexx{subprogram entry!as member function}
1389 tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}.
1390 The member function entry
1391 may contain the same attributes and follows the same rules
1392 as non\dash member global subroutine entries
1393 (see Section \refersec{chap:subroutineandentrypointentries}).
1396 \addtoindexx{accessibility attribute}
1397 member function entry may have a
1398 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
1399 attribute. If no accessibility attribute is present, private
1400 access is assumed for an entry of a class and public access
1401 is assumed for an entry of a structure, union or interface.
1404 \hypertarget{chap:DWATvirtualityvirtualityoffunction}
1405 the member function entry describes a virtual function,
1406 then that entry has a
1407 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
1410 \hypertarget{chap:DWATexplicitexplicitpropertyofmemberfunction}
1411 the member function entry describes an explicit member
1412 function, then that entry has
1413 \addtoindexx{explicit attribute}
1415 \livelink{chap:DWATexplicit}{DW\-\_AT\-\_explicit} attribute.
1418 \hypertarget{chap:DWATvtableelemlocationvirtualfunctiontablevtableslot}
1419 entry for a virtual function also has a
1420 \livelink{chap:DWATvtableelemlocation}{DW\-\_AT\-\_vtable\-\_elem\-\_location}
1421 \addtoindexi{attribute}{vtable element location attribute} whose value contains
1422 a \addtoindex{location description}
1423 yielding the address of the slot
1424 for the function within the virtual function table for the
1425 enclosing class. The address of an object of the enclosing
1426 type is pushed onto the expression stack before the location
1427 description is evaluated.
1430 \hypertarget{chap:DWATobjectpointerobjectthisselfpointerofmemberfunction}
1431 the member function entry describes a non\dash static member
1432 function, then that entry
1433 \addtoindexx{self pointer attribute|see{object pointer attribute}}
1435 \addtoindexx{object pointer attribute}
1436 a \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer}
1438 whose value is a reference to the formal parameter entry
1439 that corresponds to the object for which the function is
1440 called. The name attribute of that formal parameter is defined
1441 by the current language (for example,
1442 this for \addtoindex{C++} or self
1443 for \addtoindex{Objective C}
1444 and some other languages). That parameter
1445 also has a \livelink{chap:DWATartificial}{DW\-\_AT\-\_artificial} attribute whose value is true.
1447 Conversely, if the member function entry describes a static
1448 member function, the entry does not have
1449 \addtoindexx{object pointer attribute}
1451 \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer}
1454 If the member function entry describes a non\dash static member
1455 function that has a const\dash volatile qualification, then
1456 the entry describes a non\dash static member function whose
1457 object formal parameter has a type that has an equivalent
1458 const\dash volatile qualification.
1460 If a subroutine entry represents the defining declaration
1461 of a member function and that definition appears outside of
1462 the body of the enclosing class declaration, the subroutine
1464 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute,
1465 \addtoindexx{specification attribute}
1467 a reference to the debugging information entry representing
1468 the declaration of this function member. The referenced entry
1469 will be a child of some class (or structure) type entry.
1471 Subroutine entries containing the
1472 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute
1473 \addtoindexx{specification attribute}
1474 do not need to duplicate information provided
1475 by the declaration entry referenced by the specification
1476 attribute. In particular, such entries do not need to contain
1477 attributes for the name or return type of the function member
1478 whose definition they represent.
1480 \subsection{Class Template Instantiations}
1481 \label{chap:classtemplateinstantiations}
1483 \textit{In \addtoindex{C++} a class template is a generic definition of a class
1484 type that may be instantiated when an instance of the class
1485 is declared or defined. The generic description of the
1486 class may include both parameterized types and parameterized
1487 constant values. DWARF does not represent the generic template
1488 definition, but does represent each instantiation.}
1490 A class template instantiation is represented by a
1491 debugging information entry with the tag \livelink{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
1492 \livelink{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type} or
1493 \livelink{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type}. With five
1494 exceptions, such an entry will contain the same attributes
1495 and have the same types of child entries as would an entry
1496 for a class type defined explicitly using the instantiation
1497 types and values. The exceptions are:
1499 \begin{enumerate}[1.]
1500 \item Each formal parameterized type declaration appearing in the
1501 template definition is represented by a debugging information
1503 \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}. Each
1504 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
1505 \addtoindexx{name attribute}
1507 a null\dash terminated string containing the name of the formal
1508 type parameter as it appears in the source program. The
1509 template type parameter entry also has a
1510 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1511 describing the actual type by which the formal is replaced
1512 for this instantiation.
1514 \item Each formal parameterized value declaration appearing in the
1515 template definition is represented by a debugging information
1517 tag \livetarg{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}.
1519 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
1520 \addtoindexx{name attribute}
1522 a null\dash terminated string containing the name of the formal
1523 value parameter as it appears in the source program.
1525 \hypertarget{chap:DWATconstvaluetemplatevalueparameter}
1526 template value parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1527 describing the type of the parameterized value. Finally,
1528 the template value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value}
1529 attribute, whose value is the actual constant value of the
1530 value parameter for this instantiation as represented on the
1531 target architecture.
1533 \item The class type entry and each of its child entries references
1534 a template type parameter entry in any circumstance where the
1535 source template definition references a formal parameterized
1536 type. Similarly, the class type entry and each of its child
1537 entries references a template value parameter entry in any
1538 circumstance where the source template definition references
1539 a formal parameterized value.
1541 \item If the compiler has generated a special compilation unit to
1542 hold the template instantiation and that special compilation
1543 unit has a different name from the compilation unit containing
1544 the template definition, the name attribute for the debugging
1545 information entry representing the special compilation unit
1546 should be empty or omitted.
1548 \item If the class type entry representing the template
1549 instantiation or any of its child entries contains declaration
1550 coordinate attributes, those attributes should refer to
1551 the source for the template definition, not to any source
1552 generated artificially by the compiler.
1556 \subsection{Variant Entries}
1557 \label{chap:variantentries}
1559 A variant part of a structure is represented by a debugging
1560 information entry\addtoindexx{variant part entry} with the
1561 tag \livetarg{chap:DWTAGvariantpart}{DW\-\_TAG\-\_variant\-\_part} and is
1562 owned by the corresponding structure type entry.
1564 If the variant part has a discriminant, the discriminant is
1565 \hypertarget{chap:DWATdiscrdiscriminantofvariantpart}
1567 \addtoindexx{discriminant (entry)}
1568 separate debugging information entry which
1569 is a child of the variant part entry. This entry has the form
1571 \addtoindexx{member entry (data)!as discriminant}
1572 structure data member entry. The variant part entry will
1573 \addtoindexx{discriminant attribute}
1575 \livelink{chap:DWATdiscr}{DW\-\_AT\-\_discr} attribute
1576 whose value is a reference to
1577 the member entry for the discriminant.
1579 If the variant part does not have a discriminant (tag field),
1580 the variant part entry has a
1581 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to represent
1584 Each variant of a particular variant part is represented by
1585 \hypertarget{chap:DWATdiscrvaluediscriminantvalue}
1586 a debugging information entry\addtoindexx{variant entry} with the
1587 tag \livetarg{chap:DWTAGvariant}{DW\-\_TAG\-\_variant}
1588 and is a child of the variant part entry. The value that
1589 selects a given variant may be represented in one of three
1590 ways. The variant entry may have a
1591 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value} attribute
1592 whose value represents a single case label. The value of this
1593 attribute is encoded as an LEB128 number. The number is signed
1594 if the tag type for the variant part containing this variant
1595 is a signed type. The number is unsigned if the tag type is
1599 \hypertarget{chap:DWATdiscrlistlistofdiscriminantvalues}
1600 the variant entry may contain
1601 \addtoindexx{discriminant list attribute}
1603 \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list}
1604 attribute, whose value represents a list of discriminant
1605 values. This list is represented by any of the
1606 \livelink{chap:block}{block} forms and
1607 may contain a mixture of case labels and label ranges. Each
1608 item on the list is prefixed with a discriminant value
1609 descriptor that determines whether the list item represents
1610 a single label or a label range. A single case label is
1611 represented as an LEB128 number as defined above for
1612 \addtoindexx{discriminant value attribute}
1614 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value}
1615 attribute. A label range is represented by
1616 two LEB128 numbers, the low value of the range followed by the
1617 high value. Both values follow the rules for signedness just
1618 described. The discriminant value descriptor is an integer
1619 constant that may have one of the values given in
1620 Figure \refersec{fig:discriminantdescriptorvalues}.
1622 \begin{figure}[here]
1623 \autorows[0pt]{c}{1}{l}{
1624 \addtoindex{DW\-\_DSC\-\_label},
1625 \addtoindex{DW\-\_DSC\-\_range}
1627 \caption{Discriminant descriptor values}\label{fig:discriminantdescriptorvalues}
1630 If a variant entry has neither a \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value}
1631 attribute nor a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute, or if it has
1632 a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute with 0 size, the variant is a
1635 The components selected by a particular variant are represented
1636 by debugging information entries owned by the corresponding
1637 variant entry and appear in the same order as the corresponding
1638 declarations in the source program.
1640 \section{Condition Entries}
1641 \label{chap:conditionentries}
1643 \textit{COBOL has the notion of
1644 \addtoindexx{level-88 condition, COBOL}
1645 a ``level\dash 88 condition'' that
1646 associates a data item, called the conditional variable, with
1647 a set of one or more constant values and/or value ranges.
1648 Semantically, the condition is ‛true’ if the conditional
1649 variable's value matches any of the described constants,
1650 and the condition is ‛false’ otherwise.}
1652 The \livetarg{chap:DWTAGcondition}{DW\-\_TAG\-\_condition}
1653 debugging information entry\addtoindexx{condition entry}
1655 logical condition that tests whether a given data item’s
1656 value matches one of a set of constant values. If a name
1657 has been given to the condition, the condition entry has a
1658 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1659 \addtoindexx{name attribute}
1660 whose value is a null\dash terminated string
1661 giving the condition name as it appears in the source program.
1663 The condition entry's parent entry describes the conditional
1664 variable; normally this will be a \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable},
1665 \livelink{chap:DWTAGmember}{DW\-\_TAG\-\_member} or
1666 \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter} entry.
1668 \addtoindexx{formal parameter entry}
1670 entry has an array type, the condition can test any individual
1671 element, but not the array as a whole. The condition entry
1672 implicitly specifies a “comparison type” that is the
1673 type of an array element if the parent has an array type;
1674 otherwise it is the type of the parent entry.
1676 The condition entry owns \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} and/or
1677 \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} entries that describe the constant
1678 values associated with the condition. If any child entry has
1679 a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute, that attribute should describe a type
1680 compatible with the comparison type (according to the source
1681 language); otherwise the child’s type is the same as the
1684 \textit{For conditional variables with alphanumeric types, COBOL
1685 permits a source program to provide ranges of alphanumeric
1686 constants in the condition. Normally a subrange type entry
1687 does not describe ranges of strings; however, this can be
1688 represented using bounds attributes that are references to
1689 constant entries describing strings. A subrange type entry may
1690 refer to constant entries that are siblings of the subrange
1694 \section{Enumeration Type Entries}
1695 \label{chap:enumerationtypeentries}
1697 \textit{An “enumeration type” is a scalar that can assume one of
1698 a fixed number of symbolic values.}
1700 An enumeration type is represented by a debugging information
1702 \livetarg{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}.
1704 If a name has been given to the enumeration type in the source
1705 program, then the corresponding enumeration type entry has
1706 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1707 \addtoindexx{name attribute}
1708 whose value is a null\dash terminated
1709 string containing the enumeration type name as it appears
1710 in the source program. This entry also has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1711 attribute whose integer constant value is the number of bytes
1712 required to hold an instance of the enumeration.
1714 The \addtoindex{enumeration type entry}
1715 may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1716 which refers to the underlying data type used to implement
1719 If an enumeration type has type safe
1722 \begin{enumerate}[1.]
1723 \item Enumerators are contained in the scope of the enumeration type, and/or
1725 \item Enumerators are not implicitly converted to another type
1728 then the \addtoindex{enumeration type entry} may
1729 \addtoindexx{enum class|see{type-safe enumeration}}
1730 have a \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}
1731 attribute, which is a \livelink{chap:flag}{flag}.
1732 In a language that offers only
1733 one kind of enumeration declaration, this attribute is not
1736 \textit{In \addtoindex{C} or \addtoindex{C++},
1737 the underlying type will be the appropriate
1738 integral type determined by the compiler from the properties of
1739 \hypertarget{chap:DWATenumclasstypesafeenumerationdefinition}
1740 the enumeration literal values.
1741 A \addtoindex{C++} type declaration written
1742 using enum class declares a strongly typed enumeration and
1743 is represented using \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}
1744 in combination with \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}.}
1746 Each enumeration literal is represented by a debugging
1747 \addtoindexx{enumeration literal|see{enumeration entry}}
1748 information entry with the
1749 tag \livetarg{chap:DWTAGenumerator}{DW\-\_TAG\-\_enumerator}.
1751 such entry is a child of the
1752 \addtoindex{enumeration type entry}, and the
1753 enumerator entries appear in the same order as the declarations
1754 of the enumeration literals in the source program.
1756 Each \addtoindex{enumerator entry} has a
1757 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
1758 \addtoindexx{name attribute}
1759 value is a null\dash terminated string containing the name of the
1760 \hypertarget{chap:DWATconstvalueenumerationliteralvalue}
1761 enumeration literal as it appears in the source program.
1762 Each enumerator entry also has a
1763 \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value} attribute,
1764 whose value is the actual numeric value of the enumerator as
1765 represented on the target system.
1768 If the enumeration type occurs as the description of a
1769 \addtoindexx{enumeration type endry!as array dimension}
1770 dimension of an array type, and the stride for that dimension
1771 \hypertarget{chap:DWATbytestrideenumerationstridedimensionofarraytype}
1772 is different than what would otherwise be determined, then
1773 \hypertarget{chap:DWATbitstrideenumerationstridedimensionofarraytype}
1774 the enumeration type entry has either a
1775 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1776 or \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1777 \addtoindexx{bit stride attribute}
1778 which specifies the separation
1779 between successive elements along the dimension as described
1781 Section \refersec{chap:visibilityofdeclarations}.
1783 \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1784 \addtoindexx{bit stride attribute}
1785 is interpreted as bits and the value of
1786 \addtoindexx{byte stride attribute}
1788 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1789 attribute is interpreted as bytes.
1792 \section{Subroutine Type Entries}
1793 \label{chap:subroutinetypeentries}
1795 It is possible in \addtoindex{C}
1796 to declare pointers to subroutines
1797 that return a value of a specific type. In both
1798 \addtoindex{C} and \addtoindex{C++},
1799 it is possible to declare pointers to subroutines that not
1800 only return a value of a specific type, but accept only
1801 arguments of specific types. The type of such pointers would
1802 be described with a ``pointer to'' modifier applied to a
1803 user\dash defined type.
1805 A subroutine type is represented by a debugging information
1807 \addtoindexx{subroutine type entry}
1808 tag \livetarg{chap:DWTAGsubroutinetype}{DW\-\_TAG\-\_subroutine\-\_type}.
1810 been given to the subroutine type in the source program,
1811 then the corresponding subroutine type entry has
1812 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1813 \addtoindexx{name attribute}
1814 whose value is a null\dash terminated string containing
1815 the subroutine type name as it appears in the source program.
1817 If the subroutine type describes a function that returns
1818 a value, then the subroutine type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
1819 attribute to denote the type returned by the subroutine. If
1820 the types of the arguments are necessary to describe the
1821 subroutine type, then the corresponding subroutine type
1822 entry owns debugging information entries that describe the
1823 arguments. These debugging information entries appear in the
1824 order that the corresponding argument types appear in the
1827 In \addtoindex{C} there
1828 is a difference between the types of functions
1829 declared using function prototype style declarations and
1830 those declared using non\dash prototype declarations.
1833 \hypertarget{chap:DWATprototypedsubroutineprototype}
1834 subroutine entry declared with a function prototype style
1835 declaration may have
1836 \addtoindexx{prototyped attribute}
1838 \livelink{chap:DWATprototyped}{DW\-\_AT\-\_prototyped} attribute, which is
1839 a \livelink{chap:flag}{flag}.
1841 Each debugging information entry owned by a subroutine
1842 type entry has a tag whose value has one of two possible
1845 \begin{enumerate}[1.]
1846 \item The formal parameters of a parameter list (that have a
1847 specific type) are represented by a debugging information entry
1848 with the tag \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter}.
1849 Each formal parameter
1850 entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute that refers to the type of
1851 the formal parameter.
1853 \item The unspecified parameters of a variable parameter list
1854 \addtoindexx{unspecified parameters entry}
1856 \addtoindexx{... parameters|see{unspecified parameters entry}}
1857 represented by a debugging information entry with the
1858 tag \livelink{chap:DWTAGunspecifiedparameters}{DW\-\_TAG\-\_unspecified\-\_parameters}.
1863 \section{String Type Entries}
1864 \label{chap:stringtypeentries}
1867 A ``string'' is a sequence of characters that have specific
1868 \addtoindexx{string type entry}
1869 semantics and operations that separate them from arrays of
1871 \addtoindex{Fortran} is one of the languages that has a string
1872 type. Note that ``string'' in this context refers to a target
1873 machine concept, not the class string as used in this document
1874 (except for the name attribute).
1876 A string type is represented by a debugging information entry
1877 with the tag \livetarg{chap:DWTAGstringtype}{DW\-\_TAG\-\_string\-\_type}.
1878 If a name has been given to
1879 the string type in the source program, then the corresponding
1880 string type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1881 \addtoindexx{name attribute}
1883 a null\dash terminated string containing the string type name as
1884 it appears in the source program.
1887 \hypertarget{chap:DWATstringlengthstringlengthofstringtype}
1888 string type entry may have a
1889 \livelink{chap:DWATstringlength}{DW\-\_AT\-\_string\-\_length} attribute
1891 \addtoindexx{string length attribute}
1893 \addtoindex{location description} yielding the location
1894 where the length of the string is stored in the program. The
1895 string type entry may also have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute
1896 or \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
1897 (see Section \refersec{chap:byteandbitsizes})
1898 is the size of the data to be retrieved from the location
1899 referenced by the string length attribute. If no (byte or bit)
1900 size attribute is present, the size of the data to be retrieved
1902 \addtoindex{size of an address} on the target machine.
1904 If no string length attribute is present, the string type
1905 entry may have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or
1906 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1907 attribute, whose value
1908 (see Section \refersec{chap:byteandbitsizes})
1910 storage needed to hold a value of the string type.
1913 \section{Set Type Entries}
1914 \label{chap:settypeentries}
1916 \textit{\addtoindex{Pascal} provides the concept of a “set,” which represents
1917 a group of values of ordinal type.}
1919 A set is represented by a debugging information entry with
1920 the tag \livetarg{chap:DWTAGsettype}{DW\-\_TAG\-\_set\-\_type}.
1921 \addtoindexx{set type entry}
1922 If a name has been given to the
1923 set type, then the set type entry has
1924 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1925 \addtoindexx{name attribute}
1926 whose value is a null\dash terminated string containing the
1927 set type name as it appears in the source program.
1929 The set type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote the
1930 type of an element of the set.
1932 If the amount of storage allocated to hold each element of an
1933 object of the given set type is different from the amount of
1934 storage that is normally allocated to hold an individual object
1935 of the indicated element type, then the set type entry has
1936 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute, or
1937 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
1938 whose value (see Section \refersec{chap:byteandbitsizes}) is
1939 the amount of storage needed to hold a value of the set type.
1942 \section{Subrange Type Entries}
1943 \label{chap:subrangetypeentries}
1945 \textit{Several languages support the concept of a ``subrange''
1946 type object. These objects can represent a subset of the
1947 values that an object of the basis type for the subrange can
1949 Subrange type entries may also be used to represent
1950 the bounds of array dimensions.}
1952 A subrange type is represented by a debugging information
1954 \addtoindexx{subrange type entry}
1955 tag \livetarg{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type}.
1957 given to the subrange type, then the subrange type entry
1958 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1959 \addtoindexx{name attribute}
1960 whose value is a null\dash terminated
1961 string containing the subrange type name as it appears in
1964 The subrange entry may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to describe
1965 the type of object, called the basis type, of whose values
1966 this subrange is a subset.
1968 If the amount of storage allocated to hold each element of an
1969 object of the given subrange type is different from the amount
1970 of storage that is normally allocated to hold an individual
1971 object of the indicated element type, then the subrange
1973 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or
1974 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1975 attribute, whose value
1976 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1978 storage needed to hold a value of the subrange type.
1981 \hypertarget{chap:DWATthreadsscaledupcarrayboundthreadsscalfactor}
1982 subrange entry may have a \livelink{chap:DWATthreadsscaled}{DW\-\_AT\-\_threads\-\_scaled} attribute,
1983 which is a \livelink{chap:flag}{flag}.
1984 If present, this attribute indicates whether
1985 this subrange represents a UPC array bound which is scaled
1986 by the runtime THREADS value (the number of UPC threads in
1987 this execution of the program).
1989 \textit{This allows the representation of a UPC shared array such as}
1992 int shared foo[34*THREADS][10][20];
1996 \hypertarget{chap:DWATlowerboundlowerboundofsubrange}
1998 \hypertarget{chap:DWATupperboundupperboundofsubrange}
1999 entry may have the attributes
2000 \livelink{chap:DWATlowerbound}{DW\-\_AT\-\_lower\-\_bound}
2001 and \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound} to specify, respectively, the lower
2002 and upper bound values of the subrange. The
2003 \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound}
2005 \hypertarget{chap:DWATcountelementsofsubrangetype}
2007 % FIXME: The following matches DWARF4: odd as there is no default count.
2008 \addtoindexx{count attribute!default}
2010 \addtoindexx{count attribute}
2012 \livelink{chap:DWATcount}{DW\-\_AT\-\_count} attribute,
2014 value describes the number of elements in the subrange rather
2015 than the value of the last element. The value of each of
2016 these attributes is determined as described in
2017 Section \refersec{chap:staticanddynamicvaluesofattributes}.
2019 If the lower bound value is missing, the value is assumed to
2020 be a language\dash dependent default constant.
2021 \addtoindexx{lower bound attribute!default}
2024 \addtoindex{C}, \addtoindex{C++},
2027 \addtoindex{Objective C},
2028 \addtoindex{Objective C++},
2029 \addtoindex{Python}, and
2031 The default lower bound is 1 for
2032 \addtoindex{Ada}, \addtoindex{COBOL},
2033 \addtoindex{Fortran},
2034 \addtoindex{Modula-2},
2035 \addtoindex{Pascal} and
2038 \textit{No other default lower bound values are currently defined.}
2040 If the upper bound and count are missing, then the upper bound value is
2043 If the subrange entry has no type attribute describing the
2044 basis type, the basis type is assumed to be the same as
2045 the object described by the lower bound attribute (if it
2046 references an object). If there is no lower bound attribute,
2047 or that attribute does not reference an object, the basis type
2048 is the type of the upper bound or \addtoindex{count attribute}
2050 of them references an object). If there is no upper bound or
2051 count attribute, or neither references an object, the type is
2052 assumed to be the same type, in the source language of the
2053 compilation unit containing the subrange entry, as a signed
2054 integer with the same size as an address on the target machine.
2056 If the subrange type occurs as the description of a dimension
2057 of an array type, and the stride for that dimension is
2058 \hypertarget{chap:DWATbytestridesubrangestridedimensionofarraytype}
2059 different than what would otherwise be determined, then
2060 \hypertarget{chap:DWATbitstridesubrangestridedimensionofarraytype}
2061 the subrange type entry has either
2062 \addtoindexx{byte stride attribute}
2064 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride} or
2065 \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
2066 \addtoindexx{bit stride attribute}
2067 which specifies the separation
2068 between successive elements along the dimension as described
2070 Section \refersec{chap:byteandbitsizes}.
2072 \textit{Note that the stride can be negative.}
2074 \section{Pointer to Member Type Entries}
2075 \label{chap:pointertomembertypeentries}
2077 \textit{In \addtoindex{C++}, a
2078 pointer to a data or function member of a class or
2079 structure is a unique type.}
2081 A debugging information entry representing the type of an
2082 object that is a pointer to a structure or class member has
2083 the tag \livetarg{chap:DWTAGptrtomembertype}{DW\-\_TAG\-\_ptr\-\_to\-\_member\-\_type}.
2085 If the \addtoindex{pointer to member type} has a name, the
2086 \addtoindexx{pointer to member type entry}
2087 pointer to member entry has a
2088 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
2089 \addtoindexx{name attribute}
2091 null\dash terminated string containing the type name as it appears
2092 in the source program.
2094 The \addtoindex{pointer to member} entry
2095 has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to
2096 describe the type of the class or structure member to which
2097 objects of this type may point.
2099 The \addtoindex{pointer to member} entry also
2100 \hypertarget{chap:DWATcontainingtypecontainingtypeofpointertomembertype}
2102 \livelink{chap:DWATcontainingtype}{DW\-\_AT\-\_containing\-\_type}
2103 attribute, whose value is a reference to a debugging
2104 information entry for the class or structure to whose members
2105 objects of this type may point.
2108 \hypertarget{chap:DWATuselocationmemberlocationforpointertomembertype}
2110 \addtoindex{pointer to member entry}
2112 \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} attribute
2114 \addtoindex{location description} that computes the
2115 address of the member of the class to which the pointer to
2116 member entry points.
2118 \textit{The method used to find the address of a given member of a
2119 class or structure is common to any instance of that class
2120 or structure and to any instance of the pointer or member
2121 type. The method is thus associated with the type entry,
2122 rather than with each instance of the type.}
2124 The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is used in conjunction
2125 with the location descriptions for a particular object of the
2126 given \addtoindex{pointer to member type} and for a particular structure or
2127 class instance. The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location}
2128 attribute expects two values to be
2129 \addtoindexi{pushed}{address!implicit push for member operator}
2130 onto the DWARF expression stack before
2131 the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is evaluated.
2133 \addtoindexi{pushed}{address!implicit push for member operator}
2134 is the value of the \addtoindex{pointer to member} object
2135 itself. The second value
2136 \addtoindexi{pushed}{address!implicit push for member operator}
2137 is the base address of the
2138 entire structure or union instance containing the member
2139 whose address is being calculated.
2141 \textit{For an expression such as}
2146 % FIXME: object and mbr\_ptr should be distinguished from italic. See DW4.
2147 \textit{where mbr\_ptr has some \addtoindex{pointer to member type}, a debugger should:}
2149 \textit{1. Push the value of mbr\_ptr onto the DWARF expression stack.}
2151 \textit{2. Push the base address of object onto the DWARF expression stack.}
2153 \textit{3. Evaluate the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description
2154 given in the type of mbr\_ptr.}
2156 \section{File Type Entries}
2157 \label{chap:filetypeentries}
2159 \textit{Some languages, such as \addtoindex{Pascal},
2160 provide a data type to represent
2163 A file type is represented by a debugging information entry
2165 \addtoindexx{file type entry}
2167 \livetarg{chap:DWTAGfiletype}{DW\-\_TAG\-\_file\-\_type}.
2168 If the file type has a name,
2169 the file type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
2170 \addtoindexx{name attribute}
2172 is a null\dash terminated string containing the type name as it
2173 appears in the source program.
2175 The file type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
2176 the type of the objects contained in the file.
2178 The file type entry also
2179 \addtoindexx{byte size}
2181 \addtoindexx{bit size}
2183 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or
2184 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
2185 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
2186 is the amount of storage need to hold a value of the file type.
2188 \section{Dynamic Type Properties}
2189 \label{chap:dynamictypeproperties}
2190 \subsection{Data Location}
2191 \label{chap:datalocation}
2193 \textit{Some languages may represent objects using descriptors to hold
2194 information, including a location and/or run\dash time parameters,
2195 about the data that represents the value for that object.}
2197 \hypertarget{chap:DWATdatalocationindirectiontoactualdata}
2198 The \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
2199 attribute may be used with any
2200 \addtoindexx{data location attribute}
2201 type that provides one or more levels of
2202 \addtoindexx{hidden indirection|see{data location attribute}}
2204 and/or run\dash time parameters in its representation. Its value
2205 is a \addtoindex{location description}.
2206 The result of evaluating this
2207 description yields the location of the data for an object.
2208 When this attribute is omitted, the address of the data is
2209 the same as the address of the object.
2211 \textit{This location description will typically begin with
2212 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address}
2213 which loads the address of the
2214 object which can then serve as a descriptor in subsequent
2215 calculation. For an example using
2216 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
2217 for a \addtoindex{Fortran 90 array}, see
2218 Appendix \refersec{app:fortran90example}.}
2220 \subsection{Allocation and Association Status}
2221 \label{chap:allocationandassociationstatus}
2223 \textit{Some languages, such as \addtoindex{Fortran 90},
2224 provide types whose values
2225 may be dynamically allocated or associated with a variable
2226 under explicit program control.}
2228 \hypertarget{chap:DWATallocatedallocationstatusoftypes}
2230 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated}
2232 \addtoindexx{allocated attribute}
2233 may optionally be used with any
2234 type for which objects of the type can be explicitly allocated
2235 and deallocated. The presence of the attribute indicates that
2236 objects of the type are allocatable and deallocatable. The
2237 integer value of the attribute (see below) specifies whether
2238 an object of the type is
2239 currently allocated or not.
2241 \hypertarget{chap:DWATassociatedassociationstatusoftypes}
2243 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute
2245 \addtoindexx{associated attribute}
2246 optionally be used with
2247 any type for which objects of the type can be dynamically
2248 associated with other objects. The presence of the attribute
2249 indicates that objects of the type can be associated. The
2250 integer value of the attribute (see below) indicates whether
2251 an object of the type is currently associated or not.
2253 While these attributes are defined specifically with
2254 \addtoindex{Fortran 90} ALLOCATABLE and POINTER types
2255 in mind, usage is not limited
2256 to just that language.
2258 The value of these attributes is determined as described in
2259 Section \refersec{chap:staticanddynamicvaluesofattributes}.
2261 A non\dash zero value is interpreted as allocated or associated,
2262 and zero is interpreted as not allocated or not associated.
2264 \textit{For \addtoindex{Fortran 90},
2265 if the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated}
2266 attribute is present,
2267 the type has the POINTER property where either the parent
2268 variable is never associated with a dynamic object or the
2269 implementation does not track whether the associated object
2270 is static or dynamic. If the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute is
2271 present and the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute is not, the type
2272 has the ALLOCATABLE property. If both attributes are present,
2273 then the type should be assumed to have the POINTER property
2274 (and not ALLOCATABLE); the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute may then
2275 be used to indicate that the association status of the object
2276 resulted from execution of an ALLOCATE statement rather than
2277 pointer assignment.}
2279 \textit{For examples using
2280 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} for \addtoindex{Ada} and
2281 \addtoindex{Fortran 90}
2283 see Appendix \refersec{app:aggregateexamples}.}
2287 \section{Template Alias Entries}
2288 \label{chap:templatealiasentries}
2290 A type named using a template alias is represented
2291 by a debugging information entry with the tag
2292 \livetarg{chap:DWTAGtemplatealias}{DW\-\_TAG\-\_template\-\_alias}.
2293 The template alias entry has a
2294 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
2295 \addtoindexx{name attribute}
2296 whose value is a null\dash terminated string
2297 containing the name of the template alias as it appears in
2298 the source program. The template alias entry also contains a
2299 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is a reference to the type
2300 named by the template alias. The template alias entry has
2301 the following child entries:
2303 \begin{enumerate}[1.]
2304 \item Each formal parameterized type declaration appearing
2305 in the template alias declaration is represented
2306 by a debugging information entry with the tag
2307 \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}.
2308 Each such entry may have
2309 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
2310 \addtoindexx{name attribute}
2311 whose value is a null\dash terminated
2312 string containing the name of the formal type parameter as it
2313 appears in the source program. The template type parameter
2314 entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing the actual
2315 type by which the formal is replaced for this instantiation.
2317 \item Each formal parameterized value declaration
2318 appearing in the template alias declaration is
2319 represented by a debugging information entry with the tag
2320 \livelink{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}.
2321 Each such entry may have
2322 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
2323 \addtoindexx{name attribute}
2324 whose value is a null\dash terminated
2325 string containing the name of the formal value parameter
2326 as it appears in the source program. The template value
2327 parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
2328 the type of the parameterized value. Finally, the template
2329 value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value}
2330 attribute, whose value is the actual constant value of the value parameter for
2331 this instantiation as represented on the target architecture.