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
350 \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} entry. The scale factor value
351 is interpreted in accordance with the value defined by the
352 \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} entry. The value represented is the product
353 of the integer value in memory and the associated constant
356 \textit{The \livelink{chap:DWATsmall}{DW\-\_AT\-\_small} attribute
357 is defined with the \addtoindex{Ada} small
362 \begin{tabular}{lp{9cm}}
363 Name&Meaning\\ \hline
364 \livetarg{chap:DWDSunsigned}{DW\-\_DS\-\_unsigned} & unsigned \\
365 \livetarg{chap:DWDSleadingoverpunch}{DW\-\_DS\-\_leading\-\_overpunch} & Sign
366 is encoded in the most significant digit in a target\dash dependent manner \\
367 \livetarg{chap:DWDStrailingoverpunch}{DW\-\_DS\-\_trailing\-\_overpunch} & Sign
368 is encoded in the least significant digit in a target\dash dependent manner \\
369 \livetarg{chap:DWDSleadingseparate}{DW\-\_DS\-\_leading\-\_separate}
370 & Decimal type: Sign is a ``+'' or ``-'' character
371 to the left of the most significant digit. \\
372 \livetarg{chap:DWDStrailingseparate}{DW\-\_DS\-\_trailing\-\_separate}
373 & Decimal type: Sign is a ``+'' or ``-'' character
374 to the right of the least significant digit. \\
375 &Packed decimal type: Least significant nibble contains
376 a target\dash dependent value
377 indicating positive or negative. \\
379 \caption{Decimal sign attribute values}
380 \label{fig:decimalsignattributevalues}
383 \section{Unspecified Type Entries}
384 \label{chap:unspecifiedtypeentries}
385 \addtoindexx{unspecified type entry}
386 \addtoindexx{void type|see{unspecified type entry}}
387 Some languages have constructs in which a type
388 may be left unspecified or the absence of a type
389 may be explicitly indicated.
391 An unspecified (implicit, unknown, ambiguous or nonexistent)
392 type is represented by a debugging information entry with
393 the tag \livetarg{chap:DWTAGunspecifiedtype}{DW\-\_TAG\-\_unspecified\-\_type}.
394 If a name has been given
395 to the type, then the corresponding unspecified type entry
396 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
397 \addtoindexx{name attribute}
399 a null\dash terminated
400 string containing the name as it appears in the source program.
402 The interpretation of this debugging information entry is
403 intentionally left flexible to allow it to be interpreted
404 appropriately in different languages. For example, in
405 \addtoindex{C} and \addtoindex{C++}
406 the language implementation can provide an unspecified type
407 entry with the name “void” which can be referenced by the
408 type attribute of pointer types and typedef declarations for
410 % FIXME: the following reference was wrong in DW4 so DavidA guessed
412 Sections \refersec{chap:unspecifiedtypeentries} and
413 %The following reference was valid, so the following is probably correct.
414 Section \refersec{chap:typedefentries},
415 respectively). As another
416 example, in \addtoindex{Ada} such an unspecified type entry can be referred
417 to by the type attribute of an access type where the denoted
418 \addtoindexx{incomplete type (Ada)}
419 type is incomplete (the name is declared as a type but the
420 definition is deferred to a separate compilation unit).
422 \section{Type Modifier Entries}
423 \label{chap:typemodifierentries}
424 \addtoindexx{type modifier entry}
426 A base or user\dash defined type may be modified in different ways
427 in different languages. A type modifier is represented in
428 DWARF by a debugging information entry with one of the tags
430 Figure \refersec{fig:typemodifiertags}.
432 If a name has been given to the modified type in the source
433 program, then the corresponding modified type entry has
434 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
435 \addtoindexx{name attribute}
436 whose value is a null\dash terminated
437 string containing the modified type name as it appears in
440 Each of the type modifier entries has a
441 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute,
442 whose value is a reference to a debugging information entry
443 describing a base type, a user-defined type or another type
446 A modified type entry describing a
447 \addtoindexx{pointer type entry}
448 pointer or \addtoindex{reference type}
449 (using \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type},
450 \livelink{chap:DWTAGreferencetype}{DW\-\_TAG\-\_reference\-\_type} or
451 \livelink{chap:DWTAGrvaluereferencetype}{DW\-\_TAG\-\_rvalue\-\_reference\-\_type})
452 % Another instance of no-good-place-to-put-index entry.
454 \addtoindexx{address class!attribute}
456 \hypertarget{chap:DWATadressclasspointerorreferencetypes}
458 \livelink{chap:DWATaddressclass}{DW\-\_AT\-\_address\-\_class}
459 attribute to describe how objects having the given pointer
460 or reference type ought to be dereferenced.
462 A modified type entry describing a shared qualified type
463 (using \livelink{chap:DWTAGsharedtype}{DW\-\_TAG\-\_shared\-\_type}) may have a
464 \livelink{chap:DWATcount}{DW\-\_AT\-\_count} attribute
465 \addtoindexx{count attribute}
466 whose value is a constant expressing the blocksize of the
467 type. If no count attribute is present, then the “infinite”
468 blocksize is assumed.
470 When multiple type modifiers are chained together to modify
471 a base or user-defined type, the tree ordering reflects the
473 \addtoindexx{reference type entry, lvalue|see{reference type entry}}
475 \addtoindexx{reference type entry, rvalue|see{rvalue reference type entry}}
477 \addtoindexx{parameter|see{macro formal parameter list}}
479 \addtoindexx{parameter|see{\textit{this} parameter}}
481 \addtoindexx{parameter|see{variable parameter attribute}}
483 \addtoindexx{parameter|see{optional parameter attribute}}
485 \addtoindexx{parameter|see{unspecified parameters entry}}
487 \addtoindexx{parameter|see{template value parameter entry}}
489 \addtoindexx{parameter|see{template type parameter entry}}
491 \addtoindexx{parameter|see{formal parameter entry}}
496 \begin{tabular}{lp{9cm}}
497 Name&Meaning\\ \hline
498 \livetarg{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} & C or C++ const qualified type
499 \addtoindexx{const qualified type entry} \addtoindexx{C} \addtoindexx{C++} \\
500 \livetarg{chap:DWTAGpackedtype}{DW\-\_TAG\-\_packed\-\_type}& \addtoindex{Pascal} or Ada packed type\addtoindexx{packed type entry}
501 \addtoindexx{packed qualified type entry} \addtoindexx{Ada} \addtoindexx{Pascal} \\
502 \livetarg{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} & Pointer to an object of
503 the type being modified \addtoindexx{pointer qualified type entry} \\
504 \livetarg{chap:DWTAGreferencetype}{DW\-\_TAG\-\_reference\-\_type}& C++ (lvalue) reference
505 to an object of the type
506 \addtoindexx{reference type entry} \\
508 \addtoindexx{reference qualified type entry} \\
509 \livetarg{chap:DWTAGrestricttype}{DW\-\_TAG\-\_restrict\-\_type}& \addtoindex{C}
511 \addtoindexx{restricted type entry} \\
513 \addtoindexx{restrict qualified type} \\
514 \livetarg{chap:DWTAGrvaluereferencetype}{DW\-\_TAG\-\_rvalue\-\_reference\-\_type} & C++
515 \addtoindexx{rvalue reference type entry}
517 \addtoindexx{restricted type entry}
518 reference to an object of the type being modified
519 \addtoindexx{rvalue reference qualified type entry} \\
520 \livetarg{chap:DWTAGsharedtype}{DW\-\_TAG\-\_shared\-\_type}&UPC shared qualified type
521 \addtoindexx{shared qualified type entry} \\
522 \livetarg{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type}&C or C++ volatile qualified type
523 \addtoindex{volatile qualified type entry} \\
525 \caption{Type modifier tags}
526 \label{fig:typemodifiertags}
529 %The following clearpage prevents splitting the example across pages.
531 \textit{As examples of how type modifiers are ordered, take the following C
535 const unsigned char * volatile p;
536 which represents a volatile pointer to a constant
537 character. This is encoded in DWARF as:
538 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}(p) -->
539 \livelink{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type} -->
540 \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} -->
541 \livelink{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} -->
542 \livelink{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}(unsigned char)
544 volatile unsigned char * const restrict p;
545 on the other hand, represents a restricted constant
546 pointer to a volatile character. This is encoded as:
547 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}(p) -->
548 \livelink{chap:DWTAGrestricttype}{DW\-\_TAG\-\_restrict\-\_type} -->
549 \livelink{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} -->
550 \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} -->
551 \livelink{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type} -->
552 \livelink{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}(unsigned char)
556 \section{Typedef Entries}
557 \label{chap:typedefentries}
558 A named type that is defined in terms of another type
559 definition is represented by a debugging information entry with
560 the tag \livetarg{chap:DWTAGtypedef}{DW\-\_TAG\-\_typedef}.
561 The typedef entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
562 \addtoindexx{name attribute}
563 whose value is a null\dash terminated string containing
564 the name of the typedef as it appears in the source program.
566 The typedef entry may also contain a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose
567 value is a reference to the type named by the typedef. If
568 the debugging information entry for a typedef represents
569 a declaration of the type that is not also a definition,
570 it does not contain a type attribute.
572 \textit{Depending on the language, a named type that is defined in
573 terms of another type may be called a type alias, a subtype,
574 a constrained type and other terms. A type name declared with
575 no defining details may be termed an
576 \addtoindexx{incomplete type}
577 incomplete, forward or hidden type.
578 While the DWARF \livelink{chap:DWTAGtypedef}{DW\-\_TAG\-\_typedef} entry was
579 originally inspired by the like named construct in
580 \addtoindex{C} and \addtoindex{C++},
581 it is broadly suitable for similar constructs (by whatever
582 source syntax) in other languages.}
584 \section{Array Type Entries}
585 \label{chap:arraytypeentries}
587 Many languages share the concept of an ``array,'' which is
588 \addtoindexx{array type entry}
589 a table of components of identical type.
591 An array type is represented by a debugging information entry
592 with the tag \livetarg{chap:DWTAGarraytype}{DW\-\_TAG\-\_array\-\_type}.
595 \addtoindexx{array!declaration of type}
596 the array type in the source program, then the corresponding
597 array type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
598 \addtoindexx{name attribute}
600 null\dash terminated string containing the array type name as it
601 appears in the source program.
604 \hypertarget{chap:DWATorderingarrayrowcolumnordering}
605 array type entry describing a multidimensional array may
606 \addtoindexx{array!element ordering}
607 have a \livelink{chap:DWATordering}{DW\-\_AT\-\_ordering} attribute whose integer constant value is
608 interpreted to mean either row-major or column-major ordering
609 of array elements. The set of values and their meanings
610 for the ordering attribute are listed in
611 Figure \refersec{fig:arrayordering}.
613 ordering attribute is present, the default ordering for the
614 source language (which is indicated by the
615 \livelink{chap:DWATlanguage}{DW\-\_AT\-\_language}
617 \addtoindexx{language attribute}
618 of the enclosing compilation unit entry) is assumed.
621 \autorows[0pt]{c}{1}{l}{
622 \livetarg{chap:DWORDcolmajor}{DW\-\_ORD\-\_col\-\_major},
623 \livetarg{chap:DWORDrowmajor}{DW\-\_ORD\-\_row\-\_major}
625 \caption{Array ordering}\label{fig:arrayordering}
628 The ordering attribute may optionally appear on one-dimensional
629 arrays; it will be ignored.
631 An array type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
632 \addtoindexx{array!element type}
634 the type of each element of the array.
636 If the amount of storage allocated to hold each element of an
637 object of the given array type is different from the amount
638 of storage that is normally allocated to hold an individual
639 \hypertarget{chap:DWATbitstridearrayelementstrideofarraytype}
641 \hypertarget{chap:DWATbytestridearrayelementstrideofarraytype}
642 indicated element type, then the array type
643 \addtoindexx{bit stride attribute}
645 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
647 \addtoindexx{byte stride attribute}
648 a \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride}
650 \addtoindexx{bit stride attribute}
652 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
654 element of the array.
656 The array type entry may have either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a
657 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
658 (see Section \refersec{chap:byteandbitsizes}),
660 amount of storage needed to hold an instance of the array type.
662 \textit{If the size of the array can be determined statically at
663 compile time, this value can usually be computed by multiplying
664 the number of array elements by the size of each element.}
667 Each array dimension is described by a debugging information
668 entry with either the tag \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} or the
669 \addtoindexx{enumeration type entry!as array dimension}
671 \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}. These entries are
673 array type entry and are ordered to reflect the appearance of
674 the dimensions in the source program (i.e., leftmost dimension
675 first, next to leftmost second, and so on).
677 In languages, such as C, in which there is no concept of
678 a “multidimensional array”, an array of arrays may
679 be represented by a debugging information entry for a
680 multidimensional array.
682 Other attributes especially applicable to arrays are
683 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated},
684 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} and
685 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location},
686 which are described in
687 Section \refersec{chap:dynamictypeproperties}.
688 For relevant examples,
690 Appendix \refersec{app:fortran90example}.
692 \section{ Structure, Union, Class and Interface Type Entries}
693 \label{chap:structureunionclassandinterfacetypeentries}
695 \textit{The languages
697 \addtoindex{C++}, and
698 \addtoindex{Pascal}, among others, allow the
699 programmer to define types that are collections of related
700 components. In \addtoindex{C} and \addtoindex{C++}, these collections are called
701 “structures.” In \addtoindex{Pascal}, they are called “records.”
702 The components may be of different types. The components are
703 called “members” in \addtoindex{C} and
704 \addtoindex{C++}, and “fields” in \addtoindex{Pascal}.}
706 \textit{The components of these collections each exist in their
707 own space in computer memory. The components of a C or C++
708 “union” all coexist in the same memory.}
710 \textit{\addtoindex{Pascal} and
711 other languages have a “discriminated union,”
712 \addtoindex{discriminated union|see {variant entry}}
713 also called a “variant record.” Here, selection of a
714 number of alternative substructures (“variants”) is based
715 on the value of a component that is not part of any of those
716 substructures (the “discriminant”).}
718 \textit{\addtoindex{C++} and
719 \addtoindex{Java} have the notion of ``class'', which is in some
720 ways similar to a structure. A class may have “member
721 functions” which are subroutines that are within the scope
722 of a class or structure.}
724 \textit{The \addtoindex{C++} notion of
725 structure is more general than in \addtoindex{C}, being
726 equivalent to a class with minor differences. Accordingly,
727 in the following discussion statements about
728 \addtoindex{C++} classes may
729 be understood to apply to \addtoindex{C++} structures as well.}
731 \subsection{Structure, Union and Class Type Entries}
732 \label{chap:structureunionandclasstypeentries}
735 Structure, union, and class types are represented by debugging
736 information entries with
737 the tags \livetarg{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type},
738 \livetarg{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type},
739 and \livetarg{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
740 respectively. If a name has been given to the structure,
741 union, or class in the source program, then the corresponding
742 structure type, union type, or class type entry has a
743 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
744 \addtoindexx{name attribute}
745 whose value is a null\dash terminated string
746 containing the type name as it appears in the source program.
748 The members of a structure, union, or class are represented
749 by debugging information entries that are owned by the
750 corresponding structure type, union type, or class type entry
751 and appear in the same order as the corresponding declarations
752 in the source program.
754 A structure type, union type or class type entry may have
755 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a
756 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
757 \hypertarget{chap:DWATbitsizedatamemberbitsize}
758 (see Section \refersec{chap:byteandbitsizes}),
759 whose value is the amount of storage needed
760 to hold an instance of the structure, union or class type,
761 including any padding.
762 An incomplete structure, union or class type
763 \addtoindexx{incomplete structure/union/class}
765 \addtoindexx{incomplete type}
766 represented by a structure, union or class
767 entry that does not have a byte size attribute and that has
768 \addtoindexx{declaration attribute}
769 a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
771 If the complete declaration of a type has been placed in
772 \hypertarget{chap:DWATsignaturetypesignature}
774 (see Section \refersec{chap:separatetypeunitentries}),
775 an incomplete declaration
776 \addtoindexx{incomplete type}
777 of that type in the compilation unit may provide
778 the unique 64\dash bit signature of the type using a \livelink{chap:DWATsignature}{DW\-\_AT\-\_signature}
781 If a structure, union or class entry represents the definition
782 of a structure, class or union member corresponding to a prior
783 incomplete structure, class or union, the entry may have a
784 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute whose value is a reference to
785 the debugging information entry representing that incomplete
788 Structure, union and class entries containing the
789 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute do not need to duplicate
790 information provided by the declaration entry referenced by the
791 specification attribute. In particular, such entries do not
792 need to contain an attribute for the name of the structure,
793 class or union they represent if such information is already
794 provided in the declaration.
796 \textit{For \addtoindex{C} and \addtoindex{C++},
798 \addtoindexx{data member|see {member entry (data)}}
799 member declarations occurring within
800 the declaration of a structure, union or class type are
801 considered to be “definitions” of those members, with
802 the exception of “static” data members, whose definitions
803 appear outside of the declaration of the enclosing structure,
804 union or class type. Function member declarations appearing
805 within a structure, union or class type declaration are
806 definitions only if the body of the function also appears
807 within the type declaration.}
809 If the definition for a given member of the structure, union
810 or class does not appear within the body of the declaration,
811 that member also has a debugging information entry describing
812 its definition. That latter entry has a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
813 attribute referencing the debugging information entry
814 owned by the body of the structure, union or class entry and
815 representing a non\dash defining declaration of the data, function
816 or type member. The referenced entry will not have information
817 about the location of that member (low and high pc attributes
818 for function members, location descriptions for data members)
819 and will have a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
821 \textit{Consider a nested class whose
822 definition occurs outside of the containing class definition, as in:}
831 \textit{The two different structs can be described in
832 different compilation units to
833 facilitate DWARF space compression
834 (see Appendix \refersec{app:usingcompilationunits}).}
836 \subsection{Interface Type Entries}
837 \label{chap:interfacetypeentries}
839 \textit{The \addtoindex{Java} language defines ``interface'' types.
841 in \addtoindex{Java} is similar to a \addtoindex{C++} or
842 \addtoindex{Java} class with only abstract
843 methods and constant data members.}
846 \addtoindexx{interface type entry}
847 are represented by debugging information
849 tag \livetarg{chap:DWTAGinterfacetype}{DW\-\_TAG\-\_interface\-\_type}.
851 An interface type entry has
852 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
853 \addtoindexx{name attribute}
855 value is a null\dash terminated string containing the type name
856 as it appears in the source program.
858 The members of an interface are represented by debugging
859 information entries that are owned by the interface type
860 entry and that appear in the same order as the corresponding
861 declarations in the source program.
863 \subsection{Derived or Extended Structs, Classes and Interfaces}
864 \label{chap:derivedorextendedstructsclasesandinterfaces}
866 \textit{In \addtoindex{C++}, a class (or struct)
868 \addtoindexx{derived type (C++)|see{inheritance entry}}
869 be ``derived from'' or be a
870 ``subclass of'' another class.
871 In \addtoindex{Java}, an interface may ``extend''
872 \addtoindexx{extended type (Java)|see{inheritance entry}}
874 \addtoindexx{implementing type (Java)|see{inheritance entry}}
875 or more other interfaces, and a class may ``extend'' another
876 class and/or ``implement'' one or more interfaces. All of these
877 relationships may be described using the following. Note that
878 in \addtoindex{Java},
879 the distinction between extends and implements is
880 implied by the entities at the two ends of the relationship.}
882 A class type or interface type entry that describes a
883 derived, extended or implementing class or interface owns
884 addtoindexx{implementing type (Java)|see{inheritance entry}}
885 debugging information entries describing each of the classes
886 or interfaces it is derived from, extending or implementing,
887 respectively, ordered as they were in the source program. Each
889 \addtoindexx{inheritance entry}
891 tag \livetarg{chap:DWTAGinheritance}{DW\-\_TAG\-\_inheritance}.
893 An inheritance entry has
894 \addtoindexx{inheritance entry}
896 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is
897 a reference to the debugging information entry describing the
898 class or interface from which the parent class or structure
899 of the inheritance entry is derived, extended or implementing.
902 \addtoindexx{inheritance entry}
903 for a class that derives from or extends
904 \hypertarget{chap:DWATdatamemberlocationinheritedmemberlocation}
905 another class or struct also has
906 \addtoindexx{data member location attribute}
908 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
909 attribute, whose value describes the location of the beginning
910 of the inherited type relative to the beginning address of the
911 derived class. If that value is a constant, it is the offset
912 in bytes from the beginning of the class to the beginning of
913 the inherited type. Otherwise, the value must be a location
914 description. In this latter case, the beginning address of
915 the derived class is pushed on the expression stack before
916 the \addtoindex{location description}
917 is evaluated and the result of the
918 evaluation is the location of the inherited type.
920 \textit{The interpretation of the value of this attribute for
921 inherited types is the same as the interpretation for data
923 (see Section \refersec{chap:datamemberentries}). }
926 \addtoindexx{inheritance entry}
928 \hypertarget{chap:DWATaccessibilitycppinheritedmembers}
930 \addtoindexx{accessibility attribute}
932 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
934 If no accessibility attribute
935 is present, private access is assumed for an entry of a class
936 and public access is assumed for an entry of an interface,
940 \hypertarget{chap:DWATvirtualityvirtualityofbaseclass}
941 the class referenced by the
942 \addtoindexx{inheritance entry}
943 inheritance entry serves
944 as a \addtoindex{C++} virtual base class, the inheritance entry has a
945 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
947 \textit{For a \addtoindex{C++} virtual base, the
948 \addtoindex{data member location attribute}
949 will usually consist of a non-trivial
950 \addtoindex{location description}.}
952 \subsection{Access Declarations}
953 \label{chap:accessdeclarations}
955 \textit{In \addtoindex{C++}, a derived class may contain access declarations that
956 \addtoindex{access declaration entry}
957 change the accessibility of individual class members from the
958 overall accessibility specified by the inheritance declaration.
959 A single access declaration may refer to a set of overloaded
962 If a derived class or structure contains access declarations,
963 each such declaration may be represented by a debugging
964 information entry with the tag
965 \livetarg{chap:DWTAGaccessdeclaration}{DW\-\_TAG\-\_access\-\_declaration}.
967 such entry is a child of the class or structure type entry.
969 An access declaration entry has
970 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
971 \addtoindexx{name attribute}
973 value is a null\dash terminated string representing the name used
974 in the declaration in the source program, including any class
975 or structure qualifiers.
977 An access declaration entry
978 \hypertarget{chap:DWATaccessibilitycppbaseclasses}
981 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
982 attribute describing the declared accessibility of the named
990 \addtoindexx{friend entry}
991 declared by a structure, union or class
992 \hypertarget{chap:DWATfriendfriendrelationship}
993 type may be represented by a debugging information entry
994 that is a child of the structure, union or class type entry;
995 the friend entry has the
996 tag \livetarg{chap:DWTAGfriend}{DW\-\_TAG\-\_friend}.
999 \addtoindexx{friend attribute}
1000 a \livelink{chap:DWATfriend}{DW\-\_AT\-\_friend} attribute, whose value is
1001 a reference to the debugging information entry describing
1002 the declaration of the friend.
1005 \subsection{Data Member Entries}
1006 \label{chap:datamemberentries}
1008 A data member (as opposed to a member function) is
1009 represented by a debugging information entry with the
1010 tag \livetarg{chap:DWTAGmember}{DW\-\_TAG\-\_member}.
1012 \addtoindexx{member entry (data)}
1013 member entry for a named member has
1014 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1015 \addtoindexx{name attribute}
1016 whose value is a null\dash terminated
1017 string containing the member name as it appears in the source
1018 program. If the member entry describes an
1019 \addtoindex{anonymous union},
1021 name attribute is omitted or consists of a single zero byte.
1023 The data member entry has a
1024 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote
1025 \addtoindexx{member entry (data)}
1026 the type of that member.
1028 A data member entry may
1029 \addtoindexx{accessibility attribute}
1031 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
1032 attribute. If no accessibility attribute is present, private
1033 access is assumed for an entry of a class and public access
1034 is assumed for an entry of a structure, union, or interface.
1037 \hypertarget{chap:DWATmutablemutablepropertyofmemberdata}
1039 \addtoindexx{member entry (data)}
1041 \addtoindexx{mutable attribute}
1042 have a \livelink{chap:DWATmutable}{DW\-\_AT\-\_mutable} attribute,
1043 which is a \livelink{chap:flag}{flag}.
1044 This attribute indicates whether the data
1045 member was declared with the mutable storage class specifier.
1047 The beginning of a data member
1048 \addtoindex{beginning of a data member}
1049 is described relative to
1050 \addtoindexx{beginning of an object}
1051 the beginning of the object in which it is immediately
1052 contained. In general, the beginning is characterized by
1053 both an address and a bit offset within the byte at that
1054 address. When the storage for an entity includes all of
1055 the bits in the beginning byte, the beginning bit offset is
1058 Bit offsets in DWARF use the bit numbering and direction
1059 conventions that are appropriate to the current language on
1063 \addtoindexx{member entry (data)}
1064 corresponding to a data member that is
1065 \hypertarget{chap:DWATdatabitoffsetdatamemberbitlocation}
1067 \hypertarget{chap:DWATdatamemberlocationdatamemberlocation}
1068 in a structure, union or class may have either
1069 \addtoindexx{data member location attribute}
1071 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute or a
1072 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1073 attribute. If the beginning of the data member is the same as
1074 the beginning of the containing entity then neither attribute
1077 For a \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute
1078 \addtoindexx{data member location attribute}
1079 there are two cases:
1081 \begin{enumerate}[1.]
1083 \item If the value is an integer constant, it is the offset
1084 in bytes from the beginning of the containing entity. If
1085 the beginning of the containing entity has a non-zero bit
1086 offset then the beginning of the member entry has that same
1089 \item Otherwise, the value must be a \addtoindex{location description}.
1091 this case, the beginning of the containing entity must be byte
1092 aligned. The beginning address is pushed on the DWARF stack
1093 before the \addtoindex{location} description is evaluated; the result of
1094 the evaluation is the base address of the member entry.
1096 \textit{The push on the DWARF expression stack of the base address of
1097 the containing construct is equivalent to execution of the
1098 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} operation
1099 (see Section \refersec{chap:stackoperations});
1100 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} therefore
1101 is not needed at the
1102 beginning of a \addtoindex{location description} for a data member.
1104 result of the evaluation is a location--either an address or
1105 the name of a register, not an offset to the member.}
1107 \textit{A \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1109 \addtoindexx{data member location attribute}
1110 that has the form of a
1111 \addtoindex{location description} is not valid for a data member contained
1112 in an entity that is not byte aligned because DWARF operations
1113 do not allow for manipulating or computing bit offsets.}
1117 For a \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} attribute,
1118 the value is an integer constant
1119 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1120 that specifies the number of bits
1121 from the beginning of the containing entity to the beginning
1122 of the data member. This value must be greater than or equal
1123 to zero, but is not limited to less than the number of bits
1126 If the size of a data member is not the same as the size
1127 of the type given for the data member, the data member has
1128 \addtoindexx{bit size attribute}
1129 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1130 or a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute whose
1131 integer constant value
1132 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1134 of storage needed to hold the value of the data member.
1136 \textit{\addtoindex{C} and \addtoindex{C++}
1138 \addtoindex{bit fields}
1140 \addtoindexx{data bit offset}
1142 \addtoindexx{data bit size}
1144 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} and
1145 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attributes.}
1147 \textit{This Standard uses the following bit numbering and direction
1148 conventions in examples. These conventions are for illustrative
1149 purposes and other conventions may apply on particular
1154 \item \textit{For big\dash endian architectures, bit offsets are
1155 counted from high-order to low\dash order bits within a byte (or
1156 larger storage unit); in this case, the bit offset identifies
1157 the high\dash order bit of the object.}
1159 \item \textit{For little\dash endian architectures, bit offsets are
1160 counted from low\dash order to high\dash order bits within a byte (or
1161 larger storage unit); in this case, the bit offset identifies
1162 the low\dash order bit of the object.}
1166 \textit{In either case, the bit so identified is defined as the
1167 \addtoindexx{beginning of an object}
1168 beginning of the object.}
1170 \textit{For example, take one possible representation of the following
1171 \addtoindex{C} structure definition
1172 in both big\dash and little\dash endian byte orders:}
1183 \textit{The following diagrams show the structure layout
1184 and data bit offsets for example big\dash\ and little\dash endian
1185 architectures, respectively. Both diagrams show a structure
1186 that begins at address A and whose size is four bytes. Also,
1187 high order bits are to the left and low order bits are to
1190 \textit{Big\dash Endian Data Bit Offsets:}
1198 Addresses increase ->
1199 | A | A + 1 | A + 2 | A + 3 |
1201 Data bit offsets increase ->
1202 +---------------+---------------+---------------+---------------+
1203 |0 4|5 10|11 15|16 23|24 31|
1204 | j | k | m | n | <pad> |
1206 +---------------------------------------------------------------+
1209 \textit{Little\dash Endian Data Bit Offsets:}
1215 <- Addresses increase
1216 | A | A + 1 | A + 2 | A + 3 |
1218 <- Data bit offsets increase
1220 +---------------+---------------+---------------+---------------+
1221 |31 24|23 16|15 11|10 5|4 0|
1222 | <pad> | n | m | k | j |
1224 +---------------------------------------------------------------+
1228 \textit{Note that data member bit offsets in this example are the
1229 same for both big\dash\ and little\dash endian architectures even
1230 though the fields are allocated in different directions
1231 (high\dash order to low-order versus low\dash order to high\dash order);
1232 the bit naming conventions for memory and/or registers of
1233 the target architecture may or may not make this seem natural.}
1235 \textit{For a more extensive example showing nested and packed records
1237 Appendix \refersec{app:pascalexample}.}
1239 \textit{Attribute \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1241 \addtoindex{DWARF Version 4}
1242 and is also used for base types
1244 \refersec{chap:basetypeentries}).
1246 \livetarg{chap:DWATbitoffsetdatamemberbitlocation}
1247 attributes \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} and
1248 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} when used to
1249 identify the beginning of bit field data members as defined
1250 in DWARF V3 and earlier. The earlier attributes are defined
1251 in a manner suitable for bit field members on big-endian
1252 architectures but which is either awkward or incomplete for
1253 use on little-endian architectures.
1254 (\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} also
1255 has other uses that are not affected by this change.)}
1257 \textit{The \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1258 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1259 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1260 attribute combination is deprecated for data members in DWARF
1261 Version 4, but implementations may continue to support this
1262 use for compatibility.}
1265 \addtoindex{DWARF Version 3}
1266 definitions of these attributes are
1269 \begin{myindentpara}{1cm}
1270 \textit{If the data member entry describes a bit field, then that
1271 entry has the following attributes:}
1274 \item \textit{A \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1275 attribute whose value
1276 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1277 is the number of bytes that contain an instance of the
1278 bit field and any padding bits.}
1280 \textit{The byte size attribute may be omitted if the size of the
1281 object containing the bit field can be inferred from the type
1282 attribute of the data member containing the bit field.}
1284 \item \textit{A \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1286 \addtoindexx{bit offset attribute (V3)}
1288 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1289 is the number of bits to the left of the leftmost
1290 (most significant) bit of the bit field value.}
1292 \item \textit{A \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1294 \addtoindexx{bit size attribute (V3)}
1296 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1297 is the number of bits occupied by the bit field value.}
1302 \addtoindex{location description} for a bit field calculates the address
1303 of an anonymous object containing the bit field. The address
1304 is relative to the structure, union, or class that most closely
1305 encloses the bit field declaration. The number of bytes in this
1306 anonymous object is the value of the byte size attribute of
1307 the bit field. The offset (in bits) from the most significant
1308 bit of the anonymous object to the most significant bit of
1309 the bit field is the value of the bit offset attribute.}
1313 \textit{Diagrams similar to the above that show the use of the
1314 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1315 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1316 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} attribute
1317 combination may be found in the
1318 \addtoindex{DWARF Version 3} Standard.}
1320 \textit{In comparing
1322 \addtoindexx{DWARF Version 3}
1324 \addtoindexx{DWARF Version 4}
1325 4, note that DWARF V4
1326 defines the following combinations of attributes:}
1329 \item \textit{either \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1331 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1332 (to specify the beginning of the data member)}
1334 % FIXME: the indentation of the following line is suspect.
1335 \textit{optionally together with}
1337 \item \textit{either \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or
1338 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} (to
1339 specify the size of the data member)}
1343 \textit{DWARF V3 defines the following combinations}
1346 \item \textit{\livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1347 (to specify the beginning
1348 of the data member, except this specification is only partial
1349 in the case of a bit field) }
1351 % FIXME: the indentation of the following line is suspect.
1352 \textit{optionally together with}
1354 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1355 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1356 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1357 (to further specify the beginning of a bit field data member
1358 as well as specify the size of the data member) }
1361 \subsection{Member Function Entries}
1362 \label{chap:memberfunctionentries}
1364 A member function is represented by a
1365 \addtoindexx{member function entry}
1366 debugging information entry with the
1367 tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}.
1368 The member function entry
1369 may contain the same attributes and follows the same rules
1370 as non\dash member global subroutine entries
1371 (see Section \refersec{chap:subroutineandentrypointentries}).
1374 \addtoindexx{accessibility attribute}
1375 member function entry may have a
1376 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
1377 attribute. If no accessibility attribute is present, private
1378 access is assumed for an entry of a class and public access
1379 is assumed for an entry of a structure, union or interface.
1382 \hypertarget{chap:DWATvirtualityvirtualityoffunction}
1383 the member function entry describes a virtual function,
1384 then that entry has a
1385 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
1388 \hypertarget{chap:DWATexplicitexplicitpropertyofmemberfunction}
1389 the member function entry describes an explicit member
1390 function, then that entry has
1391 \addtoindexx{explicit attribute}
1393 \livelink{chap:DWATexplicit}{DW\-\_AT\-\_explicit} attribute.
1396 \hypertarget{chap:DWATvtableelemlocationvirtualfunctiontablevtableslot}
1397 entry for a virtual function also has a
1398 \livelink{chap:DWATvtableelemlocation}{DW\-\_AT\-\_vtable\-\_elem\-\_location}
1399 \addtoindexi{attribute}{vtable element location attribute} whose value contains
1400 a \addtoindex{location description}
1401 yielding the address of the slot
1402 for the function within the virtual function table for the
1403 enclosing class. The address of an object of the enclosing
1404 type is pushed onto the expression stack before the location
1405 description is evaluated.
1408 \hypertarget{chap:DWATobjectpointerobjectthisselfpointerofmemberfunction}
1409 the member function entry describes a non\dash static member
1410 function, then that entry has
1411 \addtoindexx{object pointer attribute}
1412 a \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer}
1414 whose value is a reference to the formal parameter entry
1415 that corresponds to the object for which the function is
1416 called. The name attribute of that formal parameter is defined
1417 by the current language (for example,
1418 this for \addtoindex{C++} or self
1419 for \addtoindex{Objective C}
1420 and some other languages). That parameter
1421 also has a \livelink{chap:DWATartificial}{DW\-\_AT\-\_artificial} attribute whose value is true.
1423 Conversely, if the member function entry describes a static
1424 member function, the entry does not have
1425 \addtoindexx{object pointer attribute}
1427 \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer}
1430 If the member function entry describes a non\dash static member
1431 function that has a const\dash volatile qualification, then
1432 the entry describes a non\dash static member function whose
1433 object formal parameter has a type that has an equivalent
1434 const\dash volatile qualification.
1436 If a subroutine entry represents the defining declaration
1437 of a member function and that definition appears outside of
1438 the body of the enclosing class declaration, the subroutine
1439 entry has a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
1440 attribute, whose value is
1441 a reference to the debugging information entry representing
1442 the declaration of this function member. The referenced entry
1443 will be a child of some class (or structure) type entry.
1445 Subroutine entries containing the \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
1446 attribute do not need to duplicate information provided
1447 by the declaration entry referenced by the specification
1448 attribute. In particular, such entries do not need to contain
1449 attributes for the name or return type of the function member
1450 whose definition they represent.
1452 \subsection{Class Template Instantiations}
1453 \label{chap:classtemplateinstantiations}
1455 \textit{In \addtoindex{C++} a class template is a generic definition of a class
1456 type that may be instantiated when an instance of the class
1457 is declared or defined. The generic description of the
1458 class may include both parameterized types and parameterized
1459 constant values. DWARF does not represent the generic template
1460 definition, but does represent each instantiation.}
1462 A class template instantiation is represented by a
1463 debugging information entry with the tag \livelink{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
1464 \livelink{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type} or
1465 \livelink{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type}. With five
1466 exceptions, such an entry will contain the same attributes
1467 and have the same types of child entries as would an entry
1468 for a class type defined explicitly using the instantiation
1469 types and values. The exceptions are:
1471 \begin{enumerate}[1.]
1472 \item Each formal parameterized type declaration appearing in the
1473 template definition is represented by a debugging information
1475 \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}. Each
1476 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
1477 \addtoindexx{name attribute}
1479 a null\dash terminated string containing the name of the formal
1480 type parameter as it appears in the source program. The
1481 template type parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1482 describing the actual type by which the formal is replaced
1483 for this instantiation.
1485 \item Each formal parameterized value declaration appearing in the
1486 template definition is represented by a debugging information
1488 tag \livetarg{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}.
1490 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
1491 \addtoindexx{name attribute}
1493 a null\dash terminated string containing the name of the formal
1494 value parameter as it appears in the source program.
1496 \hypertarget{chap:DWATconstvaluetemplatevalueparameter}
1497 template value parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1498 describing the type of the parameterized value. Finally,
1499 the template value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value}
1500 attribute, whose value is the actual constant value of the
1501 value parameter for this instantiation as represented on the
1502 target architecture.
1504 \item The class type entry and each of its child entries references
1505 a template type parameter entry in any circumstance where the
1506 source template definition references a formal parameterized
1507 type. Similarly, the class type entry and each of its child
1508 entries references a template value parameter entry in any
1509 circumstance where the source template definition references
1510 a formal parameterized value.
1512 \item If the compiler has generated a special compilation unit to
1513 hold the template instantiation and that special compilation
1514 unit has a different name from the compilation unit containing
1515 the template definition, the name attribute for the debugging
1516 information entry representing the special compilation unit
1517 should be empty or omitted.
1519 \item If the class type entry representing the template
1520 instantiation or any of its child entries contains declaration
1521 coordinate attributes, those attributes should refer to
1522 the source for the template definition, not to any source
1523 generated artificially by the compiler.
1527 \subsection{Variant Entries}
1528 \label{chap:variantentries}
1530 A variant part of a structure is represented by a debugging
1531 information entry\addtoindexx{variant part entry} with the
1532 tag \livetarg{chap:DWTAGvariantpart}{DW\-\_TAG\-\_variant\-\_part} and is
1533 owned by the corresponding structure type entry.
1535 If the variant part has a discriminant, the discriminant is
1536 \hypertarget{chap:DWATdiscrdiscriminantofvariantpart}
1538 \addtoindexx{discriminant (entry)}
1539 separate debugging information entry which
1540 is a child of the variant part entry. This entry has the form
1542 \addtoindexx{member entry (data)!as discriminant}
1543 structure data member entry. The variant part entry will
1544 \addtoindexx{discriminant attribute}
1546 \livelink{chap:DWATdiscr}{DW\-\_AT\-\_discr} attribute
1547 whose value is a reference to
1548 the member entry for the discriminant.
1550 If the variant part does not have a discriminant (tag field),
1551 the variant part entry has a
1552 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to represent
1555 Each variant of a particular variant part is represented by
1556 \hypertarget{chap:DWATdiscrvaluediscriminantvalue}
1557 a debugging information entry\addtoindexx{variant entry} with the
1558 tag \livetarg{chap:DWTAGvariant}{DW\-\_TAG\-\_variant}
1559 and is a child of the variant part entry. The value that
1560 selects a given variant may be represented in one of three
1561 ways. The variant entry may have a
1562 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value} attribute
1563 whose value represents a single case label. The value of this
1564 attribute is encoded as an LEB128 number. The number is signed
1565 if the tag type for the variant part containing this variant
1566 is a signed type. The number is unsigned if the tag type is
1570 \hypertarget{chap:DWATdiscrlistlistofdiscriminantvalues}
1571 the variant entry may contain
1572 \addtoindexx{discriminant list attribute}
1574 \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list}
1575 attribute, whose value represents a list of discriminant
1576 values. This list is represented by any of the
1577 \livelink{chap:block}{block} forms and
1578 may contain a mixture of case labels and label ranges. Each
1579 item on the list is prefixed with a discriminant value
1580 descriptor that determines whether the list item represents
1581 a single label or a label range. A single case label is
1582 represented as an LEB128 number as defined above for
1583 \addtoindexx{discriminant value attribute}
1585 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value}
1586 attribute. A label range is represented by
1587 two LEB128 numbers, the low value of the range followed by the
1588 high value. Both values follow the rules for signedness just
1589 described. The discriminant value descriptor is an integer
1590 constant that may have one of the values given in
1591 Figure \refersec{fig:discriminantdescriptorvalues}.
1593 \begin{figure}[here]
1594 \autorows[0pt]{c}{1}{l}{
1595 \addtoindex{DW\-\_DSC\-\_label},
1596 \addtoindex{DW\-\_DSC\-\_range}
1598 \caption{Discriminant descriptor values}\label{fig:discriminantdescriptorvalues}
1601 If a variant entry has neither a \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value}
1602 attribute nor a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute, or if it has
1603 a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute with 0 size, the variant is a
1606 The components selected by a particular variant are represented
1607 by debugging information entries owned by the corresponding
1608 variant entry and appear in the same order as the corresponding
1609 declarations in the source program.
1611 \section{Condition Entries}
1612 \label{chap:conditionentries}
1614 \textit{COBOL has the notion of
1615 \addtoindexx{level-88 condition, COBOL}
1616 a ``level\dash 88 condition'' that
1617 associates a data item, called the conditional variable, with
1618 a set of one or more constant values and/or value ranges.
1619 Semantically, the condition is ‛true’ if the conditional
1620 variable's value matches any of the described constants,
1621 and the condition is ‛false’ otherwise.}
1623 The \livetarg{chap:DWTAGcondition}{DW\-\_TAG\-\_condition}
1624 debugging information entry\addtoindexx{condition entry}
1626 logical condition that tests whether a given data item’s
1627 value matches one of a set of constant values. If a name
1628 has been given to the condition, the condition entry has a
1629 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1630 \addtoindexx{name attribute}
1631 whose value is a null\dash terminated string
1632 giving the condition name as it appears in the source program.
1634 The condition entry's parent entry describes the conditional
1635 variable; normally this will be a \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable},
1636 \livelink{chap:DWTAGmember}{DW\-\_TAG\-\_member} or
1637 \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter} entry.
1639 \addtoindexx{formal parameter entry}
1641 entry has an array type, the condition can test any individual
1642 element, but not the array as a whole. The condition entry
1643 implicitly specifies a “comparison type” that is the
1644 type of an array element if the parent has an array type;
1645 otherwise it is the type of the parent entry.
1647 The condition entry owns \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} and/or
1648 \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} entries that describe the constant
1649 values associated with the condition. If any child entry has
1650 a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute, that attribute should describe a type
1651 compatible with the comparison type (according to the source
1652 language); otherwise the child’s type is the same as the
1655 \textit{For conditional variables with alphanumeric types, COBOL
1656 permits a source program to provide ranges of alphanumeric
1657 constants in the condition. Normally a subrange type entry
1658 does not describe ranges of strings; however, this can be
1659 represented using bounds attributes that are references to
1660 constant entries describing strings. A subrange type entry may
1661 refer to constant entries that are siblings of the subrange
1665 \section{Enumeration Type Entries}
1666 \label{chap:enumerationtypeentries}
1668 \textit{An “enumeration type” is a scalar that can assume one of
1669 a fixed number of symbolic values.}
1671 An enumeration type is represented by a debugging information
1673 \livetarg{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}.
1675 If a name has been given to the enumeration type in the source
1676 program, then the corresponding enumeration type entry has
1677 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1678 \addtoindexx{name attribute}
1679 whose value is a null\dash terminated
1680 string containing the enumeration type name as it appears
1681 in the source program. This entry also has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1682 attribute whose integer constant value is the number of bytes
1683 required to hold an instance of the enumeration.
1685 The \addtoindex{enumeration type entry}
1686 may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1687 which refers to the underlying data type used to implement
1690 If an enumeration type has type safe
1693 \begin{enumerate}[1.]
1694 \item Enumerators are contained in the scope of the enumeration type, and/or
1696 \item Enumerators are not implicitly converted to another type
1699 then the \addtoindex{enumeration type entry} may
1700 \addtoindexx{enum class|see{type-safe enumeration}}
1701 have a \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}
1702 attribute, which is a \livelink{chap:flag}{flag}.
1703 In a language that offers only
1704 one kind of enumeration declaration, this attribute is not
1707 \textit{In \addtoindex{C} or \addtoindex{C++},
1708 the underlying type will be the appropriate
1709 integral type determined by the compiler from the properties of
1710 \hypertarget{chap:DWATenumclasstypesafeenumerationdefinition}
1711 the enumeration literal values.
1712 A \addtoindex{C++} type declaration written
1713 using enum class declares a strongly typed enumeration and
1714 is represented using \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}
1715 in combination with \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}.}
1717 Each enumeration literal is represented by a debugging
1718 \addtoindexx{enumeration literal|see{enumeration entry}}
1719 information entry with the
1720 tag \livetarg{chap:DWTAGenumerator}{DW\-\_TAG\-\_enumerator}.
1722 such entry is a child of the
1723 \addtoindex{enumeration type entry}, and the
1724 enumerator entries appear in the same order as the declarations
1725 of the enumeration literals in the source program.
1727 Each \addtoindex{enumerator entry} has a
1728 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
1729 \addtoindexx{name attribute}
1730 value is a null\dash terminated string containing the name of the
1731 \hypertarget{chap:DWATconstvalueenumerationliteralvalue}
1732 enumeration literal as it appears in the source program.
1733 Each enumerator entry also has a
1734 \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value} attribute,
1735 whose value is the actual numeric value of the enumerator as
1736 represented on the target system.
1739 If the enumeration type occurs as the description of a
1740 \addtoindexx{enumeration type endry!as array dimension}
1741 dimension of an array type, and the stride for that dimension
1742 \hypertarget{chap:DWATbytestrideenumerationstridedimensionofarraytype}
1743 is different than what would otherwise be determined, then
1744 \hypertarget{chap:DWATbitstrideenumerationstridedimensionofarraytype}
1745 the enumeration type entry has either a
1746 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1747 or \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1748 \addtoindexx{bit stride attribute}
1749 which specifies the separation
1750 between successive elements along the dimension as described
1752 Section \refersec{chap:visibilityofdeclarations}.
1754 \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1755 \addtoindexx{bit stride attribute}
1756 is interpreted as bits and the value of
1757 \addtoindexx{byte stride attribute}
1759 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1760 attribute is interpreted as bytes.
1763 \section{Subroutine Type Entries}
1764 \label{chap:subroutinetypeentries}
1766 It is possible in \addtoindex{C}
1767 to declare pointers to subroutines
1768 that return a value of a specific type. In both
1769 \addtoindex{C} and \addtoindex{C++},
1770 it is possible to declare pointers to subroutines that not
1771 only return a value of a specific type, but accept only
1772 arguments of specific types. The type of such pointers would
1773 be described with a ``pointer to'' modifier applied to a
1774 user\dash defined type.
1776 A subroutine type is represented by a debugging information
1778 tag \livetarg{chap:DWTAGsubroutinetype}{DW\-\_TAG\-\_subroutine\-\_type}.
1780 been given to the subroutine type in the source program,
1781 then the corresponding subroutine type entry has
1782 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1783 \addtoindexx{name attribute}
1784 whose value is a null\dash terminated string containing
1785 the subroutine type name as it appears in the source program.
1787 If the subroutine type describes a function that returns
1788 a value, then the subroutine type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
1789 attribute to denote the type returned by the subroutine. If
1790 the types of the arguments are necessary to describe the
1791 subroutine type, then the corresponding subroutine type
1792 entry owns debugging information entries that describe the
1793 arguments. These debugging information entries appear in the
1794 order that the corresponding argument types appear in the
1797 In \addtoindex{C} there
1798 is a difference between the types of functions
1799 declared using function prototype style declarations and
1800 those declared using non\dash prototype declarations.
1803 \hypertarget{chap:DWATprototypedsubroutineprototype}
1804 subroutine entry declared with a function prototype style
1805 declaration may have
1806 \addtoindexx{prototyped attribute}
1808 \livelink{chap:DWATprototyped}{DW\-\_AT\-\_prototyped} attribute, which is
1809 a \livelink{chap:flag}{flag}.
1811 Each debugging information entry owned by a subroutine
1812 type entry has a tag whose value has one of two possible
1815 \begin{enumerate}[1.]
1816 \item The formal parameters of a parameter list (that have a
1817 specific type) are represented by a debugging information entry
1818 with the tag \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter}.
1819 Each formal parameter
1820 entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute that refers to the type of
1821 the formal parameter.
1823 \item The unspecified parameters of a variable parameter list
1824 \addtoindexx{unspecified parameters entry}
1826 \addtoindexx{... parameters|see{unspecified parameters entry}}
1827 represented by a debugging information entry with the
1828 tag \livelink{chap:DWTAGunspecifiedparameters}{DW\-\_TAG\-\_unspecified\-\_parameters}.
1833 \section{String Type Entries}
1834 \label{chap:stringtypeentries}
1837 A ``string'' is a sequence of characters that have specific
1838 semantics and operations that separate them from arrays of
1840 \addtoindex{Fortran} is one of the languages that has a string
1841 type. Note that ``string'' in this context refers to a target
1842 machine concept, not the class string as used in this document
1843 (except for the name attribute).
1845 A string type is represented by a debugging information entry
1846 with the tag \livetarg{chap:DWTAGstringtype}{DW\-\_TAG\-\_string\-\_type}.
1847 If a name has been given to
1848 the string type in the source program, then the corresponding
1849 string type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1850 \addtoindexx{name attribute}
1852 a null\dash terminated string containing the string type name as
1853 it appears in the source program.
1856 \hypertarget{chap:DWATstringlengthstringlengthofstringtype}
1857 string type entry may have a
1858 \livelink{chap:DWATstringlength}{DW\-\_AT\-\_string\-\_length} attribute
1860 \addtoindex{location description} yielding the location
1861 where the length of the string is stored in the program. The
1862 string type entry may also have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute
1863 or \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
1864 (see Section \refersec{chap:byteandbitsizes})
1865 is the size of the data to be retrieved from the location
1866 referenced by the string length attribute. If no (byte or bit)
1867 size attribute is present, the size of the data to be retrieved
1868 is the same as the size of an address on the target machine.
1870 If no string length attribute is present, the string type
1871 entry may have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or
1872 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1873 attribute, whose value
1874 (see Section \refersec{chap:byteandbitsizes})
1876 storage needed to hold a value of the string type.
1879 \section{Set Type Entries}
1880 \label{chap:settypeentries}
1882 \textit{\addtoindex{Pascal} provides the concept of a “set,” which represents
1883 a group of values of ordinal type.}
1885 A set is represented by a debugging information entry with
1886 the tag \livetarg{chap:DWTAGsettype}{DW\-\_TAG\-\_set\-\_type}.
1887 If a name has been given to the
1888 set type, then the set type entry has
1889 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1890 \addtoindexx{name attribute}
1891 whose value is a null\dash terminated string containing the
1892 set type name as it appears in the source program.
1894 The set type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote the
1895 type of an element of the set.
1897 If the amount of storage allocated to hold each element of an
1898 object of the given set type is different from the amount of
1899 storage that is normally allocated to hold an individual object
1900 of the indicated element type, then the set type entry has
1901 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute, or
1902 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
1903 whose value (see Section \refersec{chap:byteandbitsizes}) is
1904 the amount of storage needed to hold a value of the set type.
1907 \section{Subrange Type Entries}
1908 \label{chap:subrangetypeentries}
1910 \textit{Several languages support the concept of a ``subrange''
1911 type object. These objects can represent a subset of the
1912 values that an object of the basis type for the subrange can
1913 represent. Subrange type entries may also be used to represent
1914 the bounds of array dimensions.}
1916 A subrange type is represented by a debugging information
1918 tag \livetarg{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type}.
1920 given to the subrange type, then the subrange type entry
1921 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1922 \addtoindexx{name attribute}
1923 whose value is a null\dash terminated
1924 string containing the subrange type name as it appears in
1927 The subrange entry may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to describe
1928 the type of object, called the basis type, of whose values
1929 this subrange is a subset.
1931 If the amount of storage allocated to hold each element of an
1932 object of the given subrange type is different from the amount
1933 of storage that is normally allocated to hold an individual
1934 object of the indicated element type, then the subrange
1935 type entry has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or
1936 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1937 attribute, whose value
1938 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1940 storage needed to hold a value of the subrange type.
1943 \hypertarget{chap:DWATthreadsscaledupcarrayboundthreadsscalfactor}
1944 subrange entry may have a \livelink{chap:DWATthreadsscaled}{DW\-\_AT\-\_threads\-\_scaled} attribute,
1945 which is a \livelink{chap:flag}{flag}.
1946 If present, this attribute indicates whether
1947 this subrange represents a UPC array bound which is scaled
1948 by the runtime THREADS value (the number of UPC threads in
1949 this execution of the program).
1951 \textit{This allows the representation of a UPC shared array such as}
1954 int shared foo[34*THREADS][10][20];
1958 \hypertarget{chap:DWATlowerboundlowerboundofsubrange}
1960 \hypertarget{chap:DWATupperboundupperboundofsubrange}
1961 entry may have the attributes
1962 \livelink{chap:DWATlowerbound}{DW\-\_AT\-\_lower\-\_bound}
1963 and \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound} to specify, respectively, the lower
1964 and upper bound values of the subrange. The
1965 \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound}
1967 \hypertarget{chap:DWATcountelementsofsubrangetype}
1969 % FIXME: The following matches DWARF4: odd as there is no default count.
1970 \addtoindexx{count attribute!default}
1972 \addtoindexx{count attribute}
1974 \livelink{chap:DWATcount}{DW\-\_AT\-\_count} attribute,
1976 value describes the number of elements in the subrange rather
1977 than the value of the last element. The value of each of
1978 these attributes is determined as described in
1979 Section \refersec{chap:staticanddynamicvaluesofattributes}.
1981 If the lower bound value is missing, the value is assumed to
1982 be a language\dash dependent default constant.
1983 \addtoindexx{lower bound attribute!default}
1986 \addtoindex{C}, \addtoindex{C++},
1989 \addtoindex{Objective C},
1990 \addtoindex{Objective C++},
1991 \addtoindex{Python}, and
1993 The default lower bound is 1 for
1994 \addtoindex{Ada}, \addtoindex{COBOL},
1995 \addtoindex{Fortran},
1996 \addtoindex{Modula-2},
1997 \addtoindex{Pascal} and
2000 \textit{No other default lower bound values are currently defined.}
2002 If the upper bound and count are missing, then the upper bound value is
2005 If the subrange entry has no type attribute describing the
2006 basis type, the basis type is assumed to be the same as
2007 the object described by the lower bound attribute (if it
2008 references an object). If there is no lower bound attribute,
2009 or that attribute does not reference an object, the basis type
2010 is the type of the upper bound or \addtoindex{count attribute}
2012 of them references an object). If there is no upper bound or
2013 count attribute, or neither references an object, the type is
2014 assumed to be the same type, in the source language of the
2015 compilation unit containing the subrange entry, as a signed
2016 integer with the same size as an address on the target machine.
2018 If the subrange type occurs as the description of a dimension
2019 of an array type, and the stride for that dimension is
2020 \hypertarget{chap:DWATbytestridesubrangestridedimensionofarraytype}
2021 different than what would otherwise be determined, then
2022 \hypertarget{chap:DWATbitstridesubrangestridedimensionofarraytype}
2023 the subrange type entry has either
2024 \addtoindexx{byte stride attribute}
2026 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride} or
2027 \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
2028 \addtoindexx{bit stride attribute}
2029 which specifies the separation
2030 between successive elements along the dimension as described
2032 Section \refersec{chap:byteandbitsizes}.
2034 \textit{Note that the stride can be negative.}
2036 \section{Pointer to Member Type Entries}
2037 \label{chap:pointertomembertypeentries}
2039 \textit{In \addtoindex{C++}, a
2040 pointer to a data or function member of a class or
2041 structure is a unique type.}
2043 A debugging information entry representing the type of an
2044 object that is a pointer to a structure or class member has
2045 the tag \livetarg{chap:DWTAGptrtomembertype}{DW\-\_TAG\-\_ptr\-\_to\-\_member\-\_type}.
2047 If the \addtoindex{pointer to member type} has a name, the
2048 \addtoindexx{pointer to member type entry}
2049 pointer to member entry has a
2050 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
2051 \addtoindexx{name attribute}
2053 null\dash terminated string containing the type name as it appears
2054 in the source program.
2056 The \addtoindex{pointer to member} entry
2057 has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to
2058 describe the type of the class or structure member to which
2059 objects of this type may point.
2061 The \addtoindex{pointer to member} entry also
2062 \hypertarget{chap:DWATcontainingtypecontainingtypeofpointertomembertype}
2064 \livelink{chap:DWATcontainingtype}{DW\-\_AT\-\_containing\-\_type}
2065 attribute, whose value is a reference to a debugging
2066 information entry for the class or structure to whose members
2067 objects of this type may point.
2070 \hypertarget{chap:DWATuselocationmemberlocationforpointertomembertype}
2072 \addtoindex{pointer to member entry}
2074 \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} attribute
2076 \addtoindex{location description} that computes the
2077 address of the member of the class to which the pointer to
2078 member entry points.
2080 \textit{The method used to find the address of a given member of a
2081 class or structure is common to any instance of that class
2082 or structure and to any instance of the pointer or member
2083 type. The method is thus associated with the type entry,
2084 rather than with each instance of the type.}
2086 The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is used in conjunction
2087 with the location descriptions for a particular object of the
2088 given \addtoindex{pointer to member type} and for a particular structure or
2089 class instance. The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location}
2090 attribute expects two values to be
2091 \addtoindexi{pushed}{address!implicit push for member operator}
2092 onto the DWARF expression stack before
2093 the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is evaluated.
2095 \addtoindexi{pushed}{address!implicit push for member operator}
2096 is the value of the \addtoindex{pointer to member} object
2097 itself. The second value
2098 \addtoindexi{pushed}{address!implicit push for member operator}
2099 is the base address of the
2100 entire structure or union instance containing the member
2101 whose address is being calculated.
2103 \textit{For an expression such as}
2108 % FIXME: object and mbr\_ptr should be distinguished from italic. See DW4.
2109 \textit{where mbr\_ptr has some \addtoindex{pointer to member type}, a debugger should:}
2111 \textit{1. Push the value of mbr\_ptr onto the DWARF expression stack.}
2113 \textit{2. Push the base address of object onto the DWARF expression stack.}
2115 \textit{3. Evaluate the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description
2116 given in the type of mbr\_ptr.}
2118 \section{File Type Entries}
2119 \label{chap:filetypeentries}
2121 \textit{Some languages, such as \addtoindex{Pascal},
2122 provide a data type to represent
2125 A file type is represented by a debugging information entry
2127 \addtoindexx{file type entry}
2129 \livetarg{chap:DWTAGfiletype}{DW\-\_TAG\-\_file\-\_type}.
2130 If the file type has a name,
2131 the file type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
2132 \addtoindexx{name attribute}
2134 is a null\dash terminated string containing the type name as it
2135 appears in the source program.
2137 The file type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
2138 the type of the objects contained in the file.
2140 The file type entry also
2141 \addtoindexx{byte size}
2143 \addtoindexx{bit size}
2145 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or
2146 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
2147 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
2148 is the amount of storage need to hold a value of the file type.
2150 \section{Dynamic Type Properties}
2151 \label{chap:dynamictypeproperties}
2152 \subsection{Data Location}
2153 \label{chap:datalocation}
2155 \textit{Some languages may represent objects using descriptors to hold
2156 information, including a location and/or run\dash time parameters,
2157 about the data that represents the value for that object.}
2159 \hypertarget{chap:DWATdatalocationindirectiontoactualdata}
2160 The \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
2161 attribute may be used with any
2162 \addtoindexx{data location attribute}
2163 type that provides one or more levels of
2164 \addtoindexx{hidden indirection|see{data location attribute}}
2166 and/or run\dash time parameters in its representation. Its value
2167 is a \addtoindex{location description}.
2168 The result of evaluating this
2169 description yields the location of the data for an object.
2170 When this attribute is omitted, the address of the data is
2171 the same as the address of the object.
2173 \textit{This location description will typically begin with
2174 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address}
2175 which loads the address of the
2176 object which can then serve as a descriptor in subsequent
2177 calculation. For an example using
2178 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
2179 for a \addtoindex{Fortran 90 array}, see
2180 Appendix \refersec{app:fortran90example}.}
2182 \subsection{Allocation and Association Status}
2183 \label{chap:allocationandassociationstatus}
2185 \textit{Some languages, such as \addtoindex{Fortran 90},
2186 provide types whose values
2187 may be dynamically allocated or associated with a variable
2188 under explicit program control.}
2190 \hypertarget{chap:DWATallocatedallocationstatusoftypes}
2192 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated}
2194 \addtoindexx{allocated attribute}
2195 may optionally be used with any
2196 type for which objects of the type can be explicitly allocated
2197 and deallocated. The presence of the attribute indicates that
2198 objects of the type are allocatable and deallocatable. The
2199 integer value of the attribute (see below) specifies whether
2200 an object of the type is
2201 currently allocated or not.
2203 \hypertarget{chap:DWATassociatedassociationstatusoftypes}
2205 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute
2207 \addtoindexx{associated attribute}
2208 optionally be used with
2209 any type for which objects of the type can be dynamically
2210 associated with other objects. The presence of the attribute
2211 indicates that objects of the type can be associated. The
2212 integer value of the attribute (see below) indicates whether
2213 an object of the type is currently associated or not.
2215 While these attributes are defined specifically with
2216 \addtoindex{Fortran 90} ALLOCATABLE and POINTER types
2217 in mind, usage is not limited
2218 to just that language.
2220 The value of these attributes is determined as described in
2221 Section \refersec{chap:staticanddynamicvaluesofattributes}.
2223 A non\dash zero value is interpreted as allocated or associated,
2224 and zero is interpreted as not allocated or not associated.
2226 \textit{For \addtoindex{Fortran 90},
2227 if the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated}
2228 attribute is present,
2229 the type has the POINTER property where either the parent
2230 variable is never associated with a dynamic object or the
2231 implementation does not track whether the associated object
2232 is static or dynamic. If the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute is
2233 present and the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute is not, the type
2234 has the ALLOCATABLE property. If both attributes are present,
2235 then the type should be assumed to have the POINTER property
2236 (and not ALLOCATABLE); the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute may then
2237 be used to indicate that the association status of the object
2238 resulted from execution of an ALLOCATE statement rather than
2239 pointer assignment.}
2241 \textit{For examples using
2242 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} for \addtoindex{Ada} and
2243 \addtoindex{Fortran 90}
2245 see Appendix \refersec{app:aggregateexamples}.}
2249 \section{Template Alias Entries}
2250 \label{chap:templatealiasentries}
2252 A type named using a template alias is represented
2253 by a debugging information entry with the tag
2254 \livetarg{chap:DWTAGtemplatealias}{DW\-\_TAG\-\_template\-\_alias}.
2255 The template alias entry has a
2256 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
2257 \addtoindexx{name attribute}
2258 whose value is a null\dash terminated string
2259 containing the name of the template alias as it appears in
2260 the source program. The template alias entry also contains a
2261 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is a reference to the type
2262 named by the template alias. The template alias entry has
2263 the following child entries:
2265 \begin{enumerate}[1.]
2266 \item Each formal parameterized type declaration appearing
2267 in the template alias declaration is represented
2268 by a debugging information entry with the tag
2269 \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}.
2270 Each such entry may have
2271 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
2272 \addtoindexx{name attribute}
2273 whose value is a null\dash terminated
2274 string containing the name of the formal type parameter as it
2275 appears in the source program. The template type parameter
2276 entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing the actual
2277 type by which the formal is replaced for this instantiation.
2279 \item Each formal parameterized value declaration
2280 appearing in the template alias declaration is
2281 represented by a debugging information entry with the tag
2282 \livelink{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}.
2283 Each such entry may have
2284 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
2285 \addtoindexx{name attribute}
2286 whose value is a null\dash terminated
2287 string containing the name of the formal value parameter
2288 as it appears in the source program. The template value
2289 parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
2290 the type of the parameterized value. Finally, the template
2291 value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value}
2292 attribute, whose value is the actual constant value of the value parameter for
2293 this instantiation as represented on the target architecture.