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,
74 both of whose values are
75 integer constant values (
76 see Section \refersec{chap:staticanddynamicvaluesofattributes}).
78 attribute describes the actual size in bits used to represent
79 values of the given type. The data bit offset attribute is the
80 offset in bits from the beginning of the containing storage to
81 the beginning of the value. Bits that are part of the offset
82 are padding. The data bit offset uses the bit numbering and
83 direction conventions that are appropriate to the current
85 target system to locate the beginning of the storage and
86 value. If this attribute is omitted a default data bit offset
90 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
92 \addtoindexx{bit offset attribute}
93 new in DWARF Version 4 and
94 is also used for bit field members
95 (see Section \refersec{chap:datamemberentries}).
97 \hypertarget{chap:DWATbitoffsetbasetypebitlocation}
98 replaces the attribute
99 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
101 \addtoindexx{bit offset attribute (V3)}
102 types as defined in DWARF V3 and earlier. The earlier attribute
103 is defined in a manner suitable for bit field members on
104 big\dash endian architectures but which is wasteful for use on
105 little\dash endian architectures.}
107 \textit{The attribute \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} is
108 deprecated in DWARF Version
109 4 for use in base types, but implementations may continue to
110 support its use for compatibility.}
112 \textit{The DWARF Version 3 definition of these attributes is as follows.}
114 \begin{myindentpara}{1cm}
115 \textit{A base type entry has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
116 attribute, whose value
117 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
118 is the size in bytes of the storage unit
119 used to represent an object of the given type.}
121 \textit{If the value of an object of the given type does not fully
122 occupy the storage unit described by the byte size attribute,
123 the base type entry may have a
124 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
125 \addtoindexx{bit size attribute (V3)}
127 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} attribute, both of whose values
128 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
129 are integers. The bit size attribute describes the actual
130 size in bits used to represent a value of the given type.
131 The bit offset attribute describes the offset in bits of the
132 high order bit of a value of the given type from the high
133 order bit of the storage unit used to contain that value.}
136 \textit{In comparing DWARF Versions 3 and 4, note that DWARF V4
137 defines the following combinations of attributes:}
140 \item \textit{DW\-\_AT\-\_byte\-\_size}
141 \item \textit{DW\-\_AT\-\_bit\-\_size}
142 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
143 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
144 and optionally \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}}
146 DWARF V3 defines the following combinations:
147 % FIXME: the figure below interferes with the following
148 % bullet list, which looks horrible as a result.
150 \item \textit{DW\-\_AT\-\_byte\-\_size}
151 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
152 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
153 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}}
156 \begin{figure}[!here]
158 \begin{tabular}{lp{9cm}}
159 Name&Meaning\\ \hline
160 \livetarg{chap:DWATEaddress}{DW\-\_ATE\-\_address} & linear machine address (for
161 segmented addresses see
162 Section \refersec{chap:segmentedaddresses}) \\
163 \livetarg{chap:DWATEboolean}{DW\-\_ATE\-\_boolean}& true or false \\
165 \livetarg{chap:DWATEcomplexfloat}{DW\-\_ATE\-\_complex\-\_float}& complex binary
166 floating\dash point number \\
167 \livetarg{chap:DWATEfloat}{DW\-\_ATE\-\_float} & binary floating\dash point number \\
168 \livetarg{chap:DWATEimaginaryfloat}{DW\-\_ATE\-\_imaginary\-\_float}& imaginary binary
169 floating\dash point number \\
170 \livetarg{chap:DWATEsigned}{DW\-\_ATE\-\_signed}& signed binary integer \\
171 \livetarg{chap:DWATEsignedchar}{DW\-\_ATE\-\_signed\-\_char}& signed character \\
172 \livetarg{chap:DWATEunsigned}{DW\-\_ATE\-\_unsigned} & unsigned binary integer \\
173 \livetarg{chap:DWATEunsignedchar}{DW\-\_ATE\-\_unsigned\-\_char} & unsigned character \\
174 \livetarg{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} & packed decimal \\
175 \livetarg{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string}& numeric string \\
176 \livetarg{chap:DWATEedited}{DW\-\_ATE\-\_edited} & edited string \\
177 \livetarg{chap:DWATEsignedfixed}{DW\-\_ATE\-\_signed\-\_fixed} & signed fixed\dash point scaled integer \\
178 \livetarg{chap:DWATEunsignedfixed}{DW\-\_ATE\-\_unsigned\-\_fixed}& unsigned fixed\dash point scaled integer \\
179 \livetarg{chap:DWATEdecimalfloat}{DW\-\_ATE\-\_decimal\-\_float} & decimal floating\dash point number \\
180 \livetarg{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} & Unicode character \\
182 \caption{Encoding attribute values}
183 \label{fig:encodingattributevalues}
186 \textit{The \livelink{chap:DWATEdecimalfloat}{DW\-\_ATE\-\_decimal\-\_float} encoding is intended for
187 floating\dash point representations that have a power\dash of\dash ten
188 exponent, such as that specified in IEEE 754R.}
190 \textit{The \livelink{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} encoding is intended for Unicode string
191 encodings (see the Universal Character Set standard,
192 ISO/IEC 10646\dash 1:1993). For example, the
193 \addtoindex{C++} type char16\_t is
194 represented by a base type entry with a name attribute whose
195 value is “char16\_t”, an encoding attribute whose value
196 is \livelink{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} and a byte size attribute whose value is 2.}
199 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal}
201 \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string}
203 represent packed and unpacked decimal string numeric data
204 types, respectively, either of which may be either signed
206 \hypertarget{chap:DWATdecimalsigndecimalsignrepresentation}
208 \hypertarget{chap:DWATdigitcountdigitcountforpackeddecimalornumericstringtype}
209 base types are used in combination with
210 \livelink{chap:DWATdecimalsign}{DW\-\_AT\-\_decimal\-\_sign},
211 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and
212 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale}
215 A \livelink{chap:DWATdecimalsign}{DW\-\_AT\-\_decimal\-\_sign} attribute is an integer constant that
216 conveys the representation of the sign of the decimal type
217 (see Figure \refersec{fig:decimalsignattributevalues}).
218 Its integer constant value is interpreted to
219 mean that the type has a leading overpunch, trailing overpunch,
220 leading separate or trailing separate sign representation or,
221 alternatively, no sign at all.
224 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count}
225 attribute is an integer constant
226 value that represents the number of digits in an instance of
229 \hypertarget{chap:DWATdecimalscaledecimalscalefactor}
230 The \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale}
231 attribute is an integer constant value
232 that represents the exponent of the base ten scale factor to
233 be applied to an instance of the type. A scale of zero puts the
234 decimal point immediately to the right of the least significant
235 digit. Positive scale moves the decimal point to the right
236 and implies that additional zero digits on the right are not
237 stored in an instance of the type. Negative scale moves the
238 decimal point to the left; if the absolute value of the scale
239 is larger than the digit count, this implies additional zero
240 digits on the left are not stored in an instance of the type.
242 The \livelink{chap:DWATEedited}{DW\-\_ATE\-\_edited}
244 \hypertarget{chap:DWATpicturestringpicturestringfornumericstringtype}
245 type is used to represent an edited
246 numeric or alphanumeric data type. It is used in combination
247 with an \livelink{chap:DWATpicturestring}{DW\-\_AT\-\_picture\-\_string} attribute whose value is a
248 null\dash terminated string containing the target\dash dependent picture
249 string associated with the type.
251 If the edited base type entry describes an edited numeric
252 data type, the edited type entry has a \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and a
253 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attribute. These attributes have the same
254 interpretation as described for the \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} and
255 \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base types. If the edited type entry
256 describes an edited alphanumeric data type, the edited type
257 entry does not have these attributes.
260 \textit{The presence or absence of the \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and
261 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attributes allows a debugger to easily
262 distinguish edited numeric from edited alphanumeric, although
263 in principle the digit count and scale are derivable by
264 interpreting the picture string.}
266 The \livelink{chap:DWATEsignedfixed}{DW\-\_ATE\-\_signed\-\_fixed} and \livelink{chap:DWATEunsignedfixed}{DW\-\_ATE\-\_unsigned\-\_fixed} entries
267 describe signed and unsigned fixed\dash point binary data types,
270 The fixed binary type entries have a \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count}
271 attribute with the same interpretation as described for the
272 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} and \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base types.
274 For a data type with a decimal scale factor, the fixed binary
275 type entry has a \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attribute with the same
276 interpretation as described for the \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal}
277 and \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base types.
279 \hypertarget{chap:DWATbinaryscalebinaryscalefactorforfixedpointtype}
280 For a data type with a binary scale factor, the fixed
281 \addtoindexx{binary scale attribute}
282 binary type entry has a \livelink{chap:DWATbinaryscale}{DW\-\_AT\-\_binary\-\_scale} attribute. The
283 \livelink{chap:DWATbinaryscale}{DW\-\_AT\-\_binary\-\_scale} attribute is an integer constant value
284 that represents the exponent of the base two scale factor to
285 be applied to an instance of the type. Zero scale puts the
286 binary point immediately to the right of the least significant
287 bit. Positive scale moves the binary point to the right and
288 implies that additional zero bits on the right are not stored
289 in an instance of the type. Negative scale moves the binary
290 point to the left; if the absolute value of the scale is
291 larger than the number of bits, this implies additional zero
292 bits on the left are not stored in an instance of the type.
295 \hypertarget{chap:DWATsmallscalefactorforfixedpointtype}
296 a data type with a non\dash decimal and non\dash binary scale factor,
297 the fixed binary type entry has a
298 \livelink{chap:DWATsmall}{DW\-\_AT\-\_small} attribute which
300 \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} entry. The scale factor value
301 is interpreted in accordance with the value defined by the
302 \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} entry. The value represented is the product
303 of the integer value in memory and the associated constant
306 \textit{The \livelink{chap:DWATsmall}{DW\-\_AT\-\_small} attribute
307 is defined with the \addtoindex{Ada} small
312 \begin{tabular}{lp{9cm}}
313 Name&Meaning\\ \hline
314 \livetarg{chap:DWDSunsigned}{DW\-\_DS\-\_unsigned} & unsigned \\
315 \livetarg{chap:DWDSleadingoverpunch}{DW\-\_DS\-\_leading\-\_overpunch} & Sign
316 is encoded in the most significant digit in a target\dash dependent manner \\
317 \livetarg{chap:DWDStrailingoverpunch}{DW\-\_DS\-\_trailing\-\_overpunch} & Sign
318 is encoded in the least significant digit in a target\dash dependent manner \\
319 \livetarg{chap:DWDSleadingseparate}{DW\-\_DS\-\_leading\-\_separate}
320 & Decimal type: Sign is a ``+'' or ``-'' character
321 to the left of the most significant digit. \\
322 \livetarg{chap:DWDStrailingseparate}{DW\-\_DS\-\_trailing\-\_separate}
323 & Decimal type: Sign is a ``+'' or ``-'' character
324 to the right of the least significant digit. \\
325 &Packed decimal type: Least significant nibble contains
326 a target\dash dependent value
327 indicating positive or negative. \\
329 \caption{Decimal sign attribute values}
330 \label{fig:decimalsignattributevalues}
333 \section{Unspecified Type Entries}
334 \label{chap:unspecifiedtypeentries}
335 \addtoindexx{unspecified type entry}
336 \addtoindexx{void type|see{unspecified type entry}}
337 Some languages have constructs in which a type
338 may be left unspecified or the absence of a type
340 may be explicitly indicated.
342 An unspecified (implicit, unknown, ambiguous or nonexistent)
343 type is represented by a debugging information entry with
344 the tag \livetarg{chap:DWTAGunspecifiedtype}{DW\-\_TAG\-\_unspecified\-\_type}.
345 If a name has been given
346 to the type, then the corresponding unspecified type entry
347 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is
348 a null\dash terminated
349 string containing the name as it appears in the source program.
351 The interpretation of this debugging information entry is
352 intentionally left flexible to allow it to be interpreted
353 appropriately in different languages. For example, in
354 \addtoindex{C} and \addtoindex{C++}
355 the language implementation can provide an unspecified type
356 entry with the name “void” which can be referenced by the
357 type attribute of pointer types and typedef declarations for
359 % FIXME: the following reference was wrong in DW4 so DavidA guessed
361 Sections \refersec{chap:unspecifiedtypeentries} and
362 %The following reference was valid, so the following is probably correct.
363 Section \refersec{chap:typedefentries},
364 respectively). As another
365 example, in \addtoindex{Ada} such an unspecified type entry can be referred
366 to by the type attribute of an access type where the denoted
367 type is incomplete (the name is declared as a type but the
368 definition is deferred to a separate compilation unit).
370 \section{Type Modifier Entries}
371 \label{chap:typemodifierentries}
372 \addtoindexx{type modifier entry}
374 A base or user\dash defined type may be modified in different ways
375 in different languages. A type modifier is represented in
376 DWARF by a debugging information entry with one of the tags
378 Figure \refersec{fig:typemodifiertags}.
380 If a name has been given to the modified type in the source
381 program, then the corresponding modified type entry has
382 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null-terminated
383 string containing the modified type name as it appears in
386 Each of the type modifier entries has a
387 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute,
388 whose value is a reference to a debugging information entry
389 describing a base type, a user-defined type or another type
392 A modified type entry describing a pointer or reference
393 type (using \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type},
394 \livelink{chap:DWTAGreferencetype}{DW\-\_TAG\-\_reference\-\_type} or
395 \livelink{chap:DWTAGrvaluereferencetype}{DW\-\_TAG\-\_rvalue\-\_reference\-\_type})
396 % Another instance of no-good-place-to-put-index entry.
398 \addtoindexx{address class!attribute}
400 \hypertarget{chap:DWATadressclasspointerorreferencetypes}
402 \livelink{chap:DWATaddressclass}{DW\-\_AT\-\_address\-\_class}
403 attribute to describe how objects having the given pointer
404 or reference type ought to be dereferenced.
406 A modified type entry describing a shared qualified type
407 (using \livelink{chap:DWTAGsharedtype}{DW\-\_TAG\-\_shared\-\_type}) may have a
408 \livelink{chap:DWATcount}{DW\-\_AT\-\_count} attribute
409 whose value is a constant expressing the blocksize of the
410 type. If no count attribute is present, then the “infinite”
411 blocksize is assumed.
413 When multiple type modifiers are chained together to modify
414 a base or user-defined type, the tree ordering reflects the
415 semantics of the applicable lanuage rather than the textual
416 order in the source presentation.
420 \begin{tabular}{lp{9cm}}
421 Name&Meaning\\ \hline
422 \livetarg{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} & C or C++ const qualified type
423 \addtoindexx{const qualified type entry} \addtoindexx{C} \addtoindexx{C++} \\
424 \livetarg{chap:DWTAGpackedtype}{DW\-\_TAG\-\_packed\-\_type}& Pascal or Ada packed type
425 \addtoindexx{packed qualified type entry} \addtoindexx{Ada} \addtoindexx{Pascal} \\
426 \livetarg{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} & Pointer to an object of
427 the type being modified \addtoindexx{pointer qualified type entry} \\
428 \livetarg{chap:DWTAGreferencetype}{DW\-\_TAG\-\_reference\-\_type}& C++ (lvalue) reference
429 to an object of the type
430 being modified \addtoindexx{reference qualified type entry} \\
431 \livetarg{chap:DWTAGrestricttype}{DW\-\_TAG\-\_restrict\-\_type}&C restrict qualified type
432 \addtoindexx{restricted qualified type entry} \\
433 \livetarg{chap:DWTAGrvaluereferencetype}{DW\-\_TAG\-\_rvalue\-\_reference\-\_type} & C++
434 rvalue reference to an object of the type being modified
435 \addtoindexx{rvalue reference qualified type entry} \\
436 \livetarg{chap:DWTAGsharedtype}{DW\-\_TAG\-\_shared\-\_type}&UPC shared qualified type
437 \addtoindexx{shared qualified type entry} \\
438 \livetarg{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type}&C or C++ volatile qualified type
439 \addtoindex{volatile qualified type entry} \\
441 \caption{Type modifier tags}
442 \label{fig:typemodifiertags}
445 % The following prevents splitting the examples up.
446 % FIXME perhaps there is a better way. We could box the verbatim,
447 % see memman.pdf on verbatims.
449 \textit{As examples of how tye modifiers are ordered, take the following C
453 const unsigned char * volatile p;
454 which represents a volatile pointer to a constant
455 character. This is encoded in DWARF as:
456 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}(p) -->
457 \livelink{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type} -->
458 \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} -->
459 \livelink{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} -->
460 \livelink{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}(unsigned char)
462 volatile unsigned char * const restrict p;
463 on the other hand, represents a restricted constant
464 pointer to a volatile character. This is encoded as:
465 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}(p) -->
466 \livelink{chap:DWTAGrestricttype}{DW\-\_TAG\-\_restrict\-\_type} -->
467 \livelink{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} -->
468 \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} -->
469 \livelink{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type} -->
470 \livelink{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}(unsigned char)
474 \section{Typedef Entries}
475 \label{chap:typedefentries}
476 A named type that is defined in terms of another type
477 definition is represented by a debugging information entry with
478 the tag \livetarg{chap:DWTAGtypedef}{DW\-\_TAG\-\_typedef}.
479 The typedef entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
480 attribute whose value is a null-terminated string containing
481 the name of the typedef as it appears in the source program.
483 The typedef entry may also contain a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose
484 value is a reference to the type named by the typedef. If
485 the debugging information entry for a typedef represents
486 a declaration of the type that is not also a definition,
487 it does not contain a type attribute.
489 \textit{Depending on the language, a named type that is defined in
490 terms of another type may be called a type alias, a subtype,
491 a constrained type and other terms. A type name declared with
492 no defining details may be termed an incomplete, forward
493 or hidden type. While the DWARF \livelink{chap:DWTAGtypedef}{DW\-\_TAG\-\_typedef} entry was
494 originally inspired by the like named construct in
495 \addtoindex{C} and \addtoindex{C++},
496 it is broadly suitable for similar constructs (by whatever
497 source syntax) in other languages.}
499 \section{Array Type Entries}
500 \label{chap:arraytypeentries}
502 Many languages share the concept of an ``array,'' which is
503 \addtoindexx{array type entry}
504 a table of components of identical type.
506 An array type is represented by a debugging information entry
507 with the tag \livetarg{chap:DWTAGarraytype}{DW\-\_TAG\-\_array\-\_type}.
510 \addtoindexx{array!declaration of type}
511 the array type in the source program, then the corresponding
512 array type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a
513 null-terminated string containing the array type name as it
514 appears in the source program.
517 \hypertarget{chap:DWATorderingarrayrowcolumnordering}
518 array type entry describing a multidimensional array may
519 \addtoindexx{array!element ordering}
520 have a \livelink{chap:DWATordering}{DW\-\_AT\-\_ordering} attribute whose integer constant value is
521 interpreted to mean either row-major or column-major ordering
522 of array elements. The set of values and their meanings
523 for the ordering attribute are listed in
524 Figure \refersec{fig:arrayordering}.
526 ordering attribute is present, the default ordering for the
527 source language (which is indicated by the \livelink{chap:DWATlanguage}{DW\-\_AT\-\_language}
528 attribute of the enclosing compilation unit entry) is assumed.
531 \autorows[0pt]{c}{1}{l}{
532 \livetarg{chap:DWORDcolmajor}{DW\-\_ORD\-\_col\-\_major},
533 \livetarg{chap:DWORDrowmajor}{DW\-\_ORD\-\_row\-\_major}
535 \caption{Array ordering}\label{fig:arrayordering}
538 The ordering attribute may optionally appear on one-dimensional
539 arrays; it will be ignored.
541 An array type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
542 \addtoindexx{array!element type}
544 the type of each element of the array.
546 If the amount of storage allocated to hold each element of an
547 object of the given array type is different from the amount
548 of storage that is normally allocated to hold an individual
549 \hypertarget{chap:DWATbitstridearrayelementstrideofarraytype}
551 \hypertarget{chap:DWATbytestridearrayelementstrideofarraytype}
552 indicated element type, then the array type
553 \addtoindexx{bit stride attribute}
555 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
557 \addtoindexx{byte stride attribute}
558 a \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride}
560 \addtoindexx{bit stride attribute}
562 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
564 element of the array.
566 The array type entry may have either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a
567 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
568 (see Section \refersec{chap:byteandbitsizes}),
570 amount of storage needed to hold an instance of the array type.
572 \textit{If the size of the array can be determined statically at
573 compile time, this value can usually be computed by multiplying
574 the number of array elements by the size of each element.}
577 Each array dimension is described by a debugging information
578 entry with either the tag \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} or the tag
579 \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}. These entries are
581 array type entry and are ordered to reflect the appearance of
582 the dimensions in the source program (i.e., leftmost dimension
583 first, next to leftmost second, and so on).
585 In languages, such as C, in which there is no concept of
586 a “multidimensional array”, an array of arrays may
587 be represented by a debugging information entry for a
588 multidimensional array.
590 Other attributes especially applicable to arrays are
591 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated},
592 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} and
593 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location},
594 which are described in
595 Section \refersec{chap:dynamictypeproperties}.
596 For relevant examples,
598 Appendix \refersec{app:fortran90example}.
600 \section{ Structure, Union, Class and Interface Type Entries}
601 \label{chap:structureunionclassandinterfacetypeentries}
603 \textit{The languages
605 \addtoindex{C++}, and
606 \addtoindex{Pascal}, among others, allow the
607 programmer to define types that are collections of related
608 components. In \addtoindex{C} and \addtoindex{C++}, these collections are called
609 “structures.” In \addtoindex{Pascal}, they are called “records.”
610 The components may be of different types. The components are
611 called “members” in \addtoindex{C} and
612 \addtoindex{C++}, and “fields” in \addtoindex{Pascal}.}
614 \textit{The components of these collections each exist in their
615 own space in computer memory. The components of a C or C++
616 “union” all coexist in the same memory.}
618 \textit{\addtoindex{Pascal} and
619 other languages have a “discriminated union,”
620 \addtoindex{discriminated union|see {variant entry}}
621 also called a “variant record.” Here, selection of a
622 number of alternative substructures (“variants”) is based
623 on the value of a component that is not part of any of those
624 substructures (the “discriminant”).}
626 \textit{\addtoindex{C++} and
627 \addtoindex{Java} have the notion of ``class'', which is in some
628 ways similar to a structure. A class may have “member
629 functions” which are subroutines that are within the scope
630 of a class or structure.}
632 \textit{The \addtoindex{C++} notion of
633 structure is more general than in \addtoindex{C}, being
634 equivalent to a class with minor differences. Accordingly,
635 in the following discussion statements about
636 \addtoindex{C++} classes may
637 be understood to apply to \addtoindex{C++} structures as well.}
639 \subsection{Structure, Union and Class Type Entries}
640 \label{chap:structureunionandclasstypeentries}
643 Structure, union, and class types are represented by debugging
644 information entries with
645 the tags \livetarg{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type},
646 \livetarg{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type},
647 and \livetarg{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
648 respectively. If a name has been given to the structure,
649 union, or class in the source program, then the corresponding
650 structure type, union type, or class type entry has a
651 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
652 containing the type name as it appears in the source program.
654 The members of a structure, union, or class are represented
655 by debugging information entries that are owned by the
656 corresponding structure type, union type, or class type entry
657 and appear in the same order as the corresponding declarations
658 in the source program.
660 A structure type, union type or class type entry may have
661 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a
662 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
663 \hypertarget{chap:DWATbitsizedatamemberbitsize}
664 (see Section \refersec{chap:byteandbitsizes}),
665 whose value is the amount of storage needed
666 to hold an instance of the structure, union or class type,
667 including any padding. An incomplete structure, union or
668 class type is represented by a structure, union or class
669 entry that does not have a byte size attribute and that has
670 a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
672 If the complete declaration of a type has been placed in
673 \hypertarget{chap:DWATsignaturetypesignature}
675 (see Section \refersec{chap:separatetypeunitentries}),
677 declaration of that type in the compilation unit may provide
678 the unique 64\dash bit signature of the type using a \livelink{chap:DWATsignature}{DW\-\_AT\-\_signature}
681 If a structure, union or class entry represents the definition
682 of a structure, class or union member corresponding to a prior
683 incomplete structure, class or union, the entry may have a
684 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute whose value is a reference to
685 the debugging information entry representing that incomplete
688 Structure, union and class entries containing the
689 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute do not need to duplicate
690 information provided by the declaration entry referenced by the
691 specification attribute. In particular, such entries do not
692 need to contain an attribute for the name of the structure,
693 class or union they represent if such information is already
694 provided in the declaration.
696 \textit{For \addtoindex{C} and \addtoindex{C++},
697 data member declarations occurring within
698 the declaration of a structure, union or class type are
699 considered to be “definitions” of those members, with
700 the exception of “static” data members, whose definitions
701 appear outside of the declaration of the enclosing structure,
702 union or class type. Function member declarations appearing
703 within a structure, union or class type declaration are
704 definitions only if the body of the function also appears
705 within the type declaration.}
707 If the definition for a given member of the structure, union
708 or class does not appear within the body of the declaration,
709 that member also has a debugging information entry describing
710 its definition. That latter entry has a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
711 attribute referencing the debugging information entry
712 owned by the body of the structure, union or class entry and
713 representing a non\dash defining declaration of the data, function
714 or type member. The referenced entry will not have information
715 about the location of that member (low and high pc attributes
716 for function members, location descriptions for data members)
717 and will have a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
719 \textit{Consider a nested class whose
720 definition occurs outside of the containing class definition, as in:}
729 \textit{The two different structs can be described in
730 different compilation units to
731 facilitate DWARF space compression
732 (see Appendix \refersec{app:usingcompilationunits}).}
734 \subsection{Interface Type Entries}
735 \label{chap:interfacetypeentries}
737 \textit{The \addtoindex{Java} language defines ``interface'' types.
739 in Java is similar to a \addtoindex{C++} or
740 \addtoindex{Java} class with only abstract
741 methods and constant data members.}
743 Interface types are represented by debugging information
745 tag \livetarg{chap:DWTAGinterfacetype}{DW\-\_TAG\-\_interface\-\_type}.
747 An interface type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
748 value is a null-terminated string containing the type name
749 as it appears in the source program.
751 The members of an interface are represented by debugging
752 information entries that are owned by the interface type
753 entry and that appear in the same order as the corresponding
754 declarations in the source program.
756 \subsection{Derived or Extended Structs, Classes and Interfaces}
757 \label{chap:derivedorextendedstructsclasesandinterfaces}
759 \textit{In \addtoindex{C++}, a class (or struct) may be ``derived from'' or be a
760 ``subclass of'' another class. In Java, an interface may ``extend''
761 one or more other interfaces, and a class may ``extend'' another
762 class and/or ``implement'' one or more interfaces. All of these
763 relationships may be described using the following. Note that
764 in Java, the distinction between extends and implements is
765 implied by the entities at the two ends of the relationship.}
767 A class type or interface type entry that describes a
768 derived, extended or implementing class or interface owns
769 debugging information entries describing each of the classes
770 or interfaces it is derived from, extending or implementing,
771 respectively, ordered as they were in the source program. Each
773 tag \livetarg{chap:DWTAGinheritance}{DW\-\_TAG\-\_inheritance}.
775 An inheritance entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is
776 a reference to the debugging information entry describing the
777 class or interface from which the parent class or structure
778 of the inheritance entry is derived, extended or implementing.
780 An inheritance entry for a class that derives from or extends
781 \hypertarget{chap:DWATdatamemberlocationinheritedmemberlocation}
782 another class or struct also has a
783 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
784 attribute, whose value describes the location of the beginning
785 of the inherited type relative to the beginning address of the
786 derived class. If that value is a constant, it is the offset
787 in bytes from the beginning of the class to the beginning of
788 the inherited type. Otherwise, the value must be a location
789 description. In this latter case, the beginning address of
790 the derived class is pushed on the expression stack before
791 the location description is evaluated and the result of the
792 evaluation is the location of the inherited type.
794 \textit{The interpretation of the value of this attribute for
795 inherited types is the same as the interpretation for data
797 (see Section \refersec{chap:datamemberentries}). }
800 \hypertarget{chap:DWATaccessibilitycppinheritedmembers}
802 \addtoindexx{accessibility attribute}
804 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
805 attribute. If no accessibility attribute
806 is present, private access is assumed for an entry of a class
807 and public access is assumed for an entry of an interface,
811 \hypertarget{chap:DWATvirtualityvirtualityofbaseclass}
812 the class referenced by the inheritance entry serves
813 as a \addtoindex{C++} virtual base class, the inheritance entry has a
814 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
816 \textit{For a \addtoindex{C++} virtual base, the data member location attribute
817 will usually consist of a non-trivial location description.}
819 \subsection{Access Declarations}
820 \label{chap:accessdeclarations}
822 \textit{In \addtoindex{C++}, a derived class may contain access declarations that
823 \addtoindex{access declaration entry}
824 change the accessibility of individual class members from the
825 overall accessibility specified by the inheritance declaration.
826 A single access declaration may refer to a set of overloaded
829 If a derived class or structure contains access declarations,
830 each such declaration may be represented by a debugging
831 information entry with the tag
832 \livetarg{chap:DWTAGaccessdeclaration}{DW\-\_TAG\-\_access\-\_declaration}.
834 such entry is a child of the class or structure type entry.
836 An access declaration entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
837 value is a null-terminated string representing the name used
838 in the declaration in the source program, including any class
839 or structure qualifiers.
841 An access declaration entry
842 \hypertarget{chap:DWATaccessibilitycppbaseclasses}
845 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
846 attribute describing the declared accessibility of the named
853 Each ``friend'' declared by a structure, union or class
854 \hypertarget{chap:DWATfriendfriendrelationship}
855 type may be represented by a debugging information entry
856 that is a child of the structure, union or class type entry;
857 the friend entry has the
858 tag \livetarg{chap:DWTAGfriend}{DW\-\_TAG\-\_friend}.
860 A friend entry has a \livelink{chap:DWATfriend}{DW\-\_AT\-\_friend} attribute, whose value is
861 a reference to the debugging information entry describing
862 the declaration of the friend.
865 \subsection{Data Member Entries}
866 \label{chap:datamemberentries}
868 A data member (as opposed to a member function) is
869 represented by a debugging information entry with the
870 tag \livetarg{chap:DWTAGmember}{DW\-\_TAG\-\_member}.
871 The member entry for a named member has
872 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null-terminated
873 string containing the member name as it appears in the source
874 program. If the member entry describes an
875 \addtoindex{anonymous union},
877 name attribute is omitted or consists of a single zero byte.
879 The data member entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote
880 the type of that member.
882 A data member entry may
883 \addtoindexx{accessibility attribute}
885 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
886 attribute. If no accessibility attribute is present, private
887 access is assumed for an entry of a class and public access
888 is assumed for an entry of a structure, union, or interface.
891 \hypertarget{chap:DWATmutablemutablepropertyofmemberdata}
892 entry may have a \livelink{chap:DWATmutable}{DW\-\_AT\-\_mutable} attribute,
893 which is a \livelink{chap:flag}{flag}.
894 This attribute indicates whether the data
895 member was declared with the mutable storage class specifier.
897 The beginning of a data member
898 \addtoindex{beginning of a data member}
899 is described relative to
900 \addtoindexx{beginning of an object}
901 the beginning of the object in which it is immediately
902 contained. In general, the beginning is characterized by
903 both an address and a bit offset within the byte at that
904 address. When the storage for an entity includes all of
905 the bits in the beginning byte, the beginning bit offset is
908 Bit offsets in DWARF use the bit numbering and direction
909 conventions that are appropriate to the current language on
912 The member entry corresponding to a data member that is
913 \hypertarget{chap:DWATdatabitoffsetdatamemberbitlocation}
915 \hypertarget{chap:DWATdatamemberlocationdatamemberlocation}
916 in a structure, union or class may have either a
917 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute or a
918 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
919 attribute. If the beginning of the data member is the same as
920 the beginning of the containing entity then neither attribute
923 For a \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute
926 \begin{enumerate}[1.]
928 \item If the value is an integer constant, it is the offset
929 in bytes from the beginning of the containing entity. If
930 the beginning of the containing entity has a non-zero bit
931 offset then the beginning of the member entry has that same
934 \item Otherwise, the value must be a location description. In
935 this case, the beginning of the containing entity must be byte
936 aligned. The beginning address is pushed on the DWARF stack
937 before the location description is evaluated; the result of
938 the evaluation is the base address of the member entry.
940 \textit{The push on the DWARF expression stack of the base address of
941 the containing construct is equivalent to execution of the
942 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} operation
943 (see Section \refersec{chap:stackoperations});
944 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} therefore
946 beginning of a location description for a data member. The
947 result of the evaluation is a location--either an address or
948 the name of a register, not an offset to the member.}
950 \textit{A \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
951 attribute that has the form of a
952 location description is not valid for a data member contained
953 in an entity that is not byte aligned because DWARF operations
954 do not allow for manipulating or computing bit offsets.}
958 For a \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} attribute,
959 the value is an integer constant
960 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
961 that specifies the number of bits
962 from the beginning of the containing entity to the beginning
963 of the data member. This value must be greater than or equal
964 to zero, but is not limited to less than the number of bits
967 If the size of a data member is not the same as the size
968 of the type given for the data member, the data member has
969 \addtoindexx{bit size attribute}
970 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
971 or a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute whose
972 integer constant value
973 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
975 of storage needed to hold the value of the data member.
977 \textit{\addtoindex{C} and \addtoindex{C++}
978 \addtoindex{bit fields}
979 typically require the use of the
980 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} and
981 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attributes.}
983 \textit{This Standard uses the following bit numbering and direction
984 conventions in examples. These conventions are for illustrative
985 purposes and other conventions may apply on particular
990 \item \textit{For big\dash endian architectures, bit offsets are
991 counted from high-order to low\dash order bits within a byte (or
992 larger storage unit); in this case, the bit offset identifies
993 the high\dash order bit of the object.}
995 \item \textit{For little\dash endian architectures, bit offsets are
996 counted from low\dash order to high\dash order bits within a byte (or
997 larger storage unit); in this case, the bit offset identifies
998 the low\dash order bit of the object.}
1002 \textit{In either case, the bit so identified is defined as the
1003 \addtoindexx{beginning of an object}
1004 beginning of the object.}
1006 \textit{For example, take one possible representation of the following
1007 \addtoindex{C} structure definition
1008 in both big\dash and little\dash endian byte orders:}
1019 \textit{The following diagrams show the structure layout
1020 and data bit offsets for example big\dash\ and little\dash endian
1021 architectures, respectively. Both diagrams show a structure
1022 that begins at address A and whose size is four bytes. Also,
1023 high order bits are to the left and low order bits are to
1026 \textit{Big\dash Endian Data Bit Offsets:}
1034 Addresses increase ->
1035 | A | A + 1 | A + 2 | A + 3 |
1037 Data bit offsets increase ->
1038 +---------------+---------------+---------------+---------------+
1039 |0 4|5 10|11 15|16 23|24 31|
1040 | j | k | m | n | <pad> |
1042 +---------------------------------------------------------------+
1045 \textit{Little\dash Endian Data Bit Offsets:}
1051 <- Addresses increase
1052 | A | A + 1 | A + 2 | A + 3 |
1054 <- Data bit offsets increase
1056 +---------------+---------------+---------------+---------------+
1057 |31 24|23 16|15 11|10 5|4 0|
1058 | <pad> | n | m | k | j |
1060 +---------------------------------------------------------------+
1064 \textit{Note that data member bit offsets in this example are the
1065 same for both big\dash\ and little\dash endian architectures even
1066 though the fields are allocated in different directions
1067 (high\dash order to low-order versus low\dash order to high\dash order);
1068 the bit naming conventions for memory and/or registers of
1069 the target architecture may or may not make this seem natural.}
1071 \textit{For a more extensive example showing nested and packed records
1073 Appendix \refersec{app:pascalexample}.}
1075 \textit{Attribute \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1076 is new in DWARF Version 4 and is also used for base types
1078 \refersec{chap:basetypeentries}).
1080 \livetarg{chap:DWATbitoffsetdatamemberbitlocation}
1081 attributes \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} and
1082 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} when used to
1083 identify the beginning of bit field data members as defined
1084 in DWARF V3 and earlier. The earlier attributes are defined
1085 in a manner suitable for bit field members on big-endian
1086 architectures but which is either awkward or incomplete for
1087 use on little-endian architectures.
1088 (\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} also
1089 has other uses that are not affected by this change.)}
1091 \textit{The \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1092 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1093 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1094 attribute combination is deprecated for data members in DWARF
1095 Version 4, but implementations may continue to support this
1096 use for compatibility.}
1098 \textit{The DWARF Version 3 definitions of these attributes are
1101 \begin{myindentpara}{1cm}
1102 \textit{If the data member entry describes a bit field, then that
1103 entry has the following attributes:}
1106 \item \textit{A \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1107 attribute whose value
1108 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1109 is the number of bytes that contain an instance of the
1110 bit field and any padding bits.}
1112 \textit{The byte size attribute may be omitted if the size of the
1113 object containing the bit field can be inferred from the type
1114 attribute of the data member containing the bit field.}
1116 \item \textit{A \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1118 \addtoindexx{bit offset attribute (V3)}
1120 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1121 is the number of bits to the left of the leftmost
1122 (most significant) bit of the bit field value.}
1124 \item \textit{A \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1126 \addtoindexx{bit size attribute (V3)}
1128 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1129 is the number of bits occupied by the bit field value.}
1133 \textit{The location description for a bit field calculates the address
1134 of an anonymous object containing the bit field. The address
1135 is relative to the structure, union, or class that most closely
1136 encloses the bit field declaration. The number of bytes in this
1137 anonymous object is the value of the byte size attribute of
1138 the bit field. The offset (in bits) from the most significant
1139 bit of the anonymous object to the most significant bit of
1140 the bit field is the value of the bit offset attribute.}
1144 \textit{Diagrams similar to the above that show the use of the
1145 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1146 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1147 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} attribute
1148 combination may be found in the DWARF Version 3 Standard.}
1150 \textit{In comparing DWARF Versions 3 and 4, note that DWARF V4
1151 defines the following combinations of attributes:}
1154 \item \textit{either \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1156 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1157 (to specify the beginning of the data member)}
1159 % FIXME: the indentation of the following line is suspect.
1160 \textit{optionally together with}
1162 \item \textit{either \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or
1163 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} (to
1164 specify the size of the data member)}
1168 \textit{DWARF V3 defines the following combinations}
1171 \item \textit{\livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1172 (to specify the beginning
1173 of the data member, except this specification is only partial
1174 in the case of a bit field) }
1176 % FIXME: the indentation of the following line is suspect.
1177 \textit{optionally together with}
1179 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1180 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1181 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1182 (to further specify the beginning of a bit field data member
1183 as well as specify the size of the data member) }
1186 \subsection{Member Function Entries}
1187 \label{chap:memberfunctionentries}
1189 A member function is represented by a debugging information
1190 entry with the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}.
1191 The member function entry
1192 may contain the same attributes and follows the same rules
1193 as non\dash member global subroutine entries
1194 (see Section \refersec{chap:subroutineandentrypointentries}).
1197 \addtoindexx{accessibility attribute}
1198 member function entry may have a
1199 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
1200 attribute. If no accessibility attribute is present, private
1201 access is assumed for an entry of a class and public access
1202 is assumed for an entry of a structure, union or interface.
1205 \hypertarget{chap:DWATvirtualityvirtualityoffunction}
1206 the member function entry describes a virtual function,
1207 then that entry has a
1208 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
1211 \hypertarget{chap:DWATexplicitexplicitpropertyofmemberfunction}
1212 the member function entry describes an explicit member
1213 function, then that entry has a
1214 \livelink{chap:DWATexplicit}{DW\-\_AT\-\_explicit} attribute.
1217 \hypertarget{chap:DWATvtableelemlocationvirtualfunctiontablevtableslot}
1218 entry for a virtual function also has a
1219 \livelink{chap:DWATvtableelemlocation}{DW\-\_AT\-\_vtable\-\_elem\-\_location}
1220 \addtoindexi{attribute}{vtable element location attribute} whose value contains
1221 a location description yielding the address of the slot
1222 for the function within the virtual function table for the
1223 enclosing class. The address of an object of the enclosing
1224 type is pushed onto the expression stack before the location
1225 description is evaluated.
1228 \hypertarget{chap:DWATobjectpointerobjectthisselfpointerofmemberfunction}
1229 the member function entry describes a non\dash static member
1230 function, then that entry has a \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer}
1232 whose value is a reference to the formal parameter entry
1233 that corresponds to the object for which the function is
1234 called. The name attribute of that formal parameter is defined
1235 by the current language (for example,
1236 this for \addtoindex{C++} or self
1237 for \addtoindex{Objective C}
1238 and some other languages). That parameter
1239 also has a \livelink{chap:DWATartificial}{DW\-\_AT\-\_artificial} attribute whose value is true.
1241 Conversely, if the member function entry describes a static
1242 member function, the entry does not have a
1243 \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer}
1246 If the member function entry describes a non\dash static member
1247 function that has a const\dash volatile qualification, then
1248 the entry describes a non\dash static member function whose
1249 object formal parameter has a type that has an equivalent
1250 const\dash volatile qualification.
1252 If a subroutine entry represents the defining declaration
1253 of a member function and that definition appears outside of
1254 the body of the enclosing class declaration, the subroutine
1255 entry has a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
1256 attribute, whose value is
1257 a reference to the debugging information entry representing
1258 the declaration of this function member. The referenced entry
1259 will be a child of some class (or structure) type entry.
1261 Subroutine entries containing the \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
1262 attribute do not need to duplicate information provided
1263 by the declaration entry referenced by the specification
1264 attribute. In particular, such entries do not need to contain
1265 attributes for the name or return type of the function member
1266 whose definition they represent.
1268 \subsection{Class Template Instantiations}
1269 \label{chap:classtemplateinstantiations}
1271 \textit{In \addtoindex{C++} a class template is a generic definition of a class
1272 type that may be instantiated when an instance of the class
1273 is declared or defined. The generic description of the
1274 class may include both parameterized types and parameterized
1275 constant values. DWARF does not represent the generic template
1276 definition, but does represent each instantiation.}
1278 A class template instantiation is represented by a
1279 debugging information entry with the tag \livelink{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
1280 \livelink{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type} or
1281 \livelink{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type}. With five
1282 exceptions, such an entry will contain the same attributes
1283 and have the same types of child entries as would an entry
1284 for a class type defined explicitly using the instantiation
1285 types and values. The exceptions are:
1287 \begin{enumerate}[1.]
1288 \item Each formal parameterized type declaration appearing in the
1289 template definition is represented by a debugging information
1291 \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}. Each
1292 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is
1293 a null\dash terminated string containing the name of the formal
1294 type parameter as it appears in the source program. The
1295 template type parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1296 describing the actual type by which the formal is replaced
1297 for this instantiation.
1299 \item Each formal parameterized value declaration appearing in the
1300 template definition is represented by a debugging information
1302 tag \livetarg{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}.
1304 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is
1305 a null\dash terminated string containing the name of the formal
1306 value parameter as it appears in the source program.
1308 \hypertarget{chap:DWATconstvaluetemplatevalueparameter}
1309 template value parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1310 describing the type of the parameterized value. Finally,
1311 the template value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value}
1312 attribute, whose value is the actual constant value of the
1313 value parameter for this instantiation as represented on the
1314 target architecture.
1316 \item The class type entry and each of its child entries references
1317 a template type parameter entry in any circumstance where the
1318 source template definition references a formal parameterized
1319 type. Similarly, the class type entry and each of its child
1320 entries references a template value parameter entry in any
1321 circumstance where the source template definition references
1322 a formal parameterized value.
1324 \item If the compiler has generated a special compilation unit to
1325 hold the template instantiation and that special compilation
1326 unit has a different name from the compilation unit containing
1327 the template definition, the name attribute for the debugging
1328 information entry representing the special compilation unit
1329 should be empty or omitted.
1331 \item If the class type entry representing the template
1332 instantiation or any of its child entries contains declaration
1333 coordinate attributes, those attributes should refer to
1334 the source for the template definition, not to any source
1335 generated artificially by the compiler.
1339 \subsection{Variant Entries}
1340 \label{chap:variantentries}
1342 A variant part of a structure is represented by a debugging
1343 information entry\addtoindexx{variant part entry} with the
1344 tag \livetarg{chap:DWTAGvariantpart}{DW\-\_TAG\-\_variant\-\_part} and is
1345 owned by the corresponding structure type entry.
1347 If the variant part has a discriminant, the discriminant is
1348 \hypertarget{chap:DWATdiscrdiscriminantofvariantpart}
1349 represented by a separate debugging information entry which
1350 is a child of the variant part entry. This entry has the form
1351 of a structure data member entry. The variant part entry will
1353 \livelink{chap:DWATdiscr}{DW\-\_AT\-\_discr} attribute whose value is a reference to
1354 the member entry for the discriminant.
1356 If the variant part does not have a discriminant (tag field),
1357 the variant part entry has a
1358 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to represent
1361 Each variant of a particular variant part is represented by
1362 \hypertarget{chap:DWATdiscrvaluediscriminantvalue}
1363 a debugging information entry\addtoindexx{variant entry} with the
1364 tag \livetarg{chap:DWTAGvariant}{DW\-\_TAG\-\_variant}
1365 and is a child of the variant part entry. The value that
1366 selects a given variant may be represented in one of three
1367 ways. The variant entry may have a
1368 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value} attribute
1369 whose value represents a single case label. The value of this
1370 attribute is encoded as an LEB128 number. The number is signed
1371 if the tag type for the variant part containing this variant
1372 is a signed type. The number is unsigned if the tag type is
1376 \hypertarget{chap:DWATdiscrlistlistofdiscriminantvalues}
1377 the variant entry may contain a
1378 \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list}
1379 attribute, whose value represents a list of discriminant
1380 values. This list is represented by any of the
1381 \livelink{chap:block}{block} forms and
1382 may contain a mixture of case labels and label ranges. Each
1383 item on the list is prefixed with a discriminant value
1384 descriptor that determines whether the list item represents
1385 a single label or a label range. A single case label is
1386 represented as an LEB128 number as defined above for the
1387 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value}
1388 attribute. A label range is represented by
1389 two LEB128 numbers, the low value of the range followed by the
1390 high value. Both values follow the rules for signedness just
1391 described. The discriminant value descriptor is an integer
1392 constant that may have one of the values given in
1393 Figure \refersec{fig:discriminantdescriptorvalues}.
1395 \begin{figure}[here]
1396 \autorows[0pt]{c}{1}{l}{
1397 \addtoindex{DW\-\_DSC\-\_label},
1398 \addtoindex{DW\-\_DSC\-\_range}
1400 \caption{Discriminant descriptor values}\label{fig:discriminantdescriptorvalues}
1403 If a variant entry has neither a \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value}
1404 attribute nor a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute, or if it has
1405 a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute with 0 size, the variant is a
1408 The components selected by a particular variant are represented
1409 by debugging information entries owned by the corresponding
1410 variant entry and appear in the same order as the corresponding
1411 declarations in the source program.
1413 \section{Condition Entries}
1414 \label{chap:conditionentries}
1416 \textit{COBOL has the notion of a ``level\dash 88 condition'' that
1417 associates a data item, called the conditional variable, with
1418 a set of one or more constant values and/or value ranges.
1419 Semantically, the condition is ‛true’ if the conditional
1420 variable's value matches any of the described constants,
1421 and the condition is ‛false’ otherwise.}
1423 The \livetarg{chap:DWTAGcondition}{DW\-\_TAG\-\_condition}
1424 debugging information entry\addtoindexx{condition entry}
1426 logical condition that tests whether a given data item’s
1427 value matches one of a set of constant values. If a name
1428 has been given to the condition, the condition entry has a
1429 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
1430 giving the condition name as it appears in the source program.
1432 The condition entry's parent entry describes the conditional
1433 variable; normally this will be a \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable},
1434 \livelink{chap:DWTAGmember}{DW\-\_TAG\-\_member} or
1435 \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter} entry. If the parent
1436 entry has an array type, the condition can test any individual
1437 element, but not the array as a whole. The condition entry
1438 implicitly specifies a “comparison type” that is the
1439 type of an array element if the parent has an array type;
1440 otherwise it is the type of the parent entry.
1442 The condition entry owns \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} and/or
1443 \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} entries that describe the constant
1444 values associated with the condition. If any child entry has
1445 a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute, that attribute should describe a type
1446 compatible with the comparison type (according to the source
1447 language); otherwise the child’s type is the same as the
1450 \textit{For conditional variables with alphanumeric types, COBOL
1451 permits a source program to provide ranges of alphanumeric
1452 constants in the condition. Normally a subrange type entry
1453 does not describe ranges of strings; however, this can be
1454 represented using bounds attributes that are references to
1455 constant entries describing strings. A subrange type entry may
1456 refer to constant entries that are siblings of the subrange
1460 \section{Enumeration Type Entries}
1461 \label{chap:enumerationtypeentries}
1463 \textit{An “enumeration type” is a scalar that can assume one of
1464 a fixed number of symbolic values.}
1466 An enumeration type is represented by a debugging information
1468 \livetarg{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}.
1470 If a name has been given to the enumeration type in the source
1471 program, then the corresponding enumeration type entry has
1472 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated
1473 string containing the enumeration type name as it appears
1474 in the source program. This entry also has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1475 attribute whose integer constant value is the number of bytes
1476 required to hold an instance of the enumeration.
1478 The enumeration type entry may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1479 which refers to the underlying data type used to implement
1482 If an enumeration type has type safe semantics such that
1484 \begin{enumerate}[1.]
1485 \item Enumerators are contained in the scope of the enumeration type, and/or
1487 \item Enumerators are not implicitly converted to another type
1490 then the enumeration type entry may have a \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}
1491 attribute, which is a \livelink{chap:flag}{flag}.
1492 In a language that offers only
1493 one kind of enumeration declaration, this attribute is not
1496 \textit{In \addtoindex{C} or \addtoindex{C++},
1497 the underlying type will be the appropriate
1498 integral type determined by the compiler from the properties of
1499 \hypertarget{chap:DWATenumclasstypesafeenumerationdefinition}
1500 the enumeration literal values. A \addtoindex{C++} type declaration written
1501 using enum class declares a strongly typed enumeration and
1502 is represented using \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}
1503 in combination with \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}.}
1505 Each enumeration literal is represented by a debugging
1506 information entry with the
1507 tag \livetarg{chap:DWTAGenumerator}{DW\-\_TAG\-\_enumerator}.
1509 such entry is a child of the enumeration type entry, and the
1510 enumerator entries appear in the same order as the declarations
1511 of the enumeration literals in the source program.
1513 Each enumerator entry has a
1514 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
1515 value is a null\dash terminated string containing the name of the
1516 \hypertarget{chap:DWATconstvalueenumerationliteralvalue}
1517 enumeration literal as it appears in the source program.
1518 Each enumerator entry also has a
1519 \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value} attribute,
1520 whose value is the actual numeric value of the enumerator as
1521 represented on the target system.
1524 If the enumeration type occurs as the description of a
1525 dimension of an array type, and the stride for that dimension
1526 \hypertarget{chap:DWATbytestrideenumerationstridedimensionofarraytype}
1527 is different than what would otherwise be determined, then
1528 \hypertarget{chap:DWATbitstrideenumerationstridedimensionofarraytype}
1529 the enumeration type entry has either a
1530 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1531 or \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1532 \addtoindexx{bit stride attribute}
1533 which specifies the separation
1534 between successive elements along the dimension as described
1536 Section \refersec{chap:visibilityofdeclarations}.
1538 \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1539 \addtoindexx{bit stride attribute}
1540 is interpreted as bits and the value of
1541 \addtoindexx{byte stride attribute}
1543 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1544 attribute is interpreted as bytes.
1547 \section{Subroutine Type Entries}
1548 \label{chap:subroutinetypeentries}
1550 It is possible in \addtoindex{C}
1551 to declare pointers to subroutines
1552 that return a value of a specific type. In both
1553 \addtoindex{C} and \addtoindex{C++},
1554 it is possible to declare pointers to subroutines that not
1555 only return a value of a specific type, but accept only
1556 arguments of specific types. The type of such pointers would
1557 be described with a ``pointer to'' modifier applied to a
1558 user\dash defined type.
1560 A subroutine type is represented by a debugging information
1562 tag \livetarg{chap:DWTAGsubroutinetype}{DW\-\_TAG\-\_subroutine\-\_type}.
1564 been given to the subroutine type in the source program,
1565 then the corresponding subroutine type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
1566 attribute whose value is a null\dash terminated string containing
1567 the subroutine type name as it appears in the source program.
1569 If the subroutine type describes a function that returns
1570 a value, then the subroutine type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
1571 attribute to denote the type returned by the subroutine. If
1572 the types of the arguments are necessary to describe the
1573 subroutine type, then the corresponding subroutine type
1574 entry owns debugging information entries that describe the
1575 arguments. These debugging information entries appear in the
1576 order that the corresponding argument types appear in the
1579 In \addtoindex{C} there
1580 is a difference between the types of functions
1581 declared using function prototype style declarations and
1582 those declared using non\dash prototype declarations.
1585 \hypertarget{chap:DWATprototypedsubroutineprototype}
1586 subroutine entry declared with a function prototype style
1587 declaration may have a
1588 \livelink{chap:DWATprototyped}{DW\-\_AT\-\_prototyped} attribute, which is
1589 a \livelink{chap:flag}{flag}.
1591 Each debugging information entry owned by a subroutine
1592 type entry has a tag whose value has one of two possible
1595 \begin{enumerate}[1.]
1596 \item The formal parameters of a parameter list (that have a
1597 specific type) are represented by a debugging information entry
1598 with the tag \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter}.
1599 Each formal parameter
1600 entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute that refers to the type of
1601 the formal parameter.
1603 \item The unspecified parameters of a variable parameter list
1604 \addtoindexx{unspecified parameters entry}
1606 \addtoindexx{... parameters|see{unspecified parameters entry}}
1607 represented by a debugging information entry with the
1608 tag \livelink{chap:DWTAGunspecifiedparameters}{DW\-\_TAG\-\_unspecified\-\_parameters}.
1613 \section{String Type Entries}
1614 \label{chap:stringtypeentries}
1617 A ``string'' is a sequence of characters that have specific
1618 semantics and operations that separate them from arrays of
1619 characters. Fortran is one of the languages that has a string
1620 type. Note that ``string'' in this context refers to a target
1621 machine concept, not the class string as used in this document
1622 (except for the name attribute).
1624 A string type is represented by a debugging information entry
1625 with the tag \livetarg{chap:DWTAGstringtype}{DW\-\_TAG\-\_string\-\_type}.
1626 If a name has been given to
1627 the string type in the source program, then the corresponding
1628 string type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is
1629 a null\dash terminated string containing the string type name as
1630 it appears in the source program.
1633 \hypertarget{chap:DWATstringlengthstringlengthofstringtype}
1634 string type entry may have a
1635 \livelink{chap:DWATstringlength}{DW\-\_AT\-\_string\-\_length} attribute
1636 whose value is a location description yielding the location
1637 where the length of the string is stored in the program. The
1638 string type entry may also have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute
1639 or \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
1640 (see Section \refersec{chap:byteandbitsizes})
1641 is the size of the data to be retrieved from the location
1642 referenced by the string length attribute. If no (byte or bit)
1643 size attribute is present, the size of the data to be retrieved
1644 is the same as the size of an address on the target machine.
1646 If no string length attribute is present, the string type
1647 entry may have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or
1648 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1649 attribute, whose value
1650 (see Section \refersec{chap:byteandbitsizes})
1652 storage needed to hold a value of the string type.
1655 \section{Set Type Entries}
1656 \label{chap:settypeentries}
1658 \textit{Pascal provides the concept of a “set,” which represents
1659 a group of values of ordinal type.}
1661 A set is represented by a debugging information entry with
1662 the tag \livetarg{chap:DWTAGsettype}{DW\-\_TAG\-\_set\-\_type}.
1663 If a name has been given to the
1664 set type, then the set type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1665 whose value is a null\dash terminated string containing the
1666 set type name as it appears in the source program.
1668 The set type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote the
1669 type of an element of the set.
1671 If the amount of storage allocated to hold each element of an
1672 object of the given set type is different from the amount of
1673 storage that is normally allocated to hold an individual object
1674 of the indicated element type, then the set type entry has
1675 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute, or
1676 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
1677 whose value (see Section \refersec{chap:byteandbitsizes}) is
1678 the amount of storage needed to hold a value of the set type.
1681 \section{Subrange Type Entries}
1682 \label{chap:subrangetypeentries}
1684 \textit{Several languages support the concept of a ``subrange''
1685 type object. These objects can represent a subset of the
1686 values that an object of the basis type for the subrange can
1687 represent. Subrange type entries may also be used to represent
1688 the bounds of array dimensions.}
1690 A subrange type is represented by a debugging information
1692 tag \livetarg{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type}.
1694 given to the subrange type, then the subrange type entry
1695 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated
1696 string containing the subrange type name as it appears in
1699 The subrange entry may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to describe
1700 the type of object, called the basis type, of whose values
1701 this subrange is a subset.
1703 If the amount of storage allocated to hold each element of an
1704 object of the given subrange type is different from the amount
1705 of storage that is normally allocated to hold an individual
1706 object of the indicated element type, then the subrange
1707 type entry has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or
1708 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1709 attribute, whose value
1710 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1712 storage needed to hold a value of the subrange type.
1715 \hypertarget{chap:DWATthreadsscaledupcarrayboundthreadsscalfactor}
1716 subrange entry may have a \livelink{chap:DWATthreadsscaled}{DW\-\_AT\-\_threads\-\_scaled} attribute,
1717 which is a \livelink{chap:flag}{flag}.
1718 If present, this attribute indicates whether
1719 this subrange represents a UPC array bound which is scaled
1720 by the runtime THREADS value (the number of UPC threads in
1721 this execution of the program).
1723 \textit{This allows the representation of a UPC shared array such as}
1726 int shared foo[34*THREADS][10][20];
1730 \hypertarget{chap:DWATlowerboundlowerboundofsubrange}
1732 \hypertarget{chap:DWATupperboundupperboundofsubrange}
1733 entry may have the attributes
1734 \livelink{chap:DWATlowerbound}{DW\-\_AT\-\_lower\-\_bound}
1735 and \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound} to specify, respectively, the lower
1736 and upper bound values of the subrange. The
1737 \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound}
1739 \hypertarget{chap:DWATcountelementsofsubrangetype}
1740 may be replaced by a
1741 \livelink{chap:DWATcount}{DW\-\_AT\-\_count} attribute, whose
1742 value describes the number of elements in the subrange rather
1743 than the value of the last element. The value of each of
1744 these attributes is determined as described in
1745 Section \refersec{chap:staticanddynamicvaluesofattributes}.
1747 If the lower bound value is missing, the value is assumed to
1748 be a language\dash dependent default constant. The default lower
1750 \addtoindex{C}, \addtoindex{C++},
1753 \addtoindex{Objective C},
1754 \addtoindex{Objective C++},
1755 \addtoindex{Python}, and
1757 The default lower bound is 1 for
1758 \addtoindex{Ada}, \addtoindex{COBOL},
1759 \addtoindex{Fortran},
1760 \addtoindex{Modula}\dash 2,
1761 \addtoindex{Pascal} and
1764 \textit{No other default lower bound values are currently defined.}
1766 If the upper bound and count are missing, then the upper bound value is
1769 If the subrange entry has no type attribute describing the
1770 basis type, the basis type is assumed to be the same as
1771 the object described by the lower bound attribute (if it
1772 references an object). If there is no lower bound attribute,
1773 or that attribute does not reference an object, the basis type
1774 is the type of the upper bound or count attribute (if either
1775 of them references an object). If there is no upper bound or
1776 count attribute, or neither references an object, the type is
1777 assumed to be the same type, in the source language of the
1778 compilation unit containing the subrange entry, as a signed
1779 integer with the same size as an address on the target machine.
1781 If the subrange type occurs as the description of a dimension
1782 of an array type, and the stride for that dimension is
1783 \hypertarget{chap:DWATbytestridesubrangestridedimensionofarraytype}
1784 different than what would otherwise be determined, then
1785 \hypertarget{chap:DWATbitstridesubrangestridedimensionofarraytype}
1786 the subrange type entry has either
1787 \addtoindexx{byte stride attribute}
1789 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride} or
1790 \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1791 \addtoindexx{bit stride attribute}
1792 which specifies the separation
1793 between successive elements along the dimension as described
1795 Section \refersec{chap:byteandbitsizes}.
1797 \textit{Note that the stride can be negative.}
1799 \section{Pointer to Member Type Entries}
1800 \label{chap:pointertomembertypeentries}
1802 \textit{In \addtoindex{C++}, a pointer to a data or function member of a class or
1803 structure is a unique type.}
1805 A debugging information entry representing the type of an
1806 object that is a pointer to a structure or class member has
1807 the tag \livetarg{chap:DWTAGptrtomembertype}{DW\-\_TAG\-\_ptr\-\_to\-\_member\-\_type}.
1809 If the pointer to member type has a name, the pointer to
1810 member entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a
1811 null\dash terminated string containing the type name as it appears
1812 in the source program.
1814 The pointer to member entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to
1815 describe the type of the class or structure member to which
1816 objects of this type may point.
1818 The pointer to member entry also
1819 \hypertarget{chap:DWATcontainingtypecontainingtypeofpointertomembertype}
1821 \livelink{chap:DWATcontainingtype}{DW\-\_AT\-\_containing\-\_type}
1822 attribute, whose value is a reference to a debugging
1823 information entry for the class or structure to whose members
1824 objects of this type may point.
1827 \hypertarget{chap:DWATuselocationmemberlocationforpointertomembertype}
1828 pointer to member entry has a
1829 \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} attribute
1830 whose value is a location description that computes the
1831 address of the member of the class to which the pointer to
1832 member entry points.
1834 \textit{The method used to find the address of a given member of a
1835 class or structure is common to any instance of that class
1836 or structure and to any instance of the pointer or member
1837 type. The method is thus associated with the type entry,
1838 rather than with each instance of the type.}
1840 The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is used in conjunction
1841 with the location descriptions for a particular object of the
1842 given pointer to member type and for a particular structure or
1843 class instance. The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location}
1844 attribute expects two values to be
1845 \addtoindexi{pushed}{address!implicit push for member operator}
1846 onto the DWARF expression stack before
1847 the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is evaluated.
1849 \addtoindexi{pushed}{address!implicit push for member operator}
1850 is the value of the pointer to member object
1851 itself. The second value
1852 \addtoindexi{pushed}{address!implicit push for member operator}
1853 is the base address of the
1854 entire structure or union instance containing the member
1855 whose address is being calculated.
1857 \textit{For an expression such as}
1862 % FIXME: object and mbr\_ptr should be distinguished from italic. See DW4.
1863 \textit{where mbr\_ptr has some pointer to member type, a debugger should:}
1865 \textit{1. Push the value of mbr\_ptr onto the DWARF expression stack.}
1867 \textit{2. Push the base address of object onto the DWARF expression stack.}
1869 \textit{3. Evaluate the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description
1870 given in the type of mbr\_ptr.}
1872 \section{File Type Entries}
1873 \label{chap:filetypeentries}
1875 \textit{Some languages, such as Pascal, provide a data type to represent
1878 A file type is represented by a debugging information entry
1880 \livetarg{chap:DWTAGfiletype}{DW\-\_TAG\-\_file\-\_type}.
1881 If the file type has a name,
1882 the file type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value
1883 is a null\dash terminated string containing the type name as it
1884 appears in the source program.
1886 The file type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
1887 the type of the objects contained in the file.
1889 The file type entry also
1890 \addtoindexx{byte size}
1892 \addtoindexx{bit size}
1894 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or
1895 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
1896 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1897 is the amount of storage need to hold a value of the file type.
1899 \section{Dynamic Type Properties}
1900 \label{chap:dynamictypeproperties}
1901 \subsection{Data Location}
1902 \label{chap:datalocation}
1904 \textit{Some languages may represent objects using descriptors to hold
1905 information, including a location and/or run\dash time parameters,
1906 about the data that represents the value for that object.}
1908 \hypertarget{chap:DWATdatalocationindirectiontoactualdata}
1909 The \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
1910 attribute may be used with any
1911 type that provides one or more levels of hidden indirection
1912 and/or run\dash time parameters in its representation. Its value
1913 is a location description. The result of evaluating this
1914 description yields the location of the data for an object.
1915 When this attribute is omitted, the address of the data is
1916 the same as the address of the object.
1918 \textit{This location description will typically begin with
1919 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address}
1920 which loads the address of the
1921 object which can then serve as a descriptor in subsequent
1922 calculation. For an example using
1923 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
1924 for a Fortran 90 array, see
1925 Appendix \refersec{app:fortran90example}.}
1927 \subsection{Allocation and Association Status}
1928 \label{chap:allocationandassociationstatus}
1930 \textit{Some languages, such as Fortran 90, provide types whose values
1931 may be dynamically allocated or associated with a variable
1932 under explicit program control.}
1934 \hypertarget{chap:DWATallocatedallocationstatusoftypes}
1936 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated}
1938 \addtoindexx{allocated attribute}
1939 may optionally be used with any
1940 type for which objects of the type can be explicitly allocated
1941 and deallocated. The presence of the attribute indicates that
1942 objects of the type are allocatable and deallocatable. The
1943 integer value of the attribute (see below) specifies whether
1944 an object of the type is
1945 currently allocated or not.
1947 \hypertarget{chap:DWATassociatedassociationstatusoftypes}
1949 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute
1951 \addtoindexx{associated attribute}
1952 optionally be used with
1953 any type for which objects of the type can be dynamically
1954 associated with other objects. The presence of the attribute
1955 indicates that objects of the type can be associated. The
1956 integer value of the attribute (see below) indicates whether
1957 an object of the type is currently associated or not.
1959 While these attributes are defined specifically with Fortran
1960 90 ALLOCATABLE and POINTER types in mind, usage is not limited
1961 to just that language.
1963 The value of these attributes is determined as described in
1964 Section \refersec{chap:staticanddynamicvaluesofattributes}.
1966 A non\dash zero value is interpreted as allocated or associated,
1967 and zero is interpreted as not allocated or not associated.
1969 \textit{For \addtoindex{Fortran} 90,
1970 if the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated}
1971 attribute is present,
1972 the type has the POINTER property where either the parent
1973 variable is never associated with a dynamic object or the
1974 implementation does not track whether the associated object
1975 is static or dynamic. If the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute is
1976 present and the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute is not, the type
1977 has the ALLOCATABLE property. If both attributes are present,
1978 then the type should be assumed to have the POINTER property
1979 (and not ALLOCATABLE); the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute may then
1980 be used to indicate that the association status of the object
1981 resulted from execution of an ALLOCATE statement rather than
1982 pointer assignment.}
1984 \textit{For examples using
1985 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} for \addtoindex{Ada} and
1986 \addtoindex{Fortran} 90
1988 see Appendix \refersec{app:aggregateexamples}.}
1992 \section{Template Alias Entries}
1993 \label{chap:templatealiasentries}
1995 A type named using a template alias is represented
1996 by a debugging information entry with the tag
1997 \livetarg{chap:DWTAGtemplatealias}{DW\-\_TAG\-\_template\-\_alias}.
1998 The template alias entry has a
1999 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
2000 containing the name of the template alias as it appears in
2001 the source program. The template alias entry also contains a
2002 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is a reference to the type
2003 named by the template alias. The template alias entry has
2004 the following child entries:
2006 \begin{enumerate}[1.]
2007 \item Each formal parameterized type declaration appearing
2008 in the template alias declaration is represented
2009 by a debugging information entry with the tag
2010 \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}.
2011 Each such entry may have
2012 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a null\dash terminated
2013 string containing the name of the formal type parameter as it
2014 appears in the source program. The template type parameter
2015 entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing the actual
2016 type by which the formal is replaced for this instantiation.
2018 \item Each formal parameterized value declaration
2019 appearing in the template alias declaration is
2020 represented by a debugging information entry with the tag
2021 \livelink{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}.
2022 Each such entry may have
2023 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a null\dash terminated
2024 string containing the name of the formal value parameter
2025 as it appears in the source program. The template value
2026 parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
2027 the type of the parameterized value. Finally, the template
2028 value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value}
2029 attribute, whose value is the actual constant value of the value parameter for
2030 this instantiation as represented on the target architecture.