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 \livelink{chap:DWATlanguage}{DW\-\_AT\-\_language}
576 attribute of the enclosing compilation unit entry) is assumed.
579 \autorows[0pt]{c}{1}{l}{
580 \livetarg{chap:DWORDcolmajor}{DW\-\_ORD\-\_col\-\_major},
581 \livetarg{chap:DWORDrowmajor}{DW\-\_ORD\-\_row\-\_major}
583 \caption{Array ordering}\label{fig:arrayordering}
586 The ordering attribute may optionally appear on one-dimensional
587 arrays; it will be ignored.
589 An array type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
590 \addtoindexx{array!element type}
592 the type of each element of the array.
594 If the amount of storage allocated to hold each element of an
595 object of the given array type is different from the amount
596 of storage that is normally allocated to hold an individual
597 \hypertarget{chap:DWATbitstridearrayelementstrideofarraytype}
599 \hypertarget{chap:DWATbytestridearrayelementstrideofarraytype}
600 indicated element type, then the array type
601 \addtoindexx{bit stride attribute}
603 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
605 \addtoindexx{byte stride attribute}
606 a \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride}
608 \addtoindexx{bit stride attribute}
610 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
612 element of the array.
614 The array type entry may have either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a
615 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
616 (see Section \refersec{chap:byteandbitsizes}),
618 amount of storage needed to hold an instance of the array type.
620 \textit{If the size of the array can be determined statically at
621 compile time, this value can usually be computed by multiplying
622 the number of array elements by the size of each element.}
625 Each array dimension is described by a debugging information
626 entry with either the tag \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} or the
627 \addtoindexx{enumeration type entry!as array dimension}
629 \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}. These entries are
631 array type entry and are ordered to reflect the appearance of
632 the dimensions in the source program (i.e., leftmost dimension
633 first, next to leftmost second, and so on).
635 In languages, such as C, in which there is no concept of
636 a “multidimensional array”, an array of arrays may
637 be represented by a debugging information entry for a
638 multidimensional array.
640 Other attributes especially applicable to arrays are
641 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated},
642 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} and
643 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location},
644 which are described in
645 Section \refersec{chap:dynamictypeproperties}.
646 For relevant examples,
648 Appendix \refersec{app:fortran90example}.
650 \section{ Structure, Union, Class and Interface Type Entries}
651 \label{chap:structureunionclassandinterfacetypeentries}
653 \textit{The languages
655 \addtoindex{C++}, and
656 \addtoindex{Pascal}, among others, allow the
657 programmer to define types that are collections of related
658 components. In \addtoindex{C} and \addtoindex{C++}, these collections are called
659 “structures.” In \addtoindex{Pascal}, they are called “records.”
660 The components may be of different types. The components are
661 called “members” in \addtoindex{C} and
662 \addtoindex{C++}, and “fields” in \addtoindex{Pascal}.}
664 \textit{The components of these collections each exist in their
665 own space in computer memory. The components of a C or C++
666 “union” all coexist in the same memory.}
668 \textit{\addtoindex{Pascal} and
669 other languages have a “discriminated union,”
670 \addtoindex{discriminated union|see {variant entry}}
671 also called a “variant record.” Here, selection of a
672 number of alternative substructures (“variants”) is based
673 on the value of a component that is not part of any of those
674 substructures (the “discriminant”).}
676 \textit{\addtoindex{C++} and
677 \addtoindex{Java} have the notion of ``class'', which is in some
678 ways similar to a structure. A class may have “member
679 functions” which are subroutines that are within the scope
680 of a class or structure.}
682 \textit{The \addtoindex{C++} notion of
683 structure is more general than in \addtoindex{C}, being
684 equivalent to a class with minor differences. Accordingly,
685 in the following discussion statements about
686 \addtoindex{C++} classes may
687 be understood to apply to \addtoindex{C++} structures as well.}
689 \subsection{Structure, Union and Class Type Entries}
690 \label{chap:structureunionandclasstypeentries}
693 Structure, union, and class types are represented by debugging
694 information entries with
695 the tags \livetarg{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type},
696 \livetarg{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type},
697 and \livetarg{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
698 respectively. If a name has been given to the structure,
699 union, or class in the source program, then the corresponding
700 structure type, union type, or class type entry has a
701 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
702 containing the type name as it appears in the source program.
704 The members of a structure, union, or class are represented
705 by debugging information entries that are owned by the
706 corresponding structure type, union type, or class type entry
707 and appear in the same order as the corresponding declarations
708 in the source program.
710 A structure type, union type or class type entry may have
711 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a
712 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
713 \hypertarget{chap:DWATbitsizedatamemberbitsize}
714 (see Section \refersec{chap:byteandbitsizes}),
715 whose value is the amount of storage needed
716 to hold an instance of the structure, union or class type,
717 including any padding.
718 An incomplete structure, union or class type
719 \addtoindexx{incomplete structure/union/class}
721 \addtoindexx{incomplete type}
722 represented by a structure, union or class
723 entry that does not have a byte size attribute and that has
724 \addtoindexx{declaration attribute}
725 a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
727 If the complete declaration of a type has been placed in
728 \hypertarget{chap:DWATsignaturetypesignature}
730 (see Section \refersec{chap:separatetypeunitentries}),
731 an incomplete declaration
732 \addtoindexx{incomplete type}
733 of that type in the compilation unit may provide
734 the unique 64\dash bit signature of the type using a \livelink{chap:DWATsignature}{DW\-\_AT\-\_signature}
737 If a structure, union or class entry represents the definition
738 of a structure, class or union member corresponding to a prior
739 incomplete structure, class or union, the entry may have a
740 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute whose value is a reference to
741 the debugging information entry representing that incomplete
744 Structure, union and class entries containing the
745 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute do not need to duplicate
746 information provided by the declaration entry referenced by the
747 specification attribute. In particular, such entries do not
748 need to contain an attribute for the name of the structure,
749 class or union they represent if such information is already
750 provided in the declaration.
752 \textit{For \addtoindex{C} and \addtoindex{C++},
754 \addtoindexx{data member|see {member entry (data)}}
755 member declarations occurring within
756 the declaration of a structure, union or class type are
757 considered to be “definitions” of those members, with
758 the exception of “static” data members, whose definitions
759 appear outside of the declaration of the enclosing structure,
760 union or class type. Function member declarations appearing
761 within a structure, union or class type declaration are
762 definitions only if the body of the function also appears
763 within the type declaration.}
765 If the definition for a given member of the structure, union
766 or class does not appear within the body of the declaration,
767 that member also has a debugging information entry describing
768 its definition. That latter entry has a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
769 attribute referencing the debugging information entry
770 owned by the body of the structure, union or class entry and
771 representing a non\dash defining declaration of the data, function
772 or type member. The referenced entry will not have information
773 about the location of that member (low and high pc attributes
774 for function members, location descriptions for data members)
775 and will have a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
777 \textit{Consider a nested class whose
778 definition occurs outside of the containing class definition, as in:}
787 \textit{The two different structs can be described in
788 different compilation units to
789 facilitate DWARF space compression
790 (see Appendix \refersec{app:usingcompilationunits}).}
792 \subsection{Interface Type Entries}
793 \label{chap:interfacetypeentries}
795 \textit{The \addtoindex{Java} language defines ``interface'' types.
797 in \addtoindex{Java} is similar to a \addtoindex{C++} or
798 \addtoindex{Java} class with only abstract
799 methods and constant data members.}
802 \addtoindexx{interface type entry}
803 are represented by debugging information
805 tag \livetarg{chap:DWTAGinterfacetype}{DW\-\_TAG\-\_interface\-\_type}.
807 An interface type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
808 value is a null-terminated string containing the type name
809 as it appears in the source program.
811 The members of an interface are represented by debugging
812 information entries that are owned by the interface type
813 entry and that appear in the same order as the corresponding
814 declarations in the source program.
816 \subsection{Derived or Extended Structs, Classes and Interfaces}
817 \label{chap:derivedorextendedstructsclasesandinterfaces}
819 \textit{In \addtoindex{C++}, a class (or struct)
821 \addtoindexx{derived type (C++)|see{inheritance entry}}
822 be ``derived from'' or be a
823 ``subclass of'' another class.
824 In \addtoindex{Java}, an interface may ``extend''
825 \addtoindexx{extended type (Java)|see{inheritance entry}}
827 \addtoindexx{implementing type (Java)|see{inheritance entry}}
828 or more other interfaces, and a class may ``extend'' another
829 class and/or ``implement'' one or more interfaces. All of these
830 relationships may be described using the following. Note that
831 in \addtoindex{Java},
832 the distinction between extends and implements is
833 implied by the entities at the two ends of the relationship.}
835 A class type or interface type entry that describes a
836 derived, extended or implementing class or interface owns
837 addtoindexx{implementing type (Java)|see{inheritance entry}}
838 debugging information entries describing each of the classes
839 or interfaces it is derived from, extending or implementing,
840 respectively, ordered as they were in the source program. Each
842 \addtoindexx{inheritance entry}
844 tag \livetarg{chap:DWTAGinheritance}{DW\-\_TAG\-\_inheritance}.
846 An inheritance entry has
847 \addtoindexx{inheritance entry}
849 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is
850 a reference to the debugging information entry describing the
851 class or interface from which the parent class or structure
852 of the inheritance entry is derived, extended or implementing.
855 \addtoindexx{inheritance entry}
856 for a class that derives from or extends
857 \hypertarget{chap:DWATdatamemberlocationinheritedmemberlocation}
858 another class or struct also has
859 \addtoindexx{data member location attribute}
861 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
862 attribute, whose value describes the location of the beginning
863 of the inherited type relative to the beginning address of the
864 derived class. If that value is a constant, it is the offset
865 in bytes from the beginning of the class to the beginning of
866 the inherited type. Otherwise, the value must be a location
867 description. In this latter case, the beginning address of
868 the derived class is pushed on the expression stack before
869 the location description is evaluated and the result of the
870 evaluation is the location of the inherited type.
872 \textit{The interpretation of the value of this attribute for
873 inherited types is the same as the interpretation for data
875 (see Section \refersec{chap:datamemberentries}). }
878 \addtoindexx{inheritance entry}
880 \hypertarget{chap:DWATaccessibilitycppinheritedmembers}
882 \addtoindexx{accessibility attribute}
884 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
886 If no accessibility attribute
887 is present, private access is assumed for an entry of a class
888 and public access is assumed for an entry of an interface,
892 \hypertarget{chap:DWATvirtualityvirtualityofbaseclass}
893 the class referenced by the
894 \addtoindexx{inheritance entry}
895 inheritance entry serves
896 as a \addtoindex{C++} virtual base class, the inheritance entry has a
897 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
899 \textit{For a \addtoindex{C++} virtual base, the
900 \addtoindex{data member location attribute}
901 will usually consist of a non-trivial location description.}
903 \subsection{Access Declarations}
904 \label{chap:accessdeclarations}
906 \textit{In \addtoindex{C++}, a derived class may contain access declarations that
907 \addtoindex{access declaration entry}
908 change the accessibility of individual class members from the
909 overall accessibility specified by the inheritance declaration.
910 A single access declaration may refer to a set of overloaded
913 If a derived class or structure contains access declarations,
914 each such declaration may be represented by a debugging
915 information entry with the tag
916 \livetarg{chap:DWTAGaccessdeclaration}{DW\-\_TAG\-\_access\-\_declaration}.
918 such entry is a child of the class or structure type entry.
920 An access declaration entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
921 value is a null-terminated string representing the name used
922 in the declaration in the source program, including any class
923 or structure qualifiers.
925 An access declaration entry
926 \hypertarget{chap:DWATaccessibilitycppbaseclasses}
929 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
930 attribute describing the declared accessibility of the named
938 \addtoindexx{friend entry}
939 declared by a structure, union or class
940 \hypertarget{chap:DWATfriendfriendrelationship}
941 type may be represented by a debugging information entry
942 that is a child of the structure, union or class type entry;
943 the friend entry has the
944 tag \livetarg{chap:DWTAGfriend}{DW\-\_TAG\-\_friend}.
947 \addtoindexx{friend attribute}
948 a \livelink{chap:DWATfriend}{DW\-\_AT\-\_friend} attribute, whose value is
949 a reference to the debugging information entry describing
950 the declaration of the friend.
953 \subsection{Data Member Entries}
954 \label{chap:datamemberentries}
956 A data member (as opposed to a member function) is
957 represented by a debugging information entry with the
958 tag \livetarg{chap:DWTAGmember}{DW\-\_TAG\-\_member}.
959 The member entry for a named member has
960 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null-terminated
961 string containing the member name as it appears in the source
962 program. If the member entry describes an
963 \addtoindex{anonymous union},
965 name attribute is omitted or consists of a single zero byte.
967 The data member entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote
968 the type of that member.
970 A data member entry may
971 \addtoindexx{accessibility attribute}
973 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
974 attribute. If no accessibility attribute is present, private
975 access is assumed for an entry of a class and public access
976 is assumed for an entry of a structure, union, or interface.
979 \hypertarget{chap:DWATmutablemutablepropertyofmemberdata}
980 entry may have a \livelink{chap:DWATmutable}{DW\-\_AT\-\_mutable} attribute,
981 which is a \livelink{chap:flag}{flag}.
982 This attribute indicates whether the data
983 member was declared with the mutable storage class specifier.
985 The beginning of a data member
986 \addtoindex{beginning of a data member}
987 is described relative to
988 \addtoindexx{beginning of an object}
989 the beginning of the object in which it is immediately
990 contained. In general, the beginning is characterized by
991 both an address and a bit offset within the byte at that
992 address. When the storage for an entity includes all of
993 the bits in the beginning byte, the beginning bit offset is
996 Bit offsets in DWARF use the bit numbering and direction
997 conventions that are appropriate to the current language on
1000 The member entry corresponding to a data member that is
1001 \hypertarget{chap:DWATdatabitoffsetdatamemberbitlocation}
1003 \hypertarget{chap:DWATdatamemberlocationdatamemberlocation}
1004 in a structure, union or class may have either
1005 \addtoindexx{data member location attribute}
1007 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute or a
1008 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1009 attribute. If the beginning of the data member is the same as
1010 the beginning of the containing entity then neither attribute
1013 For a \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute
1015 \addtoindexx{data member location attribute}
1016 there are two cases:
1018 \begin{enumerate}[1.]
1020 \item If the value is an integer constant, it is the offset
1021 in bytes from the beginning of the containing entity. If
1022 the beginning of the containing entity has a non-zero bit
1023 offset then the beginning of the member entry has that same
1026 \item Otherwise, the value must be a location description. In
1027 this case, the beginning of the containing entity must be byte
1028 aligned. The beginning address is pushed on the DWARF stack
1029 before the location description is evaluated; the result of
1030 the evaluation is the base address of the member entry.
1032 \textit{The push on the DWARF expression stack of the base address of
1033 the containing construct is equivalent to execution of the
1034 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} operation
1035 (see Section \refersec{chap:stackoperations});
1036 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} therefore
1037 is not needed at the
1038 beginning of a location description for a data member. The
1039 result of the evaluation is a location--either an address or
1040 the name of a register, not an offset to the member.}
1042 \textit{A \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1044 \addtoindexx{data member location attribute}
1045 that has the form of a
1046 location description is not valid for a data member contained
1047 in an entity that is not byte aligned because DWARF operations
1048 do not allow for manipulating or computing bit offsets.}
1052 For a \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} attribute,
1053 the value is an integer constant
1054 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1055 that specifies the number of bits
1056 from the beginning of the containing entity to the beginning
1057 of the data member. This value must be greater than or equal
1058 to zero, but is not limited to less than the number of bits
1061 If the size of a data member is not the same as the size
1062 of the type given for the data member, the data member has
1063 \addtoindexx{bit size attribute}
1064 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1065 or a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute whose
1066 integer constant value
1067 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1069 of storage needed to hold the value of the data member.
1071 \textit{\addtoindex{C} and \addtoindex{C++}
1073 \addtoindex{bit fields}
1075 \addtoindexx{data bit offset}
1077 \addtoindexx{data bit size}
1079 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} and
1080 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attributes.}
1082 \textit{This Standard uses the following bit numbering and direction
1083 conventions in examples. These conventions are for illustrative
1084 purposes and other conventions may apply on particular
1089 \item \textit{For big\dash endian architectures, bit offsets are
1090 counted from high-order to low\dash order bits within a byte (or
1091 larger storage unit); in this case, the bit offset identifies
1092 the high\dash order bit of the object.}
1094 \item \textit{For little\dash endian architectures, bit offsets are
1095 counted from low\dash order to high\dash order bits within a byte (or
1096 larger storage unit); in this case, the bit offset identifies
1097 the low\dash order bit of the object.}
1101 \textit{In either case, the bit so identified is defined as the
1102 \addtoindexx{beginning of an object}
1103 beginning of the object.}
1105 \textit{For example, take one possible representation of the following
1106 \addtoindex{C} structure definition
1107 in both big\dash and little\dash endian byte orders:}
1118 \textit{The following diagrams show the structure layout
1119 and data bit offsets for example big\dash\ and little\dash endian
1120 architectures, respectively. Both diagrams show a structure
1121 that begins at address A and whose size is four bytes. Also,
1122 high order bits are to the left and low order bits are to
1125 \textit{Big\dash Endian Data Bit Offsets:}
1133 Addresses increase ->
1134 | A | A + 1 | A + 2 | A + 3 |
1136 Data bit offsets increase ->
1137 +---------------+---------------+---------------+---------------+
1138 |0 4|5 10|11 15|16 23|24 31|
1139 | j | k | m | n | <pad> |
1141 +---------------------------------------------------------------+
1144 \textit{Little\dash Endian Data Bit Offsets:}
1150 <- Addresses increase
1151 | A | A + 1 | A + 2 | A + 3 |
1153 <- Data bit offsets increase
1155 +---------------+---------------+---------------+---------------+
1156 |31 24|23 16|15 11|10 5|4 0|
1157 | <pad> | n | m | k | j |
1159 +---------------------------------------------------------------+
1163 \textit{Note that data member bit offsets in this example are the
1164 same for both big\dash\ and little\dash endian architectures even
1165 though the fields are allocated in different directions
1166 (high\dash order to low-order versus low\dash order to high\dash order);
1167 the bit naming conventions for memory and/or registers of
1168 the target architecture may or may not make this seem natural.}
1170 \textit{For a more extensive example showing nested and packed records
1172 Appendix \refersec{app:pascalexample}.}
1174 \textit{Attribute \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1176 \addtoindex{DWARF Version 4}
1177 and is also used for base types
1179 \refersec{chap:basetypeentries}).
1181 \livetarg{chap:DWATbitoffsetdatamemberbitlocation}
1182 attributes \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} and
1183 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} when used to
1184 identify the beginning of bit field data members as defined
1185 in DWARF V3 and earlier. The earlier attributes are defined
1186 in a manner suitable for bit field members on big-endian
1187 architectures but which is either awkward or incomplete for
1188 use on little-endian architectures.
1189 (\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} also
1190 has other uses that are not affected by this change.)}
1192 \textit{The \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1193 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1194 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1195 attribute combination is deprecated for data members in DWARF
1196 Version 4, but implementations may continue to support this
1197 use for compatibility.}
1200 \addtoindex{DWARF Version 3}
1201 definitions of these attributes are
1204 \begin{myindentpara}{1cm}
1205 \textit{If the data member entry describes a bit field, then that
1206 entry has the following attributes:}
1209 \item \textit{A \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1210 attribute whose value
1211 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1212 is the number of bytes that contain an instance of the
1213 bit field and any padding bits.}
1215 \textit{The byte size attribute may be omitted if the size of the
1216 object containing the bit field can be inferred from the type
1217 attribute of the data member containing the bit field.}
1219 \item \textit{A \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1221 \addtoindexx{bit offset attribute (V3)}
1223 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1224 is the number of bits to the left of the leftmost
1225 (most significant) bit of the bit field value.}
1227 \item \textit{A \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1229 \addtoindexx{bit size attribute (V3)}
1231 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1232 is the number of bits occupied by the bit field value.}
1236 \textit{The location description for a bit field calculates the address
1237 of an anonymous object containing the bit field. The address
1238 is relative to the structure, union, or class that most closely
1239 encloses the bit field declaration. The number of bytes in this
1240 anonymous object is the value of the byte size attribute of
1241 the bit field. The offset (in bits) from the most significant
1242 bit of the anonymous object to the most significant bit of
1243 the bit field is the value of the bit offset attribute.}
1247 \textit{Diagrams similar to the above that show the use of the
1248 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1249 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1250 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} attribute
1251 combination may be found in the
1252 \addtoindex{DWARF Version 3} Standard.}
1254 \textit{In comparing
1256 \addtoindexx{DWARF Version 3}
1258 \addtoindexx{DWARF Version 4}
1259 4, note that DWARF V4
1260 defines the following combinations of attributes:}
1263 \item \textit{either \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1265 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1266 (to specify the beginning of the data member)}
1268 % FIXME: the indentation of the following line is suspect.
1269 \textit{optionally together with}
1271 \item \textit{either \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or
1272 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} (to
1273 specify the size of the data member)}
1277 \textit{DWARF V3 defines the following combinations}
1280 \item \textit{\livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1281 (to specify the beginning
1282 of the data member, except this specification is only partial
1283 in the case of a bit field) }
1285 % FIXME: the indentation of the following line is suspect.
1286 \textit{optionally together with}
1288 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1289 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1290 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1291 (to further specify the beginning of a bit field data member
1292 as well as specify the size of the data member) }
1295 \subsection{Member Function Entries}
1296 \label{chap:memberfunctionentries}
1298 A member function is represented by a debugging information
1299 entry with the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}.
1300 The member function entry
1301 may contain the same attributes and follows the same rules
1302 as non\dash member global subroutine entries
1303 (see Section \refersec{chap:subroutineandentrypointentries}).
1306 \addtoindexx{accessibility attribute}
1307 member function entry may have a
1308 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
1309 attribute. If no accessibility attribute is present, private
1310 access is assumed for an entry of a class and public access
1311 is assumed for an entry of a structure, union or interface.
1314 \hypertarget{chap:DWATvirtualityvirtualityoffunction}
1315 the member function entry describes a virtual function,
1316 then that entry has a
1317 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
1320 \hypertarget{chap:DWATexplicitexplicitpropertyofmemberfunction}
1321 the member function entry describes an explicit member
1322 function, then that entry has
1323 \addtoindexx{explicit attribute}
1325 \livelink{chap:DWATexplicit}{DW\-\_AT\-\_explicit} attribute.
1328 \hypertarget{chap:DWATvtableelemlocationvirtualfunctiontablevtableslot}
1329 entry for a virtual function also has a
1330 \livelink{chap:DWATvtableelemlocation}{DW\-\_AT\-\_vtable\-\_elem\-\_location}
1331 \addtoindexi{attribute}{vtable element location attribute} whose value contains
1332 a location description yielding the address of the slot
1333 for the function within the virtual function table for the
1334 enclosing class. The address of an object of the enclosing
1335 type is pushed onto the expression stack before the location
1336 description is evaluated.
1339 \hypertarget{chap:DWATobjectpointerobjectthisselfpointerofmemberfunction}
1340 the member function entry describes a non\dash static member
1341 function, then that entry has a \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer}
1343 whose value is a reference to the formal parameter entry
1344 that corresponds to the object for which the function is
1345 called. The name attribute of that formal parameter is defined
1346 by the current language (for example,
1347 this for \addtoindex{C++} or self
1348 for \addtoindex{Objective C}
1349 and some other languages). That parameter
1350 also has a \livelink{chap:DWATartificial}{DW\-\_AT\-\_artificial} attribute whose value is true.
1352 Conversely, if the member function entry describes a static
1353 member function, the entry does not have a
1354 \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer}
1357 If the member function entry describes a non\dash static member
1358 function that has a const\dash volatile qualification, then
1359 the entry describes a non\dash static member function whose
1360 object formal parameter has a type that has an equivalent
1361 const\dash volatile qualification.
1363 If a subroutine entry represents the defining declaration
1364 of a member function and that definition appears outside of
1365 the body of the enclosing class declaration, the subroutine
1366 entry has a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
1367 attribute, whose value is
1368 a reference to the debugging information entry representing
1369 the declaration of this function member. The referenced entry
1370 will be a child of some class (or structure) type entry.
1372 Subroutine entries containing the \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
1373 attribute do not need to duplicate information provided
1374 by the declaration entry referenced by the specification
1375 attribute. In particular, such entries do not need to contain
1376 attributes for the name or return type of the function member
1377 whose definition they represent.
1379 \subsection{Class Template Instantiations}
1380 \label{chap:classtemplateinstantiations}
1382 \textit{In \addtoindex{C++} a class template is a generic definition of a class
1383 type that may be instantiated when an instance of the class
1384 is declared or defined. The generic description of the
1385 class may include both parameterized types and parameterized
1386 constant values. DWARF does not represent the generic template
1387 definition, but does represent each instantiation.}
1389 A class template instantiation is represented by a
1390 debugging information entry with the tag \livelink{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
1391 \livelink{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type} or
1392 \livelink{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type}. With five
1393 exceptions, such an entry will contain the same attributes
1394 and have the same types of child entries as would an entry
1395 for a class type defined explicitly using the instantiation
1396 types and values. The exceptions are:
1398 \begin{enumerate}[1.]
1399 \item Each formal parameterized type declaration appearing in the
1400 template definition is represented by a debugging information
1402 \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}. Each
1403 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is
1404 a null\dash terminated string containing the name of the formal
1405 type parameter as it appears in the source program. The
1406 template type parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1407 describing the actual type by which the formal is replaced
1408 for this instantiation.
1410 \item Each formal parameterized value declaration appearing in the
1411 template definition is represented by a debugging information
1413 tag \livetarg{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}.
1415 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is
1416 a null\dash terminated string containing the name of the formal
1417 value parameter as it appears in the source program.
1419 \hypertarget{chap:DWATconstvaluetemplatevalueparameter}
1420 template value parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1421 describing the type of the parameterized value. Finally,
1422 the template value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value}
1423 attribute, whose value is the actual constant value of the
1424 value parameter for this instantiation as represented on the
1425 target architecture.
1427 \item The class type entry and each of its child entries references
1428 a template type parameter entry in any circumstance where the
1429 source template definition references a formal parameterized
1430 type. Similarly, the class type entry and each of its child
1431 entries references a template value parameter entry in any
1432 circumstance where the source template definition references
1433 a formal parameterized value.
1435 \item If the compiler has generated a special compilation unit to
1436 hold the template instantiation and that special compilation
1437 unit has a different name from the compilation unit containing
1438 the template definition, the name attribute for the debugging
1439 information entry representing the special compilation unit
1440 should be empty or omitted.
1442 \item If the class type entry representing the template
1443 instantiation or any of its child entries contains declaration
1444 coordinate attributes, those attributes should refer to
1445 the source for the template definition, not to any source
1446 generated artificially by the compiler.
1450 \subsection{Variant Entries}
1451 \label{chap:variantentries}
1453 A variant part of a structure is represented by a debugging
1454 information entry\addtoindexx{variant part entry} with the
1455 tag \livetarg{chap:DWTAGvariantpart}{DW\-\_TAG\-\_variant\-\_part} and is
1456 owned by the corresponding structure type entry.
1458 If the variant part has a discriminant, the discriminant is
1459 \hypertarget{chap:DWATdiscrdiscriminantofvariantpart}
1461 \addtoindexx{discriminant (entry)}
1462 separate debugging information entry which
1463 is a child of the variant part entry. This entry has the form
1464 of a structure data member entry. The variant part entry will
1465 \addtoindexx{discriminant attribute}
1467 \livelink{chap:DWATdiscr}{DW\-\_AT\-\_discr} attribute
1468 whose value is a reference to
1469 the member entry for the discriminant.
1471 If the variant part does not have a discriminant (tag field),
1472 the variant part entry has a
1473 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to represent
1476 Each variant of a particular variant part is represented by
1477 \hypertarget{chap:DWATdiscrvaluediscriminantvalue}
1478 a debugging information entry\addtoindexx{variant entry} with the
1479 tag \livetarg{chap:DWTAGvariant}{DW\-\_TAG\-\_variant}
1480 and is a child of the variant part entry. The value that
1481 selects a given variant may be represented in one of three
1482 ways. The variant entry may have a
1483 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value} attribute
1484 whose value represents a single case label. The value of this
1485 attribute is encoded as an LEB128 number. The number is signed
1486 if the tag type for the variant part containing this variant
1487 is a signed type. The number is unsigned if the tag type is
1491 \hypertarget{chap:DWATdiscrlistlistofdiscriminantvalues}
1492 the variant entry may contain
1493 \addtoindexx{discriminant list attribute}
1495 \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list}
1496 attribute, whose value represents a list of discriminant
1497 values. This list is represented by any of the
1498 \livelink{chap:block}{block} forms and
1499 may contain a mixture of case labels and label ranges. Each
1500 item on the list is prefixed with a discriminant value
1501 descriptor that determines whether the list item represents
1502 a single label or a label range. A single case label is
1503 represented as an LEB128 number as defined above for
1504 \addtoindexx{discriminant value attribute}
1506 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value}
1507 attribute. A label range is represented by
1508 two LEB128 numbers, the low value of the range followed by the
1509 high value. Both values follow the rules for signedness just
1510 described. The discriminant value descriptor is an integer
1511 constant that may have one of the values given in
1512 Figure \refersec{fig:discriminantdescriptorvalues}.
1514 \begin{figure}[here]
1515 \autorows[0pt]{c}{1}{l}{
1516 \addtoindex{DW\-\_DSC\-\_label},
1517 \addtoindex{DW\-\_DSC\-\_range}
1519 \caption{Discriminant descriptor values}\label{fig:discriminantdescriptorvalues}
1522 If a variant entry has neither a \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value}
1523 attribute nor a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute, or if it has
1524 a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute with 0 size, the variant is a
1527 The components selected by a particular variant are represented
1528 by debugging information entries owned by the corresponding
1529 variant entry and appear in the same order as the corresponding
1530 declarations in the source program.
1532 \section{Condition Entries}
1533 \label{chap:conditionentries}
1535 \textit{COBOL has the notion of a ``level\dash 88 condition'' that
1536 associates a data item, called the conditional variable, with
1537 a set of one or more constant values and/or value ranges.
1538 Semantically, the condition is ‛true’ if the conditional
1539 variable's value matches any of the described constants,
1540 and the condition is ‛false’ otherwise.}
1542 The \livetarg{chap:DWTAGcondition}{DW\-\_TAG\-\_condition}
1543 debugging information entry\addtoindexx{condition entry}
1545 logical condition that tests whether a given data item’s
1546 value matches one of a set of constant values. If a name
1547 has been given to the condition, the condition entry has a
1548 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
1549 giving the condition name as it appears in the source program.
1551 The condition entry's parent entry describes the conditional
1552 variable; normally this will be a \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable},
1553 \livelink{chap:DWTAGmember}{DW\-\_TAG\-\_member} or
1554 \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter} entry.
1556 \addtoindexx{formal parameter entry}
1558 entry has an array type, the condition can test any individual
1559 element, but not the array as a whole. The condition entry
1560 implicitly specifies a “comparison type” that is the
1561 type of an array element if the parent has an array type;
1562 otherwise it is the type of the parent entry.
1564 The condition entry owns \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} and/or
1565 \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} entries that describe the constant
1566 values associated with the condition. If any child entry has
1567 a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute, that attribute should describe a type
1568 compatible with the comparison type (according to the source
1569 language); otherwise the child’s type is the same as the
1572 \textit{For conditional variables with alphanumeric types, COBOL
1573 permits a source program to provide ranges of alphanumeric
1574 constants in the condition. Normally a subrange type entry
1575 does not describe ranges of strings; however, this can be
1576 represented using bounds attributes that are references to
1577 constant entries describing strings. A subrange type entry may
1578 refer to constant entries that are siblings of the subrange
1582 \section{Enumeration Type Entries}
1583 \label{chap:enumerationtypeentries}
1585 \textit{An “enumeration type” is a scalar that can assume one of
1586 a fixed number of symbolic values.}
1588 An enumeration type is represented by a debugging information
1590 \livetarg{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}.
1592 If a name has been given to the enumeration type in the source
1593 program, then the corresponding enumeration type entry has
1594 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated
1595 string containing the enumeration type name as it appears
1596 in the source program. This entry also has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1597 attribute whose integer constant value is the number of bytes
1598 required to hold an instance of the enumeration.
1600 The \addtoindex{enumeration type entry}
1601 may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1602 which refers to the underlying data type used to implement
1605 If an enumeration type has type safe
1608 \begin{enumerate}[1.]
1609 \item Enumerators are contained in the scope of the enumeration type, and/or
1611 \item Enumerators are not implicitly converted to another type
1614 then the \addtoindex{enumeration type entry} may
1615 \addtoindexx{enum class|see{type-safe enumeration}}
1616 have a \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}
1617 attribute, which is a \livelink{chap:flag}{flag}.
1618 In a language that offers only
1619 one kind of enumeration declaration, this attribute is not
1622 \textit{In \addtoindex{C} or \addtoindex{C++},
1623 the underlying type will be the appropriate
1624 integral type determined by the compiler from the properties of
1625 \hypertarget{chap:DWATenumclasstypesafeenumerationdefinition}
1626 the enumeration literal values.
1627 A \addtoindex{C++} type declaration written
1628 using enum class declares a strongly typed enumeration and
1629 is represented using \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}
1630 in combination with \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}.}
1632 Each enumeration literal is represented by a debugging
1633 \addtoindexx{enumeration literal|see{enumeration entry}}
1634 information entry with the
1635 tag \livetarg{chap:DWTAGenumerator}{DW\-\_TAG\-\_enumerator}.
1637 such entry is a child of the
1638 \addtoindex{enumeration type entry}, and the
1639 enumerator entries appear in the same order as the declarations
1640 of the enumeration literals in the source program.
1642 Each \addtoindex{enumerator entry} has a
1643 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
1644 value is a null\dash terminated string containing the name of the
1645 \hypertarget{chap:DWATconstvalueenumerationliteralvalue}
1646 enumeration literal as it appears in the source program.
1647 Each enumerator entry also has a
1648 \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value} attribute,
1649 whose value is the actual numeric value of the enumerator as
1650 represented on the target system.
1653 If the enumeration type occurs as the description of a
1654 \addtoindexx{enumeration type endry!as array dimension}
1655 dimension of an array type, and the stride for that dimension
1656 \hypertarget{chap:DWATbytestrideenumerationstridedimensionofarraytype}
1657 is different than what would otherwise be determined, then
1658 \hypertarget{chap:DWATbitstrideenumerationstridedimensionofarraytype}
1659 the enumeration type entry has either a
1660 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1661 or \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1662 \addtoindexx{bit stride attribute}
1663 which specifies the separation
1664 between successive elements along the dimension as described
1666 Section \refersec{chap:visibilityofdeclarations}.
1668 \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1669 \addtoindexx{bit stride attribute}
1670 is interpreted as bits and the value of
1671 \addtoindexx{byte stride attribute}
1673 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1674 attribute is interpreted as bytes.
1677 \section{Subroutine Type Entries}
1678 \label{chap:subroutinetypeentries}
1680 It is possible in \addtoindex{C}
1681 to declare pointers to subroutines
1682 that return a value of a specific type. In both
1683 \addtoindex{C} and \addtoindex{C++},
1684 it is possible to declare pointers to subroutines that not
1685 only return a value of a specific type, but accept only
1686 arguments of specific types. The type of such pointers would
1687 be described with a ``pointer to'' modifier applied to a
1688 user\dash defined type.
1690 A subroutine type is represented by a debugging information
1692 tag \livetarg{chap:DWTAGsubroutinetype}{DW\-\_TAG\-\_subroutine\-\_type}.
1694 been given to the subroutine type in the source program,
1695 then the corresponding subroutine type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
1696 attribute whose value is a null\dash terminated string containing
1697 the subroutine type name as it appears in the source program.
1699 If the subroutine type describes a function that returns
1700 a value, then the subroutine type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
1701 attribute to denote the type returned by the subroutine. If
1702 the types of the arguments are necessary to describe the
1703 subroutine type, then the corresponding subroutine type
1704 entry owns debugging information entries that describe the
1705 arguments. These debugging information entries appear in the
1706 order that the corresponding argument types appear in the
1709 In \addtoindex{C} there
1710 is a difference between the types of functions
1711 declared using function prototype style declarations and
1712 those declared using non\dash prototype declarations.
1715 \hypertarget{chap:DWATprototypedsubroutineprototype}
1716 subroutine entry declared with a function prototype style
1717 declaration may have a
1718 \livelink{chap:DWATprototyped}{DW\-\_AT\-\_prototyped} attribute, which is
1719 a \livelink{chap:flag}{flag}.
1721 Each debugging information entry owned by a subroutine
1722 type entry has a tag whose value has one of two possible
1725 \begin{enumerate}[1.]
1726 \item The formal parameters of a parameter list (that have a
1727 specific type) are represented by a debugging information entry
1728 with the tag \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter}.
1729 Each formal parameter
1730 entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute that refers to the type of
1731 the formal parameter.
1733 \item The unspecified parameters of a variable parameter list
1734 \addtoindexx{unspecified parameters entry}
1736 \addtoindexx{... parameters|see{unspecified parameters entry}}
1737 represented by a debugging information entry with the
1738 tag \livelink{chap:DWTAGunspecifiedparameters}{DW\-\_TAG\-\_unspecified\-\_parameters}.
1743 \section{String Type Entries}
1744 \label{chap:stringtypeentries}
1747 A ``string'' is a sequence of characters that have specific
1748 semantics and operations that separate them from arrays of
1750 \addtoindex{Fortran} is one of the languages that has a string
1751 type. Note that ``string'' in this context refers to a target
1752 machine concept, not the class string as used in this document
1753 (except for the name attribute).
1755 A string type is represented by a debugging information entry
1756 with the tag \livetarg{chap:DWTAGstringtype}{DW\-\_TAG\-\_string\-\_type}.
1757 If a name has been given to
1758 the string type in the source program, then the corresponding
1759 string type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is
1760 a null\dash terminated string containing the string type name as
1761 it appears in the source program.
1764 \hypertarget{chap:DWATstringlengthstringlengthofstringtype}
1765 string type entry may have a
1766 \livelink{chap:DWATstringlength}{DW\-\_AT\-\_string\-\_length} attribute
1767 whose value is a location description yielding the location
1768 where the length of the string is stored in the program. The
1769 string type entry may also have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute
1770 or \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
1771 (see Section \refersec{chap:byteandbitsizes})
1772 is the size of the data to be retrieved from the location
1773 referenced by the string length attribute. If no (byte or bit)
1774 size attribute is present, the size of the data to be retrieved
1775 is the same as the size of an address on the target machine.
1777 If no string length attribute is present, the string type
1778 entry may have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or
1779 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1780 attribute, whose value
1781 (see Section \refersec{chap:byteandbitsizes})
1783 storage needed to hold a value of the string type.
1786 \section{Set Type Entries}
1787 \label{chap:settypeentries}
1789 \textit{Pascal provides the concept of a “set,” which represents
1790 a group of values of ordinal type.}
1792 A set is represented by a debugging information entry with
1793 the tag \livetarg{chap:DWTAGsettype}{DW\-\_TAG\-\_set\-\_type}.
1794 If a name has been given to the
1795 set type, then the set type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1796 whose value is a null\dash terminated string containing the
1797 set type name as it appears in the source program.
1799 The set type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote the
1800 type of an element of the set.
1802 If the amount of storage allocated to hold each element of an
1803 object of the given set type is different from the amount of
1804 storage that is normally allocated to hold an individual object
1805 of the indicated element type, then the set type entry has
1806 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute, or
1807 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
1808 whose value (see Section \refersec{chap:byteandbitsizes}) is
1809 the amount of storage needed to hold a value of the set type.
1812 \section{Subrange Type Entries}
1813 \label{chap:subrangetypeentries}
1815 \textit{Several languages support the concept of a ``subrange''
1816 type object. These objects can represent a subset of the
1817 values that an object of the basis type for the subrange can
1818 represent. Subrange type entries may also be used to represent
1819 the bounds of array dimensions.}
1821 A subrange type is represented by a debugging information
1823 tag \livetarg{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type}.
1825 given to the subrange type, then the subrange type entry
1826 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated
1827 string containing the subrange type name as it appears in
1830 The subrange entry may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to describe
1831 the type of object, called the basis type, of whose values
1832 this subrange is a subset.
1834 If the amount of storage allocated to hold each element of an
1835 object of the given subrange type is different from the amount
1836 of storage that is normally allocated to hold an individual
1837 object of the indicated element type, then the subrange
1838 type entry has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or
1839 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1840 attribute, whose value
1841 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1843 storage needed to hold a value of the subrange type.
1846 \hypertarget{chap:DWATthreadsscaledupcarrayboundthreadsscalfactor}
1847 subrange entry may have a \livelink{chap:DWATthreadsscaled}{DW\-\_AT\-\_threads\-\_scaled} attribute,
1848 which is a \livelink{chap:flag}{flag}.
1849 If present, this attribute indicates whether
1850 this subrange represents a UPC array bound which is scaled
1851 by the runtime THREADS value (the number of UPC threads in
1852 this execution of the program).
1854 \textit{This allows the representation of a UPC shared array such as}
1857 int shared foo[34*THREADS][10][20];
1861 \hypertarget{chap:DWATlowerboundlowerboundofsubrange}
1863 \hypertarget{chap:DWATupperboundupperboundofsubrange}
1864 entry may have the attributes
1865 \livelink{chap:DWATlowerbound}{DW\-\_AT\-\_lower\-\_bound}
1866 and \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound} to specify, respectively, the lower
1867 and upper bound values of the subrange. The
1868 \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound}
1870 \hypertarget{chap:DWATcountelementsofsubrangetype}
1872 % FIXME: The following matches DWARF4: odd as there is no default count.
1873 \addtoindexx{count attribute!default}
1875 \addtoindexx{count attribute}
1877 \livelink{chap:DWATcount}{DW\-\_AT\-\_count} attribute,
1879 value describes the number of elements in the subrange rather
1880 than the value of the last element. The value of each of
1881 these attributes is determined as described in
1882 Section \refersec{chap:staticanddynamicvaluesofattributes}.
1884 If the lower bound value is missing, the value is assumed to
1885 be a language\dash dependent default constant. The default lower
1887 \addtoindex{C}, \addtoindex{C++},
1890 \addtoindex{Objective C},
1891 \addtoindex{Objective C++},
1892 \addtoindex{Python}, and
1894 The default lower bound is 1 for
1895 \addtoindex{Ada}, \addtoindex{COBOL},
1896 \addtoindex{Fortran},
1897 \addtoindex{Modula}\dash 2,
1898 \addtoindex{Pascal} and
1901 \textit{No other default lower bound values are currently defined.}
1903 If the upper bound and count are missing, then the upper bound value is
1906 If the subrange entry has no type attribute describing the
1907 basis type, the basis type is assumed to be the same as
1908 the object described by the lower bound attribute (if it
1909 references an object). If there is no lower bound attribute,
1910 or that attribute does not reference an object, the basis type
1911 is the type of the upper bound or \addtoindex{count attribute}
1913 of them references an object). If there is no upper bound or
1914 count attribute, or neither references an object, the type is
1915 assumed to be the same type, in the source language of the
1916 compilation unit containing the subrange entry, as a signed
1917 integer with the same size as an address on the target machine.
1919 If the subrange type occurs as the description of a dimension
1920 of an array type, and the stride for that dimension is
1921 \hypertarget{chap:DWATbytestridesubrangestridedimensionofarraytype}
1922 different than what would otherwise be determined, then
1923 \hypertarget{chap:DWATbitstridesubrangestridedimensionofarraytype}
1924 the subrange type entry has either
1925 \addtoindexx{byte stride attribute}
1927 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride} or
1928 \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1929 \addtoindexx{bit stride attribute}
1930 which specifies the separation
1931 between successive elements along the dimension as described
1933 Section \refersec{chap:byteandbitsizes}.
1935 \textit{Note that the stride can be negative.}
1937 \section{Pointer to Member Type Entries}
1938 \label{chap:pointertomembertypeentries}
1940 \textit{In \addtoindex{C++}, a pointer to a data or function member of a class or
1941 structure is a unique type.}
1943 A debugging information entry representing the type of an
1944 object that is a pointer to a structure or class member has
1945 the tag \livetarg{chap:DWTAGptrtomembertype}{DW\-\_TAG\-\_ptr\-\_to\-\_member\-\_type}.
1947 If the pointer to member type has a name, the pointer to
1948 member entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a
1949 null\dash terminated string containing the type name as it appears
1950 in the source program.
1952 The pointer to member entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to
1953 describe the type of the class or structure member to which
1954 objects of this type may point.
1956 The pointer to member entry also
1957 \hypertarget{chap:DWATcontainingtypecontainingtypeofpointertomembertype}
1959 \livelink{chap:DWATcontainingtype}{DW\-\_AT\-\_containing\-\_type}
1960 attribute, whose value is a reference to a debugging
1961 information entry for the class or structure to whose members
1962 objects of this type may point.
1965 \hypertarget{chap:DWATuselocationmemberlocationforpointertomembertype}
1966 pointer to member entry has a
1967 \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} attribute
1968 whose value is a location description that computes the
1969 address of the member of the class to which the pointer to
1970 member entry points.
1972 \textit{The method used to find the address of a given member of a
1973 class or structure is common to any instance of that class
1974 or structure and to any instance of the pointer or member
1975 type. The method is thus associated with the type entry,
1976 rather than with each instance of the type.}
1978 The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is used in conjunction
1979 with the location descriptions for a particular object of the
1980 given pointer to member type and for a particular structure or
1981 class instance. The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location}
1982 attribute expects two values to be
1983 \addtoindexi{pushed}{address!implicit push for member operator}
1984 onto the DWARF expression stack before
1985 the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is evaluated.
1987 \addtoindexi{pushed}{address!implicit push for member operator}
1988 is the value of the pointer to member object
1989 itself. The second value
1990 \addtoindexi{pushed}{address!implicit push for member operator}
1991 is the base address of the
1992 entire structure or union instance containing the member
1993 whose address is being calculated.
1995 \textit{For an expression such as}
2000 % FIXME: object and mbr\_ptr should be distinguished from italic. See DW4.
2001 \textit{where mbr\_ptr has some pointer to member type, a debugger should:}
2003 \textit{1. Push the value of mbr\_ptr onto the DWARF expression stack.}
2005 \textit{2. Push the base address of object onto the DWARF expression stack.}
2007 \textit{3. Evaluate the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description
2008 given in the type of mbr\_ptr.}
2010 \section{File Type Entries}
2011 \label{chap:filetypeentries}
2013 \textit{Some languages, such as Pascal, provide a data type to represent
2016 A file type is represented by a debugging information entry
2018 \addtoindexx{file type entry}
2020 \livetarg{chap:DWTAGfiletype}{DW\-\_TAG\-\_file\-\_type}.
2021 If the file type has a name,
2022 the file type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value
2023 is a null\dash terminated string containing the type name as it
2024 appears in the source program.
2026 The file type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
2027 the type of the objects contained in the file.
2029 The file type entry also
2030 \addtoindexx{byte size}
2032 \addtoindexx{bit size}
2034 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or
2035 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
2036 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
2037 is the amount of storage need to hold a value of the file type.
2039 \section{Dynamic Type Properties}
2040 \label{chap:dynamictypeproperties}
2041 \subsection{Data Location}
2042 \label{chap:datalocation}
2044 \textit{Some languages may represent objects using descriptors to hold
2045 information, including a location and/or run\dash time parameters,
2046 about the data that represents the value for that object.}
2048 \hypertarget{chap:DWATdatalocationindirectiontoactualdata}
2049 The \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
2050 attribute may be used with any
2051 \addtoindexx{data location attribute}
2052 type that provides one or more levels of
2053 \addtoindexx{hidden indirection|see{data location attribute}}
2055 and/or run\dash time parameters in its representation. Its value
2056 is a location description. The result of evaluating this
2057 description yields the location of the data for an object.
2058 When this attribute is omitted, the address of the data is
2059 the same as the address of the object.
2061 \textit{This location description will typically begin with
2062 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address}
2063 which loads the address of the
2064 object which can then serve as a descriptor in subsequent
2065 calculation. For an example using
2066 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
2067 for a \addtoindex{Fortran 90 array}, see
2068 Appendix \refersec{app:fortran90example}.}
2070 \subsection{Allocation and Association Status}
2071 \label{chap:allocationandassociationstatus}
2073 \textit{Some languages, such as \addtoindex{Fortran 90},
2074 provide types whose values
2075 may be dynamically allocated or associated with a variable
2076 under explicit program control.}
2078 \hypertarget{chap:DWATallocatedallocationstatusoftypes}
2080 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated}
2082 \addtoindexx{allocated attribute}
2083 may optionally be used with any
2084 type for which objects of the type can be explicitly allocated
2085 and deallocated. The presence of the attribute indicates that
2086 objects of the type are allocatable and deallocatable. The
2087 integer value of the attribute (see below) specifies whether
2088 an object of the type is
2089 currently allocated or not.
2091 \hypertarget{chap:DWATassociatedassociationstatusoftypes}
2093 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute
2095 \addtoindexx{associated attribute}
2096 optionally be used with
2097 any type for which objects of the type can be dynamically
2098 associated with other objects. The presence of the attribute
2099 indicates that objects of the type can be associated. The
2100 integer value of the attribute (see below) indicates whether
2101 an object of the type is currently associated or not.
2103 While these attributes are defined specifically with
2104 \addtoindex{Fortran 90} ALLOCATABLE and POINTER types
2105 in mind, usage is not limited
2106 to just that language.
2108 The value of these attributes is determined as described in
2109 Section \refersec{chap:staticanddynamicvaluesofattributes}.
2111 A non\dash zero value is interpreted as allocated or associated,
2112 and zero is interpreted as not allocated or not associated.
2114 \textit{For \addtoindex{Fortran 90},
2115 if the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated}
2116 attribute is present,
2117 the type has the POINTER property where either the parent
2118 variable is never associated with a dynamic object or the
2119 implementation does not track whether the associated object
2120 is static or dynamic. If the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute is
2121 present and the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute is not, the type
2122 has the ALLOCATABLE property. If both attributes are present,
2123 then the type should be assumed to have the POINTER property
2124 (and not ALLOCATABLE); the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute may then
2125 be used to indicate that the association status of the object
2126 resulted from execution of an ALLOCATE statement rather than
2127 pointer assignment.}
2129 \textit{For examples using
2130 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} for \addtoindex{Ada} and
2131 \addtoindex{Fortran 90}
2133 see Appendix \refersec{app:aggregateexamples}.}
2137 \section{Template Alias Entries}
2138 \label{chap:templatealiasentries}
2140 A type named using a template alias is represented
2141 by a debugging information entry with the tag
2142 \livetarg{chap:DWTAGtemplatealias}{DW\-\_TAG\-\_template\-\_alias}.
2143 The template alias entry has a
2144 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
2145 containing the name of the template alias as it appears in
2146 the source program. The template alias entry also contains a
2147 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is a reference to the type
2148 named by the template alias. The template alias entry has
2149 the following child entries:
2151 \begin{enumerate}[1.]
2152 \item Each formal parameterized type declaration appearing
2153 in the template alias declaration is represented
2154 by a debugging information entry with the tag
2155 \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}.
2156 Each such entry may have
2157 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a null\dash terminated
2158 string containing the name of the formal type parameter as it
2159 appears in the source program. The template type parameter
2160 entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing the actual
2161 type by which the formal is replaced for this instantiation.
2163 \item Each formal parameterized value declaration
2164 appearing in the template alias declaration is
2165 represented by a debugging information entry with the tag
2166 \livelink{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}.
2167 Each such entry may have
2168 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a null\dash terminated
2169 string containing the name of the formal value parameter
2170 as it appears in the source program. The template value
2171 parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
2172 the type of the parameterized value. Finally, the template
2173 value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value}
2174 attribute, whose value is the actual constant value of the value parameter for
2175 this instantiation as represented on the target architecture.