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 whose value is
30 a null\dash terminated string containing the name of the base type
31 as recognized by the programming language of the compilation
32 unit containing the base type entry.
35 \addtoindexx{encoding attribute}
36 a \livelink{chap:DWATencoding}{DW\-\_AT\-\_encoding} attribute describing
37 how the base type is encoded and is to be interpreted. The
38 value of this attribute is an integer constant. The set of
39 values and their meanings for the \livelink{chap:DWATencoding}{DW\-\_AT\-\_encoding} attribute
41 Figure \refersec{fig:encodingattributevalues}
45 may have a \livelink{chap:DWATendianity}{DW\-\_AT\-\_endianity} attribute
46 \addtoindexx{endianity attribute}
48 Section \refersec{chap:dataobjectentries}.
49 If omitted, the encoding assumes the representation that
50 is the default for the target architecture.
53 \hypertarget{chap:DWATbytesizedataobjectordatatypesize}
54 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute
55 \hypertarget{chap:DWATbitsizebasetypebitsize}
56 or a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
57 \addtoindex{bit size attribute}
58 whose integer constant value
59 (see Section \refersec{chap:byteandbitsizes})
60 is the amount of storage needed to hold
63 \textit{For example, the
64 \addtoindex{C} type int on a machine that uses 32\dash bit
65 integers is represented by a base type entry with a name
66 attribute whose value is “int”, an encoding attribute
67 whose value is \livelink{chap:DWATEsigned}{DW\-\_ATE\-\_signed}
68 and a byte size attribute whose value is 4.}
70 If the value of an object of the given type does not fully
71 occupy the storage described by a byte size attribute,
72 \hypertarget{chap:DWATdatabitoffsetbasetypebitlocation}
73 the base type entry may also have
74 \addtoindexx{bit size attribute}
76 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and a
77 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} attribute,
79 \addtoindexx{data bit offset attribute}
81 integer constant values (
82 see Section \refersec{chap:staticanddynamicvaluesofattributes}).
84 attribute describes the actual size in bits used to represent
85 values of the given type. The data bit offset attribute is the
86 offset in bits from the beginning of the containing storage to
87 the beginning of the value. Bits that are part of the offset
88 are padding. The data bit offset uses the bit numbering and
89 direction conventions that are appropriate to the current
91 target system to locate the beginning of the storage and
92 value. If this attribute is omitted a default data bit offset
96 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
98 \addtoindexx{bit offset attribute}
100 \addtoindexx{data bit offset attribute}
102 \addtoindex{DWARF Version 4} and
103 is also used for bit field members
104 (see Section \refersec{chap:datamemberentries}).
106 \hypertarget{chap:DWATbitoffsetbasetypebitlocation}
107 replaces the attribute
108 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
110 \addtoindexx{bit offset attribute (V3)}
111 types as defined in DWARF V3 and earlier. The earlier attribute
112 is defined in a manner suitable for bit field members on
113 big\dash endian architectures but which is wasteful for use on
114 little\dash endian architectures.}
116 \textit{The attribute \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} is
118 \addtoindex{DWARF Version 4}
119 for use in base types, but implementations may continue to
120 support its use for compatibility.}
123 \addtoindex{DWARF Version 3}
124 definition of these attributes is as follows.}
126 \begin{myindentpara}{1cm}
127 \textit{A base type entry has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
128 attribute, whose value
129 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
130 is the size in bytes of the storage unit
131 used to represent an object of the given type.}
133 \textit{If the value of an object of the given type does not fully
134 occupy the storage unit described by the byte size attribute,
135 the base type entry may have a
136 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
137 \addtoindexx{bit size attribute (V3)}
139 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} attribute, both of whose values
140 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
141 are integers. The bit size attribute describes the actual
142 size in bits used to represent a value of the given type.
143 The bit offset attribute describes the offset in bits of the
144 high order bit of a value of the given type from the high
145 order bit of the storage unit used to contain that value.}
150 \addtoindexx{DWARF Version 3}
152 \addtoindexx{DWARF Version 4} and
153 4, note that DWARF V4
154 defines the following combinations of attributes:}
157 \item \textit{DW\-\_AT\-\_byte\-\_size}
158 \item \textit{DW\-\_AT\-\_bit\-\_size}
159 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
160 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
161 and optionally \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}}
164 \addtoindexx{DWARF Version 3}
165 defines the following combinations:
166 % FIXME: the figure below interferes with the following
167 % bullet list, which looks horrible as a result.
169 \item \textit{DW\-\_AT\-\_byte\-\_size}
170 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
171 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
172 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}}
175 \begin{figure}[!here]
177 \begin{tabular}{lp{9cm}}
178 Name&Meaning\\ \hline
179 \livetarg{chap:DWATEaddress}{DW\-\_ATE\-\_address} & linear machine address (for
180 segmented addresses see
181 Section \refersec{chap:segmentedaddresses}) \\
182 \livetarg{chap:DWATEboolean}{DW\-\_ATE\-\_boolean}& true or false \\
184 \livetarg{chap:DWATEcomplexfloat}{DW\-\_ATE\-\_complex\-\_float}& complex binary
185 floating\dash point number \\
186 \livetarg{chap:DWATEfloat}{DW\-\_ATE\-\_float} & binary floating\dash point number \\
187 \livetarg{chap:DWATEimaginaryfloat}{DW\-\_ATE\-\_imaginary\-\_float}& imaginary binary
188 floating\dash point number \\
189 \livetarg{chap:DWATEsigned}{DW\-\_ATE\-\_signed}& signed binary integer \\
190 \livetarg{chap:DWATEsignedchar}{DW\-\_ATE\-\_signed\-\_char}& signed character \\
191 \livetarg{chap:DWATEunsigned}{DW\-\_ATE\-\_unsigned} & unsigned binary integer \\
192 \livetarg{chap:DWATEunsignedchar}{DW\-\_ATE\-\_unsigned\-\_char} & unsigned character \\
193 \livetarg{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} & packed decimal \\
194 \livetarg{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string}& numeric string \\
195 \livetarg{chap:DWATEedited}{DW\-\_ATE\-\_edited} & edited string \\
196 \livetarg{chap:DWATEsignedfixed}{DW\-\_ATE\-\_signed\-\_fixed} & signed fixed\dash point scaled integer \\
197 \livetarg{chap:DWATEunsignedfixed}{DW\-\_ATE\-\_unsigned\-\_fixed}& unsigned fixed\dash point scaled integer \\
198 \livetarg{chap:DWATEdecimalfloat}{DW\-\_ATE\-\_decimal\-\_float} & decimal floating\dash point number \\
199 \livetarg{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} & Unicode character \\
201 \caption{Encoding attribute values}
202 \label{fig:encodingattributevalues}
205 \textit{The \livelink{chap:DWATEdecimalfloat}{DW\-\_ATE\-\_decimal\-\_float} encoding is intended for
206 floating\dash point representations that have a power\dash of\dash ten
207 exponent, such as that specified in IEEE 754R.}
209 \textit{The \livelink{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} encoding is intended for Unicode string
210 encodings (see the Universal Character Set standard,
211 ISO/IEC 10646\dash 1:1993). For example, the
212 \addtoindex{C++} type char16\_t is
213 represented by a base type entry with a name attribute whose
214 value is “char16\_t”, an encoding attribute whose value
215 is \livelink{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} and a byte size attribute whose value is 2.}
218 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal}
220 \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string}
222 represent packed and unpacked decimal string numeric data
223 types, respectively, either of which may be
225 \addtoindexx{decimal scale attribute}
227 \addtoindexx{decimal sign attribute}
229 \addtoindexx{digit count attribute}
231 \hypertarget{chap:DWATdecimalsigndecimalsignrepresentation}
233 \hypertarget{chap:DWATdigitcountdigitcountforpackeddecimalornumericstringtype}
234 base types are used in combination with
235 \livelink{chap:DWATdecimalsign}{DW\-\_AT\-\_decimal\-\_sign},
236 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and
237 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale}
240 A \livelink{chap:DWATdecimalsign}{DW\-\_AT\-\_decimal\-\_sign} attribute
241 \addtoindexx{decimal sign attribute}
242 is an integer constant that
243 conveys the representation of the sign of the decimal type
244 (see Figure \refersec{fig:decimalsignattributevalues}).
245 Its integer constant value is interpreted to
246 mean that the type has a leading overpunch, trailing overpunch,
247 leading separate or trailing separate sign representation or,
248 alternatively, no sign at all.
251 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count}
253 \addtoindexx{digit count attribute}
254 is an integer constant
255 value that represents the number of digits in an instance of
258 \hypertarget{chap:DWATdecimalscaledecimalscalefactor}
259 The \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale}
261 \addtoindexx{decimal scale attribute}
262 is an integer constant value
263 that represents the exponent of the base ten scale factor to
264 be applied to an instance of the type. A scale of zero puts the
265 decimal point immediately to the right of the least significant
266 digit. Positive scale moves the decimal point to the right
267 and implies that additional zero digits on the right are not
268 stored in an instance of the type. Negative scale moves the
269 decimal point to the left; if the absolute value of the scale
270 is larger than the digit count, this implies additional zero
271 digits on the left are not stored in an instance of the type.
273 The \livelink{chap:DWATEedited}{DW\-\_ATE\-\_edited}
275 \hypertarget{chap:DWATpicturestringpicturestringfornumericstringtype}
276 type is used to represent an edited
277 numeric or alphanumeric data type. It is used in combination
278 with an \livelink{chap:DWATpicturestring}{DW\-\_AT\-\_picture\-\_string} attribute whose value is a
279 null\dash terminated string containing the target\dash dependent picture
280 string associated with the type.
282 If the edited base type entry describes an edited numeric
283 data type, the edited type entry has a \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and a
284 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attribute.
285 \addtoindexx{decimal scale attribute}
286 These attributes have the same
287 interpretation as described for the
288 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} and
289 \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base
290 types. If the edited type entry
291 describes an edited alphanumeric data type, the edited type
292 entry does not have these attributes.
295 \textit{The presence or absence of the \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and
296 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attributes
297 \addtoindexx{decimal scale attribute}
298 allows a debugger to easily
299 distinguish edited numeric from edited alphanumeric, although
300 in principle the digit count and scale are derivable by
301 interpreting the picture string.}
303 The \livelink{chap:DWATEsignedfixed}{DW\-\_ATE\-\_signed\-\_fixed} and \livelink{chap:DWATEunsignedfixed}{DW\-\_ATE\-\_unsigned\-\_fixed} entries
304 describe signed and unsigned fixed\dash point binary data types,
307 The fixed binary type entries have
308 \addtoindexx{digit count attribute}
310 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count}
311 attribute with the same interpretation as described for the
312 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} and \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base types.
314 For a data type with a decimal scale factor, the fixed binary
316 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attribute
317 \addtoindexx{decimal scale attribute}
319 interpretation as described for the
320 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal}
321 and \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base types.
323 \hypertarget{chap:DWATbinaryscalebinaryscalefactorforfixedpointtype}
324 For a data type with a binary scale factor, the fixed
325 \addtoindexx{binary scale attribute}
326 binary type entry has a
327 \livelink{chap:DWATbinaryscale}{DW\-\_AT\-\_binary\-\_scale} attribute.
329 \livelink{chap:DWATbinaryscale}{DW\-\_AT\-\_binary\-\_scale} attribute
330 is an integer constant value
331 that represents the exponent of the base two scale factor to
332 be applied to an instance of the type. Zero scale puts the
333 binary point immediately to the right of the least significant
334 bit. Positive scale moves the binary point to the right and
335 implies that additional zero bits on the right are not stored
336 in an instance of the type. Negative scale moves the binary
337 point to the left; if the absolute value of the scale is
338 larger than the number of bits, this implies additional zero
339 bits on the left are not stored in an instance of the type.
342 \hypertarget{chap:DWATsmallscalefactorforfixedpointtype}
343 a data type with a non\dash decimal and non\dash binary scale factor,
344 the fixed binary type entry has a
345 \livelink{chap:DWATsmall}{DW\-\_AT\-\_small} attribute which
347 \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} entry. The scale factor value
348 is interpreted in accordance with the value defined by the
349 \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} entry. The value represented is the product
350 of the integer value in memory and the associated constant
353 \textit{The \livelink{chap:DWATsmall}{DW\-\_AT\-\_small} attribute
354 is defined with the \addtoindex{Ada} small
359 \begin{tabular}{lp{9cm}}
360 Name&Meaning\\ \hline
361 \livetarg{chap:DWDSunsigned}{DW\-\_DS\-\_unsigned} & unsigned \\
362 \livetarg{chap:DWDSleadingoverpunch}{DW\-\_DS\-\_leading\-\_overpunch} & Sign
363 is encoded in the most significant digit in a target\dash dependent manner \\
364 \livetarg{chap:DWDStrailingoverpunch}{DW\-\_DS\-\_trailing\-\_overpunch} & Sign
365 is encoded in the least significant digit in a target\dash dependent manner \\
366 \livetarg{chap:DWDSleadingseparate}{DW\-\_DS\-\_leading\-\_separate}
367 & Decimal type: Sign is a ``+'' or ``-'' character
368 to the left of the most significant digit. \\
369 \livetarg{chap:DWDStrailingseparate}{DW\-\_DS\-\_trailing\-\_separate}
370 & Decimal type: Sign is a ``+'' or ``-'' character
371 to the right of the least significant digit. \\
372 &Packed decimal type: Least significant nibble contains
373 a target\dash dependent value
374 indicating positive or negative. \\
376 \caption{Decimal sign attribute values}
377 \label{fig:decimalsignattributevalues}
380 \section{Unspecified Type Entries}
381 \label{chap:unspecifiedtypeentries}
382 \addtoindexx{unspecified type entry}
383 \addtoindexx{void type|see{unspecified type entry}}
384 Some languages have constructs in which a type
385 may be left unspecified or the absence of a type
386 may be explicitly indicated.
388 An unspecified (implicit, unknown, ambiguous or nonexistent)
389 type is represented by a debugging information entry with
390 the tag \livetarg{chap:DWTAGunspecifiedtype}{DW\-\_TAG\-\_unspecified\-\_type}.
391 If a name has been given
392 to the type, then the corresponding unspecified type entry
393 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is
394 a null\dash terminated
395 string containing the name as it appears in the source program.
397 The interpretation of this debugging information entry is
398 intentionally left flexible to allow it to be interpreted
399 appropriately in different languages. For example, in
400 \addtoindex{C} and \addtoindex{C++}
401 the language implementation can provide an unspecified type
402 entry with the name “void” which can be referenced by the
403 type attribute of pointer types and typedef declarations for
405 % FIXME: the following reference was wrong in DW4 so DavidA guessed
407 Sections \refersec{chap:unspecifiedtypeentries} and
408 %The following reference was valid, so the following is probably correct.
409 Section \refersec{chap:typedefentries},
410 respectively). As another
411 example, in \addtoindex{Ada} such an unspecified type entry can be referred
412 to by the type attribute of an access type where the denoted
413 \addtoindexx{incomplete type (Ada)}
414 type is incomplete (the name is declared as a type but the
415 definition is deferred to a separate compilation unit).
417 \section{Type Modifier Entries}
418 \label{chap:typemodifierentries}
419 \addtoindexx{type modifier entry}
421 A base or user\dash defined type may be modified in different ways
422 in different languages. A type modifier is represented in
423 DWARF by a debugging information entry with one of the tags
425 Figure \refersec{fig:typemodifiertags}.
427 If a name has been given to the modified type in the source
428 program, then the corresponding modified type entry has
429 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null-terminated
430 string containing the modified type name as it appears in
433 Each of the type modifier entries has a
434 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute,
435 whose value is a reference to a debugging information entry
436 describing a base type, a user-defined type or another type
439 A modified type entry describing a pointer or reference
440 type (using \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type},
441 \livelink{chap:DWTAGreferencetype}{DW\-\_TAG\-\_reference\-\_type} or
442 \livelink{chap:DWTAGrvaluereferencetype}{DW\-\_TAG\-\_rvalue\-\_reference\-\_type})
443 % Another instance of no-good-place-to-put-index entry.
445 \addtoindexx{address class!attribute}
447 \hypertarget{chap:DWATadressclasspointerorreferencetypes}
449 \livelink{chap:DWATaddressclass}{DW\-\_AT\-\_address\-\_class}
450 attribute to describe how objects having the given pointer
451 or reference type ought to be dereferenced.
453 A modified type entry describing a shared qualified type
454 (using \livelink{chap:DWTAGsharedtype}{DW\-\_TAG\-\_shared\-\_type}) may have a
455 \livelink{chap:DWATcount}{DW\-\_AT\-\_count} attribute
456 \addtoindexx{count attribute}
457 whose value is a constant expressing the blocksize of the
458 type. If no count attribute is present, then the “infinite”
459 blocksize is assumed.
461 When multiple type modifiers are chained together to modify
462 a base or user-defined type, the tree ordering reflects the
463 semantics of the applicable lanuage rather than the textual
464 order in the source presentation.
468 \begin{tabular}{lp{9cm}}
469 Name&Meaning\\ \hline
470 \livetarg{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} & C or C++ const qualified type
471 \addtoindexx{const qualified type entry} \addtoindexx{C} \addtoindexx{C++} \\
472 \livetarg{chap:DWTAGpackedtype}{DW\-\_TAG\-\_packed\-\_type}& Pascal or Ada packed type
473 \addtoindexx{packed qualified type entry} \addtoindexx{Ada} \addtoindexx{Pascal} \\
474 \livetarg{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} & Pointer to an object of
475 the type being modified \addtoindexx{pointer qualified type entry} \\
476 \livetarg{chap:DWTAGreferencetype}{DW\-\_TAG\-\_reference\-\_type}& C++ (lvalue) reference
477 to an object of the type
478 being modified \addtoindexx{reference qualified type entry} \\
479 \livetarg{chap:DWTAGrestricttype}{DW\-\_TAG\-\_restrict\-\_type}&C restrict qualified type
480 \addtoindexx{restricted qualified type entry} \\
481 \livetarg{chap:DWTAGrvaluereferencetype}{DW\-\_TAG\-\_rvalue\-\_reference\-\_type} & C++
482 rvalue reference to an object of the type being modified
483 \addtoindexx{rvalue reference qualified type entry} \\
484 \livetarg{chap:DWTAGsharedtype}{DW\-\_TAG\-\_shared\-\_type}&UPC shared qualified type
485 \addtoindexx{shared qualified type entry} \\
486 \livetarg{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type}&C or C++ volatile qualified type
487 \addtoindex{volatile qualified type entry} \\
489 \caption{Type modifier tags}
490 \label{fig:typemodifiertags}
493 %The following clearpage prevents splitting the example across pages.
495 \textit{As examples of how type modifiers are ordered, take the following C
499 const unsigned char * volatile p;
500 which represents a volatile pointer to a constant
501 character. This is encoded in DWARF as:
502 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}(p) -->
503 \livelink{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type} -->
504 \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} -->
505 \livelink{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} -->
506 \livelink{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}(unsigned char)
508 volatile unsigned char * const restrict p;
509 on the other hand, represents a restricted constant
510 pointer to a volatile character. This is encoded as:
511 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}(p) -->
512 \livelink{chap:DWTAGrestricttype}{DW\-\_TAG\-\_restrict\-\_type} -->
513 \livelink{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} -->
514 \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} -->
515 \livelink{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type} -->
516 \livelink{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}(unsigned char)
520 \section{Typedef Entries}
521 \label{chap:typedefentries}
522 A named type that is defined in terms of another type
523 definition is represented by a debugging information entry with
524 the tag \livetarg{chap:DWTAGtypedef}{DW\-\_TAG\-\_typedef}.
525 The typedef entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
526 attribute whose value is a null-terminated string containing
527 the name of the typedef as it appears in the source program.
529 The typedef entry may also contain a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose
530 value is a reference to the type named by the typedef. If
531 the debugging information entry for a typedef represents
532 a declaration of the type that is not also a definition,
533 it does not contain a type attribute.
535 \textit{Depending on the language, a named type that is defined in
536 terms of another type may be called a type alias, a subtype,
537 a constrained type and other terms. A type name declared with
538 no defining details may be termed an
539 \addtoindexx{incomplete type}
540 incomplete, forward or hidden type.
541 While the DWARF \livelink{chap:DWTAGtypedef}{DW\-\_TAG\-\_typedef} entry was
542 originally inspired by the like named construct in
543 \addtoindex{C} and \addtoindex{C++},
544 it is broadly suitable for similar constructs (by whatever
545 source syntax) in other languages.}
547 \section{Array Type Entries}
548 \label{chap:arraytypeentries}
550 Many languages share the concept of an ``array,'' which is
551 \addtoindexx{array type entry}
552 a table of components of identical type.
554 An array type is represented by a debugging information entry
555 with the tag \livetarg{chap:DWTAGarraytype}{DW\-\_TAG\-\_array\-\_type}.
558 \addtoindexx{array!declaration of type}
559 the array type in the source program, then the corresponding
560 array type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a
561 null-terminated string containing the array type name as it
562 appears in the source program.
565 \hypertarget{chap:DWATorderingarrayrowcolumnordering}
566 array type entry describing a multidimensional array may
567 \addtoindexx{array!element ordering}
568 have a \livelink{chap:DWATordering}{DW\-\_AT\-\_ordering} attribute whose integer constant value is
569 interpreted to mean either row-major or column-major ordering
570 of array elements. The set of values and their meanings
571 for the ordering attribute are listed in
572 Figure \refersec{fig:arrayordering}.
574 ordering attribute is present, the default ordering for the
575 source language (which is indicated by the
576 \livelink{chap:DWATlanguage}{DW\-\_AT\-\_language}
578 \addtoindexx{language attribute}
579 of the enclosing compilation unit entry) is assumed.
582 \autorows[0pt]{c}{1}{l}{
583 \livetarg{chap:DWORDcolmajor}{DW\-\_ORD\-\_col\-\_major},
584 \livetarg{chap:DWORDrowmajor}{DW\-\_ORD\-\_row\-\_major}
586 \caption{Array ordering}\label{fig:arrayordering}
589 The ordering attribute may optionally appear on one-dimensional
590 arrays; it will be ignored.
592 An array type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
593 \addtoindexx{array!element type}
595 the type of each element of the array.
597 If the amount of storage allocated to hold each element of an
598 object of the given array type is different from the amount
599 of storage that is normally allocated to hold an individual
600 \hypertarget{chap:DWATbitstridearrayelementstrideofarraytype}
602 \hypertarget{chap:DWATbytestridearrayelementstrideofarraytype}
603 indicated element type, then the array type
604 \addtoindexx{bit stride attribute}
606 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
608 \addtoindexx{byte stride attribute}
609 a \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride}
611 \addtoindexx{bit stride attribute}
613 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
615 element of the array.
617 The array type entry may have either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a
618 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
619 (see Section \refersec{chap:byteandbitsizes}),
621 amount of storage needed to hold an instance of the array type.
623 \textit{If the size of the array can be determined statically at
624 compile time, this value can usually be computed by multiplying
625 the number of array elements by the size of each element.}
628 Each array dimension is described by a debugging information
629 entry with either the tag \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} or the
630 \addtoindexx{enumeration type entry!as array dimension}
632 \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}. These entries are
634 array type entry and are ordered to reflect the appearance of
635 the dimensions in the source program (i.e., leftmost dimension
636 first, next to leftmost second, and so on).
638 In languages, such as C, in which there is no concept of
639 a “multidimensional array”, an array of arrays may
640 be represented by a debugging information entry for a
641 multidimensional array.
643 Other attributes especially applicable to arrays are
644 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated},
645 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} and
646 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location},
647 which are described in
648 Section \refersec{chap:dynamictypeproperties}.
649 For relevant examples,
651 Appendix \refersec{app:fortran90example}.
653 \section{ Structure, Union, Class and Interface Type Entries}
654 \label{chap:structureunionclassandinterfacetypeentries}
656 \textit{The languages
658 \addtoindex{C++}, and
659 \addtoindex{Pascal}, among others, allow the
660 programmer to define types that are collections of related
661 components. In \addtoindex{C} and \addtoindex{C++}, these collections are called
662 “structures.” In \addtoindex{Pascal}, they are called “records.”
663 The components may be of different types. The components are
664 called “members” in \addtoindex{C} and
665 \addtoindex{C++}, and “fields” in \addtoindex{Pascal}.}
667 \textit{The components of these collections each exist in their
668 own space in computer memory. The components of a C or C++
669 “union” all coexist in the same memory.}
671 \textit{\addtoindex{Pascal} and
672 other languages have a “discriminated union,”
673 \addtoindex{discriminated union|see {variant entry}}
674 also called a “variant record.” Here, selection of a
675 number of alternative substructures (“variants”) is based
676 on the value of a component that is not part of any of those
677 substructures (the “discriminant”).}
679 \textit{\addtoindex{C++} and
680 \addtoindex{Java} have the notion of ``class'', which is in some
681 ways similar to a structure. A class may have “member
682 functions” which are subroutines that are within the scope
683 of a class or structure.}
685 \textit{The \addtoindex{C++} notion of
686 structure is more general than in \addtoindex{C}, being
687 equivalent to a class with minor differences. Accordingly,
688 in the following discussion statements about
689 \addtoindex{C++} classes may
690 be understood to apply to \addtoindex{C++} structures as well.}
692 \subsection{Structure, Union and Class Type Entries}
693 \label{chap:structureunionandclasstypeentries}
696 Structure, union, and class types are represented by debugging
697 information entries with
698 the tags \livetarg{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type},
699 \livetarg{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type},
700 and \livetarg{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
701 respectively. If a name has been given to the structure,
702 union, or class in the source program, then the corresponding
703 structure type, union type, or class type entry has a
704 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
705 containing the type name as it appears in the source program.
707 The members of a structure, union, or class are represented
708 by debugging information entries that are owned by the
709 corresponding structure type, union type, or class type entry
710 and appear in the same order as the corresponding declarations
711 in the source program.
713 A structure type, union type or class type entry may have
714 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a
715 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
716 \hypertarget{chap:DWATbitsizedatamemberbitsize}
717 (see Section \refersec{chap:byteandbitsizes}),
718 whose value is the amount of storage needed
719 to hold an instance of the structure, union or class type,
720 including any padding.
721 An incomplete structure, union or class type
722 \addtoindexx{incomplete structure/union/class}
724 \addtoindexx{incomplete type}
725 represented by a structure, union or class
726 entry that does not have a byte size attribute and that has
727 \addtoindexx{declaration attribute}
728 a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
730 If the complete declaration of a type has been placed in
731 \hypertarget{chap:DWATsignaturetypesignature}
733 (see Section \refersec{chap:separatetypeunitentries}),
734 an incomplete declaration
735 \addtoindexx{incomplete type}
736 of that type in the compilation unit may provide
737 the unique 64\dash bit signature of the type using a \livelink{chap:DWATsignature}{DW\-\_AT\-\_signature}
740 If a structure, union or class entry represents the definition
741 of a structure, class or union member corresponding to a prior
742 incomplete structure, class or union, the entry may have a
743 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute whose value is a reference to
744 the debugging information entry representing that incomplete
747 Structure, union and class entries containing the
748 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute do not need to duplicate
749 information provided by the declaration entry referenced by the
750 specification attribute. In particular, such entries do not
751 need to contain an attribute for the name of the structure,
752 class or union they represent if such information is already
753 provided in the declaration.
755 \textit{For \addtoindex{C} and \addtoindex{C++},
757 \addtoindexx{data member|see {member entry (data)}}
758 member declarations occurring within
759 the declaration of a structure, union or class type are
760 considered to be “definitions” of those members, with
761 the exception of “static” data members, whose definitions
762 appear outside of the declaration of the enclosing structure,
763 union or class type. Function member declarations appearing
764 within a structure, union or class type declaration are
765 definitions only if the body of the function also appears
766 within the type declaration.}
768 If the definition for a given member of the structure, union
769 or class does not appear within the body of the declaration,
770 that member also has a debugging information entry describing
771 its definition. That latter entry has a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
772 attribute referencing the debugging information entry
773 owned by the body of the structure, union or class entry and
774 representing a non\dash defining declaration of the data, function
775 or type member. The referenced entry will not have information
776 about the location of that member (low and high pc attributes
777 for function members, location descriptions for data members)
778 and will have a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
780 \textit{Consider a nested class whose
781 definition occurs outside of the containing class definition, as in:}
790 \textit{The two different structs can be described in
791 different compilation units to
792 facilitate DWARF space compression
793 (see Appendix \refersec{app:usingcompilationunits}).}
795 \subsection{Interface Type Entries}
796 \label{chap:interfacetypeentries}
798 \textit{The \addtoindex{Java} language defines ``interface'' types.
800 in \addtoindex{Java} is similar to a \addtoindex{C++} or
801 \addtoindex{Java} class with only abstract
802 methods and constant data members.}
805 \addtoindexx{interface type entry}
806 are represented by debugging information
808 tag \livetarg{chap:DWTAGinterfacetype}{DW\-\_TAG\-\_interface\-\_type}.
810 An interface type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
811 value is a null-terminated string containing the type name
812 as it appears in the source program.
814 The members of an interface are represented by debugging
815 information entries that are owned by the interface type
816 entry and that appear in the same order as the corresponding
817 declarations in the source program.
819 \subsection{Derived or Extended Structs, Classes and Interfaces}
820 \label{chap:derivedorextendedstructsclasesandinterfaces}
822 \textit{In \addtoindex{C++}, a class (or struct)
824 \addtoindexx{derived type (C++)|see{inheritance entry}}
825 be ``derived from'' or be a
826 ``subclass of'' another class.
827 In \addtoindex{Java}, an interface may ``extend''
828 \addtoindexx{extended type (Java)|see{inheritance entry}}
830 \addtoindexx{implementing type (Java)|see{inheritance entry}}
831 or more other interfaces, and a class may ``extend'' another
832 class and/or ``implement'' one or more interfaces. All of these
833 relationships may be described using the following. Note that
834 in \addtoindex{Java},
835 the distinction between extends and implements is
836 implied by the entities at the two ends of the relationship.}
838 A class type or interface type entry that describes a
839 derived, extended or implementing class or interface owns
840 addtoindexx{implementing type (Java)|see{inheritance entry}}
841 debugging information entries describing each of the classes
842 or interfaces it is derived from, extending or implementing,
843 respectively, ordered as they were in the source program. Each
845 \addtoindexx{inheritance entry}
847 tag \livetarg{chap:DWTAGinheritance}{DW\-\_TAG\-\_inheritance}.
849 An inheritance entry has
850 \addtoindexx{inheritance entry}
852 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is
853 a reference to the debugging information entry describing the
854 class or interface from which the parent class or structure
855 of the inheritance entry is derived, extended or implementing.
858 \addtoindexx{inheritance entry}
859 for a class that derives from or extends
860 \hypertarget{chap:DWATdatamemberlocationinheritedmemberlocation}
861 another class or struct also has
862 \addtoindexx{data member location attribute}
864 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
865 attribute, whose value describes the location of the beginning
866 of the inherited type relative to the beginning address of the
867 derived class. If that value is a constant, it is the offset
868 in bytes from the beginning of the class to the beginning of
869 the inherited type. Otherwise, the value must be a location
870 description. In this latter case, the beginning address of
871 the derived class is pushed on the expression stack before
872 the \addtoindex{location description}
873 is evaluated and the result of the
874 evaluation is the location of the inherited type.
876 \textit{The interpretation of the value of this attribute for
877 inherited types is the same as the interpretation for data
879 (see Section \refersec{chap:datamemberentries}). }
882 \addtoindexx{inheritance entry}
884 \hypertarget{chap:DWATaccessibilitycppinheritedmembers}
886 \addtoindexx{accessibility attribute}
888 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
890 If no accessibility attribute
891 is present, private access is assumed for an entry of a class
892 and public access is assumed for an entry of an interface,
896 \hypertarget{chap:DWATvirtualityvirtualityofbaseclass}
897 the class referenced by the
898 \addtoindexx{inheritance entry}
899 inheritance entry serves
900 as a \addtoindex{C++} virtual base class, the inheritance entry has a
901 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
903 \textit{For a \addtoindex{C++} virtual base, the
904 \addtoindex{data member location attribute}
905 will usually consist of a non-trivial
906 \addtoindex{location description}.}
908 \subsection{Access Declarations}
909 \label{chap:accessdeclarations}
911 \textit{In \addtoindex{C++}, a derived class may contain access declarations that
912 \addtoindex{access declaration entry}
913 change the accessibility of individual class members from the
914 overall accessibility specified by the inheritance declaration.
915 A single access declaration may refer to a set of overloaded
918 If a derived class or structure contains access declarations,
919 each such declaration may be represented by a debugging
920 information entry with the tag
921 \livetarg{chap:DWTAGaccessdeclaration}{DW\-\_TAG\-\_access\-\_declaration}.
923 such entry is a child of the class or structure type entry.
925 An access declaration entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
926 value is a null-terminated string representing the name used
927 in the declaration in the source program, including any class
928 or structure qualifiers.
930 An access declaration entry
931 \hypertarget{chap:DWATaccessibilitycppbaseclasses}
934 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
935 attribute describing the declared accessibility of the named
943 \addtoindexx{friend entry}
944 declared by a structure, union or class
945 \hypertarget{chap:DWATfriendfriendrelationship}
946 type may be represented by a debugging information entry
947 that is a child of the structure, union or class type entry;
948 the friend entry has the
949 tag \livetarg{chap:DWTAGfriend}{DW\-\_TAG\-\_friend}.
952 \addtoindexx{friend attribute}
953 a \livelink{chap:DWATfriend}{DW\-\_AT\-\_friend} attribute, whose value is
954 a reference to the debugging information entry describing
955 the declaration of the friend.
958 \subsection{Data Member Entries}
959 \label{chap:datamemberentries}
961 A data member (as opposed to a member function) is
962 represented by a debugging information entry with the
963 tag \livetarg{chap:DWTAGmember}{DW\-\_TAG\-\_member}.
964 The member entry for a named member has
965 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null-terminated
966 string containing the member name as it appears in the source
967 program. If the member entry describes an
968 \addtoindex{anonymous union},
970 name attribute is omitted or consists of a single zero byte.
972 The data member entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote
973 the type of that member.
975 A data member entry may
976 \addtoindexx{accessibility attribute}
978 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
979 attribute. If no accessibility attribute is present, private
980 access is assumed for an entry of a class and public access
981 is assumed for an entry of a structure, union, or interface.
984 \hypertarget{chap:DWATmutablemutablepropertyofmemberdata}
985 entry may have a \livelink{chap:DWATmutable}{DW\-\_AT\-\_mutable} attribute,
986 which is a \livelink{chap:flag}{flag}.
987 This attribute indicates whether the data
988 member was declared with the mutable storage class specifier.
990 The beginning of a data member
991 \addtoindex{beginning of a data member}
992 is described relative to
993 \addtoindexx{beginning of an object}
994 the beginning of the object in which it is immediately
995 contained. In general, the beginning is characterized by
996 both an address and a bit offset within the byte at that
997 address. When the storage for an entity includes all of
998 the bits in the beginning byte, the beginning bit offset is
1001 Bit offsets in DWARF use the bit numbering and direction
1002 conventions that are appropriate to the current language on
1005 The member entry corresponding to a data member that is
1006 \hypertarget{chap:DWATdatabitoffsetdatamemberbitlocation}
1008 \hypertarget{chap:DWATdatamemberlocationdatamemberlocation}
1009 in a structure, union or class may have either
1010 \addtoindexx{data member location attribute}
1012 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute or a
1013 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1014 attribute. If the beginning of the data member is the same as
1015 the beginning of the containing entity then neither attribute
1018 For a \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute
1019 \addtoindexx{data member location attribute}
1020 there are two cases:
1022 \begin{enumerate}[1.]
1024 \item If the value is an integer constant, it is the offset
1025 in bytes from the beginning of the containing entity. If
1026 the beginning of the containing entity has a non-zero bit
1027 offset then the beginning of the member entry has that same
1030 \item Otherwise, the value must be a \addtoindex{location description}.
1032 this case, the beginning of the containing entity must be byte
1033 aligned. The beginning address is pushed on the DWARF stack
1034 before the \addtoindex{location} description is evaluated; the result of
1035 the evaluation is the base address of the member entry.
1037 \textit{The push on the DWARF expression stack of the base address of
1038 the containing construct is equivalent to execution of the
1039 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} operation
1040 (see Section \refersec{chap:stackoperations});
1041 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} therefore
1042 is not needed at the
1043 beginning of a \addtoindex{location description} for a data member.
1045 result of the evaluation is a location--either an address or
1046 the name of a register, not an offset to the member.}
1048 \textit{A \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1050 \addtoindexx{data member location attribute}
1051 that has the form of a
1052 \addtoindex{location description} is not valid for a data member contained
1053 in an entity that is not byte aligned because DWARF operations
1054 do not allow for manipulating or computing bit offsets.}
1058 For a \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} attribute,
1059 the value is an integer constant
1060 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1061 that specifies the number of bits
1062 from the beginning of the containing entity to the beginning
1063 of the data member. This value must be greater than or equal
1064 to zero, but is not limited to less than the number of bits
1067 If the size of a data member is not the same as the size
1068 of the type given for the data member, the data member has
1069 \addtoindexx{bit size attribute}
1070 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1071 or a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute whose
1072 integer constant value
1073 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1075 of storage needed to hold the value of the data member.
1077 \textit{\addtoindex{C} and \addtoindex{C++}
1079 \addtoindex{bit fields}
1081 \addtoindexx{data bit offset}
1083 \addtoindexx{data bit size}
1085 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} and
1086 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attributes.}
1088 \textit{This Standard uses the following bit numbering and direction
1089 conventions in examples. These conventions are for illustrative
1090 purposes and other conventions may apply on particular
1095 \item \textit{For big\dash endian architectures, bit offsets are
1096 counted from high-order to low\dash order bits within a byte (or
1097 larger storage unit); in this case, the bit offset identifies
1098 the high\dash order bit of the object.}
1100 \item \textit{For little\dash endian architectures, bit offsets are
1101 counted from low\dash order to high\dash order bits within a byte (or
1102 larger storage unit); in this case, the bit offset identifies
1103 the low\dash order bit of the object.}
1107 \textit{In either case, the bit so identified is defined as the
1108 \addtoindexx{beginning of an object}
1109 beginning of the object.}
1111 \textit{For example, take one possible representation of the following
1112 \addtoindex{C} structure definition
1113 in both big\dash and little\dash endian byte orders:}
1124 \textit{The following diagrams show the structure layout
1125 and data bit offsets for example big\dash\ and little\dash endian
1126 architectures, respectively. Both diagrams show a structure
1127 that begins at address A and whose size is four bytes. Also,
1128 high order bits are to the left and low order bits are to
1131 \textit{Big\dash Endian Data Bit Offsets:}
1139 Addresses increase ->
1140 | A | A + 1 | A + 2 | A + 3 |
1142 Data bit offsets increase ->
1143 +---------------+---------------+---------------+---------------+
1144 |0 4|5 10|11 15|16 23|24 31|
1145 | j | k | m | n | <pad> |
1147 +---------------------------------------------------------------+
1150 \textit{Little\dash Endian Data Bit Offsets:}
1156 <- Addresses increase
1157 | A | A + 1 | A + 2 | A + 3 |
1159 <- Data bit offsets increase
1161 +---------------+---------------+---------------+---------------+
1162 |31 24|23 16|15 11|10 5|4 0|
1163 | <pad> | n | m | k | j |
1165 +---------------------------------------------------------------+
1169 \textit{Note that data member bit offsets in this example are the
1170 same for both big\dash\ and little\dash endian architectures even
1171 though the fields are allocated in different directions
1172 (high\dash order to low-order versus low\dash order to high\dash order);
1173 the bit naming conventions for memory and/or registers of
1174 the target architecture may or may not make this seem natural.}
1176 \textit{For a more extensive example showing nested and packed records
1178 Appendix \refersec{app:pascalexample}.}
1180 \textit{Attribute \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1182 \addtoindex{DWARF Version 4}
1183 and is also used for base types
1185 \refersec{chap:basetypeentries}).
1187 \livetarg{chap:DWATbitoffsetdatamemberbitlocation}
1188 attributes \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} and
1189 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} when used to
1190 identify the beginning of bit field data members as defined
1191 in DWARF V3 and earlier. The earlier attributes are defined
1192 in a manner suitable for bit field members on big-endian
1193 architectures but which is either awkward or incomplete for
1194 use on little-endian architectures.
1195 (\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} also
1196 has other uses that are not affected by this change.)}
1198 \textit{The \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1199 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1200 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1201 attribute combination is deprecated for data members in DWARF
1202 Version 4, but implementations may continue to support this
1203 use for compatibility.}
1206 \addtoindex{DWARF Version 3}
1207 definitions of these attributes are
1210 \begin{myindentpara}{1cm}
1211 \textit{If the data member entry describes a bit field, then that
1212 entry has the following attributes:}
1215 \item \textit{A \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1216 attribute whose value
1217 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1218 is the number of bytes that contain an instance of the
1219 bit field and any padding bits.}
1221 \textit{The byte size attribute may be omitted if the size of the
1222 object containing the bit field can be inferred from the type
1223 attribute of the data member containing the bit field.}
1225 \item \textit{A \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1227 \addtoindexx{bit offset attribute (V3)}
1229 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1230 is the number of bits to the left of the leftmost
1231 (most significant) bit of the bit field value.}
1233 \item \textit{A \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1235 \addtoindexx{bit size attribute (V3)}
1237 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1238 is the number of bits occupied by the bit field value.}
1243 \addtoindex{location description} for a bit field calculates the address
1244 of an anonymous object containing the bit field. The address
1245 is relative to the structure, union, or class that most closely
1246 encloses the bit field declaration. The number of bytes in this
1247 anonymous object is the value of the byte size attribute of
1248 the bit field. The offset (in bits) from the most significant
1249 bit of the anonymous object to the most significant bit of
1250 the bit field is the value of the bit offset attribute.}
1254 \textit{Diagrams similar to the above that show the use of the
1255 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1256 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1257 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} attribute
1258 combination may be found in the
1259 \addtoindex{DWARF Version 3} Standard.}
1261 \textit{In comparing
1263 \addtoindexx{DWARF Version 3}
1265 \addtoindexx{DWARF Version 4}
1266 4, note that DWARF V4
1267 defines the following combinations of attributes:}
1270 \item \textit{either \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1272 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1273 (to specify the beginning of the data member)}
1275 % FIXME: the indentation of the following line is suspect.
1276 \textit{optionally together with}
1278 \item \textit{either \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or
1279 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} (to
1280 specify the size of the data member)}
1284 \textit{DWARF V3 defines the following combinations}
1287 \item \textit{\livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1288 (to specify the beginning
1289 of the data member, except this specification is only partial
1290 in the case of a bit field) }
1292 % FIXME: the indentation of the following line is suspect.
1293 \textit{optionally together with}
1295 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1296 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1297 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1298 (to further specify the beginning of a bit field data member
1299 as well as specify the size of the data member) }
1302 \subsection{Member Function Entries}
1303 \label{chap:memberfunctionentries}
1305 A member function is represented by a debugging information
1306 entry with the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}.
1307 The member function entry
1308 may contain the same attributes and follows the same rules
1309 as non\dash member global subroutine entries
1310 (see Section \refersec{chap:subroutineandentrypointentries}).
1313 \addtoindexx{accessibility attribute}
1314 member function entry may have a
1315 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
1316 attribute. If no accessibility attribute is present, private
1317 access is assumed for an entry of a class and public access
1318 is assumed for an entry of a structure, union or interface.
1321 \hypertarget{chap:DWATvirtualityvirtualityoffunction}
1322 the member function entry describes a virtual function,
1323 then that entry has a
1324 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
1327 \hypertarget{chap:DWATexplicitexplicitpropertyofmemberfunction}
1328 the member function entry describes an explicit member
1329 function, then that entry has
1330 \addtoindexx{explicit attribute}
1332 \livelink{chap:DWATexplicit}{DW\-\_AT\-\_explicit} attribute.
1335 \hypertarget{chap:DWATvtableelemlocationvirtualfunctiontablevtableslot}
1336 entry for a virtual function also has a
1337 \livelink{chap:DWATvtableelemlocation}{DW\-\_AT\-\_vtable\-\_elem\-\_location}
1338 \addtoindexi{attribute}{vtable element location attribute} whose value contains
1339 a \addtoindex{location description}
1340 yielding the address of the slot
1341 for the function within the virtual function table for the
1342 enclosing class. The address of an object of the enclosing
1343 type is pushed onto the expression stack before the location
1344 description is evaluated.
1347 \hypertarget{chap:DWATobjectpointerobjectthisselfpointerofmemberfunction}
1348 the member function entry describes a non\dash static member
1349 function, then that entry has a \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer}
1351 whose value is a reference to the formal parameter entry
1352 that corresponds to the object for which the function is
1353 called. The name attribute of that formal parameter is defined
1354 by the current language (for example,
1355 this for \addtoindex{C++} or self
1356 for \addtoindex{Objective C}
1357 and some other languages). That parameter
1358 also has a \livelink{chap:DWATartificial}{DW\-\_AT\-\_artificial} attribute whose value is true.
1360 Conversely, if the member function entry describes a static
1361 member function, the entry does not have a
1362 \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer}
1365 If the member function entry describes a non\dash static member
1366 function that has a const\dash volatile qualification, then
1367 the entry describes a non\dash static member function whose
1368 object formal parameter has a type that has an equivalent
1369 const\dash volatile qualification.
1371 If a subroutine entry represents the defining declaration
1372 of a member function and that definition appears outside of
1373 the body of the enclosing class declaration, the subroutine
1374 entry has a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
1375 attribute, whose value is
1376 a reference to the debugging information entry representing
1377 the declaration of this function member. The referenced entry
1378 will be a child of some class (or structure) type entry.
1380 Subroutine entries containing the \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
1381 attribute do not need to duplicate information provided
1382 by the declaration entry referenced by the specification
1383 attribute. In particular, such entries do not need to contain
1384 attributes for the name or return type of the function member
1385 whose definition they represent.
1387 \subsection{Class Template Instantiations}
1388 \label{chap:classtemplateinstantiations}
1390 \textit{In \addtoindex{C++} a class template is a generic definition of a class
1391 type that may be instantiated when an instance of the class
1392 is declared or defined. The generic description of the
1393 class may include both parameterized types and parameterized
1394 constant values. DWARF does not represent the generic template
1395 definition, but does represent each instantiation.}
1397 A class template instantiation is represented by a
1398 debugging information entry with the tag \livelink{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
1399 \livelink{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type} or
1400 \livelink{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type}. With five
1401 exceptions, such an entry will contain the same attributes
1402 and have the same types of child entries as would an entry
1403 for a class type defined explicitly using the instantiation
1404 types and values. The exceptions are:
1406 \begin{enumerate}[1.]
1407 \item Each formal parameterized type declaration appearing in the
1408 template definition is represented by a debugging information
1410 \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}. Each
1411 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is
1412 a null\dash terminated string containing the name of the formal
1413 type parameter as it appears in the source program. The
1414 template type parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1415 describing the actual type by which the formal is replaced
1416 for this instantiation.
1418 \item Each formal parameterized value declaration appearing in the
1419 template definition is represented by a debugging information
1421 tag \livetarg{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}.
1423 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is
1424 a null\dash terminated string containing the name of the formal
1425 value parameter as it appears in the source program.
1427 \hypertarget{chap:DWATconstvaluetemplatevalueparameter}
1428 template value parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1429 describing the type of the parameterized value. Finally,
1430 the template value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value}
1431 attribute, whose value is the actual constant value of the
1432 value parameter for this instantiation as represented on the
1433 target architecture.
1435 \item The class type entry and each of its child entries references
1436 a template type parameter entry in any circumstance where the
1437 source template definition references a formal parameterized
1438 type. Similarly, the class type entry and each of its child
1439 entries references a template value parameter entry in any
1440 circumstance where the source template definition references
1441 a formal parameterized value.
1443 \item If the compiler has generated a special compilation unit to
1444 hold the template instantiation and that special compilation
1445 unit has a different name from the compilation unit containing
1446 the template definition, the name attribute for the debugging
1447 information entry representing the special compilation unit
1448 should be empty or omitted.
1450 \item If the class type entry representing the template
1451 instantiation or any of its child entries contains declaration
1452 coordinate attributes, those attributes should refer to
1453 the source for the template definition, not to any source
1454 generated artificially by the compiler.
1458 \subsection{Variant Entries}
1459 \label{chap:variantentries}
1461 A variant part of a structure is represented by a debugging
1462 information entry\addtoindexx{variant part entry} with the
1463 tag \livetarg{chap:DWTAGvariantpart}{DW\-\_TAG\-\_variant\-\_part} and is
1464 owned by the corresponding structure type entry.
1466 If the variant part has a discriminant, the discriminant is
1467 \hypertarget{chap:DWATdiscrdiscriminantofvariantpart}
1469 \addtoindexx{discriminant (entry)}
1470 separate debugging information entry which
1471 is a child of the variant part entry. This entry has the form
1472 of a structure data member entry. The variant part entry will
1473 \addtoindexx{discriminant attribute}
1475 \livelink{chap:DWATdiscr}{DW\-\_AT\-\_discr} attribute
1476 whose value is a reference to
1477 the member entry for the discriminant.
1479 If the variant part does not have a discriminant (tag field),
1480 the variant part entry has a
1481 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to represent
1484 Each variant of a particular variant part is represented by
1485 \hypertarget{chap:DWATdiscrvaluediscriminantvalue}
1486 a debugging information entry\addtoindexx{variant entry} with the
1487 tag \livetarg{chap:DWTAGvariant}{DW\-\_TAG\-\_variant}
1488 and is a child of the variant part entry. The value that
1489 selects a given variant may be represented in one of three
1490 ways. The variant entry may have a
1491 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value} attribute
1492 whose value represents a single case label. The value of this
1493 attribute is encoded as an LEB128 number. The number is signed
1494 if the tag type for the variant part containing this variant
1495 is a signed type. The number is unsigned if the tag type is
1499 \hypertarget{chap:DWATdiscrlistlistofdiscriminantvalues}
1500 the variant entry may contain
1501 \addtoindexx{discriminant list attribute}
1503 \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list}
1504 attribute, whose value represents a list of discriminant
1505 values. This list is represented by any of the
1506 \livelink{chap:block}{block} forms and
1507 may contain a mixture of case labels and label ranges. Each
1508 item on the list is prefixed with a discriminant value
1509 descriptor that determines whether the list item represents
1510 a single label or a label range. A single case label is
1511 represented as an LEB128 number as defined above for
1512 \addtoindexx{discriminant value attribute}
1514 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value}
1515 attribute. A label range is represented by
1516 two LEB128 numbers, the low value of the range followed by the
1517 high value. Both values follow the rules for signedness just
1518 described. The discriminant value descriptor is an integer
1519 constant that may have one of the values given in
1520 Figure \refersec{fig:discriminantdescriptorvalues}.
1522 \begin{figure}[here]
1523 \autorows[0pt]{c}{1}{l}{
1524 \addtoindex{DW\-\_DSC\-\_label},
1525 \addtoindex{DW\-\_DSC\-\_range}
1527 \caption{Discriminant descriptor values}\label{fig:discriminantdescriptorvalues}
1530 If a variant entry has neither a \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value}
1531 attribute nor a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute, or if it has
1532 a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute with 0 size, the variant is a
1535 The components selected by a particular variant are represented
1536 by debugging information entries owned by the corresponding
1537 variant entry and appear in the same order as the corresponding
1538 declarations in the source program.
1540 \section{Condition Entries}
1541 \label{chap:conditionentries}
1543 \textit{COBOL has the notion of
1544 \addtoindexx{level-88 condition, COBOL}
1545 a ``level\dash 88 condition'' that
1546 associates a data item, called the conditional variable, with
1547 a set of one or more constant values and/or value ranges.
1548 Semantically, the condition is ‛true’ if the conditional
1549 variable's value matches any of the described constants,
1550 and the condition is ‛false’ otherwise.}
1552 The \livetarg{chap:DWTAGcondition}{DW\-\_TAG\-\_condition}
1553 debugging information entry\addtoindexx{condition entry}
1555 logical condition that tests whether a given data item’s
1556 value matches one of a set of constant values. If a name
1557 has been given to the condition, the condition entry has a
1558 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
1559 giving the condition name as it appears in the source program.
1561 The condition entry's parent entry describes the conditional
1562 variable; normally this will be a \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable},
1563 \livelink{chap:DWTAGmember}{DW\-\_TAG\-\_member} or
1564 \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter} entry.
1566 \addtoindexx{formal parameter entry}
1568 entry has an array type, the condition can test any individual
1569 element, but not the array as a whole. The condition entry
1570 implicitly specifies a “comparison type” that is the
1571 type of an array element if the parent has an array type;
1572 otherwise it is the type of the parent entry.
1574 The condition entry owns \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} and/or
1575 \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} entries that describe the constant
1576 values associated with the condition. If any child entry has
1577 a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute, that attribute should describe a type
1578 compatible with the comparison type (according to the source
1579 language); otherwise the child’s type is the same as the
1582 \textit{For conditional variables with alphanumeric types, COBOL
1583 permits a source program to provide ranges of alphanumeric
1584 constants in the condition. Normally a subrange type entry
1585 does not describe ranges of strings; however, this can be
1586 represented using bounds attributes that are references to
1587 constant entries describing strings. A subrange type entry may
1588 refer to constant entries that are siblings of the subrange
1592 \section{Enumeration Type Entries}
1593 \label{chap:enumerationtypeentries}
1595 \textit{An “enumeration type” is a scalar that can assume one of
1596 a fixed number of symbolic values.}
1598 An enumeration type is represented by a debugging information
1600 \livetarg{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}.
1602 If a name has been given to the enumeration type in the source
1603 program, then the corresponding enumeration type entry has
1604 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated
1605 string containing the enumeration type name as it appears
1606 in the source program. This entry also has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1607 attribute whose integer constant value is the number of bytes
1608 required to hold an instance of the enumeration.
1610 The \addtoindex{enumeration type entry}
1611 may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1612 which refers to the underlying data type used to implement
1615 If an enumeration type has type safe
1618 \begin{enumerate}[1.]
1619 \item Enumerators are contained in the scope of the enumeration type, and/or
1621 \item Enumerators are not implicitly converted to another type
1624 then the \addtoindex{enumeration type entry} may
1625 \addtoindexx{enum class|see{type-safe enumeration}}
1626 have a \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}
1627 attribute, which is a \livelink{chap:flag}{flag}.
1628 In a language that offers only
1629 one kind of enumeration declaration, this attribute is not
1632 \textit{In \addtoindex{C} or \addtoindex{C++},
1633 the underlying type will be the appropriate
1634 integral type determined by the compiler from the properties of
1635 \hypertarget{chap:DWATenumclasstypesafeenumerationdefinition}
1636 the enumeration literal values.
1637 A \addtoindex{C++} type declaration written
1638 using enum class declares a strongly typed enumeration and
1639 is represented using \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}
1640 in combination with \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}.}
1642 Each enumeration literal is represented by a debugging
1643 \addtoindexx{enumeration literal|see{enumeration entry}}
1644 information entry with the
1645 tag \livetarg{chap:DWTAGenumerator}{DW\-\_TAG\-\_enumerator}.
1647 such entry is a child of the
1648 \addtoindex{enumeration type entry}, and the
1649 enumerator entries appear in the same order as the declarations
1650 of the enumeration literals in the source program.
1652 Each \addtoindex{enumerator entry} has a
1653 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
1654 value is a null\dash terminated string containing the name of the
1655 \hypertarget{chap:DWATconstvalueenumerationliteralvalue}
1656 enumeration literal as it appears in the source program.
1657 Each enumerator entry also has a
1658 \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value} attribute,
1659 whose value is the actual numeric value of the enumerator as
1660 represented on the target system.
1663 If the enumeration type occurs as the description of a
1664 \addtoindexx{enumeration type endry!as array dimension}
1665 dimension of an array type, and the stride for that dimension
1666 \hypertarget{chap:DWATbytestrideenumerationstridedimensionofarraytype}
1667 is different than what would otherwise be determined, then
1668 \hypertarget{chap:DWATbitstrideenumerationstridedimensionofarraytype}
1669 the enumeration type entry has either a
1670 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1671 or \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1672 \addtoindexx{bit stride attribute}
1673 which specifies the separation
1674 between successive elements along the dimension as described
1676 Section \refersec{chap:visibilityofdeclarations}.
1678 \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1679 \addtoindexx{bit stride attribute}
1680 is interpreted as bits and the value of
1681 \addtoindexx{byte stride attribute}
1683 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1684 attribute is interpreted as bytes.
1687 \section{Subroutine Type Entries}
1688 \label{chap:subroutinetypeentries}
1690 It is possible in \addtoindex{C}
1691 to declare pointers to subroutines
1692 that return a value of a specific type. In both
1693 \addtoindex{C} and \addtoindex{C++},
1694 it is possible to declare pointers to subroutines that not
1695 only return a value of a specific type, but accept only
1696 arguments of specific types. The type of such pointers would
1697 be described with a ``pointer to'' modifier applied to a
1698 user\dash defined type.
1700 A subroutine type is represented by a debugging information
1702 tag \livetarg{chap:DWTAGsubroutinetype}{DW\-\_TAG\-\_subroutine\-\_type}.
1704 been given to the subroutine type in the source program,
1705 then the corresponding subroutine type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
1706 attribute whose value is a null\dash terminated string containing
1707 the subroutine type name as it appears in the source program.
1709 If the subroutine type describes a function that returns
1710 a value, then the subroutine type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
1711 attribute to denote the type returned by the subroutine. If
1712 the types of the arguments are necessary to describe the
1713 subroutine type, then the corresponding subroutine type
1714 entry owns debugging information entries that describe the
1715 arguments. These debugging information entries appear in the
1716 order that the corresponding argument types appear in the
1719 In \addtoindex{C} there
1720 is a difference between the types of functions
1721 declared using function prototype style declarations and
1722 those declared using non\dash prototype declarations.
1725 \hypertarget{chap:DWATprototypedsubroutineprototype}
1726 subroutine entry declared with a function prototype style
1727 declaration may have a
1728 \livelink{chap:DWATprototyped}{DW\-\_AT\-\_prototyped} attribute, which is
1729 a \livelink{chap:flag}{flag}.
1731 Each debugging information entry owned by a subroutine
1732 type entry has a tag whose value has one of two possible
1735 \begin{enumerate}[1.]
1736 \item The formal parameters of a parameter list (that have a
1737 specific type) are represented by a debugging information entry
1738 with the tag \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter}.
1739 Each formal parameter
1740 entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute that refers to the type of
1741 the formal parameter.
1743 \item The unspecified parameters of a variable parameter list
1744 \addtoindexx{unspecified parameters entry}
1746 \addtoindexx{... parameters|see{unspecified parameters entry}}
1747 represented by a debugging information entry with the
1748 tag \livelink{chap:DWTAGunspecifiedparameters}{DW\-\_TAG\-\_unspecified\-\_parameters}.
1753 \section{String Type Entries}
1754 \label{chap:stringtypeentries}
1757 A ``string'' is a sequence of characters that have specific
1758 semantics and operations that separate them from arrays of
1760 \addtoindex{Fortran} is one of the languages that has a string
1761 type. Note that ``string'' in this context refers to a target
1762 machine concept, not the class string as used in this document
1763 (except for the name attribute).
1765 A string type is represented by a debugging information entry
1766 with the tag \livetarg{chap:DWTAGstringtype}{DW\-\_TAG\-\_string\-\_type}.
1767 If a name has been given to
1768 the string type in the source program, then the corresponding
1769 string type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is
1770 a null\dash terminated string containing the string type name as
1771 it appears in the source program.
1774 \hypertarget{chap:DWATstringlengthstringlengthofstringtype}
1775 string type entry may have a
1776 \livelink{chap:DWATstringlength}{DW\-\_AT\-\_string\-\_length} attribute
1778 \addtoindex{location description} yielding the location
1779 where the length of the string is stored in the program. The
1780 string type entry may also have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute
1781 or \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
1782 (see Section \refersec{chap:byteandbitsizes})
1783 is the size of the data to be retrieved from the location
1784 referenced by the string length attribute. If no (byte or bit)
1785 size attribute is present, the size of the data to be retrieved
1786 is the same as the size of an address on the target machine.
1788 If no string length attribute is present, the string type
1789 entry may have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or
1790 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1791 attribute, whose value
1792 (see Section \refersec{chap:byteandbitsizes})
1794 storage needed to hold a value of the string type.
1797 \section{Set Type Entries}
1798 \label{chap:settypeentries}
1800 \textit{Pascal provides the concept of a “set,” which represents
1801 a group of values of ordinal type.}
1803 A set is represented by a debugging information entry with
1804 the tag \livetarg{chap:DWTAGsettype}{DW\-\_TAG\-\_set\-\_type}.
1805 If a name has been given to the
1806 set type, then the set type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1807 whose value is a null\dash terminated string containing the
1808 set type name as it appears in the source program.
1810 The set type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote the
1811 type of an element of the set.
1813 If the amount of storage allocated to hold each element of an
1814 object of the given set type is different from the amount of
1815 storage that is normally allocated to hold an individual object
1816 of the indicated element type, then the set type entry has
1817 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute, or
1818 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
1819 whose value (see Section \refersec{chap:byteandbitsizes}) is
1820 the amount of storage needed to hold a value of the set type.
1823 \section{Subrange Type Entries}
1824 \label{chap:subrangetypeentries}
1826 \textit{Several languages support the concept of a ``subrange''
1827 type object. These objects can represent a subset of the
1828 values that an object of the basis type for the subrange can
1829 represent. Subrange type entries may also be used to represent
1830 the bounds of array dimensions.}
1832 A subrange type is represented by a debugging information
1834 tag \livetarg{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type}.
1836 given to the subrange type, then the subrange type entry
1837 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated
1838 string containing the subrange type name as it appears in
1841 The subrange entry may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to describe
1842 the type of object, called the basis type, of whose values
1843 this subrange is a subset.
1845 If the amount of storage allocated to hold each element of an
1846 object of the given subrange type is different from the amount
1847 of storage that is normally allocated to hold an individual
1848 object of the indicated element type, then the subrange
1849 type entry has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or
1850 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1851 attribute, whose value
1852 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1854 storage needed to hold a value of the subrange type.
1857 \hypertarget{chap:DWATthreadsscaledupcarrayboundthreadsscalfactor}
1858 subrange entry may have a \livelink{chap:DWATthreadsscaled}{DW\-\_AT\-\_threads\-\_scaled} attribute,
1859 which is a \livelink{chap:flag}{flag}.
1860 If present, this attribute indicates whether
1861 this subrange represents a UPC array bound which is scaled
1862 by the runtime THREADS value (the number of UPC threads in
1863 this execution of the program).
1865 \textit{This allows the representation of a UPC shared array such as}
1868 int shared foo[34*THREADS][10][20];
1872 \hypertarget{chap:DWATlowerboundlowerboundofsubrange}
1874 \hypertarget{chap:DWATupperboundupperboundofsubrange}
1875 entry may have the attributes
1876 \livelink{chap:DWATlowerbound}{DW\-\_AT\-\_lower\-\_bound}
1877 and \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound} to specify, respectively, the lower
1878 and upper bound values of the subrange. The
1879 \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound}
1881 \hypertarget{chap:DWATcountelementsofsubrangetype}
1883 % FIXME: The following matches DWARF4: odd as there is no default count.
1884 \addtoindexx{count attribute!default}
1886 \addtoindexx{count attribute}
1888 \livelink{chap:DWATcount}{DW\-\_AT\-\_count} attribute,
1890 value describes the number of elements in the subrange rather
1891 than the value of the last element. The value of each of
1892 these attributes is determined as described in
1893 Section \refersec{chap:staticanddynamicvaluesofattributes}.
1895 If the lower bound value is missing, the value is assumed to
1896 be a language\dash dependent default constant.
1897 \addtoindexx{lower bound attribute!default}
1900 \addtoindex{C}, \addtoindex{C++},
1903 \addtoindex{Objective C},
1904 \addtoindex{Objective C++},
1905 \addtoindex{Python}, and
1907 The default lower bound is 1 for
1908 \addtoindex{Ada}, \addtoindex{COBOL},
1909 \addtoindex{Fortran},
1910 \addtoindex{Modula}\dash 2,
1911 \addtoindex{Pascal} and
1914 \textit{No other default lower bound values are currently defined.}
1916 If the upper bound and count are missing, then the upper bound value is
1919 If the subrange entry has no type attribute describing the
1920 basis type, the basis type is assumed to be the same as
1921 the object described by the lower bound attribute (if it
1922 references an object). If there is no lower bound attribute,
1923 or that attribute does not reference an object, the basis type
1924 is the type of the upper bound or \addtoindex{count attribute}
1926 of them references an object). If there is no upper bound or
1927 count attribute, or neither references an object, the type is
1928 assumed to be the same type, in the source language of the
1929 compilation unit containing the subrange entry, as a signed
1930 integer with the same size as an address on the target machine.
1932 If the subrange type occurs as the description of a dimension
1933 of an array type, and the stride for that dimension is
1934 \hypertarget{chap:DWATbytestridesubrangestridedimensionofarraytype}
1935 different than what would otherwise be determined, then
1936 \hypertarget{chap:DWATbitstridesubrangestridedimensionofarraytype}
1937 the subrange type entry has either
1938 \addtoindexx{byte stride attribute}
1940 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride} or
1941 \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1942 \addtoindexx{bit stride attribute}
1943 which specifies the separation
1944 between successive elements along the dimension as described
1946 Section \refersec{chap:byteandbitsizes}.
1948 \textit{Note that the stride can be negative.}
1950 \section{Pointer to Member Type Entries}
1951 \label{chap:pointertomembertypeentries}
1953 \textit{In \addtoindex{C++}, a pointer to a data or function member of a class or
1954 structure is a unique type.}
1956 A debugging information entry representing the type of an
1957 object that is a pointer to a structure or class member has
1958 the tag \livetarg{chap:DWTAGptrtomembertype}{DW\-\_TAG\-\_ptr\-\_to\-\_member\-\_type}.
1960 If the pointer to member type has a name, the pointer to
1961 member entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a
1962 null\dash terminated string containing the type name as it appears
1963 in the source program.
1965 The pointer to member entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to
1966 describe the type of the class or structure member to which
1967 objects of this type may point.
1969 The pointer to member entry also
1970 \hypertarget{chap:DWATcontainingtypecontainingtypeofpointertomembertype}
1972 \livelink{chap:DWATcontainingtype}{DW\-\_AT\-\_containing\-\_type}
1973 attribute, whose value is a reference to a debugging
1974 information entry for the class or structure to whose members
1975 objects of this type may point.
1978 \hypertarget{chap:DWATuselocationmemberlocationforpointertomembertype}
1979 pointer to member entry has a
1980 \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} attribute
1982 \addtoindex{location description} that computes the
1983 address of the member of the class to which the pointer to
1984 member entry points.
1986 \textit{The method used to find the address of a given member of a
1987 class or structure is common to any instance of that class
1988 or structure and to any instance of the pointer or member
1989 type. The method is thus associated with the type entry,
1990 rather than with each instance of the type.}
1992 The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is used in conjunction
1993 with the location descriptions for a particular object of the
1994 given pointer to member type and for a particular structure or
1995 class instance. The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location}
1996 attribute expects two values to be
1997 \addtoindexi{pushed}{address!implicit push for member operator}
1998 onto the DWARF expression stack before
1999 the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is evaluated.
2001 \addtoindexi{pushed}{address!implicit push for member operator}
2002 is the value of the pointer to member object
2003 itself. The second value
2004 \addtoindexi{pushed}{address!implicit push for member operator}
2005 is the base address of the
2006 entire structure or union instance containing the member
2007 whose address is being calculated.
2009 \textit{For an expression such as}
2014 % FIXME: object and mbr\_ptr should be distinguished from italic. See DW4.
2015 \textit{where mbr\_ptr has some pointer to member type, a debugger should:}
2017 \textit{1. Push the value of mbr\_ptr onto the DWARF expression stack.}
2019 \textit{2. Push the base address of object onto the DWARF expression stack.}
2021 \textit{3. Evaluate the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description
2022 given in the type of mbr\_ptr.}
2024 \section{File Type Entries}
2025 \label{chap:filetypeentries}
2027 \textit{Some languages, such as Pascal, provide a data type to represent
2030 A file type is represented by a debugging information entry
2032 \addtoindexx{file type entry}
2034 \livetarg{chap:DWTAGfiletype}{DW\-\_TAG\-\_file\-\_type}.
2035 If the file type has a name,
2036 the file type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value
2037 is a null\dash terminated string containing the type name as it
2038 appears in the source program.
2040 The file type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
2041 the type of the objects contained in the file.
2043 The file type entry also
2044 \addtoindexx{byte size}
2046 \addtoindexx{bit size}
2048 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or
2049 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
2050 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
2051 is the amount of storage need to hold a value of the file type.
2053 \section{Dynamic Type Properties}
2054 \label{chap:dynamictypeproperties}
2055 \subsection{Data Location}
2056 \label{chap:datalocation}
2058 \textit{Some languages may represent objects using descriptors to hold
2059 information, including a location and/or run\dash time parameters,
2060 about the data that represents the value for that object.}
2062 \hypertarget{chap:DWATdatalocationindirectiontoactualdata}
2063 The \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
2064 attribute may be used with any
2065 \addtoindexx{data location attribute}
2066 type that provides one or more levels of
2067 \addtoindexx{hidden indirection|see{data location attribute}}
2069 and/or run\dash time parameters in its representation. Its value
2070 is a \addtoindex{location description}.
2071 The result of evaluating this
2072 description yields the location of the data for an object.
2073 When this attribute is omitted, the address of the data is
2074 the same as the address of the object.
2076 \textit{This location description will typically begin with
2077 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address}
2078 which loads the address of the
2079 object which can then serve as a descriptor in subsequent
2080 calculation. For an example using
2081 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
2082 for a \addtoindex{Fortran 90 array}, see
2083 Appendix \refersec{app:fortran90example}.}
2085 \subsection{Allocation and Association Status}
2086 \label{chap:allocationandassociationstatus}
2088 \textit{Some languages, such as \addtoindex{Fortran 90},
2089 provide types whose values
2090 may be dynamically allocated or associated with a variable
2091 under explicit program control.}
2093 \hypertarget{chap:DWATallocatedallocationstatusoftypes}
2095 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated}
2097 \addtoindexx{allocated attribute}
2098 may optionally be used with any
2099 type for which objects of the type can be explicitly allocated
2100 and deallocated. The presence of the attribute indicates that
2101 objects of the type are allocatable and deallocatable. The
2102 integer value of the attribute (see below) specifies whether
2103 an object of the type is
2104 currently allocated or not.
2106 \hypertarget{chap:DWATassociatedassociationstatusoftypes}
2108 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute
2110 \addtoindexx{associated attribute}
2111 optionally be used with
2112 any type for which objects of the type can be dynamically
2113 associated with other objects. The presence of the attribute
2114 indicates that objects of the type can be associated. The
2115 integer value of the attribute (see below) indicates whether
2116 an object of the type is currently associated or not.
2118 While these attributes are defined specifically with
2119 \addtoindex{Fortran 90} ALLOCATABLE and POINTER types
2120 in mind, usage is not limited
2121 to just that language.
2123 The value of these attributes is determined as described in
2124 Section \refersec{chap:staticanddynamicvaluesofattributes}.
2126 A non\dash zero value is interpreted as allocated or associated,
2127 and zero is interpreted as not allocated or not associated.
2129 \textit{For \addtoindex{Fortran 90},
2130 if the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated}
2131 attribute is present,
2132 the type has the POINTER property where either the parent
2133 variable is never associated with a dynamic object or the
2134 implementation does not track whether the associated object
2135 is static or dynamic. If the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute is
2136 present and the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute is not, the type
2137 has the ALLOCATABLE property. If both attributes are present,
2138 then the type should be assumed to have the POINTER property
2139 (and not ALLOCATABLE); the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute may then
2140 be used to indicate that the association status of the object
2141 resulted from execution of an ALLOCATE statement rather than
2142 pointer assignment.}
2144 \textit{For examples using
2145 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} for \addtoindex{Ada} and
2146 \addtoindex{Fortran 90}
2148 see Appendix \refersec{app:aggregateexamples}.}
2152 \section{Template Alias Entries}
2153 \label{chap:templatealiasentries}
2155 A type named using a template alias is represented
2156 by a debugging information entry with the tag
2157 \livetarg{chap:DWTAGtemplatealias}{DW\-\_TAG\-\_template\-\_alias}.
2158 The template alias entry has a
2159 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
2160 containing the name of the template alias as it appears in
2161 the source program. The template alias entry also contains a
2162 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is a reference to the type
2163 named by the template alias. The template alias entry has
2164 the following child entries:
2166 \begin{enumerate}[1.]
2167 \item Each formal parameterized type declaration appearing
2168 in the template alias declaration is represented
2169 by a debugging information entry with the tag
2170 \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}.
2171 Each such entry may have
2172 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a null\dash terminated
2173 string containing the name of the formal type parameter as it
2174 appears in the source program. The template type parameter
2175 entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing the actual
2176 type by which the formal is replaced for this instantiation.
2178 \item Each formal parameterized value declaration
2179 appearing in the template alias declaration is
2180 represented by a debugging information entry with the tag
2181 \livelink{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}.
2182 Each such entry may have
2183 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a null\dash terminated
2184 string containing the name of the formal value parameter
2185 as it appears in the source program. The template value
2186 parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
2187 the type of the parameterized value. Finally, the template
2188 value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value}
2189 attribute, whose value is the actual constant value of the value parameter for
2190 this instantiation as represented on the target architecture.