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 pointer or reference
447 type (using \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type},
448 \livelink{chap:DWTAGreferencetype}{DW\-\_TAG\-\_reference\-\_type} or
449 \livelink{chap:DWTAGrvaluereferencetype}{DW\-\_TAG\-\_rvalue\-\_reference\-\_type})
450 % Another instance of no-good-place-to-put-index entry.
452 \addtoindexx{address class!attribute}
454 \hypertarget{chap:DWATadressclasspointerorreferencetypes}
456 \livelink{chap:DWATaddressclass}{DW\-\_AT\-\_address\-\_class}
457 attribute to describe how objects having the given pointer
458 or reference type ought to be dereferenced.
460 A modified type entry describing a shared qualified type
461 (using \livelink{chap:DWTAGsharedtype}{DW\-\_TAG\-\_shared\-\_type}) may have a
462 \livelink{chap:DWATcount}{DW\-\_AT\-\_count} attribute
463 \addtoindexx{count attribute}
464 whose value is a constant expressing the blocksize of the
465 type. If no count attribute is present, then the “infinite”
466 blocksize is assumed.
468 When multiple type modifiers are chained together to modify
469 a base or user-defined type, the tree ordering reflects the
470 semantics of the applicable lanuage rather than the textual
471 order in the source presentation.
475 \begin{tabular}{lp{9cm}}
476 Name&Meaning\\ \hline
477 \livetarg{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} & C or C++ const qualified type
478 \addtoindexx{const qualified type entry} \addtoindexx{C} \addtoindexx{C++} \\
479 \livetarg{chap:DWTAGpackedtype}{DW\-\_TAG\-\_packed\-\_type}& Pascal or Ada packed type
480 \addtoindexx{packed qualified type entry} \addtoindexx{Ada} \addtoindexx{Pascal} \\
481 \livetarg{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} & Pointer to an object of
482 the type being modified \addtoindexx{pointer qualified type entry} \\
483 \livetarg{chap:DWTAGreferencetype}{DW\-\_TAG\-\_reference\-\_type}& C++ (lvalue) reference
484 to an object of the type
485 being modified \addtoindexx{reference qualified type entry} \\
486 \livetarg{chap:DWTAGrestricttype}{DW\-\_TAG\-\_restrict\-\_type}&C restrict qualified type
487 \addtoindexx{restricted qualified type entry} \\
488 \livetarg{chap:DWTAGrvaluereferencetype}{DW\-\_TAG\-\_rvalue\-\_reference\-\_type} & C++
489 rvalue reference to an object of the type being modified
490 \addtoindexx{rvalue reference qualified type entry} \\
491 \livetarg{chap:DWTAGsharedtype}{DW\-\_TAG\-\_shared\-\_type}&UPC shared qualified type
492 \addtoindexx{shared qualified type entry} \\
493 \livetarg{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type}&C or C++ volatile qualified type
494 \addtoindex{volatile qualified type entry} \\
496 \caption{Type modifier tags}
497 \label{fig:typemodifiertags}
500 %The following clearpage prevents splitting the example across pages.
502 \textit{As examples of how type modifiers are ordered, take the following C
506 const unsigned char * volatile p;
507 which represents a volatile pointer to a constant
508 character. This is encoded in DWARF as:
509 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}(p) -->
510 \livelink{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type} -->
511 \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} -->
512 \livelink{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} -->
513 \livelink{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}(unsigned char)
515 volatile unsigned char * const restrict p;
516 on the other hand, represents a restricted constant
517 pointer to a volatile character. This is encoded as:
518 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}(p) -->
519 \livelink{chap:DWTAGrestricttype}{DW\-\_TAG\-\_restrict\-\_type} -->
520 \livelink{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} -->
521 \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} -->
522 \livelink{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type} -->
523 \livelink{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}(unsigned char)
527 \section{Typedef Entries}
528 \label{chap:typedefentries}
529 A named type that is defined in terms of another type
530 definition is represented by a debugging information entry with
531 the tag \livetarg{chap:DWTAGtypedef}{DW\-\_TAG\-\_typedef}.
532 The typedef entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
533 \addtoindexx{name attribute}
534 whose value is a null\dash terminated string containing
535 the name of the typedef as it appears in the source program.
537 The typedef entry may also contain a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose
538 value is a reference to the type named by the typedef. If
539 the debugging information entry for a typedef represents
540 a declaration of the type that is not also a definition,
541 it does not contain a type attribute.
543 \textit{Depending on the language, a named type that is defined in
544 terms of another type may be called a type alias, a subtype,
545 a constrained type and other terms. A type name declared with
546 no defining details may be termed an
547 \addtoindexx{incomplete type}
548 incomplete, forward or hidden type.
549 While the DWARF \livelink{chap:DWTAGtypedef}{DW\-\_TAG\-\_typedef} entry was
550 originally inspired by the like named construct in
551 \addtoindex{C} and \addtoindex{C++},
552 it is broadly suitable for similar constructs (by whatever
553 source syntax) in other languages.}
555 \section{Array Type Entries}
556 \label{chap:arraytypeentries}
558 Many languages share the concept of an ``array,'' which is
559 \addtoindexx{array type entry}
560 a table of components of identical type.
562 An array type is represented by a debugging information entry
563 with the tag \livetarg{chap:DWTAGarraytype}{DW\-\_TAG\-\_array\-\_type}.
566 \addtoindexx{array!declaration of type}
567 the array type in the source program, then the corresponding
568 array type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
569 \addtoindexx{name attribute}
571 null\dash terminated string containing the array type name as it
572 appears in the source program.
575 \hypertarget{chap:DWATorderingarrayrowcolumnordering}
576 array type entry describing a multidimensional array may
577 \addtoindexx{array!element ordering}
578 have a \livelink{chap:DWATordering}{DW\-\_AT\-\_ordering} attribute whose integer constant value is
579 interpreted to mean either row-major or column-major ordering
580 of array elements. The set of values and their meanings
581 for the ordering attribute are listed in
582 Figure \refersec{fig:arrayordering}.
584 ordering attribute is present, the default ordering for the
585 source language (which is indicated by the
586 \livelink{chap:DWATlanguage}{DW\-\_AT\-\_language}
588 \addtoindexx{language attribute}
589 of the enclosing compilation unit entry) is assumed.
592 \autorows[0pt]{c}{1}{l}{
593 \livetarg{chap:DWORDcolmajor}{DW\-\_ORD\-\_col\-\_major},
594 \livetarg{chap:DWORDrowmajor}{DW\-\_ORD\-\_row\-\_major}
596 \caption{Array ordering}\label{fig:arrayordering}
599 The ordering attribute may optionally appear on one-dimensional
600 arrays; it will be ignored.
602 An array type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
603 \addtoindexx{array!element type}
605 the type of each element of the array.
607 If the amount of storage allocated to hold each element of an
608 object of the given array type is different from the amount
609 of storage that is normally allocated to hold an individual
610 \hypertarget{chap:DWATbitstridearrayelementstrideofarraytype}
612 \hypertarget{chap:DWATbytestridearrayelementstrideofarraytype}
613 indicated element type, then the array type
614 \addtoindexx{bit stride attribute}
616 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
618 \addtoindexx{byte stride attribute}
619 a \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride}
621 \addtoindexx{bit stride attribute}
623 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
625 element of the array.
627 The array type entry may have either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a
628 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
629 (see Section \refersec{chap:byteandbitsizes}),
631 amount of storage needed to hold an instance of the array type.
633 \textit{If the size of the array can be determined statically at
634 compile time, this value can usually be computed by multiplying
635 the number of array elements by the size of each element.}
638 Each array dimension is described by a debugging information
639 entry with either the tag \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} or the
640 \addtoindexx{enumeration type entry!as array dimension}
642 \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}. These entries are
644 array type entry and are ordered to reflect the appearance of
645 the dimensions in the source program (i.e., leftmost dimension
646 first, next to leftmost second, and so on).
648 In languages, such as C, in which there is no concept of
649 a “multidimensional array”, an array of arrays may
650 be represented by a debugging information entry for a
651 multidimensional array.
653 Other attributes especially applicable to arrays are
654 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated},
655 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} and
656 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location},
657 which are described in
658 Section \refersec{chap:dynamictypeproperties}.
659 For relevant examples,
661 Appendix \refersec{app:fortran90example}.
663 \section{ Structure, Union, Class and Interface Type Entries}
664 \label{chap:structureunionclassandinterfacetypeentries}
666 \textit{The languages
668 \addtoindex{C++}, and
669 \addtoindex{Pascal}, among others, allow the
670 programmer to define types that are collections of related
671 components. In \addtoindex{C} and \addtoindex{C++}, these collections are called
672 “structures.” In \addtoindex{Pascal}, they are called “records.”
673 The components may be of different types. The components are
674 called “members” in \addtoindex{C} and
675 \addtoindex{C++}, and “fields” in \addtoindex{Pascal}.}
677 \textit{The components of these collections each exist in their
678 own space in computer memory. The components of a C or C++
679 “union” all coexist in the same memory.}
681 \textit{\addtoindex{Pascal} and
682 other languages have a “discriminated union,”
683 \addtoindex{discriminated union|see {variant entry}}
684 also called a “variant record.” Here, selection of a
685 number of alternative substructures (“variants”) is based
686 on the value of a component that is not part of any of those
687 substructures (the “discriminant”).}
689 \textit{\addtoindex{C++} and
690 \addtoindex{Java} have the notion of ``class'', which is in some
691 ways similar to a structure. A class may have “member
692 functions” which are subroutines that are within the scope
693 of a class or structure.}
695 \textit{The \addtoindex{C++} notion of
696 structure is more general than in \addtoindex{C}, being
697 equivalent to a class with minor differences. Accordingly,
698 in the following discussion statements about
699 \addtoindex{C++} classes may
700 be understood to apply to \addtoindex{C++} structures as well.}
702 \subsection{Structure, Union and Class Type Entries}
703 \label{chap:structureunionandclasstypeentries}
706 Structure, union, and class types are represented by debugging
707 information entries with
708 the tags \livetarg{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type},
709 \livetarg{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type},
710 and \livetarg{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
711 respectively. If a name has been given to the structure,
712 union, or class in the source program, then the corresponding
713 structure type, union type, or class type entry has a
714 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
715 \addtoindexx{name attribute}
716 whose value is a null\dash terminated string
717 containing the type name as it appears in the source program.
719 The members of a structure, union, or class are represented
720 by debugging information entries that are owned by the
721 corresponding structure type, union type, or class type entry
722 and appear in the same order as the corresponding declarations
723 in the source program.
725 A structure type, union type or class type entry may have
726 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a
727 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
728 \hypertarget{chap:DWATbitsizedatamemberbitsize}
729 (see Section \refersec{chap:byteandbitsizes}),
730 whose value is the amount of storage needed
731 to hold an instance of the structure, union or class type,
732 including any padding.
733 An incomplete structure, union or class type
734 \addtoindexx{incomplete structure/union/class}
736 \addtoindexx{incomplete type}
737 represented by a structure, union or class
738 entry that does not have a byte size attribute and that has
739 \addtoindexx{declaration attribute}
740 a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
742 If the complete declaration of a type has been placed in
743 \hypertarget{chap:DWATsignaturetypesignature}
745 (see Section \refersec{chap:separatetypeunitentries}),
746 an incomplete declaration
747 \addtoindexx{incomplete type}
748 of that type in the compilation unit may provide
749 the unique 64\dash bit signature of the type using a \livelink{chap:DWATsignature}{DW\-\_AT\-\_signature}
752 If a structure, union or class entry represents the definition
753 of a structure, class or union member corresponding to a prior
754 incomplete structure, class or union, the entry may have a
755 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute whose value is a reference to
756 the debugging information entry representing that incomplete
759 Structure, union and class entries containing the
760 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute do not need to duplicate
761 information provided by the declaration entry referenced by the
762 specification attribute. In particular, such entries do not
763 need to contain an attribute for the name of the structure,
764 class or union they represent if such information is already
765 provided in the declaration.
767 \textit{For \addtoindex{C} and \addtoindex{C++},
769 \addtoindexx{data member|see {member entry (data)}}
770 member declarations occurring within
771 the declaration of a structure, union or class type are
772 considered to be “definitions” of those members, with
773 the exception of “static” data members, whose definitions
774 appear outside of the declaration of the enclosing structure,
775 union or class type. Function member declarations appearing
776 within a structure, union or class type declaration are
777 definitions only if the body of the function also appears
778 within the type declaration.}
780 If the definition for a given member of the structure, union
781 or class does not appear within the body of the declaration,
782 that member also has a debugging information entry describing
783 its definition. That latter entry has a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
784 attribute referencing the debugging information entry
785 owned by the body of the structure, union or class entry and
786 representing a non\dash defining declaration of the data, function
787 or type member. The referenced entry will not have information
788 about the location of that member (low and high pc attributes
789 for function members, location descriptions for data members)
790 and will have a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
792 \textit{Consider a nested class whose
793 definition occurs outside of the containing class definition, as in:}
802 \textit{The two different structs can be described in
803 different compilation units to
804 facilitate DWARF space compression
805 (see Appendix \refersec{app:usingcompilationunits}).}
807 \subsection{Interface Type Entries}
808 \label{chap:interfacetypeentries}
810 \textit{The \addtoindex{Java} language defines ``interface'' types.
812 in \addtoindex{Java} is similar to a \addtoindex{C++} or
813 \addtoindex{Java} class with only abstract
814 methods and constant data members.}
817 \addtoindexx{interface type entry}
818 are represented by debugging information
820 tag \livetarg{chap:DWTAGinterfacetype}{DW\-\_TAG\-\_interface\-\_type}.
822 An interface type entry has
823 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
824 \addtoindexx{name attribute}
826 value is a null\dash terminated string containing the type name
827 as it appears in the source program.
829 The members of an interface are represented by debugging
830 information entries that are owned by the interface type
831 entry and that appear in the same order as the corresponding
832 declarations in the source program.
834 \subsection{Derived or Extended Structs, Classes and Interfaces}
835 \label{chap:derivedorextendedstructsclasesandinterfaces}
837 \textit{In \addtoindex{C++}, a class (or struct)
839 \addtoindexx{derived type (C++)|see{inheritance entry}}
840 be ``derived from'' or be a
841 ``subclass of'' another class.
842 In \addtoindex{Java}, an interface may ``extend''
843 \addtoindexx{extended type (Java)|see{inheritance entry}}
845 \addtoindexx{implementing type (Java)|see{inheritance entry}}
846 or more other interfaces, and a class may ``extend'' another
847 class and/or ``implement'' one or more interfaces. All of these
848 relationships may be described using the following. Note that
849 in \addtoindex{Java},
850 the distinction between extends and implements is
851 implied by the entities at the two ends of the relationship.}
853 A class type or interface type entry that describes a
854 derived, extended or implementing class or interface owns
855 addtoindexx{implementing type (Java)|see{inheritance entry}}
856 debugging information entries describing each of the classes
857 or interfaces it is derived from, extending or implementing,
858 respectively, ordered as they were in the source program. Each
860 \addtoindexx{inheritance entry}
862 tag \livetarg{chap:DWTAGinheritance}{DW\-\_TAG\-\_inheritance}.
864 An inheritance entry has
865 \addtoindexx{inheritance entry}
867 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is
868 a reference to the debugging information entry describing the
869 class or interface from which the parent class or structure
870 of the inheritance entry is derived, extended or implementing.
873 \addtoindexx{inheritance entry}
874 for a class that derives from or extends
875 \hypertarget{chap:DWATdatamemberlocationinheritedmemberlocation}
876 another class or struct also has
877 \addtoindexx{data member location attribute}
879 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
880 attribute, whose value describes the location of the beginning
881 of the inherited type relative to the beginning address of the
882 derived class. If that value is a constant, it is the offset
883 in bytes from the beginning of the class to the beginning of
884 the inherited type. Otherwise, the value must be a location
885 description. In this latter case, the beginning address of
886 the derived class is pushed on the expression stack before
887 the \addtoindex{location description}
888 is evaluated and the result of the
889 evaluation is the location of the inherited type.
891 \textit{The interpretation of the value of this attribute for
892 inherited types is the same as the interpretation for data
894 (see Section \refersec{chap:datamemberentries}). }
897 \addtoindexx{inheritance entry}
899 \hypertarget{chap:DWATaccessibilitycppinheritedmembers}
901 \addtoindexx{accessibility attribute}
903 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
905 If no accessibility attribute
906 is present, private access is assumed for an entry of a class
907 and public access is assumed for an entry of an interface,
911 \hypertarget{chap:DWATvirtualityvirtualityofbaseclass}
912 the class referenced by the
913 \addtoindexx{inheritance entry}
914 inheritance entry serves
915 as a \addtoindex{C++} virtual base class, the inheritance entry has a
916 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
918 \textit{For a \addtoindex{C++} virtual base, the
919 \addtoindex{data member location attribute}
920 will usually consist of a non-trivial
921 \addtoindex{location description}.}
923 \subsection{Access Declarations}
924 \label{chap:accessdeclarations}
926 \textit{In \addtoindex{C++}, a derived class may contain access declarations that
927 \addtoindex{access declaration entry}
928 change the accessibility of individual class members from the
929 overall accessibility specified by the inheritance declaration.
930 A single access declaration may refer to a set of overloaded
933 If a derived class or structure contains access declarations,
934 each such declaration may be represented by a debugging
935 information entry with the tag
936 \livetarg{chap:DWTAGaccessdeclaration}{DW\-\_TAG\-\_access\-\_declaration}.
938 such entry is a child of the class or structure type entry.
940 An access declaration entry has
941 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
942 \addtoindexx{name attribute}
944 value is a null\dash terminated string representing the name used
945 in the declaration in the source program, including any class
946 or structure qualifiers.
948 An access declaration entry
949 \hypertarget{chap:DWATaccessibilitycppbaseclasses}
952 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
953 attribute describing the declared accessibility of the named
961 \addtoindexx{friend entry}
962 declared by a structure, union or class
963 \hypertarget{chap:DWATfriendfriendrelationship}
964 type may be represented by a debugging information entry
965 that is a child of the structure, union or class type entry;
966 the friend entry has the
967 tag \livetarg{chap:DWTAGfriend}{DW\-\_TAG\-\_friend}.
970 \addtoindexx{friend attribute}
971 a \livelink{chap:DWATfriend}{DW\-\_AT\-\_friend} attribute, whose value is
972 a reference to the debugging information entry describing
973 the declaration of the friend.
976 \subsection{Data Member Entries}
977 \label{chap:datamemberentries}
979 A data member (as opposed to a member function) is
980 represented by a debugging information entry with the
981 tag \livetarg{chap:DWTAGmember}{DW\-\_TAG\-\_member}.
983 \addtoindexx{member entry (data)}
984 member entry for a named member has
985 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
986 \addtoindexx{name attribute}
987 whose value is a null\dash terminated
988 string containing the member name as it appears in the source
989 program. If the member entry describes an
990 \addtoindex{anonymous union},
992 name attribute is omitted or consists of a single zero byte.
994 The data member entry has a
995 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote
996 \addtoindexx{member entry (data)}
997 the type of that member.
999 A data member entry may
1000 \addtoindexx{accessibility attribute}
1002 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
1003 attribute. If no accessibility attribute is present, private
1004 access is assumed for an entry of a class and public access
1005 is assumed for an entry of a structure, union, or interface.
1008 \hypertarget{chap:DWATmutablemutablepropertyofmemberdata}
1010 \addtoindexx{member entry (data)}
1012 \addtoindexx{mutable attribute}
1013 have a \livelink{chap:DWATmutable}{DW\-\_AT\-\_mutable} attribute,
1014 which is a \livelink{chap:flag}{flag}.
1015 This attribute indicates whether the data
1016 member was declared with the mutable storage class specifier.
1018 The beginning of a data member
1019 \addtoindex{beginning of a data member}
1020 is described relative to
1021 \addtoindexx{beginning of an object}
1022 the beginning of the object in which it is immediately
1023 contained. In general, the beginning is characterized by
1024 both an address and a bit offset within the byte at that
1025 address. When the storage for an entity includes all of
1026 the bits in the beginning byte, the beginning bit offset is
1029 Bit offsets in DWARF use the bit numbering and direction
1030 conventions that are appropriate to the current language on
1034 \addtoindexx{member entry (data)}
1035 corresponding to a data member that is
1036 \hypertarget{chap:DWATdatabitoffsetdatamemberbitlocation}
1038 \hypertarget{chap:DWATdatamemberlocationdatamemberlocation}
1039 in a structure, union or class may have either
1040 \addtoindexx{data member location attribute}
1042 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute or a
1043 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1044 attribute. If the beginning of the data member is the same as
1045 the beginning of the containing entity then neither attribute
1048 For a \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute
1049 \addtoindexx{data member location attribute}
1050 there are two cases:
1052 \begin{enumerate}[1.]
1054 \item If the value is an integer constant, it is the offset
1055 in bytes from the beginning of the containing entity. If
1056 the beginning of the containing entity has a non-zero bit
1057 offset then the beginning of the member entry has that same
1060 \item Otherwise, the value must be a \addtoindex{location description}.
1062 this case, the beginning of the containing entity must be byte
1063 aligned. The beginning address is pushed on the DWARF stack
1064 before the \addtoindex{location} description is evaluated; the result of
1065 the evaluation is the base address of the member entry.
1067 \textit{The push on the DWARF expression stack of the base address of
1068 the containing construct is equivalent to execution of the
1069 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} operation
1070 (see Section \refersec{chap:stackoperations});
1071 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} therefore
1072 is not needed at the
1073 beginning of a \addtoindex{location description} for a data member.
1075 result of the evaluation is a location--either an address or
1076 the name of a register, not an offset to the member.}
1078 \textit{A \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1080 \addtoindexx{data member location attribute}
1081 that has the form of a
1082 \addtoindex{location description} is not valid for a data member contained
1083 in an entity that is not byte aligned because DWARF operations
1084 do not allow for manipulating or computing bit offsets.}
1088 For a \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} attribute,
1089 the value is an integer constant
1090 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1091 that specifies the number of bits
1092 from the beginning of the containing entity to the beginning
1093 of the data member. This value must be greater than or equal
1094 to zero, but is not limited to less than the number of bits
1097 If the size of a data member is not the same as the size
1098 of the type given for the data member, the data member has
1099 \addtoindexx{bit size attribute}
1100 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1101 or a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute whose
1102 integer constant value
1103 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1105 of storage needed to hold the value of the data member.
1107 \textit{\addtoindex{C} and \addtoindex{C++}
1109 \addtoindex{bit fields}
1111 \addtoindexx{data bit offset}
1113 \addtoindexx{data bit size}
1115 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} and
1116 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attributes.}
1118 \textit{This Standard uses the following bit numbering and direction
1119 conventions in examples. These conventions are for illustrative
1120 purposes and other conventions may apply on particular
1125 \item \textit{For big\dash endian architectures, bit offsets are
1126 counted from high-order to low\dash order bits within a byte (or
1127 larger storage unit); in this case, the bit offset identifies
1128 the high\dash order bit of the object.}
1130 \item \textit{For little\dash endian architectures, bit offsets are
1131 counted from low\dash order to high\dash order bits within a byte (or
1132 larger storage unit); in this case, the bit offset identifies
1133 the low\dash order bit of the object.}
1137 \textit{In either case, the bit so identified is defined as the
1138 \addtoindexx{beginning of an object}
1139 beginning of the object.}
1141 \textit{For example, take one possible representation of the following
1142 \addtoindex{C} structure definition
1143 in both big\dash and little\dash endian byte orders:}
1154 \textit{The following diagrams show the structure layout
1155 and data bit offsets for example big\dash\ and little\dash endian
1156 architectures, respectively. Both diagrams show a structure
1157 that begins at address A and whose size is four bytes. Also,
1158 high order bits are to the left and low order bits are to
1161 \textit{Big\dash Endian Data Bit Offsets:}
1169 Addresses increase ->
1170 | A | A + 1 | A + 2 | A + 3 |
1172 Data bit offsets increase ->
1173 +---------------+---------------+---------------+---------------+
1174 |0 4|5 10|11 15|16 23|24 31|
1175 | j | k | m | n | <pad> |
1177 +---------------------------------------------------------------+
1180 \textit{Little\dash Endian Data Bit Offsets:}
1186 <- Addresses increase
1187 | A | A + 1 | A + 2 | A + 3 |
1189 <- Data bit offsets increase
1191 +---------------+---------------+---------------+---------------+
1192 |31 24|23 16|15 11|10 5|4 0|
1193 | <pad> | n | m | k | j |
1195 +---------------------------------------------------------------+
1199 \textit{Note that data member bit offsets in this example are the
1200 same for both big\dash\ and little\dash endian architectures even
1201 though the fields are allocated in different directions
1202 (high\dash order to low-order versus low\dash order to high\dash order);
1203 the bit naming conventions for memory and/or registers of
1204 the target architecture may or may not make this seem natural.}
1206 \textit{For a more extensive example showing nested and packed records
1208 Appendix \refersec{app:pascalexample}.}
1210 \textit{Attribute \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1212 \addtoindex{DWARF Version 4}
1213 and is also used for base types
1215 \refersec{chap:basetypeentries}).
1217 \livetarg{chap:DWATbitoffsetdatamemberbitlocation}
1218 attributes \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} and
1219 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} when used to
1220 identify the beginning of bit field data members as defined
1221 in DWARF V3 and earlier. The earlier attributes are defined
1222 in a manner suitable for bit field members on big-endian
1223 architectures but which is either awkward or incomplete for
1224 use on little-endian architectures.
1225 (\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} also
1226 has other uses that are not affected by this change.)}
1228 \textit{The \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1229 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1230 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1231 attribute combination is deprecated for data members in DWARF
1232 Version 4, but implementations may continue to support this
1233 use for compatibility.}
1236 \addtoindex{DWARF Version 3}
1237 definitions of these attributes are
1240 \begin{myindentpara}{1cm}
1241 \textit{If the data member entry describes a bit field, then that
1242 entry has the following attributes:}
1245 \item \textit{A \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1246 attribute whose value
1247 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1248 is the number of bytes that contain an instance of the
1249 bit field and any padding bits.}
1251 \textit{The byte size attribute may be omitted if the size of the
1252 object containing the bit field can be inferred from the type
1253 attribute of the data member containing the bit field.}
1255 \item \textit{A \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1257 \addtoindexx{bit offset attribute (V3)}
1259 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1260 is the number of bits to the left of the leftmost
1261 (most significant) bit of the bit field value.}
1263 \item \textit{A \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1265 \addtoindexx{bit size attribute (V3)}
1267 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1268 is the number of bits occupied by the bit field value.}
1273 \addtoindex{location description} for a bit field calculates the address
1274 of an anonymous object containing the bit field. The address
1275 is relative to the structure, union, or class that most closely
1276 encloses the bit field declaration. The number of bytes in this
1277 anonymous object is the value of the byte size attribute of
1278 the bit field. The offset (in bits) from the most significant
1279 bit of the anonymous object to the most significant bit of
1280 the bit field is the value of the bit offset attribute.}
1284 \textit{Diagrams similar to the above that show the use of the
1285 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1286 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1287 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} attribute
1288 combination may be found in the
1289 \addtoindex{DWARF Version 3} Standard.}
1291 \textit{In comparing
1293 \addtoindexx{DWARF Version 3}
1295 \addtoindexx{DWARF Version 4}
1296 4, note that DWARF V4
1297 defines the following combinations of attributes:}
1300 \item \textit{either \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1302 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1303 (to specify the beginning of the data member)}
1305 % FIXME: the indentation of the following line is suspect.
1306 \textit{optionally together with}
1308 \item \textit{either \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or
1309 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} (to
1310 specify the size of the data member)}
1314 \textit{DWARF V3 defines the following combinations}
1317 \item \textit{\livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1318 (to specify the beginning
1319 of the data member, except this specification is only partial
1320 in the case of a bit field) }
1322 % FIXME: the indentation of the following line is suspect.
1323 \textit{optionally together with}
1325 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1326 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1327 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1328 (to further specify the beginning of a bit field data member
1329 as well as specify the size of the data member) }
1332 \subsection{Member Function Entries}
1333 \label{chap:memberfunctionentries}
1335 A member function is represented by a
1336 \addtoindexx{member function entry}
1337 debugging information entry with the
1338 tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}.
1339 The member function entry
1340 may contain the same attributes and follows the same rules
1341 as non\dash member global subroutine entries
1342 (see Section \refersec{chap:subroutineandentrypointentries}).
1345 \addtoindexx{accessibility attribute}
1346 member function entry may have a
1347 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
1348 attribute. If no accessibility attribute is present, private
1349 access is assumed for an entry of a class and public access
1350 is assumed for an entry of a structure, union or interface.
1353 \hypertarget{chap:DWATvirtualityvirtualityoffunction}
1354 the member function entry describes a virtual function,
1355 then that entry has a
1356 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
1359 \hypertarget{chap:DWATexplicitexplicitpropertyofmemberfunction}
1360 the member function entry describes an explicit member
1361 function, then that entry has
1362 \addtoindexx{explicit attribute}
1364 \livelink{chap:DWATexplicit}{DW\-\_AT\-\_explicit} attribute.
1367 \hypertarget{chap:DWATvtableelemlocationvirtualfunctiontablevtableslot}
1368 entry for a virtual function also has a
1369 \livelink{chap:DWATvtableelemlocation}{DW\-\_AT\-\_vtable\-\_elem\-\_location}
1370 \addtoindexi{attribute}{vtable element location attribute} whose value contains
1371 a \addtoindex{location description}
1372 yielding the address of the slot
1373 for the function within the virtual function table for the
1374 enclosing class. The address of an object of the enclosing
1375 type is pushed onto the expression stack before the location
1376 description is evaluated.
1379 \hypertarget{chap:DWATobjectpointerobjectthisselfpointerofmemberfunction}
1380 the member function entry describes a non\dash static member
1381 function, then that entry has a \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer}
1383 whose value is a reference to the formal parameter entry
1384 that corresponds to the object for which the function is
1385 called. The name attribute of that formal parameter is defined
1386 by the current language (for example,
1387 this for \addtoindex{C++} or self
1388 for \addtoindex{Objective C}
1389 and some other languages). That parameter
1390 also has a \livelink{chap:DWATartificial}{DW\-\_AT\-\_artificial} attribute whose value is true.
1392 Conversely, if the member function entry describes a static
1393 member function, the entry does not have a
1394 \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer}
1397 If the member function entry describes a non\dash static member
1398 function that has a const\dash volatile qualification, then
1399 the entry describes a non\dash static member function whose
1400 object formal parameter has a type that has an equivalent
1401 const\dash volatile qualification.
1403 If a subroutine entry represents the defining declaration
1404 of a member function and that definition appears outside of
1405 the body of the enclosing class declaration, the subroutine
1406 entry has a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
1407 attribute, whose value is
1408 a reference to the debugging information entry representing
1409 the declaration of this function member. The referenced entry
1410 will be a child of some class (or structure) type entry.
1412 Subroutine entries containing the \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
1413 attribute do not need to duplicate information provided
1414 by the declaration entry referenced by the specification
1415 attribute. In particular, such entries do not need to contain
1416 attributes for the name or return type of the function member
1417 whose definition they represent.
1419 \subsection{Class Template Instantiations}
1420 \label{chap:classtemplateinstantiations}
1422 \textit{In \addtoindex{C++} a class template is a generic definition of a class
1423 type that may be instantiated when an instance of the class
1424 is declared or defined. The generic description of the
1425 class may include both parameterized types and parameterized
1426 constant values. DWARF does not represent the generic template
1427 definition, but does represent each instantiation.}
1429 A class template instantiation is represented by a
1430 debugging information entry with the tag \livelink{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
1431 \livelink{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type} or
1432 \livelink{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type}. With five
1433 exceptions, such an entry will contain the same attributes
1434 and have the same types of child entries as would an entry
1435 for a class type defined explicitly using the instantiation
1436 types and values. The exceptions are:
1438 \begin{enumerate}[1.]
1439 \item Each formal parameterized type declaration appearing in the
1440 template definition is represented by a debugging information
1442 \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}. Each
1443 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
1444 \addtoindexx{name attribute}
1446 a null\dash terminated string containing the name of the formal
1447 type parameter as it appears in the source program. The
1448 template type parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1449 describing the actual type by which the formal is replaced
1450 for this instantiation.
1452 \item Each formal parameterized value declaration appearing in the
1453 template definition is represented by a debugging information
1455 tag \livetarg{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}.
1457 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
1458 \addtoindexx{name attribute}
1460 a null\dash terminated string containing the name of the formal
1461 value parameter as it appears in the source program.
1463 \hypertarget{chap:DWATconstvaluetemplatevalueparameter}
1464 template value parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1465 describing the type of the parameterized value. Finally,
1466 the template value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value}
1467 attribute, whose value is the actual constant value of the
1468 value parameter for this instantiation as represented on the
1469 target architecture.
1471 \item The class type entry and each of its child entries references
1472 a template type parameter entry in any circumstance where the
1473 source template definition references a formal parameterized
1474 type. Similarly, the class type entry and each of its child
1475 entries references a template value parameter entry in any
1476 circumstance where the source template definition references
1477 a formal parameterized value.
1479 \item If the compiler has generated a special compilation unit to
1480 hold the template instantiation and that special compilation
1481 unit has a different name from the compilation unit containing
1482 the template definition, the name attribute for the debugging
1483 information entry representing the special compilation unit
1484 should be empty or omitted.
1486 \item If the class type entry representing the template
1487 instantiation or any of its child entries contains declaration
1488 coordinate attributes, those attributes should refer to
1489 the source for the template definition, not to any source
1490 generated artificially by the compiler.
1494 \subsection{Variant Entries}
1495 \label{chap:variantentries}
1497 A variant part of a structure is represented by a debugging
1498 information entry\addtoindexx{variant part entry} with the
1499 tag \livetarg{chap:DWTAGvariantpart}{DW\-\_TAG\-\_variant\-\_part} and is
1500 owned by the corresponding structure type entry.
1502 If the variant part has a discriminant, the discriminant is
1503 \hypertarget{chap:DWATdiscrdiscriminantofvariantpart}
1505 \addtoindexx{discriminant (entry)}
1506 separate debugging information entry which
1507 is a child of the variant part entry. This entry has the form
1509 \addtoindexx{member entry (data)!as discriminant}
1510 structure data member entry. The variant part entry will
1511 \addtoindexx{discriminant attribute}
1513 \livelink{chap:DWATdiscr}{DW\-\_AT\-\_discr} attribute
1514 whose value is a reference to
1515 the member entry for the discriminant.
1517 If the variant part does not have a discriminant (tag field),
1518 the variant part entry has a
1519 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to represent
1522 Each variant of a particular variant part is represented by
1523 \hypertarget{chap:DWATdiscrvaluediscriminantvalue}
1524 a debugging information entry\addtoindexx{variant entry} with the
1525 tag \livetarg{chap:DWTAGvariant}{DW\-\_TAG\-\_variant}
1526 and is a child of the variant part entry. The value that
1527 selects a given variant may be represented in one of three
1528 ways. The variant entry may have a
1529 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value} attribute
1530 whose value represents a single case label. The value of this
1531 attribute is encoded as an LEB128 number. The number is signed
1532 if the tag type for the variant part containing this variant
1533 is a signed type. The number is unsigned if the tag type is
1537 \hypertarget{chap:DWATdiscrlistlistofdiscriminantvalues}
1538 the variant entry may contain
1539 \addtoindexx{discriminant list attribute}
1541 \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list}
1542 attribute, whose value represents a list of discriminant
1543 values. This list is represented by any of the
1544 \livelink{chap:block}{block} forms and
1545 may contain a mixture of case labels and label ranges. Each
1546 item on the list is prefixed with a discriminant value
1547 descriptor that determines whether the list item represents
1548 a single label or a label range. A single case label is
1549 represented as an LEB128 number as defined above for
1550 \addtoindexx{discriminant value attribute}
1552 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value}
1553 attribute. A label range is represented by
1554 two LEB128 numbers, the low value of the range followed by the
1555 high value. Both values follow the rules for signedness just
1556 described. The discriminant value descriptor is an integer
1557 constant that may have one of the values given in
1558 Figure \refersec{fig:discriminantdescriptorvalues}.
1560 \begin{figure}[here]
1561 \autorows[0pt]{c}{1}{l}{
1562 \addtoindex{DW\-\_DSC\-\_label},
1563 \addtoindex{DW\-\_DSC\-\_range}
1565 \caption{Discriminant descriptor values}\label{fig:discriminantdescriptorvalues}
1568 If a variant entry has neither a \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value}
1569 attribute nor a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute, or if it has
1570 a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute with 0 size, the variant is a
1573 The components selected by a particular variant are represented
1574 by debugging information entries owned by the corresponding
1575 variant entry and appear in the same order as the corresponding
1576 declarations in the source program.
1578 \section{Condition Entries}
1579 \label{chap:conditionentries}
1581 \textit{COBOL has the notion of
1582 \addtoindexx{level-88 condition, COBOL}
1583 a ``level\dash 88 condition'' that
1584 associates a data item, called the conditional variable, with
1585 a set of one or more constant values and/or value ranges.
1586 Semantically, the condition is ‛true’ if the conditional
1587 variable's value matches any of the described constants,
1588 and the condition is ‛false’ otherwise.}
1590 The \livetarg{chap:DWTAGcondition}{DW\-\_TAG\-\_condition}
1591 debugging information entry\addtoindexx{condition entry}
1593 logical condition that tests whether a given data item’s
1594 value matches one of a set of constant values. If a name
1595 has been given to the condition, the condition entry has a
1596 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1597 \addtoindexx{name attribute}
1598 whose value is a null\dash terminated string
1599 giving the condition name as it appears in the source program.
1601 The condition entry's parent entry describes the conditional
1602 variable; normally this will be a \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable},
1603 \livelink{chap:DWTAGmember}{DW\-\_TAG\-\_member} or
1604 \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter} entry.
1606 \addtoindexx{formal parameter entry}
1608 entry has an array type, the condition can test any individual
1609 element, but not the array as a whole. The condition entry
1610 implicitly specifies a “comparison type” that is the
1611 type of an array element if the parent has an array type;
1612 otherwise it is the type of the parent entry.
1614 The condition entry owns \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} and/or
1615 \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} entries that describe the constant
1616 values associated with the condition. If any child entry has
1617 a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute, that attribute should describe a type
1618 compatible with the comparison type (according to the source
1619 language); otherwise the child’s type is the same as the
1622 \textit{For conditional variables with alphanumeric types, COBOL
1623 permits a source program to provide ranges of alphanumeric
1624 constants in the condition. Normally a subrange type entry
1625 does not describe ranges of strings; however, this can be
1626 represented using bounds attributes that are references to
1627 constant entries describing strings. A subrange type entry may
1628 refer to constant entries that are siblings of the subrange
1632 \section{Enumeration Type Entries}
1633 \label{chap:enumerationtypeentries}
1635 \textit{An “enumeration type” is a scalar that can assume one of
1636 a fixed number of symbolic values.}
1638 An enumeration type is represented by a debugging information
1640 \livetarg{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}.
1642 If a name has been given to the enumeration type in the source
1643 program, then the corresponding enumeration type entry has
1644 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1645 \addtoindexx{name attribute}
1646 whose value is a null\dash terminated
1647 string containing the enumeration type name as it appears
1648 in the source program. This entry also has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1649 attribute whose integer constant value is the number of bytes
1650 required to hold an instance of the enumeration.
1652 The \addtoindex{enumeration type entry}
1653 may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1654 which refers to the underlying data type used to implement
1657 If an enumeration type has type safe
1660 \begin{enumerate}[1.]
1661 \item Enumerators are contained in the scope of the enumeration type, and/or
1663 \item Enumerators are not implicitly converted to another type
1666 then the \addtoindex{enumeration type entry} may
1667 \addtoindexx{enum class|see{type-safe enumeration}}
1668 have a \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}
1669 attribute, which is a \livelink{chap:flag}{flag}.
1670 In a language that offers only
1671 one kind of enumeration declaration, this attribute is not
1674 \textit{In \addtoindex{C} or \addtoindex{C++},
1675 the underlying type will be the appropriate
1676 integral type determined by the compiler from the properties of
1677 \hypertarget{chap:DWATenumclasstypesafeenumerationdefinition}
1678 the enumeration literal values.
1679 A \addtoindex{C++} type declaration written
1680 using enum class declares a strongly typed enumeration and
1681 is represented using \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}
1682 in combination with \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}.}
1684 Each enumeration literal is represented by a debugging
1685 \addtoindexx{enumeration literal|see{enumeration entry}}
1686 information entry with the
1687 tag \livetarg{chap:DWTAGenumerator}{DW\-\_TAG\-\_enumerator}.
1689 such entry is a child of the
1690 \addtoindex{enumeration type entry}, and the
1691 enumerator entries appear in the same order as the declarations
1692 of the enumeration literals in the source program.
1694 Each \addtoindex{enumerator entry} has a
1695 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
1696 \addtoindexx{name attribute}
1697 value is a null\dash terminated string containing the name of the
1698 \hypertarget{chap:DWATconstvalueenumerationliteralvalue}
1699 enumeration literal as it appears in the source program.
1700 Each enumerator entry also has a
1701 \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value} attribute,
1702 whose value is the actual numeric value of the enumerator as
1703 represented on the target system.
1706 If the enumeration type occurs as the description of a
1707 \addtoindexx{enumeration type endry!as array dimension}
1708 dimension of an array type, and the stride for that dimension
1709 \hypertarget{chap:DWATbytestrideenumerationstridedimensionofarraytype}
1710 is different than what would otherwise be determined, then
1711 \hypertarget{chap:DWATbitstrideenumerationstridedimensionofarraytype}
1712 the enumeration type entry has either a
1713 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1714 or \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1715 \addtoindexx{bit stride attribute}
1716 which specifies the separation
1717 between successive elements along the dimension as described
1719 Section \refersec{chap:visibilityofdeclarations}.
1721 \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1722 \addtoindexx{bit stride attribute}
1723 is interpreted as bits and the value of
1724 \addtoindexx{byte stride attribute}
1726 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1727 attribute is interpreted as bytes.
1730 \section{Subroutine Type Entries}
1731 \label{chap:subroutinetypeentries}
1733 It is possible in \addtoindex{C}
1734 to declare pointers to subroutines
1735 that return a value of a specific type. In both
1736 \addtoindex{C} and \addtoindex{C++},
1737 it is possible to declare pointers to subroutines that not
1738 only return a value of a specific type, but accept only
1739 arguments of specific types. The type of such pointers would
1740 be described with a ``pointer to'' modifier applied to a
1741 user\dash defined type.
1743 A subroutine type is represented by a debugging information
1745 tag \livetarg{chap:DWTAGsubroutinetype}{DW\-\_TAG\-\_subroutine\-\_type}.
1747 been given to the subroutine type in the source program,
1748 then the corresponding subroutine type entry has
1749 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1750 \addtoindexx{name attribute}
1751 whose value is a null\dash terminated string containing
1752 the subroutine type name as it appears in the source program.
1754 If the subroutine type describes a function that returns
1755 a value, then the subroutine type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
1756 attribute to denote the type returned by the subroutine. If
1757 the types of the arguments are necessary to describe the
1758 subroutine type, then the corresponding subroutine type
1759 entry owns debugging information entries that describe the
1760 arguments. These debugging information entries appear in the
1761 order that the corresponding argument types appear in the
1764 In \addtoindex{C} there
1765 is a difference between the types of functions
1766 declared using function prototype style declarations and
1767 those declared using non\dash prototype declarations.
1770 \hypertarget{chap:DWATprototypedsubroutineprototype}
1771 subroutine entry declared with a function prototype style
1772 declaration may have a
1773 \livelink{chap:DWATprototyped}{DW\-\_AT\-\_prototyped} attribute, which is
1774 a \livelink{chap:flag}{flag}.
1776 Each debugging information entry owned by a subroutine
1777 type entry has a tag whose value has one of two possible
1780 \begin{enumerate}[1.]
1781 \item The formal parameters of a parameter list (that have a
1782 specific type) are represented by a debugging information entry
1783 with the tag \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter}.
1784 Each formal parameter
1785 entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute that refers to the type of
1786 the formal parameter.
1788 \item The unspecified parameters of a variable parameter list
1789 \addtoindexx{unspecified parameters entry}
1791 \addtoindexx{... parameters|see{unspecified parameters entry}}
1792 represented by a debugging information entry with the
1793 tag \livelink{chap:DWTAGunspecifiedparameters}{DW\-\_TAG\-\_unspecified\-\_parameters}.
1798 \section{String Type Entries}
1799 \label{chap:stringtypeentries}
1802 A ``string'' is a sequence of characters that have specific
1803 semantics and operations that separate them from arrays of
1805 \addtoindex{Fortran} is one of the languages that has a string
1806 type. Note that ``string'' in this context refers to a target
1807 machine concept, not the class string as used in this document
1808 (except for the name attribute).
1810 A string type is represented by a debugging information entry
1811 with the tag \livetarg{chap:DWTAGstringtype}{DW\-\_TAG\-\_string\-\_type}.
1812 If a name has been given to
1813 the string type in the source program, then the corresponding
1814 string type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1815 \addtoindexx{name attribute}
1817 a null\dash terminated string containing the string type name as
1818 it appears in the source program.
1821 \hypertarget{chap:DWATstringlengthstringlengthofstringtype}
1822 string type entry may have a
1823 \livelink{chap:DWATstringlength}{DW\-\_AT\-\_string\-\_length} attribute
1825 \addtoindex{location description} yielding the location
1826 where the length of the string is stored in the program. The
1827 string type entry may also have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute
1828 or \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
1829 (see Section \refersec{chap:byteandbitsizes})
1830 is the size of the data to be retrieved from the location
1831 referenced by the string length attribute. If no (byte or bit)
1832 size attribute is present, the size of the data to be retrieved
1833 is the same as the size of an address on the target machine.
1835 If no string length attribute is present, the string type
1836 entry may have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or
1837 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1838 attribute, whose value
1839 (see Section \refersec{chap:byteandbitsizes})
1841 storage needed to hold a value of the string type.
1844 \section{Set Type Entries}
1845 \label{chap:settypeentries}
1847 \textit{Pascal provides the concept of a “set,” which represents
1848 a group of values of ordinal type.}
1850 A set is represented by a debugging information entry with
1851 the tag \livetarg{chap:DWTAGsettype}{DW\-\_TAG\-\_set\-\_type}.
1852 If a name has been given to the
1853 set type, then the set type entry has
1854 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1855 \addtoindexx{name attribute}
1856 whose value is a null\dash terminated string containing the
1857 set type name as it appears in the source program.
1859 The set type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote the
1860 type of an element of the set.
1862 If the amount of storage allocated to hold each element of an
1863 object of the given set type is different from the amount of
1864 storage that is normally allocated to hold an individual object
1865 of the indicated element type, then the set type entry has
1866 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute, or
1867 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
1868 whose value (see Section \refersec{chap:byteandbitsizes}) is
1869 the amount of storage needed to hold a value of the set type.
1872 \section{Subrange Type Entries}
1873 \label{chap:subrangetypeentries}
1875 \textit{Several languages support the concept of a ``subrange''
1876 type object. These objects can represent a subset of the
1877 values that an object of the basis type for the subrange can
1878 represent. Subrange type entries may also be used to represent
1879 the bounds of array dimensions.}
1881 A subrange type is represented by a debugging information
1883 tag \livetarg{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type}.
1885 given to the subrange type, then the subrange type entry
1886 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1887 \addtoindexx{name attribute}
1888 whose value is a null\dash terminated
1889 string containing the subrange type name as it appears in
1892 The subrange entry may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to describe
1893 the type of object, called the basis type, of whose values
1894 this subrange is a subset.
1896 If the amount of storage allocated to hold each element of an
1897 object of the given subrange type is different from the amount
1898 of storage that is normally allocated to hold an individual
1899 object of the indicated element type, then the subrange
1900 type entry has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or
1901 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1902 attribute, whose value
1903 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1905 storage needed to hold a value of the subrange type.
1908 \hypertarget{chap:DWATthreadsscaledupcarrayboundthreadsscalfactor}
1909 subrange entry may have a \livelink{chap:DWATthreadsscaled}{DW\-\_AT\-\_threads\-\_scaled} attribute,
1910 which is a \livelink{chap:flag}{flag}.
1911 If present, this attribute indicates whether
1912 this subrange represents a UPC array bound which is scaled
1913 by the runtime THREADS value (the number of UPC threads in
1914 this execution of the program).
1916 \textit{This allows the representation of a UPC shared array such as}
1919 int shared foo[34*THREADS][10][20];
1923 \hypertarget{chap:DWATlowerboundlowerboundofsubrange}
1925 \hypertarget{chap:DWATupperboundupperboundofsubrange}
1926 entry may have the attributes
1927 \livelink{chap:DWATlowerbound}{DW\-\_AT\-\_lower\-\_bound}
1928 and \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound} to specify, respectively, the lower
1929 and upper bound values of the subrange. The
1930 \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound}
1932 \hypertarget{chap:DWATcountelementsofsubrangetype}
1934 % FIXME: The following matches DWARF4: odd as there is no default count.
1935 \addtoindexx{count attribute!default}
1937 \addtoindexx{count attribute}
1939 \livelink{chap:DWATcount}{DW\-\_AT\-\_count} attribute,
1941 value describes the number of elements in the subrange rather
1942 than the value of the last element. The value of each of
1943 these attributes is determined as described in
1944 Section \refersec{chap:staticanddynamicvaluesofattributes}.
1946 If the lower bound value is missing, the value is assumed to
1947 be a language\dash dependent default constant.
1948 \addtoindexx{lower bound attribute!default}
1951 \addtoindex{C}, \addtoindex{C++},
1954 \addtoindex{Objective C},
1955 \addtoindex{Objective C++},
1956 \addtoindex{Python}, and
1958 The default lower bound is 1 for
1959 \addtoindex{Ada}, \addtoindex{COBOL},
1960 \addtoindex{Fortran},
1961 \addtoindex{Modula-2},
1962 \addtoindex{Pascal} and
1965 \textit{No other default lower bound values are currently defined.}
1967 If the upper bound and count are missing, then the upper bound value is
1970 If the subrange entry has no type attribute describing the
1971 basis type, the basis type is assumed to be the same as
1972 the object described by the lower bound attribute (if it
1973 references an object). If there is no lower bound attribute,
1974 or that attribute does not reference an object, the basis type
1975 is the type of the upper bound or \addtoindex{count attribute}
1977 of them references an object). If there is no upper bound or
1978 count attribute, or neither references an object, the type is
1979 assumed to be the same type, in the source language of the
1980 compilation unit containing the subrange entry, as a signed
1981 integer with the same size as an address on the target machine.
1983 If the subrange type occurs as the description of a dimension
1984 of an array type, and the stride for that dimension is
1985 \hypertarget{chap:DWATbytestridesubrangestridedimensionofarraytype}
1986 different than what would otherwise be determined, then
1987 \hypertarget{chap:DWATbitstridesubrangestridedimensionofarraytype}
1988 the subrange type entry has either
1989 \addtoindexx{byte stride attribute}
1991 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride} or
1992 \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1993 \addtoindexx{bit stride attribute}
1994 which specifies the separation
1995 between successive elements along the dimension as described
1997 Section \refersec{chap:byteandbitsizes}.
1999 \textit{Note that the stride can be negative.}
2001 \section{Pointer to Member Type Entries}
2002 \label{chap:pointertomembertypeentries}
2004 \textit{In \addtoindex{C++}, a pointer to a data or function member of a class or
2005 structure is a unique type.}
2007 A debugging information entry representing the type of an
2008 object that is a pointer to a structure or class member has
2009 the tag \livetarg{chap:DWTAGptrtomembertype}{DW\-\_TAG\-\_ptr\-\_to\-\_member\-\_type}.
2011 If the pointer to member type has a name, the pointer to
2012 member entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
2013 \addtoindexx{name attribute}
2015 null\dash terminated string containing the type name as it appears
2016 in the source program.
2018 The pointer to member entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to
2019 describe the type of the class or structure member to which
2020 objects of this type may point.
2022 The pointer to member entry also
2023 \hypertarget{chap:DWATcontainingtypecontainingtypeofpointertomembertype}
2025 \livelink{chap:DWATcontainingtype}{DW\-\_AT\-\_containing\-\_type}
2026 attribute, whose value is a reference to a debugging
2027 information entry for the class or structure to whose members
2028 objects of this type may point.
2031 \hypertarget{chap:DWATuselocationmemberlocationforpointertomembertype}
2032 pointer to member entry has a
2033 \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} attribute
2035 \addtoindex{location description} that computes the
2036 address of the member of the class to which the pointer to
2037 member entry points.
2039 \textit{The method used to find the address of a given member of a
2040 class or structure is common to any instance of that class
2041 or structure and to any instance of the pointer or member
2042 type. The method is thus associated with the type entry,
2043 rather than with each instance of the type.}
2045 The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is used in conjunction
2046 with the location descriptions for a particular object of the
2047 given pointer to member type and for a particular structure or
2048 class instance. The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location}
2049 attribute expects two values to be
2050 \addtoindexi{pushed}{address!implicit push for member operator}
2051 onto the DWARF expression stack before
2052 the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is evaluated.
2054 \addtoindexi{pushed}{address!implicit push for member operator}
2055 is the value of the pointer to member object
2056 itself. The second value
2057 \addtoindexi{pushed}{address!implicit push for member operator}
2058 is the base address of the
2059 entire structure or union instance containing the member
2060 whose address is being calculated.
2062 \textit{For an expression such as}
2067 % FIXME: object and mbr\_ptr should be distinguished from italic. See DW4.
2068 \textit{where mbr\_ptr has some pointer to member type, a debugger should:}
2070 \textit{1. Push the value of mbr\_ptr onto the DWARF expression stack.}
2072 \textit{2. Push the base address of object onto the DWARF expression stack.}
2074 \textit{3. Evaluate the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description
2075 given in the type of mbr\_ptr.}
2077 \section{File Type Entries}
2078 \label{chap:filetypeentries}
2080 \textit{Some languages, such as Pascal, provide a data type to represent
2083 A file type is represented by a debugging information entry
2085 \addtoindexx{file type entry}
2087 \livetarg{chap:DWTAGfiletype}{DW\-\_TAG\-\_file\-\_type}.
2088 If the file type has a name,
2089 the file type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
2090 \addtoindexx{name attribute}
2092 is a null\dash terminated string containing the type name as it
2093 appears in the source program.
2095 The file type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
2096 the type of the objects contained in the file.
2098 The file type entry also
2099 \addtoindexx{byte size}
2101 \addtoindexx{bit size}
2103 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or
2104 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
2105 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
2106 is the amount of storage need to hold a value of the file type.
2108 \section{Dynamic Type Properties}
2109 \label{chap:dynamictypeproperties}
2110 \subsection{Data Location}
2111 \label{chap:datalocation}
2113 \textit{Some languages may represent objects using descriptors to hold
2114 information, including a location and/or run\dash time parameters,
2115 about the data that represents the value for that object.}
2117 \hypertarget{chap:DWATdatalocationindirectiontoactualdata}
2118 The \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
2119 attribute may be used with any
2120 \addtoindexx{data location attribute}
2121 type that provides one or more levels of
2122 \addtoindexx{hidden indirection|see{data location attribute}}
2124 and/or run\dash time parameters in its representation. Its value
2125 is a \addtoindex{location description}.
2126 The result of evaluating this
2127 description yields the location of the data for an object.
2128 When this attribute is omitted, the address of the data is
2129 the same as the address of the object.
2131 \textit{This location description will typically begin with
2132 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address}
2133 which loads the address of the
2134 object which can then serve as a descriptor in subsequent
2135 calculation. For an example using
2136 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
2137 for a \addtoindex{Fortran 90 array}, see
2138 Appendix \refersec{app:fortran90example}.}
2140 \subsection{Allocation and Association Status}
2141 \label{chap:allocationandassociationstatus}
2143 \textit{Some languages, such as \addtoindex{Fortran 90},
2144 provide types whose values
2145 may be dynamically allocated or associated with a variable
2146 under explicit program control.}
2148 \hypertarget{chap:DWATallocatedallocationstatusoftypes}
2150 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated}
2152 \addtoindexx{allocated attribute}
2153 may optionally be used with any
2154 type for which objects of the type can be explicitly allocated
2155 and deallocated. The presence of the attribute indicates that
2156 objects of the type are allocatable and deallocatable. The
2157 integer value of the attribute (see below) specifies whether
2158 an object of the type is
2159 currently allocated or not.
2161 \hypertarget{chap:DWATassociatedassociationstatusoftypes}
2163 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute
2165 \addtoindexx{associated attribute}
2166 optionally be used with
2167 any type for which objects of the type can be dynamically
2168 associated with other objects. The presence of the attribute
2169 indicates that objects of the type can be associated. The
2170 integer value of the attribute (see below) indicates whether
2171 an object of the type is currently associated or not.
2173 While these attributes are defined specifically with
2174 \addtoindex{Fortran 90} ALLOCATABLE and POINTER types
2175 in mind, usage is not limited
2176 to just that language.
2178 The value of these attributes is determined as described in
2179 Section \refersec{chap:staticanddynamicvaluesofattributes}.
2181 A non\dash zero value is interpreted as allocated or associated,
2182 and zero is interpreted as not allocated or not associated.
2184 \textit{For \addtoindex{Fortran 90},
2185 if the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated}
2186 attribute is present,
2187 the type has the POINTER property where either the parent
2188 variable is never associated with a dynamic object or the
2189 implementation does not track whether the associated object
2190 is static or dynamic. If the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute is
2191 present and the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute is not, the type
2192 has the ALLOCATABLE property. If both attributes are present,
2193 then the type should be assumed to have the POINTER property
2194 (and not ALLOCATABLE); the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute may then
2195 be used to indicate that the association status of the object
2196 resulted from execution of an ALLOCATE statement rather than
2197 pointer assignment.}
2199 \textit{For examples using
2200 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} for \addtoindex{Ada} and
2201 \addtoindex{Fortran 90}
2203 see Appendix \refersec{app:aggregateexamples}.}
2207 \section{Template Alias Entries}
2208 \label{chap:templatealiasentries}
2210 A type named using a template alias is represented
2211 by a debugging information entry with the tag
2212 \livetarg{chap:DWTAGtemplatealias}{DW\-\_TAG\-\_template\-\_alias}.
2213 The template alias entry has a
2214 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
2215 \addtoindexx{name attribute}
2216 whose value is a null\dash terminated string
2217 containing the name of the template alias as it appears in
2218 the source program. The template alias entry also contains a
2219 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is a reference to the type
2220 named by the template alias. The template alias entry has
2221 the following child entries:
2223 \begin{enumerate}[1.]
2224 \item Each formal parameterized type declaration appearing
2225 in the template alias declaration is represented
2226 by a debugging information entry with the tag
2227 \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}.
2228 Each such entry may have
2229 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
2230 \addtoindexx{name attribute}
2231 whose value is a null\dash terminated
2232 string containing the name of the formal type parameter as it
2233 appears in the source program. The template type parameter
2234 entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing the actual
2235 type by which the formal is replaced for this instantiation.
2237 \item Each formal parameterized value declaration
2238 appearing in the template alias declaration is
2239 represented by a debugging information entry with the tag
2240 \livelink{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}.
2241 Each such entry may have
2242 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute,
2243 \addtoindexx{name attribute}
2244 whose value is a null\dash terminated
2245 string containing the name of the formal value parameter
2246 as it appears in the source program. The template value
2247 parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
2248 the type of the parameterized value. Finally, the template
2249 value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value}
2250 attribute, whose value is the actual constant value of the value parameter for
2251 this instantiation as represented on the target architecture.