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
19 other data types. Each programming language has a set of base
20 types that are considered to be built into that language.}
22 A base type is represented by a debugging information entry
24 \livetarg{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}.
26 A \addtoindex{base type entry}
27 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is
28 a null\dash terminated string containing the name of the base type
29 as recognized by the programming language of the compilation
30 unit containing the base type entry.
32 A base type entry has a \livelink{chap:DWATencoding}{DW\-\_AT\-\_encoding} attribute describing
33 how the base type is encoded and is to be interpreted. The
34 value of this attribute is an integer constant. The set of
35 values and their meanings for the \livelink{chap:DWATencoding}{DW\-\_AT\-\_encoding} attribute
37 Figure \refersec{fig:encodingattributevalues}
41 may have a \livelink{chap:DWATendianity}{DW\-\_AT\-\_endianity} attribute
42 \addtoindexx{endianity attribute}
44 Section \refersec{chap:dataobjectentries}.
45 If omitted, the encoding assumes the representation that
46 is the default for the target architecture.
49 \hypertarget{chap:DWATbytesizedataobjectordatatypesize}
50 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute
51 \hypertarget{chap:DWATbitsizebasetypebitsize}
52 or a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
53 \addtoindex{bit size attribute}
54 whose integer constant value
55 (see Section \refersec{chap:byteandbitsizes})
56 is the amount of storage needed to hold
59 \textit{For example, the
60 \addtoindex{C} type int on a machine that uses 32\dash bit
61 integers is represented by a base type entry with a name
62 attribute whose value is “int”, an encoding attribute
63 whose value is \livelink{chap:DWATEsigned}{DW\-\_ATE\-\_signed}
64 and a byte size attribute whose value is 4.}
66 If the value of an object of the given type does not fully
67 occupy the storage described by a byte size attribute,
68 \hypertarget{chap:DWATdatabitoffsetbasetypebitlocation}
69 the base type entry may also have
70 \addtoindexx{bit size attribute}
72 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and a
73 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} attribute,
75 \addtoindexx{data bit offset attribute}
77 integer constant values (
78 see Section \refersec{chap:staticanddynamicvaluesofattributes}).
80 attribute describes the actual size in bits used to represent
81 values of the given type. The data bit offset attribute is the
82 offset in bits from the beginning of the containing storage to
83 the beginning of the value. Bits that are part of the offset
84 are padding. The data bit offset uses the bit numbering and
85 direction conventions that are appropriate to the current
87 target system to locate the beginning of the storage and
88 value. If this attribute is omitted a default data bit offset
92 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
94 \addtoindexx{bit offset attribute}
96 \addtoindexx{data bit offset attribute}
97 in DWARF Version 4 and
98 is also used for bit field members
99 (see Section \refersec{chap:datamemberentries}).
101 \hypertarget{chap:DWATbitoffsetbasetypebitlocation}
102 replaces the attribute
103 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
105 \addtoindexx{bit offset attribute (V3)}
106 types as defined in DWARF V3 and earlier. The earlier attribute
107 is defined in a manner suitable for bit field members on
108 big\dash endian architectures but which is wasteful for use on
109 little\dash endian architectures.}
111 \textit{The attribute \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} is
112 deprecated in DWARF Version
113 4 for use in base types, but implementations may continue to
114 support its use for compatibility.}
116 \textit{The DWARF Version 3 definition of these attributes is as follows.}
118 \begin{myindentpara}{1cm}
119 \textit{A base type entry has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
120 attribute, whose value
121 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
122 is the size in bytes of the storage unit
123 used to represent an object of the given type.}
125 \textit{If the value of an object of the given type does not fully
126 occupy the storage unit described by the byte size attribute,
127 the base type entry may have a
128 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
129 \addtoindexx{bit size attribute (V3)}
131 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} attribute, both of whose values
132 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
133 are integers. The bit size attribute describes the actual
134 size in bits used to represent a value of the given type.
135 The bit offset attribute describes the offset in bits of the
136 high order bit of a value of the given type from the high
137 order bit of the storage unit used to contain that value.}
140 \textit{In comparing DWARF Versions 3 and 4, note that DWARF V4
141 defines the following combinations of attributes:}
144 \item \textit{DW\-\_AT\-\_byte\-\_size}
145 \item \textit{DW\-\_AT\-\_bit\-\_size}
146 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
147 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
148 and optionally \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}}
150 DWARF V3 defines the following combinations:
151 % FIXME: the figure below interferes with the following
152 % bullet list, which looks horrible as a result.
154 \item \textit{DW\-\_AT\-\_byte\-\_size}
155 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
156 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
157 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}}
160 \begin{figure}[!here]
162 \begin{tabular}{lp{9cm}}
163 Name&Meaning\\ \hline
164 \livetarg{chap:DWATEaddress}{DW\-\_ATE\-\_address} & linear machine address (for
165 segmented addresses see
166 Section \refersec{chap:segmentedaddresses}) \\
167 \livetarg{chap:DWATEboolean}{DW\-\_ATE\-\_boolean}& true or false \\
169 \livetarg{chap:DWATEcomplexfloat}{DW\-\_ATE\-\_complex\-\_float}& complex binary
170 floating\dash point number \\
171 \livetarg{chap:DWATEfloat}{DW\-\_ATE\-\_float} & binary floating\dash point number \\
172 \livetarg{chap:DWATEimaginaryfloat}{DW\-\_ATE\-\_imaginary\-\_float}& imaginary binary
173 floating\dash point number \\
174 \livetarg{chap:DWATEsigned}{DW\-\_ATE\-\_signed}& signed binary integer \\
175 \livetarg{chap:DWATEsignedchar}{DW\-\_ATE\-\_signed\-\_char}& signed character \\
176 \livetarg{chap:DWATEunsigned}{DW\-\_ATE\-\_unsigned} & unsigned binary integer \\
177 \livetarg{chap:DWATEunsignedchar}{DW\-\_ATE\-\_unsigned\-\_char} & unsigned character \\
178 \livetarg{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} & packed decimal \\
179 \livetarg{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string}& numeric string \\
180 \livetarg{chap:DWATEedited}{DW\-\_ATE\-\_edited} & edited string \\
181 \livetarg{chap:DWATEsignedfixed}{DW\-\_ATE\-\_signed\-\_fixed} & signed fixed\dash point scaled integer \\
182 \livetarg{chap:DWATEunsignedfixed}{DW\-\_ATE\-\_unsigned\-\_fixed}& unsigned fixed\dash point scaled integer \\
183 \livetarg{chap:DWATEdecimalfloat}{DW\-\_ATE\-\_decimal\-\_float} & decimal floating\dash point number \\
184 \livetarg{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} & Unicode character \\
186 \caption{Encoding attribute values}
187 \label{fig:encodingattributevalues}
190 \textit{The \livelink{chap:DWATEdecimalfloat}{DW\-\_ATE\-\_decimal\-\_float} encoding is intended for
191 floating\dash point representations that have a power\dash of\dash ten
192 exponent, such as that specified in IEEE 754R.}
194 \textit{The \livelink{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} encoding is intended for Unicode string
195 encodings (see the Universal Character Set standard,
196 ISO/IEC 10646\dash 1:1993). For example, the
197 \addtoindex{C++} type char16\_t is
198 represented by a base type entry with a name attribute whose
199 value is “char16\_t”, an encoding attribute whose value
200 is \livelink{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} and a byte size attribute whose value is 2.}
203 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal}
205 \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string}
207 represent packed and unpacked decimal string numeric data
208 types, respectively, either of which may be
210 \addtoindexx{decimal scale attribute}
212 \addtoindexx{decimal sign attribute}
214 \addtoindexx{digit count attribute}
216 \hypertarget{chap:DWATdecimalsigndecimalsignrepresentation}
218 \hypertarget{chap:DWATdigitcountdigitcountforpackeddecimalornumericstringtype}
219 base types are used in combination with
220 \livelink{chap:DWATdecimalsign}{DW\-\_AT\-\_decimal\-\_sign},
221 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and
222 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale}
225 A \livelink{chap:DWATdecimalsign}{DW\-\_AT\-\_decimal\-\_sign} attribute
226 \addtoindexx{decimal sign attribute}
227 is an integer constant that
228 conveys the representation of the sign of the decimal type
229 (see Figure \refersec{fig:decimalsignattributevalues}).
230 Its integer constant value is interpreted to
231 mean that the type has a leading overpunch, trailing overpunch,
232 leading separate or trailing separate sign representation or,
233 alternatively, no sign at all.
236 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count}
238 \addtoindexx{digit count attribute}
239 is an integer constant
240 value that represents the number of digits in an instance of
243 \hypertarget{chap:DWATdecimalscaledecimalscalefactor}
244 The \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale}
246 \addtoindexx{decimal scale attribute}
247 is an integer constant value
248 that represents the exponent of the base ten scale factor to
249 be applied to an instance of the type. A scale of zero puts the
250 decimal point immediately to the right of the least significant
251 digit. Positive scale moves the decimal point to the right
252 and implies that additional zero digits on the right are not
253 stored in an instance of the type. Negative scale moves the
254 decimal point to the left; if the absolute value of the scale
255 is larger than the digit count, this implies additional zero
256 digits on the left are not stored in an instance of the type.
258 The \livelink{chap:DWATEedited}{DW\-\_ATE\-\_edited}
260 \hypertarget{chap:DWATpicturestringpicturestringfornumericstringtype}
261 type is used to represent an edited
262 numeric or alphanumeric data type. It is used in combination
263 with an \livelink{chap:DWATpicturestring}{DW\-\_AT\-\_picture\-\_string} attribute whose value is a
264 null\dash terminated string containing the target\dash dependent picture
265 string associated with the type.
267 If the edited base type entry describes an edited numeric
268 data type, the edited type entry has a \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and a
269 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attribute.
270 \addtoindexx{decimal scale attribute}
271 These attributes have the same
272 interpretation as described for the
273 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} and
274 \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base
275 types. If the edited type entry
276 describes an edited alphanumeric data type, the edited type
277 entry does not have these attributes.
280 \textit{The presence or absence of the \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and
281 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attributes
282 \addtoindexx{decimal scale attribute}
283 allows a debugger to easily
284 distinguish edited numeric from edited alphanumeric, although
285 in principle the digit count and scale are derivable by
286 interpreting the picture string.}
288 The \livelink{chap:DWATEsignedfixed}{DW\-\_ATE\-\_signed\-\_fixed} and \livelink{chap:DWATEunsignedfixed}{DW\-\_ATE\-\_unsigned\-\_fixed} entries
289 describe signed and unsigned fixed\dash point binary data types,
292 The fixed binary type entries have
293 \addtoindexx{digit count attribute}
295 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count}
296 attribute with the same interpretation as described for the
297 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} and \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base types.
299 For a data type with a decimal scale factor, the fixed binary
301 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attribute
302 \addtoindexx{decimal scale attribute}
304 interpretation as described for the
305 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal}
306 and \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base types.
308 \hypertarget{chap:DWATbinaryscalebinaryscalefactorforfixedpointtype}
309 For a data type with a binary scale factor, the fixed
310 \addtoindexx{binary scale attribute}
311 binary type entry has a
312 \livelink{chap:DWATbinaryscale}{DW\-\_AT\-\_binary\-\_scale} attribute.
314 \livelink{chap:DWATbinaryscale}{DW\-\_AT\-\_binary\-\_scale} attribute
315 is an integer constant value
316 that represents the exponent of the base two scale factor to
317 be applied to an instance of the type. Zero scale puts the
318 binary point immediately to the right of the least significant
319 bit. Positive scale moves the binary point to the right and
320 implies that additional zero bits on the right are not stored
321 in an instance of the type. Negative scale moves the binary
322 point to the left; if the absolute value of the scale is
323 larger than the number of bits, this implies additional zero
324 bits on the left are not stored in an instance of the type.
327 \hypertarget{chap:DWATsmallscalefactorforfixedpointtype}
328 a data type with a non\dash decimal and non\dash binary scale factor,
329 the fixed binary type entry has a
330 \livelink{chap:DWATsmall}{DW\-\_AT\-\_small} attribute which
332 \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} entry. The scale factor value
333 is interpreted in accordance with the value defined by the
334 \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} entry. The value represented is the product
335 of the integer value in memory and the associated constant
338 \textit{The \livelink{chap:DWATsmall}{DW\-\_AT\-\_small} attribute
339 is defined with the \addtoindex{Ada} small
344 \begin{tabular}{lp{9cm}}
345 Name&Meaning\\ \hline
346 \livetarg{chap:DWDSunsigned}{DW\-\_DS\-\_unsigned} & unsigned \\
347 \livetarg{chap:DWDSleadingoverpunch}{DW\-\_DS\-\_leading\-\_overpunch} & Sign
348 is encoded in the most significant digit in a target\dash dependent manner \\
349 \livetarg{chap:DWDStrailingoverpunch}{DW\-\_DS\-\_trailing\-\_overpunch} & Sign
350 is encoded in the least significant digit in a target\dash dependent manner \\
351 \livetarg{chap:DWDSleadingseparate}{DW\-\_DS\-\_leading\-\_separate}
352 & Decimal type: Sign is a ``+'' or ``-'' character
353 to the left of the most significant digit. \\
354 \livetarg{chap:DWDStrailingseparate}{DW\-\_DS\-\_trailing\-\_separate}
355 & Decimal type: Sign is a ``+'' or ``-'' character
356 to the right of the least significant digit. \\
357 &Packed decimal type: Least significant nibble contains
358 a target\dash dependent value
359 indicating positive or negative. \\
361 \caption{Decimal sign attribute values}
362 \label{fig:decimalsignattributevalues}
365 \section{Unspecified Type Entries}
366 \label{chap:unspecifiedtypeentries}
367 \addtoindexx{unspecified type entry}
368 \addtoindexx{void type|see{unspecified type entry}}
369 Some languages have constructs in which a type
370 may be left unspecified or the absence of a type
372 may be explicitly indicated.
374 An unspecified (implicit, unknown, ambiguous or nonexistent)
375 type is represented by a debugging information entry with
376 the tag \livetarg{chap:DWTAGunspecifiedtype}{DW\-\_TAG\-\_unspecified\-\_type}.
377 If a name has been given
378 to the type, then the corresponding unspecified type entry
379 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is
380 a null\dash terminated
381 string containing the name as it appears in the source program.
383 The interpretation of this debugging information entry is
384 intentionally left flexible to allow it to be interpreted
385 appropriately in different languages. For example, in
386 \addtoindex{C} and \addtoindex{C++}
387 the language implementation can provide an unspecified type
388 entry with the name “void” which can be referenced by the
389 type attribute of pointer types and typedef declarations for
391 % FIXME: the following reference was wrong in DW4 so DavidA guessed
393 Sections \refersec{chap:unspecifiedtypeentries} and
394 %The following reference was valid, so the following is probably correct.
395 Section \refersec{chap:typedefentries},
396 respectively). As another
397 example, in \addtoindex{Ada} such an unspecified type entry can be referred
398 to by the type attribute of an access type where the denoted
399 type is incomplete (the name is declared as a type but the
400 definition is deferred to a separate compilation unit).
402 \section{Type Modifier Entries}
403 \label{chap:typemodifierentries}
404 \addtoindexx{type modifier entry}
406 A base or user\dash defined type may be modified in different ways
407 in different languages. A type modifier is represented in
408 DWARF by a debugging information entry with one of the tags
410 Figure \refersec{fig:typemodifiertags}.
412 If a name has been given to the modified type in the source
413 program, then the corresponding modified type entry has
414 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null-terminated
415 string containing the modified type name as it appears in
418 Each of the type modifier entries has a
419 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute,
420 whose value is a reference to a debugging information entry
421 describing a base type, a user-defined type or another type
424 A modified type entry describing a pointer or reference
425 type (using \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type},
426 \livelink{chap:DWTAGreferencetype}{DW\-\_TAG\-\_reference\-\_type} or
427 \livelink{chap:DWTAGrvaluereferencetype}{DW\-\_TAG\-\_rvalue\-\_reference\-\_type})
428 % Another instance of no-good-place-to-put-index entry.
430 \addtoindexx{address class!attribute}
432 \hypertarget{chap:DWATadressclasspointerorreferencetypes}
434 \livelink{chap:DWATaddressclass}{DW\-\_AT\-\_address\-\_class}
435 attribute to describe how objects having the given pointer
436 or reference type ought to be dereferenced.
438 A modified type entry describing a shared qualified type
439 (using \livelink{chap:DWTAGsharedtype}{DW\-\_TAG\-\_shared\-\_type}) may have a
440 \livelink{chap:DWATcount}{DW\-\_AT\-\_count} attribute
441 \addtoindexx{count attribute}
442 whose value is a constant expressing the blocksize of the
443 type. If no count attribute is present, then the “infinite”
444 blocksize is assumed.
446 When multiple type modifiers are chained together to modify
447 a base or user-defined type, the tree ordering reflects the
448 semantics of the applicable lanuage rather than the textual
449 order in the source presentation.
453 \begin{tabular}{lp{9cm}}
454 Name&Meaning\\ \hline
455 \livetarg{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} & C or C++ const qualified type
456 \addtoindexx{const qualified type entry} \addtoindexx{C} \addtoindexx{C++} \\
457 \livetarg{chap:DWTAGpackedtype}{DW\-\_TAG\-\_packed\-\_type}& Pascal or Ada packed type
458 \addtoindexx{packed qualified type entry} \addtoindexx{Ada} \addtoindexx{Pascal} \\
459 \livetarg{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} & Pointer to an object of
460 the type being modified \addtoindexx{pointer qualified type entry} \\
461 \livetarg{chap:DWTAGreferencetype}{DW\-\_TAG\-\_reference\-\_type}& C++ (lvalue) reference
462 to an object of the type
463 being modified \addtoindexx{reference qualified type entry} \\
464 \livetarg{chap:DWTAGrestricttype}{DW\-\_TAG\-\_restrict\-\_type}&C restrict qualified type
465 \addtoindexx{restricted qualified type entry} \\
466 \livetarg{chap:DWTAGrvaluereferencetype}{DW\-\_TAG\-\_rvalue\-\_reference\-\_type} & C++
467 rvalue reference to an object of the type being modified
468 \addtoindexx{rvalue reference qualified type entry} \\
469 \livetarg{chap:DWTAGsharedtype}{DW\-\_TAG\-\_shared\-\_type}&UPC shared qualified type
470 \addtoindexx{shared qualified type entry} \\
471 \livetarg{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type}&C or C++ volatile qualified type
472 \addtoindex{volatile qualified type entry} \\
474 \caption{Type modifier tags}
475 \label{fig:typemodifiertags}
478 % The following prevents splitting the examples up.
479 % FIXME perhaps there is a better way. We could box the verbatim,
480 % see memman.pdf on verbatims.
482 \textit{As examples of how tye modifiers are ordered, take the following C
486 const unsigned char * volatile p;
487 which represents a volatile pointer to a constant
488 character. This is encoded in DWARF as:
489 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}(p) -->
490 \livelink{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type} -->
491 \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} -->
492 \livelink{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} -->
493 \livelink{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}(unsigned char)
495 volatile unsigned char * const restrict p;
496 on the other hand, represents a restricted constant
497 pointer to a volatile character. This is encoded as:
498 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}(p) -->
499 \livelink{chap:DWTAGrestricttype}{DW\-\_TAG\-\_restrict\-\_type} -->
500 \livelink{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} -->
501 \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} -->
502 \livelink{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type} -->
503 \livelink{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}(unsigned char)
507 \section{Typedef Entries}
508 \label{chap:typedefentries}
509 A named type that is defined in terms of another type
510 definition is represented by a debugging information entry with
511 the tag \livetarg{chap:DWTAGtypedef}{DW\-\_TAG\-\_typedef}.
512 The typedef entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
513 attribute whose value is a null-terminated string containing
514 the name of the typedef as it appears in the source program.
516 The typedef entry may also contain a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose
517 value is a reference to the type named by the typedef. If
518 the debugging information entry for a typedef represents
519 a declaration of the type that is not also a definition,
520 it does not contain a type attribute.
522 \textit{Depending on the language, a named type that is defined in
523 terms of another type may be called a type alias, a subtype,
524 a constrained type and other terms. A type name declared with
525 no defining details may be termed an incomplete, forward
526 or hidden type. While the DWARF \livelink{chap:DWTAGtypedef}{DW\-\_TAG\-\_typedef} entry was
527 originally inspired by the like named construct in
528 \addtoindex{C} and \addtoindex{C++},
529 it is broadly suitable for similar constructs (by whatever
530 source syntax) in other languages.}
532 \section{Array Type Entries}
533 \label{chap:arraytypeentries}
535 Many languages share the concept of an ``array,'' which is
536 \addtoindexx{array type entry}
537 a table of components of identical type.
539 An array type is represented by a debugging information entry
540 with the tag \livetarg{chap:DWTAGarraytype}{DW\-\_TAG\-\_array\-\_type}.
543 \addtoindexx{array!declaration of type}
544 the array type in the source program, then the corresponding
545 array type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a
546 null-terminated string containing the array type name as it
547 appears in the source program.
550 \hypertarget{chap:DWATorderingarrayrowcolumnordering}
551 array type entry describing a multidimensional array may
552 \addtoindexx{array!element ordering}
553 have a \livelink{chap:DWATordering}{DW\-\_AT\-\_ordering} attribute whose integer constant value is
554 interpreted to mean either row-major or column-major ordering
555 of array elements. The set of values and their meanings
556 for the ordering attribute are listed in
557 Figure \refersec{fig:arrayordering}.
559 ordering attribute is present, the default ordering for the
560 source language (which is indicated by the \livelink{chap:DWATlanguage}{DW\-\_AT\-\_language}
561 attribute of the enclosing compilation unit entry) is assumed.
564 \autorows[0pt]{c}{1}{l}{
565 \livetarg{chap:DWORDcolmajor}{DW\-\_ORD\-\_col\-\_major},
566 \livetarg{chap:DWORDrowmajor}{DW\-\_ORD\-\_row\-\_major}
568 \caption{Array ordering}\label{fig:arrayordering}
571 The ordering attribute may optionally appear on one-dimensional
572 arrays; it will be ignored.
574 An array type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
575 \addtoindexx{array!element type}
577 the type of each element of the array.
579 If the amount of storage allocated to hold each element of an
580 object of the given array type is different from the amount
581 of storage that is normally allocated to hold an individual
582 \hypertarget{chap:DWATbitstridearrayelementstrideofarraytype}
584 \hypertarget{chap:DWATbytestridearrayelementstrideofarraytype}
585 indicated element type, then the array type
586 \addtoindexx{bit stride attribute}
588 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
590 \addtoindexx{byte stride attribute}
591 a \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride}
593 \addtoindexx{bit stride attribute}
595 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
597 element of the array.
599 The array type entry may have either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a
600 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
601 (see Section \refersec{chap:byteandbitsizes}),
603 amount of storage needed to hold an instance of the array type.
605 \textit{If the size of the array can be determined statically at
606 compile time, this value can usually be computed by multiplying
607 the number of array elements by the size of each element.}
610 Each array dimension is described by a debugging information
611 entry with either the tag \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} or the tag
612 \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}. These entries are
614 array type entry and are ordered to reflect the appearance of
615 the dimensions in the source program (i.e., leftmost dimension
616 first, next to leftmost second, and so on).
618 In languages, such as C, in which there is no concept of
619 a “multidimensional array”, an array of arrays may
620 be represented by a debugging information entry for a
621 multidimensional array.
623 Other attributes especially applicable to arrays are
624 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated},
625 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} and
626 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location},
627 which are described in
628 Section \refersec{chap:dynamictypeproperties}.
629 For relevant examples,
631 Appendix \refersec{app:fortran90example}.
633 \section{ Structure, Union, Class and Interface Type Entries}
634 \label{chap:structureunionclassandinterfacetypeentries}
636 \textit{The languages
638 \addtoindex{C++}, and
639 \addtoindex{Pascal}, among others, allow the
640 programmer to define types that are collections of related
641 components. In \addtoindex{C} and \addtoindex{C++}, these collections are called
642 “structures.” In \addtoindex{Pascal}, they are called “records.”
643 The components may be of different types. The components are
644 called “members” in \addtoindex{C} and
645 \addtoindex{C++}, and “fields” in \addtoindex{Pascal}.}
647 \textit{The components of these collections each exist in their
648 own space in computer memory. The components of a C or C++
649 “union” all coexist in the same memory.}
651 \textit{\addtoindex{Pascal} and
652 other languages have a “discriminated union,”
653 \addtoindex{discriminated union|see {variant entry}}
654 also called a “variant record.” Here, selection of a
655 number of alternative substructures (“variants”) is based
656 on the value of a component that is not part of any of those
657 substructures (the “discriminant”).}
659 \textit{\addtoindex{C++} and
660 \addtoindex{Java} have the notion of ``class'', which is in some
661 ways similar to a structure. A class may have “member
662 functions” which are subroutines that are within the scope
663 of a class or structure.}
665 \textit{The \addtoindex{C++} notion of
666 structure is more general than in \addtoindex{C}, being
667 equivalent to a class with minor differences. Accordingly,
668 in the following discussion statements about
669 \addtoindex{C++} classes may
670 be understood to apply to \addtoindex{C++} structures as well.}
672 \subsection{Structure, Union and Class Type Entries}
673 \label{chap:structureunionandclasstypeentries}
676 Structure, union, and class types are represented by debugging
677 information entries with
678 the tags \livetarg{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type},
679 \livetarg{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type},
680 and \livetarg{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
681 respectively. If a name has been given to the structure,
682 union, or class in the source program, then the corresponding
683 structure type, union type, or class type entry has a
684 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
685 containing the type name as it appears in the source program.
687 The members of a structure, union, or class are represented
688 by debugging information entries that are owned by the
689 corresponding structure type, union type, or class type entry
690 and appear in the same order as the corresponding declarations
691 in the source program.
693 A structure type, union type or class type entry may have
694 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a
695 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
696 \hypertarget{chap:DWATbitsizedatamemberbitsize}
697 (see Section \refersec{chap:byteandbitsizes}),
698 whose value is the amount of storage needed
699 to hold an instance of the structure, union or class type,
700 including any padding. An incomplete structure, union or
701 class type is represented by a structure, union or class
702 entry that does not have a byte size attribute and that has
703 \addtoindexx{declaration attribute}
704 a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
706 If the complete declaration of a type has been placed in
707 \hypertarget{chap:DWATsignaturetypesignature}
709 (see Section \refersec{chap:separatetypeunitentries}),
711 declaration of that type in the compilation unit may provide
712 the unique 64\dash bit signature of the type using a \livelink{chap:DWATsignature}{DW\-\_AT\-\_signature}
715 If a structure, union or class entry represents the definition
716 of a structure, class or union member corresponding to a prior
717 incomplete structure, class or union, the entry may have a
718 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute whose value is a reference to
719 the debugging information entry representing that incomplete
722 Structure, union and class entries containing the
723 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute do not need to duplicate
724 information provided by the declaration entry referenced by the
725 specification attribute. In particular, such entries do not
726 need to contain an attribute for the name of the structure,
727 class or union they represent if such information is already
728 provided in the declaration.
730 \textit{For \addtoindex{C} and \addtoindex{C++},
732 \addtoindexx{data member|see {member entry (data)}}
733 member declarations occurring within
734 the declaration of a structure, union or class type are
735 considered to be “definitions” of those members, with
736 the exception of “static” data members, whose definitions
737 appear outside of the declaration of the enclosing structure,
738 union or class type. Function member declarations appearing
739 within a structure, union or class type declaration are
740 definitions only if the body of the function also appears
741 within the type declaration.}
743 If the definition for a given member of the structure, union
744 or class does not appear within the body of the declaration,
745 that member also has a debugging information entry describing
746 its definition. That latter entry has a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
747 attribute referencing the debugging information entry
748 owned by the body of the structure, union or class entry and
749 representing a non\dash defining declaration of the data, function
750 or type member. The referenced entry will not have information
751 about the location of that member (low and high pc attributes
752 for function members, location descriptions for data members)
753 and will have a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
755 \textit{Consider a nested class whose
756 definition occurs outside of the containing class definition, as in:}
765 \textit{The two different structs can be described in
766 different compilation units to
767 facilitate DWARF space compression
768 (see Appendix \refersec{app:usingcompilationunits}).}
770 \subsection{Interface Type Entries}
771 \label{chap:interfacetypeentries}
773 \textit{The \addtoindex{Java} language defines ``interface'' types.
775 in Java is similar to a \addtoindex{C++} or
776 \addtoindex{Java} class with only abstract
777 methods and constant data members.}
779 Interface types are represented by debugging information
781 tag \livetarg{chap:DWTAGinterfacetype}{DW\-\_TAG\-\_interface\-\_type}.
783 An interface type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
784 value is a null-terminated string containing the type name
785 as it appears in the source program.
787 The members of an interface are represented by debugging
788 information entries that are owned by the interface type
789 entry and that appear in the same order as the corresponding
790 declarations in the source program.
792 \subsection{Derived or Extended Structs, Classes and Interfaces}
793 \label{chap:derivedorextendedstructsclasesandinterfaces}
795 \textit{In \addtoindex{C++}, a class (or struct)
797 \addtoindexx{derived type (C++)|see{inheritance entry}}
798 be ``derived from'' or be a
799 ``subclass of'' another class. In Java, an interface may ``extend''
800 one or more other interfaces, and a class may ``extend'' another
801 class and/or ``implement'' one or more interfaces. All of these
802 relationships may be described using the following. Note that
803 in Java, the distinction between extends and implements is
804 implied by the entities at the two ends of the relationship.}
806 A class type or interface type entry that describes a
807 derived, extended or implementing class or interface owns
808 debugging information entries describing each of the classes
809 or interfaces it is derived from, extending or implementing,
810 respectively, ordered as they were in the source program. Each
812 tag \livetarg{chap:DWTAGinheritance}{DW\-\_TAG\-\_inheritance}.
814 An inheritance entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is
815 a reference to the debugging information entry describing the
816 class or interface from which the parent class or structure
817 of the inheritance entry is derived, extended or implementing.
819 An inheritance entry for a class that derives from or extends
820 \hypertarget{chap:DWATdatamemberlocationinheritedmemberlocation}
821 another class or struct also has
822 \addtoindexx{data member location attribute}
824 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
825 attribute, whose value describes the location of the beginning
826 of the inherited type relative to the beginning address of the
827 derived class. If that value is a constant, it is the offset
828 in bytes from the beginning of the class to the beginning of
829 the inherited type. Otherwise, the value must be a location
830 description. In this latter case, the beginning address of
831 the derived class is pushed on the expression stack before
832 the location description is evaluated and the result of the
833 evaluation is the location of the inherited type.
835 \textit{The interpretation of the value of this attribute for
836 inherited types is the same as the interpretation for data
838 (see Section \refersec{chap:datamemberentries}). }
841 \hypertarget{chap:DWATaccessibilitycppinheritedmembers}
843 \addtoindexx{accessibility attribute}
845 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
846 attribute. If no accessibility attribute
847 is present, private access is assumed for an entry of a class
848 and public access is assumed for an entry of an interface,
852 \hypertarget{chap:DWATvirtualityvirtualityofbaseclass}
853 the class referenced by the inheritance entry serves
854 as a \addtoindex{C++} virtual base class, the inheritance entry has a
855 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
857 \textit{For a \addtoindex{C++} virtual base, the
858 \addtoindex{data member location attribute}
859 will usually consist of a non-trivial location description.}
861 \subsection{Access Declarations}
862 \label{chap:accessdeclarations}
864 \textit{In \addtoindex{C++}, a derived class may contain access declarations that
865 \addtoindex{access declaration entry}
866 change the accessibility of individual class members from the
867 overall accessibility specified by the inheritance declaration.
868 A single access declaration may refer to a set of overloaded
871 If a derived class or structure contains access declarations,
872 each such declaration may be represented by a debugging
873 information entry with the tag
874 \livetarg{chap:DWTAGaccessdeclaration}{DW\-\_TAG\-\_access\-\_declaration}.
876 such entry is a child of the class or structure type entry.
878 An access declaration entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
879 value is a null-terminated string representing the name used
880 in the declaration in the source program, including any class
881 or structure qualifiers.
883 An access declaration entry
884 \hypertarget{chap:DWATaccessibilitycppbaseclasses}
887 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
888 attribute describing the declared accessibility of the named
895 Each ``friend'' declared by a structure, union or class
896 \hypertarget{chap:DWATfriendfriendrelationship}
897 type may be represented by a debugging information entry
898 that is a child of the structure, union or class type entry;
899 the friend entry has the
900 tag \livetarg{chap:DWTAGfriend}{DW\-\_TAG\-\_friend}.
902 A friend entry has a \livelink{chap:DWATfriend}{DW\-\_AT\-\_friend} attribute, whose value is
903 a reference to the debugging information entry describing
904 the declaration of the friend.
907 \subsection{Data Member Entries}
908 \label{chap:datamemberentries}
910 A data member (as opposed to a member function) is
911 represented by a debugging information entry with the
912 tag \livetarg{chap:DWTAGmember}{DW\-\_TAG\-\_member}.
913 The member entry for a named member has
914 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null-terminated
915 string containing the member name as it appears in the source
916 program. If the member entry describes an
917 \addtoindex{anonymous union},
919 name attribute is omitted or consists of a single zero byte.
921 The data member entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote
922 the type of that member.
924 A data member entry may
925 \addtoindexx{accessibility attribute}
927 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
928 attribute. If no accessibility attribute is present, private
929 access is assumed for an entry of a class and public access
930 is assumed for an entry of a structure, union, or interface.
933 \hypertarget{chap:DWATmutablemutablepropertyofmemberdata}
934 entry may have a \livelink{chap:DWATmutable}{DW\-\_AT\-\_mutable} attribute,
935 which is a \livelink{chap:flag}{flag}.
936 This attribute indicates whether the data
937 member was declared with the mutable storage class specifier.
939 The beginning of a data member
940 \addtoindex{beginning of a data member}
941 is described relative to
942 \addtoindexx{beginning of an object}
943 the beginning of the object in which it is immediately
944 contained. In general, the beginning is characterized by
945 both an address and a bit offset within the byte at that
946 address. When the storage for an entity includes all of
947 the bits in the beginning byte, the beginning bit offset is
950 Bit offsets in DWARF use the bit numbering and direction
951 conventions that are appropriate to the current language on
954 The member entry corresponding to a data member that is
955 \hypertarget{chap:DWATdatabitoffsetdatamemberbitlocation}
957 \hypertarget{chap:DWATdatamemberlocationdatamemberlocation}
958 in a structure, union or class may have either
959 \addtoindexx{data member location attribute}
961 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute or a
962 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
963 attribute. If the beginning of the data member is the same as
964 the beginning of the containing entity then neither attribute
967 For a \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute
969 \addtoindexx{data member location attribute}
972 \begin{enumerate}[1.]
974 \item If the value is an integer constant, it is the offset
975 in bytes from the beginning of the containing entity. If
976 the beginning of the containing entity has a non-zero bit
977 offset then the beginning of the member entry has that same
980 \item Otherwise, the value must be a location description. In
981 this case, the beginning of the containing entity must be byte
982 aligned. The beginning address is pushed on the DWARF stack
983 before the location description is evaluated; the result of
984 the evaluation is the base address of the member entry.
986 \textit{The push on the DWARF expression stack of the base address of
987 the containing construct is equivalent to execution of the
988 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} operation
989 (see Section \refersec{chap:stackoperations});
990 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} therefore
992 beginning of a location description for a data member. The
993 result of the evaluation is a location--either an address or
994 the name of a register, not an offset to the member.}
996 \textit{A \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
998 \addtoindexx{data member location attribute}
999 that has the form of a
1000 location description is not valid for a data member contained
1001 in an entity that is not byte aligned because DWARF operations
1002 do not allow for manipulating or computing bit offsets.}
1006 For a \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} attribute,
1007 the value is an integer constant
1008 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1009 that specifies the number of bits
1010 from the beginning of the containing entity to the beginning
1011 of the data member. This value must be greater than or equal
1012 to zero, but is not limited to less than the number of bits
1015 If the size of a data member is not the same as the size
1016 of the type given for the data member, the data member has
1017 \addtoindexx{bit size attribute}
1018 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1019 or a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute whose
1020 integer constant value
1021 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1023 of storage needed to hold the value of the data member.
1025 \textit{\addtoindex{C} and \addtoindex{C++}
1027 \addtoindex{bit fields}
1029 \addtoindexx{data bit offset}
1031 \addtoindexx{data bit size}
1033 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} and
1034 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attributes.}
1036 \textit{This Standard uses the following bit numbering and direction
1037 conventions in examples. These conventions are for illustrative
1038 purposes and other conventions may apply on particular
1043 \item \textit{For big\dash endian architectures, bit offsets are
1044 counted from high-order to low\dash order bits within a byte (or
1045 larger storage unit); in this case, the bit offset identifies
1046 the high\dash order bit of the object.}
1048 \item \textit{For little\dash endian architectures, bit offsets are
1049 counted from low\dash order to high\dash order bits within a byte (or
1050 larger storage unit); in this case, the bit offset identifies
1051 the low\dash order bit of the object.}
1055 \textit{In either case, the bit so identified is defined as the
1056 \addtoindexx{beginning of an object}
1057 beginning of the object.}
1059 \textit{For example, take one possible representation of the following
1060 \addtoindex{C} structure definition
1061 in both big\dash and little\dash endian byte orders:}
1072 \textit{The following diagrams show the structure layout
1073 and data bit offsets for example big\dash\ and little\dash endian
1074 architectures, respectively. Both diagrams show a structure
1075 that begins at address A and whose size is four bytes. Also,
1076 high order bits are to the left and low order bits are to
1079 \textit{Big\dash Endian Data Bit Offsets:}
1087 Addresses increase ->
1088 | A | A + 1 | A + 2 | A + 3 |
1090 Data bit offsets increase ->
1091 +---------------+---------------+---------------+---------------+
1092 |0 4|5 10|11 15|16 23|24 31|
1093 | j | k | m | n | <pad> |
1095 +---------------------------------------------------------------+
1098 \textit{Little\dash Endian Data Bit Offsets:}
1104 <- Addresses increase
1105 | A | A + 1 | A + 2 | A + 3 |
1107 <- Data bit offsets increase
1109 +---------------+---------------+---------------+---------------+
1110 |31 24|23 16|15 11|10 5|4 0|
1111 | <pad> | n | m | k | j |
1113 +---------------------------------------------------------------+
1117 \textit{Note that data member bit offsets in this example are the
1118 same for both big\dash\ and little\dash endian architectures even
1119 though the fields are allocated in different directions
1120 (high\dash order to low-order versus low\dash order to high\dash order);
1121 the bit naming conventions for memory and/or registers of
1122 the target architecture may or may not make this seem natural.}
1124 \textit{For a more extensive example showing nested and packed records
1126 Appendix \refersec{app:pascalexample}.}
1128 \textit{Attribute \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1129 is new in DWARF Version 4 and is also used for base types
1131 \refersec{chap:basetypeentries}).
1133 \livetarg{chap:DWATbitoffsetdatamemberbitlocation}
1134 attributes \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} and
1135 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} when used to
1136 identify the beginning of bit field data members as defined
1137 in DWARF V3 and earlier. The earlier attributes are defined
1138 in a manner suitable for bit field members on big-endian
1139 architectures but which is either awkward or incomplete for
1140 use on little-endian architectures.
1141 (\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} also
1142 has other uses that are not affected by this change.)}
1144 \textit{The \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1145 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1146 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1147 attribute combination is deprecated for data members in DWARF
1148 Version 4, but implementations may continue to support this
1149 use for compatibility.}
1151 \textit{The DWARF Version 3 definitions of these attributes are
1154 \begin{myindentpara}{1cm}
1155 \textit{If the data member entry describes a bit field, then that
1156 entry has the following attributes:}
1159 \item \textit{A \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1160 attribute whose value
1161 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1162 is the number of bytes that contain an instance of the
1163 bit field and any padding bits.}
1165 \textit{The byte size attribute may be omitted if the size of the
1166 object containing the bit field can be inferred from the type
1167 attribute of the data member containing the bit field.}
1169 \item \textit{A \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1171 \addtoindexx{bit offset attribute (V3)}
1173 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1174 is the number of bits to the left of the leftmost
1175 (most significant) bit of the bit field value.}
1177 \item \textit{A \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1179 \addtoindexx{bit size attribute (V3)}
1181 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1182 is the number of bits occupied by the bit field value.}
1186 \textit{The location description for a bit field calculates the address
1187 of an anonymous object containing the bit field. The address
1188 is relative to the structure, union, or class that most closely
1189 encloses the bit field declaration. The number of bytes in this
1190 anonymous object is the value of the byte size attribute of
1191 the bit field. The offset (in bits) from the most significant
1192 bit of the anonymous object to the most significant bit of
1193 the bit field is the value of the bit offset attribute.}
1197 \textit{Diagrams similar to the above that show the use of the
1198 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1199 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1200 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} attribute
1201 combination may be found in the DWARF Version 3 Standard.}
1203 \textit{In comparing DWARF Versions 3 and 4, note that DWARF V4
1204 defines the following combinations of attributes:}
1207 \item \textit{either \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1209 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1210 (to specify the beginning of the data member)}
1212 % FIXME: the indentation of the following line is suspect.
1213 \textit{optionally together with}
1215 \item \textit{either \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or
1216 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} (to
1217 specify the size of the data member)}
1221 \textit{DWARF V3 defines the following combinations}
1224 \item \textit{\livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1225 (to specify the beginning
1226 of the data member, except this specification is only partial
1227 in the case of a bit field) }
1229 % FIXME: the indentation of the following line is suspect.
1230 \textit{optionally together with}
1232 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1233 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1234 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1235 (to further specify the beginning of a bit field data member
1236 as well as specify the size of the data member) }
1239 \subsection{Member Function Entries}
1240 \label{chap:memberfunctionentries}
1242 A member function is represented by a debugging information
1243 entry with the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}.
1244 The member function entry
1245 may contain the same attributes and follows the same rules
1246 as non\dash member global subroutine entries
1247 (see Section \refersec{chap:subroutineandentrypointentries}).
1250 \addtoindexx{accessibility attribute}
1251 member function entry may have a
1252 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
1253 attribute. If no accessibility attribute is present, private
1254 access is assumed for an entry of a class and public access
1255 is assumed for an entry of a structure, union or interface.
1258 \hypertarget{chap:DWATvirtualityvirtualityoffunction}
1259 the member function entry describes a virtual function,
1260 then that entry has a
1261 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
1264 \hypertarget{chap:DWATexplicitexplicitpropertyofmemberfunction}
1265 the member function entry describes an explicit member
1266 function, then that entry has a
1267 \livelink{chap:DWATexplicit}{DW\-\_AT\-\_explicit} attribute.
1270 \hypertarget{chap:DWATvtableelemlocationvirtualfunctiontablevtableslot}
1271 entry for a virtual function also has a
1272 \livelink{chap:DWATvtableelemlocation}{DW\-\_AT\-\_vtable\-\_elem\-\_location}
1273 \addtoindexi{attribute}{vtable element location attribute} whose value contains
1274 a location description yielding the address of the slot
1275 for the function within the virtual function table for the
1276 enclosing class. The address of an object of the enclosing
1277 type is pushed onto the expression stack before the location
1278 description is evaluated.
1281 \hypertarget{chap:DWATobjectpointerobjectthisselfpointerofmemberfunction}
1282 the member function entry describes a non\dash static member
1283 function, then that entry has a \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer}
1285 whose value is a reference to the formal parameter entry
1286 that corresponds to the object for which the function is
1287 called. The name attribute of that formal parameter is defined
1288 by the current language (for example,
1289 this for \addtoindex{C++} or self
1290 for \addtoindex{Objective C}
1291 and some other languages). That parameter
1292 also has a \livelink{chap:DWATartificial}{DW\-\_AT\-\_artificial} attribute whose value is true.
1294 Conversely, if the member function entry describes a static
1295 member function, the entry does not have a
1296 \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer}
1299 If the member function entry describes a non\dash static member
1300 function that has a const\dash volatile qualification, then
1301 the entry describes a non\dash static member function whose
1302 object formal parameter has a type that has an equivalent
1303 const\dash volatile qualification.
1305 If a subroutine entry represents the defining declaration
1306 of a member function and that definition appears outside of
1307 the body of the enclosing class declaration, the subroutine
1308 entry has a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
1309 attribute, whose value is
1310 a reference to the debugging information entry representing
1311 the declaration of this function member. The referenced entry
1312 will be a child of some class (or structure) type entry.
1314 Subroutine entries containing the \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
1315 attribute do not need to duplicate information provided
1316 by the declaration entry referenced by the specification
1317 attribute. In particular, such entries do not need to contain
1318 attributes for the name or return type of the function member
1319 whose definition they represent.
1321 \subsection{Class Template Instantiations}
1322 \label{chap:classtemplateinstantiations}
1324 \textit{In \addtoindex{C++} a class template is a generic definition of a class
1325 type that may be instantiated when an instance of the class
1326 is declared or defined. The generic description of the
1327 class may include both parameterized types and parameterized
1328 constant values. DWARF does not represent the generic template
1329 definition, but does represent each instantiation.}
1331 A class template instantiation is represented by a
1332 debugging information entry with the tag \livelink{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
1333 \livelink{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type} or
1334 \livelink{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type}. With five
1335 exceptions, such an entry will contain the same attributes
1336 and have the same types of child entries as would an entry
1337 for a class type defined explicitly using the instantiation
1338 types and values. The exceptions are:
1340 \begin{enumerate}[1.]
1341 \item Each formal parameterized type declaration appearing in the
1342 template definition is represented by a debugging information
1344 \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}. Each
1345 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is
1346 a null\dash terminated string containing the name of the formal
1347 type parameter as it appears in the source program. The
1348 template type parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1349 describing the actual type by which the formal is replaced
1350 for this instantiation.
1352 \item Each formal parameterized value declaration appearing in the
1353 template definition is represented by a debugging information
1355 tag \livetarg{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}.
1357 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is
1358 a null\dash terminated string containing the name of the formal
1359 value parameter as it appears in the source program.
1361 \hypertarget{chap:DWATconstvaluetemplatevalueparameter}
1362 template value parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1363 describing the type of the parameterized value. Finally,
1364 the template value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value}
1365 attribute, whose value is the actual constant value of the
1366 value parameter for this instantiation as represented on the
1367 target architecture.
1369 \item The class type entry and each of its child entries references
1370 a template type parameter entry in any circumstance where the
1371 source template definition references a formal parameterized
1372 type. Similarly, the class type entry and each of its child
1373 entries references a template value parameter entry in any
1374 circumstance where the source template definition references
1375 a formal parameterized value.
1377 \item If the compiler has generated a special compilation unit to
1378 hold the template instantiation and that special compilation
1379 unit has a different name from the compilation unit containing
1380 the template definition, the name attribute for the debugging
1381 information entry representing the special compilation unit
1382 should be empty or omitted.
1384 \item If the class type entry representing the template
1385 instantiation or any of its child entries contains declaration
1386 coordinate attributes, those attributes should refer to
1387 the source for the template definition, not to any source
1388 generated artificially by the compiler.
1392 \subsection{Variant Entries}
1393 \label{chap:variantentries}
1395 A variant part of a structure is represented by a debugging
1396 information entry\addtoindexx{variant part entry} with the
1397 tag \livetarg{chap:DWTAGvariantpart}{DW\-\_TAG\-\_variant\-\_part} and is
1398 owned by the corresponding structure type entry.
1400 If the variant part has a discriminant, the discriminant is
1401 \hypertarget{chap:DWATdiscrdiscriminantofvariantpart}
1402 represented by a separate debugging information entry which
1403 is a child of the variant part entry. This entry has the form
1404 of a structure data member entry. The variant part entry will
1406 \livelink{chap:DWATdiscr}{DW\-\_AT\-\_discr} attribute whose value is a reference to
1407 the member entry for the discriminant.
1409 If the variant part does not have a discriminant (tag field),
1410 the variant part entry has a
1411 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to represent
1414 Each variant of a particular variant part is represented by
1415 \hypertarget{chap:DWATdiscrvaluediscriminantvalue}
1416 a debugging information entry\addtoindexx{variant entry} with the
1417 tag \livetarg{chap:DWTAGvariant}{DW\-\_TAG\-\_variant}
1418 and is a child of the variant part entry. The value that
1419 selects a given variant may be represented in one of three
1420 ways. The variant entry may have a
1421 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value} attribute
1422 whose value represents a single case label. The value of this
1423 attribute is encoded as an LEB128 number. The number is signed
1424 if the tag type for the variant part containing this variant
1425 is a signed type. The number is unsigned if the tag type is
1429 \hypertarget{chap:DWATdiscrlistlistofdiscriminantvalues}
1430 the variant entry may contain a
1431 \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list}
1432 attribute, whose value represents a list of discriminant
1433 values. This list is represented by any of the
1434 \livelink{chap:block}{block} forms and
1435 may contain a mixture of case labels and label ranges. Each
1436 item on the list is prefixed with a discriminant value
1437 descriptor that determines whether the list item represents
1438 a single label or a label range. A single case label is
1439 represented as an LEB128 number as defined above for the
1440 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value}
1441 attribute. A label range is represented by
1442 two LEB128 numbers, the low value of the range followed by the
1443 high value. Both values follow the rules for signedness just
1444 described. The discriminant value descriptor is an integer
1445 constant that may have one of the values given in
1446 Figure \refersec{fig:discriminantdescriptorvalues}.
1448 \begin{figure}[here]
1449 \autorows[0pt]{c}{1}{l}{
1450 \addtoindex{DW\-\_DSC\-\_label},
1451 \addtoindex{DW\-\_DSC\-\_range}
1453 \caption{Discriminant descriptor values}\label{fig:discriminantdescriptorvalues}
1456 If a variant entry has neither a \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value}
1457 attribute nor a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute, or if it has
1458 a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute with 0 size, the variant is a
1461 The components selected by a particular variant are represented
1462 by debugging information entries owned by the corresponding
1463 variant entry and appear in the same order as the corresponding
1464 declarations in the source program.
1466 \section{Condition Entries}
1467 \label{chap:conditionentries}
1469 \textit{COBOL has the notion of a ``level\dash 88 condition'' that
1470 associates a data item, called the conditional variable, with
1471 a set of one or more constant values and/or value ranges.
1472 Semantically, the condition is ‛true’ if the conditional
1473 variable's value matches any of the described constants,
1474 and the condition is ‛false’ otherwise.}
1476 The \livetarg{chap:DWTAGcondition}{DW\-\_TAG\-\_condition}
1477 debugging information entry\addtoindexx{condition entry}
1479 logical condition that tests whether a given data item’s
1480 value matches one of a set of constant values. If a name
1481 has been given to the condition, the condition entry has a
1482 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
1483 giving the condition name as it appears in the source program.
1485 The condition entry's parent entry describes the conditional
1486 variable; normally this will be a \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable},
1487 \livelink{chap:DWTAGmember}{DW\-\_TAG\-\_member} or
1488 \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter} entry. If the parent
1489 entry has an array type, the condition can test any individual
1490 element, but not the array as a whole. The condition entry
1491 implicitly specifies a “comparison type” that is the
1492 type of an array element if the parent has an array type;
1493 otherwise it is the type of the parent entry.
1495 The condition entry owns \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} and/or
1496 \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} entries that describe the constant
1497 values associated with the condition. If any child entry has
1498 a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute, that attribute should describe a type
1499 compatible with the comparison type (according to the source
1500 language); otherwise the child’s type is the same as the
1503 \textit{For conditional variables with alphanumeric types, COBOL
1504 permits a source program to provide ranges of alphanumeric
1505 constants in the condition. Normally a subrange type entry
1506 does not describe ranges of strings; however, this can be
1507 represented using bounds attributes that are references to
1508 constant entries describing strings. A subrange type entry may
1509 refer to constant entries that are siblings of the subrange
1513 \section{Enumeration Type Entries}
1514 \label{chap:enumerationtypeentries}
1516 \textit{An “enumeration type” is a scalar that can assume one of
1517 a fixed number of symbolic values.}
1519 An enumeration type is represented by a debugging information
1521 \livetarg{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}.
1523 If a name has been given to the enumeration type in the source
1524 program, then the corresponding enumeration type entry has
1525 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated
1526 string containing the enumeration type name as it appears
1527 in the source program. This entry also has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1528 attribute whose integer constant value is the number of bytes
1529 required to hold an instance of the enumeration.
1531 The enumeration type entry may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1532 which refers to the underlying data type used to implement
1535 If an enumeration type has type safe semantics such that
1537 \begin{enumerate}[1.]
1538 \item Enumerators are contained in the scope of the enumeration type, and/or
1540 \item Enumerators are not implicitly converted to another type
1543 then the enumeration type entry may have a \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}
1544 attribute, which is a \livelink{chap:flag}{flag}.
1545 In a language that offers only
1546 one kind of enumeration declaration, this attribute is not
1549 \textit{In \addtoindex{C} or \addtoindex{C++},
1550 the underlying type will be the appropriate
1551 integral type determined by the compiler from the properties of
1552 \hypertarget{chap:DWATenumclasstypesafeenumerationdefinition}
1553 the enumeration literal values. A \addtoindex{C++} type declaration written
1554 using enum class declares a strongly typed enumeration and
1555 is represented using \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}
1556 in combination with \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}.}
1558 Each enumeration literal is represented by a debugging
1559 information entry with the
1560 tag \livetarg{chap:DWTAGenumerator}{DW\-\_TAG\-\_enumerator}.
1562 such entry is a child of the enumeration type entry, and the
1563 enumerator entries appear in the same order as the declarations
1564 of the enumeration literals in the source program.
1566 Each enumerator entry has a
1567 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
1568 value is a null\dash terminated string containing the name of the
1569 \hypertarget{chap:DWATconstvalueenumerationliteralvalue}
1570 enumeration literal as it appears in the source program.
1571 Each enumerator entry also has a
1572 \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value} attribute,
1573 whose value is the actual numeric value of the enumerator as
1574 represented on the target system.
1577 If the enumeration type occurs as the description of a
1578 dimension of an array type, and the stride for that dimension
1579 \hypertarget{chap:DWATbytestrideenumerationstridedimensionofarraytype}
1580 is different than what would otherwise be determined, then
1581 \hypertarget{chap:DWATbitstrideenumerationstridedimensionofarraytype}
1582 the enumeration type entry has either a
1583 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1584 or \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1585 \addtoindexx{bit stride attribute}
1586 which specifies the separation
1587 between successive elements along the dimension as described
1589 Section \refersec{chap:visibilityofdeclarations}.
1591 \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1592 \addtoindexx{bit stride attribute}
1593 is interpreted as bits and the value of
1594 \addtoindexx{byte stride attribute}
1596 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1597 attribute is interpreted as bytes.
1600 \section{Subroutine Type Entries}
1601 \label{chap:subroutinetypeentries}
1603 It is possible in \addtoindex{C}
1604 to declare pointers to subroutines
1605 that return a value of a specific type. In both
1606 \addtoindex{C} and \addtoindex{C++},
1607 it is possible to declare pointers to subroutines that not
1608 only return a value of a specific type, but accept only
1609 arguments of specific types. The type of such pointers would
1610 be described with a ``pointer to'' modifier applied to a
1611 user\dash defined type.
1613 A subroutine type is represented by a debugging information
1615 tag \livetarg{chap:DWTAGsubroutinetype}{DW\-\_TAG\-\_subroutine\-\_type}.
1617 been given to the subroutine type in the source program,
1618 then the corresponding subroutine type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
1619 attribute whose value is a null\dash terminated string containing
1620 the subroutine type name as it appears in the source program.
1622 If the subroutine type describes a function that returns
1623 a value, then the subroutine type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
1624 attribute to denote the type returned by the subroutine. If
1625 the types of the arguments are necessary to describe the
1626 subroutine type, then the corresponding subroutine type
1627 entry owns debugging information entries that describe the
1628 arguments. These debugging information entries appear in the
1629 order that the corresponding argument types appear in the
1632 In \addtoindex{C} there
1633 is a difference between the types of functions
1634 declared using function prototype style declarations and
1635 those declared using non\dash prototype declarations.
1638 \hypertarget{chap:DWATprototypedsubroutineprototype}
1639 subroutine entry declared with a function prototype style
1640 declaration may have a
1641 \livelink{chap:DWATprototyped}{DW\-\_AT\-\_prototyped} attribute, which is
1642 a \livelink{chap:flag}{flag}.
1644 Each debugging information entry owned by a subroutine
1645 type entry has a tag whose value has one of two possible
1648 \begin{enumerate}[1.]
1649 \item The formal parameters of a parameter list (that have a
1650 specific type) are represented by a debugging information entry
1651 with the tag \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter}.
1652 Each formal parameter
1653 entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute that refers to the type of
1654 the formal parameter.
1656 \item The unspecified parameters of a variable parameter list
1657 \addtoindexx{unspecified parameters entry}
1659 \addtoindexx{... parameters|see{unspecified parameters entry}}
1660 represented by a debugging information entry with the
1661 tag \livelink{chap:DWTAGunspecifiedparameters}{DW\-\_TAG\-\_unspecified\-\_parameters}.
1666 \section{String Type Entries}
1667 \label{chap:stringtypeentries}
1670 A ``string'' is a sequence of characters that have specific
1671 semantics and operations that separate them from arrays of
1672 characters. Fortran is one of the languages that has a string
1673 type. Note that ``string'' in this context refers to a target
1674 machine concept, not the class string as used in this document
1675 (except for the name attribute).
1677 A string type is represented by a debugging information entry
1678 with the tag \livetarg{chap:DWTAGstringtype}{DW\-\_TAG\-\_string\-\_type}.
1679 If a name has been given to
1680 the string type in the source program, then the corresponding
1681 string type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is
1682 a null\dash terminated string containing the string type name as
1683 it appears in the source program.
1686 \hypertarget{chap:DWATstringlengthstringlengthofstringtype}
1687 string type entry may have a
1688 \livelink{chap:DWATstringlength}{DW\-\_AT\-\_string\-\_length} attribute
1689 whose value is a location description yielding the location
1690 where the length of the string is stored in the program. The
1691 string type entry may also have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute
1692 or \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
1693 (see Section \refersec{chap:byteandbitsizes})
1694 is the size of the data to be retrieved from the location
1695 referenced by the string length attribute. If no (byte or bit)
1696 size attribute is present, the size of the data to be retrieved
1697 is the same as the size of an address on the target machine.
1699 If no string length attribute is present, the string type
1700 entry may have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or
1701 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1702 attribute, whose value
1703 (see Section \refersec{chap:byteandbitsizes})
1705 storage needed to hold a value of the string type.
1708 \section{Set Type Entries}
1709 \label{chap:settypeentries}
1711 \textit{Pascal provides the concept of a “set,” which represents
1712 a group of values of ordinal type.}
1714 A set is represented by a debugging information entry with
1715 the tag \livetarg{chap:DWTAGsettype}{DW\-\_TAG\-\_set\-\_type}.
1716 If a name has been given to the
1717 set type, then the set type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1718 whose value is a null\dash terminated string containing the
1719 set type name as it appears in the source program.
1721 The set type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote the
1722 type of an element of the set.
1724 If the amount of storage allocated to hold each element of an
1725 object of the given set type is different from the amount of
1726 storage that is normally allocated to hold an individual object
1727 of the indicated element type, then the set type entry has
1728 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute, or
1729 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
1730 whose value (see Section \refersec{chap:byteandbitsizes}) is
1731 the amount of storage needed to hold a value of the set type.
1734 \section{Subrange Type Entries}
1735 \label{chap:subrangetypeentries}
1737 \textit{Several languages support the concept of a ``subrange''
1738 type object. These objects can represent a subset of the
1739 values that an object of the basis type for the subrange can
1740 represent. Subrange type entries may also be used to represent
1741 the bounds of array dimensions.}
1743 A subrange type is represented by a debugging information
1745 tag \livetarg{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type}.
1747 given to the subrange type, then the subrange type entry
1748 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated
1749 string containing the subrange type name as it appears in
1752 The subrange entry may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to describe
1753 the type of object, called the basis type, of whose values
1754 this subrange is a subset.
1756 If the amount of storage allocated to hold each element of an
1757 object of the given subrange type is different from the amount
1758 of storage that is normally allocated to hold an individual
1759 object of the indicated element type, then the subrange
1760 type entry has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or
1761 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1762 attribute, whose value
1763 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1765 storage needed to hold a value of the subrange type.
1768 \hypertarget{chap:DWATthreadsscaledupcarrayboundthreadsscalfactor}
1769 subrange entry may have a \livelink{chap:DWATthreadsscaled}{DW\-\_AT\-\_threads\-\_scaled} attribute,
1770 which is a \livelink{chap:flag}{flag}.
1771 If present, this attribute indicates whether
1772 this subrange represents a UPC array bound which is scaled
1773 by the runtime THREADS value (the number of UPC threads in
1774 this execution of the program).
1776 \textit{This allows the representation of a UPC shared array such as}
1779 int shared foo[34*THREADS][10][20];
1783 \hypertarget{chap:DWATlowerboundlowerboundofsubrange}
1785 \hypertarget{chap:DWATupperboundupperboundofsubrange}
1786 entry may have the attributes
1787 \livelink{chap:DWATlowerbound}{DW\-\_AT\-\_lower\-\_bound}
1788 and \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound} to specify, respectively, the lower
1789 and upper bound values of the subrange. The
1790 \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound}
1792 \hypertarget{chap:DWATcountelementsofsubrangetype}
1794 % FIXME: The following matches DWARF4: odd as there is no default count.
1795 \addtoindexx{count attribute!default}
1797 \addtoindexx{count attribute}
1799 \livelink{chap:DWATcount}{DW\-\_AT\-\_count} attribute,
1801 value describes the number of elements in the subrange rather
1802 than the value of the last element. The value of each of
1803 these attributes is determined as described in
1804 Section \refersec{chap:staticanddynamicvaluesofattributes}.
1806 If the lower bound value is missing, the value is assumed to
1807 be a language\dash dependent default constant. The default lower
1809 \addtoindex{C}, \addtoindex{C++},
1812 \addtoindex{Objective C},
1813 \addtoindex{Objective C++},
1814 \addtoindex{Python}, and
1816 The default lower bound is 1 for
1817 \addtoindex{Ada}, \addtoindex{COBOL},
1818 \addtoindex{Fortran},
1819 \addtoindex{Modula}\dash 2,
1820 \addtoindex{Pascal} and
1823 \textit{No other default lower bound values are currently defined.}
1825 If the upper bound and count are missing, then the upper bound value is
1828 If the subrange entry has no type attribute describing the
1829 basis type, the basis type is assumed to be the same as
1830 the object described by the lower bound attribute (if it
1831 references an object). If there is no lower bound attribute,
1832 or that attribute does not reference an object, the basis type
1833 is the type of the upper bound or \addtoindex{count attribute}
1835 of them references an object). If there is no upper bound or
1836 count attribute, or neither references an object, the type is
1837 assumed to be the same type, in the source language of the
1838 compilation unit containing the subrange entry, as a signed
1839 integer with the same size as an address on the target machine.
1841 If the subrange type occurs as the description of a dimension
1842 of an array type, and the stride for that dimension is
1843 \hypertarget{chap:DWATbytestridesubrangestridedimensionofarraytype}
1844 different than what would otherwise be determined, then
1845 \hypertarget{chap:DWATbitstridesubrangestridedimensionofarraytype}
1846 the subrange type entry has either
1847 \addtoindexx{byte stride attribute}
1849 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride} or
1850 \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1851 \addtoindexx{bit stride attribute}
1852 which specifies the separation
1853 between successive elements along the dimension as described
1855 Section \refersec{chap:byteandbitsizes}.
1857 \textit{Note that the stride can be negative.}
1859 \section{Pointer to Member Type Entries}
1860 \label{chap:pointertomembertypeentries}
1862 \textit{In \addtoindex{C++}, a pointer to a data or function member of a class or
1863 structure is a unique type.}
1865 A debugging information entry representing the type of an
1866 object that is a pointer to a structure or class member has
1867 the tag \livetarg{chap:DWTAGptrtomembertype}{DW\-\_TAG\-\_ptr\-\_to\-\_member\-\_type}.
1869 If the pointer to member type has a name, the pointer to
1870 member entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a
1871 null\dash terminated string containing the type name as it appears
1872 in the source program.
1874 The pointer to member entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to
1875 describe the type of the class or structure member to which
1876 objects of this type may point.
1878 The pointer to member entry also
1879 \hypertarget{chap:DWATcontainingtypecontainingtypeofpointertomembertype}
1881 \livelink{chap:DWATcontainingtype}{DW\-\_AT\-\_containing\-\_type}
1882 attribute, whose value is a reference to a debugging
1883 information entry for the class or structure to whose members
1884 objects of this type may point.
1887 \hypertarget{chap:DWATuselocationmemberlocationforpointertomembertype}
1888 pointer to member entry has a
1889 \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} attribute
1890 whose value is a location description that computes the
1891 address of the member of the class to which the pointer to
1892 member entry points.
1894 \textit{The method used to find the address of a given member of a
1895 class or structure is common to any instance of that class
1896 or structure and to any instance of the pointer or member
1897 type. The method is thus associated with the type entry,
1898 rather than with each instance of the type.}
1900 The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is used in conjunction
1901 with the location descriptions for a particular object of the
1902 given pointer to member type and for a particular structure or
1903 class instance. The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location}
1904 attribute expects two values to be
1905 \addtoindexi{pushed}{address!implicit push for member operator}
1906 onto the DWARF expression stack before
1907 the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is evaluated.
1909 \addtoindexi{pushed}{address!implicit push for member operator}
1910 is the value of the pointer to member object
1911 itself. The second value
1912 \addtoindexi{pushed}{address!implicit push for member operator}
1913 is the base address of the
1914 entire structure or union instance containing the member
1915 whose address is being calculated.
1917 \textit{For an expression such as}
1922 % FIXME: object and mbr\_ptr should be distinguished from italic. See DW4.
1923 \textit{where mbr\_ptr has some pointer to member type, a debugger should:}
1925 \textit{1. Push the value of mbr\_ptr onto the DWARF expression stack.}
1927 \textit{2. Push the base address of object onto the DWARF expression stack.}
1929 \textit{3. Evaluate the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description
1930 given in the type of mbr\_ptr.}
1932 \section{File Type Entries}
1933 \label{chap:filetypeentries}
1935 \textit{Some languages, such as Pascal, provide a data type to represent
1938 A file type is represented by a debugging information entry
1940 \livetarg{chap:DWTAGfiletype}{DW\-\_TAG\-\_file\-\_type}.
1941 If the file type has a name,
1942 the file type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value
1943 is a null\dash terminated string containing the type name as it
1944 appears in the source program.
1946 The file type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
1947 the type of the objects contained in the file.
1949 The file type entry also
1950 \addtoindexx{byte size}
1952 \addtoindexx{bit size}
1954 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or
1955 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
1956 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1957 is the amount of storage need to hold a value of the file type.
1959 \section{Dynamic Type Properties}
1960 \label{chap:dynamictypeproperties}
1961 \subsection{Data Location}
1962 \label{chap:datalocation}
1964 \textit{Some languages may represent objects using descriptors to hold
1965 information, including a location and/or run\dash time parameters,
1966 about the data that represents the value for that object.}
1968 \hypertarget{chap:DWATdatalocationindirectiontoactualdata}
1969 The \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
1970 attribute may be used with any
1971 type that provides one or more levels of hidden indirection
1972 and/or run\dash time parameters in its representation. Its value
1973 is a location description. The result of evaluating this
1974 description yields the location of the data for an object.
1975 When this attribute is omitted, the address of the data is
1976 the same as the address of the object.
1978 \textit{This location description will typically begin with
1979 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address}
1980 which loads the address of the
1981 object which can then serve as a descriptor in subsequent
1982 calculation. For an example using
1983 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
1984 for a Fortran 90 array, see
1985 Appendix \refersec{app:fortran90example}.}
1987 \subsection{Allocation and Association Status}
1988 \label{chap:allocationandassociationstatus}
1990 \textit{Some languages, such as Fortran 90, provide types whose values
1991 may be dynamically allocated or associated with a variable
1992 under explicit program control.}
1994 \hypertarget{chap:DWATallocatedallocationstatusoftypes}
1996 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated}
1998 \addtoindexx{allocated attribute}
1999 may optionally be used with any
2000 type for which objects of the type can be explicitly allocated
2001 and deallocated. The presence of the attribute indicates that
2002 objects of the type are allocatable and deallocatable. The
2003 integer value of the attribute (see below) specifies whether
2004 an object of the type is
2005 currently allocated or not.
2007 \hypertarget{chap:DWATassociatedassociationstatusoftypes}
2009 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute
2011 \addtoindexx{associated attribute}
2012 optionally be used with
2013 any type for which objects of the type can be dynamically
2014 associated with other objects. The presence of the attribute
2015 indicates that objects of the type can be associated. The
2016 integer value of the attribute (see below) indicates whether
2017 an object of the type is currently associated or not.
2019 While these attributes are defined specifically with Fortran
2020 90 ALLOCATABLE and POINTER types in mind, usage is not limited
2021 to just that language.
2023 The value of these attributes is determined as described in
2024 Section \refersec{chap:staticanddynamicvaluesofattributes}.
2026 A non\dash zero value is interpreted as allocated or associated,
2027 and zero is interpreted as not allocated or not associated.
2029 \textit{For \addtoindex{Fortran} 90,
2030 if the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated}
2031 attribute is present,
2032 the type has the POINTER property where either the parent
2033 variable is never associated with a dynamic object or the
2034 implementation does not track whether the associated object
2035 is static or dynamic. If the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute is
2036 present and the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute is not, the type
2037 has the ALLOCATABLE property. If both attributes are present,
2038 then the type should be assumed to have the POINTER property
2039 (and not ALLOCATABLE); the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute may then
2040 be used to indicate that the association status of the object
2041 resulted from execution of an ALLOCATE statement rather than
2042 pointer assignment.}
2044 \textit{For examples using
2045 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} for \addtoindex{Ada} and
2046 \addtoindex{Fortran} 90
2048 see Appendix \refersec{app:aggregateexamples}.}
2052 \section{Template Alias Entries}
2053 \label{chap:templatealiasentries}
2055 A type named using a template alias is represented
2056 by a debugging information entry with the tag
2057 \livetarg{chap:DWTAGtemplatealias}{DW\-\_TAG\-\_template\-\_alias}.
2058 The template alias entry has a
2059 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
2060 containing the name of the template alias as it appears in
2061 the source program. The template alias entry also contains a
2062 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is a reference to the type
2063 named by the template alias. The template alias entry has
2064 the following child entries:
2066 \begin{enumerate}[1.]
2067 \item Each formal parameterized type declaration appearing
2068 in the template alias declaration is represented
2069 by a debugging information entry with the tag
2070 \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}.
2071 Each such entry may have
2072 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a null\dash terminated
2073 string containing the name of the formal type parameter as it
2074 appears in the source program. The template type parameter
2075 entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing the actual
2076 type by which the formal is replaced for this instantiation.
2078 \item Each formal parameterized value declaration
2079 appearing in the template alias declaration is
2080 represented by a debugging information entry with the tag
2081 \livelink{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}.
2082 Each such entry may have
2083 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a null\dash terminated
2084 string containing the name of the formal value parameter
2085 as it appears in the source program. The template value
2086 parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
2087 the type of the parameterized value. Finally, the template
2088 value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value}
2089 attribute, whose value is the actual constant value of the value parameter for
2090 this instantiation as represented on the target architecture.