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 base type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is
27 a null\dash terminated string containing the name of the base type
28 as recognized by the programming language of the compilation
29 unit containing the base type entry.
31 A base type entry has a \livelink{chap:DWATencoding}{DW\-\_AT\-\_encoding} attribute describing
32 how the base type is encoded and is to be interpreted. The
33 value of this attribute is an integer constant. The set of
34 values and their meanings for the \livelink{chap:DWATencoding}{DW\-\_AT\-\_encoding} attribute
36 Figure \refersec{fig:encodingattributevalues}
40 may have a \livelink{chap:DWATendianity}{DW\-\_AT\-\_endianity} attribute as described in
41 Section \refersec{chap:dataobjectentries}.
42 If omitted, the encoding assumes the representation that
43 is the default for the target architecture.
46 \hypertarget{chap:DWATbytesizedataobjectordatatypesize}
47 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute
48 \hypertarget{chap:DWATbitsizebasetypebitsize}
49 or a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute whose integer constant value
50 (see Section \refersec{chap:byteandbitsizes})
51 is the amount of storage needed to hold
54 \textit{For example, the C type int on a machine that uses 32\dash bit
55 integers is represented by a base type entry with a name
56 attribute whose value is “int”, an encoding attribute
57 whose value is \livelink{chap:DWATEsigned}{DW\-\_ATE\-\_signed} and a byte size attribute whose
60 If the value of an object of the given type does not fully
61 occupy the storage described by a byte size attribute,
62 \hypertarget{chap:DWATdatabitoffsetbasetypebitlocation}
63 the base type entry may also have a
64 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and a
65 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} attribute, both of whose values are
66 integer constant values (
67 see Section \refersec{chap:staticanddynamicvaluesofattributes}).
69 attribute describes the actual size in bits used to represent
70 values of the given type. The data bit offset attribute is the
71 offset in bits from the beginning of the containing storage to
72 the beginning of the value. Bits that are part of the offset
73 are padding. The data bit offset uses the bit numbering and
74 direction conventions that are appropriate to the current
76 target system to locate the beginning of the storage and
77 value. If this attribute is omitted a default data bit offset
80 \textit{Attribute \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} is new in DWARF Version 4 and
81 is also used for bit field members
82 (see Section \refersec{chap:datamemberentries}).
84 \hypertarget{chap:DWATbitoffsetbasetypebitlocation}
85 replaces the attribute \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} when used for base
86 types as defined in DWARF V3 and earlier. The earlier attribute
87 is defined in a manner suitable for bit field members on
88 big\dash endian architectures but which is wasteful for use on
89 little\dash endian architectures.}
91 \textit{The attribute \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} is
92 deprecated in DWARF Version
93 4 for use in base types, but implementations may continue to
94 support its use for compatibility.}
96 \textit{The DWARF Version 3 definition of these attributes is as follows.}
98 \begin{myindentpara}{1cm}
99 \textit{A base type entry has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute, whose value
100 (see Section 2.19) is the size in bytes of the storage unit
101 used to represent an object of the given type.}
103 \textit{If the value of an object of the given type does not fully
104 occupy the storage unit described by the byte size attribute,
105 the base type entry may have a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute and a
106 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} attribute, both of whose values (see Section
107 2.19) are integers. The bit size attribute describes the actual
108 size in bits used to represent a value of the given type.
109 The bit offset attribute describes the offset in bits of the
110 high order bit of a value of the given type from the high
111 order bit of the storage unit used to contain that value.}
114 \textit{In comparing DWARF Versions 3 and 4, note that DWARF V4
115 defines the following combinations of attributes:}
118 \item \textit{DW\-\_AT\-\_byte\-\_size}
119 \item \textit{DW\-\_AT\-\_bit\-\_size}
120 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}, \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
121 and optionally \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}}
123 DWARF V3 defines the following combinations:
124 % FIXME: the figure below interferes with the following
125 % bullet list, which looks horrible as a result.
127 \item \textit{DW\-\_AT\-\_byte\-\_size}
128 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}, \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}}
131 \begin{figure}[!here]
133 \begin{tabular}{lp{9cm}}
134 Name&Meaning\\ \hline
135 \livetarg{chap:DWATEaddress}{DW\-\_ATE\-\_address} & linear machine address (for
136 segmented addresses see
137 Section \refersec{chap:segmentedaddresses}) \\
138 \livetarg{chap:DWATEboolean}{DW\-\_ATE\-\_boolean}& true or false \\
140 \livetarg{chap:DWATEcomplexfloat}{DW\-\_ATE\-\_complex\-\_float}& complex binary floating\dash point number \\
141 \livetarg{chap:DWATEfloat}{DW\-\_ATE\-\_float} & binary floating\dash point number \\
142 \livetarg{chap:DWATEimaginaryfloat}{DW\-\_ATE\-\_imaginary\-\_float}& imaginary binary floating\dash point number \\
143 \livetarg{chap:DWATEsigned}{DW\-\_ATE\-\_signed}& signed binary integer \\
144 \livetarg{chap:DWATEsignedchar}{DW\-\_ATE\-\_signed\-\_char}& signed character \\
145 \livetarg{chap:DWATEunsigned}{DW\-\_ATE\-\_unsigned} & unsigned binary integer \\
146 \livetarg{chap:DWATEunsignedchar}{DW\-\_ATE\-\_unsigned\-\_char} & unsigned character \\
147 \livetarg{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} & packed decimal \\
148 \livetarg{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string}& numeric string \\
149 \livetarg{chap:DWATEedited}{DW\-\_ATE\-\_edited} & edited string \\
150 \livetarg{chap:DWATEsignedfixed}{DW\-\_ATE\-\_signed\-\_fixed} & signed fixed\dash point scaled integer \\
151 \livetarg{chap:DWATEunsignedfixed}{DW\-\_ATE\-\_unsigned\-\_fixed}& unsigned fixed\dash point scaled integer \\
152 \livetarg{chap:DWATEdecimalfloat}{DW\-\_ATE\-\_decimal\-\_float} & decimal floating\dash point number \\
153 \livetarg{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} & Unicode character \\
155 \caption{Encoding attribute values}
156 \label{fig:encodingattributevalues}
159 \textit{The \livelink{chap:DWATEdecimalfloat}{DW\-\_ATE\-\_decimal\-\_float} encoding is intended for
160 floating\dash point representations that have a power\dash of\dash ten
161 exponent, such as that specified in IEEE 754R.}
163 \textit{The \livelink{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} encoding is intended for Unicode string
164 encodings (see the Universal Character Set standard,
165 ISO/IEC 10646\dash 1:1993). For example, the C++ type char16\_t is
166 represented by a base type entry with a name attribute whose
167 value is “char16\_t”, an encoding attribute whose value
168 is \livelink{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} and a byte size attribute whose value is 2.}
171 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal}
173 \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string}
175 represent packed and unpacked decimal string numeric data
176 types, respectively, either of which may be either signed
178 \hypertarget{chap:DWATdecimalsigndecimalsignrepresentation}
180 \hypertarget{chap:DWATdigitcountdigitcountforpackeddecimalornumericstringtype}
181 base types are used in combination with
182 \livelink{chap:DWATdecimalsign}{DW\-\_AT\-\_decimal\-\_sign},
183 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and
184 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale}
187 A \livelink{chap:DWATdecimalsign}{DW\-\_AT\-\_decimal\-\_sign} attribute is an integer constant that
188 conveys the representation of the sign of the decimal type
189 (see Figure \refersec{fig:decimalsignattributevalues}).
190 Its integer constant value is interpreted to
191 mean that the type has a leading overpunch, trailing overpunch,
192 leading separate or trailing separate sign representation or,
193 alternatively, no sign at all.
196 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count}
197 attribute is an integer constant
198 value that represents the number of digits in an instance of
201 \hypertarget{chap:DWATdecimalscaledecimalscalefactor}
202 The \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attribute is an integer constant value
203 that represents the exponent of the base ten scale factor to
204 be applied to an instance of the type. A scale of zero puts the
205 decimal point immediately to the right of the least significant
206 digit. Positive scale moves the decimal point to the right
207 and implies that additional zero digits on the right are not
208 stored in an instance of the type. Negative scale moves the
209 decimal point to the left; if the absolute value of the scale
210 is larger than the digit count, this implies additional zero
211 digits on the left are not stored in an instance of the type.
213 The \livelink{chap:DWATEedited}{DW\-\_ATE\-\_edited}
215 \hypertarget{chap:DWATpicturestringpicturestringfornumericstringtype}
216 type is used to represent an edited
217 numeric or alphanumeric data type. It is used in combination
218 with an \livelink{chap:DWATpicturestring}{DW\-\_AT\-\_picture\-\_string} attribute whose value is a
219 null\dash terminated string containing the target\dash dependent picture
220 string associated with the type.
222 If the edited base type entry describes an edited numeric
223 data type, the edited type entry has a \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and a
224 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attribute. These attributes have the same
225 interpretation as described for the \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} and
226 \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base types. If the edited type entry
227 describes an edited alphanumeric data type, the edited type
228 entry does not have these attributes.
231 \textit{The presence or absence of the \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and
232 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attributes allows a debugger to easily
233 distinguish edited numeric from edited alphanumeric, although
234 in principle the digit count and scale are derivable by
235 interpreting the picture string.}
237 The \livelink{chap:DWATEsignedfixed}{DW\-\_ATE\-\_signed\-\_fixed} and \livelink{chap:DWATEunsignedfixed}{DW\-\_ATE\-\_unsigned\-\_fixed} entries
238 describe signed and unsigned fixed\dash point binary data types,
241 The fixed binary type entries have a \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count}
242 attribute with the same interpretation as described for the
243 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} and \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base types.
245 For a data type with a decimal scale factor, the fixed binary
246 type entry has a \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attribute with the same
247 interpretation as described for the \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal}
248 and \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base types.
250 \hypertarget{chap:DWATbinaryscalebinaryscalefactorforfixedpointtype}
251 For a data type with a binary scale factor, the fixed
252 binary type entry has a \livelink{chap:DWATbinaryscale}{DW\-\_AT\-\_binary\-\_scale} attribute. The
253 \livelink{chap:DWATbinaryscale}{DW\-\_AT\-\_binary\-\_scale} attribute is an integer constant value
254 that represents the exponent of the base two scale factor to
255 be applied to an instance of the type. Zero scale puts the
256 binary point immediately to the right of the least significant
257 bit. Positive scale moves the binary point to the right and
258 implies that additional zero bits on the right are not stored
259 in an instance of the type. Negative scale moves the binary
260 point to the left; if the absolute value of the scale is
261 larger than the number of bits, this implies additional zero
262 bits on the left are not stored in an instance of the type.
265 \hypertarget{chap:DWATsmallscalefactorforfixedpointtype}
266 a data type with a non\dash decimal and non\dash binary scale factor,
267 the fixed binary type entry has a
268 \livelink{chap:DWATsmall}{DW\-\_AT\-\_small} attribute which
270 \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} entry. The scale factor value
271 is interpreted in accordance with the value defined by the
272 \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} entry. The value represented is the product
273 of the integer value in memory and the associated constant
276 \textit{The \livelink{chap:DWATsmall}{DW\-\_AT\-\_small} attribute is defined with the Ada small
281 \begin{tabular}{lp{9cm}}
282 Name&Meaning\\ \hline
283 \livetarg{chap:DWDSunsigned}{DW\-\_DS\-\_unsigned} & unsigned \\
284 \livetarg{chap:DWDSleadingoverpunch}{DW\-\_DS\-\_leading\-\_overpunch} & Sign is encoded in the most significant digit in a target\dash dependent manner \\
285 \livetarg{chap:DWDStrailingoverpunch}{DW\-\_DS\-\_trailing\-\_overpunch} & Sign is encoded in the least significant digit in a target\dash dependent manner \\
286 \livetarg{chap:DWDSleadingseparate}{DW\-\_DS\-\_leading\-\_separate}
287 & Decimal type: Sign is a ``+'' or ``-'' character
288 to the left of the most significant digit. \\
289 \livetarg{chap:DWDStrailingseparate}{DW\-\_DS\-\_trailing\-\_separate}
290 & Decimal type: Sign is a ``+'' or ``-'' character
291 to the right of the least significant digit. \\
292 &Packed decimal type: Least significant nibble contains
293 a target\dash dependent value
294 indicating positive or negative. \\
296 \caption{Decimal sign attribute values}
297 \label{fig:decimalsignattributevalues}
300 \section{Unspecified Type Entries}
301 \label{chap:unspecifiedtypeentries}
302 Some languages have constructs in which a type may be left unspecified or the absence of a type
303 may be explicitly indicated.
305 An unspecified (implicit, unknown, ambiguous or nonexistent)
306 type is represented by a debugging information entry with
307 the tag \livetarg{chap:DWTAGunspecifiedtype}{DW\-\_TAG\-\_unspecified\-\_type}.
308 If a name has been given
309 to the type, then the corresponding unspecified type entry
310 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated
311 string containing the name as it appears in the source program.
313 The interpretation of this debugging information entry is
314 intentionally left flexible to allow it to be interpreted
315 appropriately in different languages. For example, in C and C++
316 the language implementation can provide an unspecified type
317 entry with the name “void” which can be referenced by the
318 type attribute of pointer types and typedef declarations for
320 % FIXME: the following reference was wrong in DW4 so DavidA guessed
322 Sections \refersec{chap:unspecifiedtypeentries} and
323 %The following reference was valid, so the following is probably correct.
324 Section \refersec{chap:typedefentries},
325 respectively). As another
326 example, in Ada such an unspecified type entry can be referred
327 to by the type attribute of an access type where the denoted
328 type is incomplete (the name is declared as a type but the
329 definition is deferred to a separate compilation unit). Type
332 A base or user\dash defined type may be modified in different ways
333 in different languages. A type modifier is represented in
334 DWARF by a debugging information entry with one of the tags
336 Figure \refersec{fig:typemodifiertags}.
339 If a name has been given to the modified type in the source
340 program, then the corresponding modified type entry has
341 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null-terminated
342 string containing the modified type name as it appears in
345 Each of the type modifier entries has a
346 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute,
347 whose value is a reference to a debugging information entry
348 describing a base type, a user-defined type or another type
351 A modified type entry describing a pointer or reference
352 type (using \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type}, \livelink{chap:DWTAGreferencetype}{DW\-\_TAG\-\_reference\-\_type} or
353 \livelink{chap:DWTAGrvaluereferencetype}{DW\-\_TAG\-\_rvalue\-\_reference\-\_type})
355 \hypertarget{chap:DWATadressclasspointerorreferencetypes}
357 \livelink{chap:DWATaddressclass}{DW\-\_AT\-\_address\-\_class}
358 attribute to describe how objects having the given pointer
359 or reference type ought to be dereferenced.
361 A modified type entry describing a shared qualified type
362 (using \livelink{chap:DWTAGsharedtype}{DW\-\_TAG\-\_shared\-\_type}) may have a \livelink{chap:DWATcount}{DW\-\_AT\-\_count} attribute
363 whose value is a constant expressing the blocksize of the
364 type. If no count attribute is present, then the “infinite”
365 blocksize is assumed.
367 When multiple type modifiers are chained together to modify
368 a base or user-defined type, the tree ordering reflects the
369 semantics of the applicable lanuage rather than the textual
370 order in the source presentation.
374 \begin{tabular}{lp{9cm}}
375 Name&Meaning\\ \hline
376 \livetarg{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} & C or C++ const qualified type \\
377 \livetarg{chap:DWTAGpackedtype}{DW\-\_TAG\-\_packed\-\_type}& Pascal or Ada packed type \\
378 \livetarg{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} & Pointer to an object of the type being modified \\
379 \livetarg{chap:DWTAGreferencetype}{DW\-\_TAG\-\_reference\-\_type}& C++ (lvalue) reference to an object of the type
381 \livetarg{chap:DWTAGrestricttype}{DW\-\_TAG\-\_restrict\-\_type}&C restrict qualified type \\
382 \livetarg{chap:DWTAGrvaluereferencetype}{DW\-\_TAG\-\_rvalue\-\_reference\-\_type} & C++ rvalue reference to an object of the type
384 \livetarg{chap:DWTAGsharedtype}{DW\-\_TAG\-\_shared\-\_type}&UPC shared qualified type \\
385 \livetarg{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type}&C or C++ volatile qualified type \\
387 \caption{Type modifier tags}
388 \label{fig:typemodifiertags}
391 % The following prevents splitting the examples up.
392 % FIXME perhaps there is a better way. We could box the verbatim,
393 % see memman.pdf on verbatims.
395 \textit{As examples of how tye modifiers are ordered, take the following C
399 const unsigned char * volatile p;
400 which represents a volatile pointer to a constant
401 character. This is encoded in DWARF as:
402 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}(p) -->
403 \livelink{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type} -->
404 \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} -->
405 \livelink{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} -->
406 \livelink{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}(unsigned char)
408 volatile unsigned char * const restrict p;
409 on the other hand, represents a restricted constant
410 pointer to a volatile character. This is encoded as:
411 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}(p) -->
412 \livelink{chap:DWTAGrestricttype}{DW\-\_TAG\-\_restrict\-\_type} -->
413 \livelink{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} -->
414 \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} -->
415 \livelink{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type} -->
416 \livelink{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}(unsigned char)
420 \section{Typedef Entries}
421 \label{chap:typedefentries}
422 A named type that is defined in terms of another type
423 definition is represented by a debugging information entry with
424 the tag \livetarg{chap:DWTAGtypedef}{DW\-\_TAG\-\_typedef}.
425 The typedef entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
426 attribute whose value is a null-terminated string containing
427 the name of the typedef as it appears in the source program.
429 The typedef entry may also contain a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose
430 value is a reference to the type named by the typedef. If
431 the debugging information entry for a typedef represents
432 a declaration of the type that is not also a definition,
433 it does not contain a type attribute.
435 \textit{Depending on the language, a named type that is defined in
436 terms of another type may be called a type alias, a subtype,
437 a constrained type and other terms. A type name declared with
438 no defining details may be termed an incomplete, forward
439 or hidden type. While the DWARF \livelink{chap:DWTAGtypedef}{DW\-\_TAG\-\_typedef} entry was
440 originally inspired by the like named construct in C and C++,
441 it is broadly suitable for similar constructs (by whatever
442 source syntax) in other languages.}
444 \section{Array Type Entries}
445 \label{chap:arraytypeentries}
447 Many languages share the concept of an ``array,'' which is
448 a table of components of identical type.
450 An array type is represented by a debugging information entry
451 with the tag \livetarg{chap:DWTAGarraytype}{DW\-\_TAG\-\_array\-\_type}.
452 If a name has been given to
453 the array type in the source program, then the corresponding
454 array type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a
455 null-terminated string containing the array type name as it
456 appears in the source program.
459 \hypertarget{chap:DWATorderingarrayrowcolumnordering}
460 array type entry describing a multidimensional array may
461 have a \livelink{chap:DWATordering}{DW\-\_AT\-\_ordering} attribute whose integer constant value is
462 interpreted to mean either row-major or column-major ordering
463 of array elements. The set of values and their meanings
464 for the ordering attribute are listed in
465 Figure \refersec{fig:arrayordering}.
467 ordering attribute is present, the default ordering for the
468 source language (which is indicated by the \livelink{chap:DWATlanguage}{DW\-\_AT\-\_language}
469 attribute of the enclosing compilation unit entry) is assumed.
472 \autorows[0pt]{c}{1}{l}{
473 \livetarg{chap:DWORDcolmajor}{DW\-\_ORD\-\_col\-\_major},
474 \livetarg{chap:DWORDrowmajor}{DW\-\_ORD\-\_row\-\_major}
476 \caption{Array ordering}\label{fig:arrayordering}
479 The ordering attribute may optionally appear on one-dimensional
480 arrays; it will be ignored.
482 An array type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
483 the type of each element of the array.
485 If the amount of storage allocated to hold each element of an
486 object of the given array type is different from the amount
487 of storage that is normally allocated to hold an individual
488 \hypertarget{chap:DWATbitstridearrayelementstrideofarraytype}
490 \hypertarget{chap:DWATbytestridearrayelementstrideofarraytype}
491 indicated element type, then the array type
492 entry has either a \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride} or a \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride}
493 attribute, whose value
494 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
496 element of the array.
498 The array type entry may have either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a
499 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
500 (see Section \refersec{chap:byteandbitsizes}),
502 amount of storage needed to hold an instance of the array type.
504 \textit{If the size of the array can be determined statically at
505 compile time, this value can usually be computed by multiplying
506 the number of array elements by the size of each element.}
509 Each array dimension is described by a debugging information
510 entry with either the tag \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} or the tag
511 \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}. These entries are children of the
512 array type entry and are ordered to reflect the appearance of
513 the dimensions in the source program (i.e., leftmost dimension
514 first, next to leftmost second, and so on).
516 In languages, such as C, in which there is no concept of
517 a “multidimensional array”, an array of arrays may
518 be represented by a debugging information entry for a
519 multidimensional array.
521 Other attributes especially applicable to arrays are
522 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated},
523 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} and
524 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location},
525 which are described in
526 Section \refersec{chap:dynamictypeproperties}.
527 For relevant examples,
529 Appendix \refersec{app:fortran90example}.
531 \section{ Structure, Union, Class and Interface Type Entries}
532 \label{chap:structureunionclassandinterfacetypeentries}
534 \textit{The languages C, C++, and Pascal, among others, allow the
535 programmer to define types that are collections of related
536 components. In C and C++, these collections are called
537 “structures.” In Pascal, they are called “records.”
538 The components may be of different types. The components are
539 called “members” in C and C++, and “fields” in Pascal.}
541 \textit{The components of these collections each exist in their
542 own space in computer memory. The components of a C or C++
543 “union” all coexist in the same memory.}
545 \textit{Pascal and other languages have a “discriminated union,”
546 also called a “variant record.” Here, selection of a
547 number of alternative substructures (“variants”) is based
548 on the value of a component that is not part of any of those
549 substructures (the “discriminant”).}
551 \textit{C++ and Java have the notion of "class”, which is in some
552 ways similar to a structure. A class may have “member
553 functions” which are subroutines that are within the scope
554 of a class or structure.}
556 \textit{The C++ notion of structure is more general than in C, being
557 equivalent to a class with minor differences. Accordingly,
558 in the following discussion statements about C++ classes may
559 be understood to apply to C++ structures as well.}
561 \subsection{Structure, Union and Class Type Entries}
562 \label{chap:structureunionandclasstypeentries}
565 Structure, union, and class types are represented by debugging
566 information entries with
567 the tags \livetarg{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type},
568 \livetarg{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type},
569 and \livetarg{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
570 respectively. If a name has been given to the structure,
571 union, or class in the source program, then the corresponding
572 structure type, union type, or class type entry has a
573 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
574 containing the type name as it appears in the source program.
576 The members of a structure, union, or class are represented
577 by debugging information entries that are owned by the
578 corresponding structure type, union type, or class type entry
579 and appear in the same order as the corresponding declarations
580 in the source program.
582 A structure type, union type or class type entry may have
583 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
584 \hypertarget{chap:DWATbitsizedatamemberbitsize}
585 (see Section \refersec{chap:byteandbitsizes}),
586 whose value is the amount of storage needed
587 to hold an instance of the structure, union or class type,
588 including any padding. An incomplete structure, union or
589 class type is represented by a structure, union or class
590 entry that does not have a byte size attribute and that has
591 a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
593 If the complete declaration of a type has been placed in
594 \hypertarget{chap:DWATsignaturetypesignature}
596 (see Section \refersec{chap:separatetypeunitentries}),
598 declaration of that type in the compilation unit may provide
599 the unique 64\dash bit signature of the type using a \livelink{chap:DWATsignature}{DW\-\_AT\-\_signature}
602 If a structure, union or class entry represents the definition
603 of a structure, class or union member corresponding to a prior
604 incomplete structure, class or union, the entry may have a
605 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute whose value is a reference to
606 the debugging information entry representing that incomplete
609 Structure, union and class entries containing the
610 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute do not need to duplicate
611 information provided by the declaration entry referenced by the
612 specification attribute. In particular, such entries do not
613 need to contain an attribute for the name of the structure,
614 class or union they represent if such information is already
615 provided in the declaration.
617 \textit{For C and C++, data member declarations occurring within
618 the declaration of a structure, union or class type are
619 considered to be “definitions” of those members, with
620 the exception of “static” data members, whose definitions
621 appear outside of the declaration of the enclosing structure,
622 union or class type. Function member declarations appearing
623 within a structure, union or class type declaration are
624 definitions only if the body of the function also appears
625 within the type declaration.}
627 If the definition for a given member of the structure, union
628 or class does not appear within the body of the declaration,
629 that member also has a debugging information entry describing
630 its definition. That latter entry has a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
631 attribute referencing the debugging information entry
632 owned by the body of the structure, union or class entry and
633 representing a non\dash defining declaration of the data, function
634 or type member. The referenced entry will not have information
635 about the location of that member (low and high pc attributes
636 for function members, location descriptions for data members)
637 and will have a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
639 \textit{Consider a nested class whose
640 definition occurs outside of the containing class definition, as in:}
649 \textit{The two different structs can be described in
650 different compilation units to
651 facilitate DWARF space compression
652 (see Appendix \refersec{app:usingcompilationunits}).}
654 \subsection{Interface Type Entries}
655 \label{chap:interfacetypeentries}
657 \textit{The Java language defines "interface" types. An interface
658 in Java is similar to a C++ or Java class with only abstract
659 methods and constant data members.}
661 Interface types are represented by debugging information
663 tag \livetarg{chap:DWTAGinterfacetype}{DW\-\_TAG\-\_interface\-\_type}.
665 An interface type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
666 value is a null-terminated string containing the type name
667 as it appears in the source program.
669 The members of an interface are represented by debugging
670 information entries that are owned by the interface type
671 entry and that appear in the same order as the corresponding
672 declarations in the source program.
674 \subsection{Derived or Extended Structs, Classes and Interfaces}
675 \label{chap:derivedorextendedstructsclasesandinterfaces}
677 \textit{In C++, a class (or struct) may be ``derived from'' or be a
678 ``subclass of'' another class. In Java, an interface may ``extend''
679 one or more other interfaces, and a class may "extend" another
680 class and/or "implement" one or more interfaces. All of these
681 relationships may be described using the following. Note that
682 in Java, the distinction between extends and implements is
683 implied by the entities at the two ends of the relationship.}
685 A class type or interface type entry that describes a
686 derived, extended or implementing class or interface owns
687 debugging information entries describing each of the classes
688 or interfaces it is derived from, extending or implementing,
689 respectively, ordered as they were in the source program. Each
691 tag \livetarg{chap:DWTAGinheritance}{DW\-\_TAG\-\_inheritance}.
693 An inheritance entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is
694 a reference to the debugging information entry describing the
695 class or interface from which the parent class or structure
696 of the inheritance entry is derived, extended or implementing.
698 An inheritance entry for a class that derives from or extends
699 \hypertarget{chap:DWATdatamemberlocationinheritedmemberlocation}
700 another class or struct also has a
701 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
702 attribute, whose value describes the location of the beginning
703 of the inherited type relative to the beginning address of the
704 derived class. If that value is a constant, it is the offset
705 in bytes from the beginning of the class to the beginning of
706 the inherited type. Otherwise, the value must be a location
707 description. In this latter case, the beginning address of
708 the derived class is pushed on the expression stack before
709 the location description is evaluated and the result of the
710 evaluation is the location of the inherited type.
712 \textit{The interpretation of the value of this attribute for
713 inherited types is the same as the interpretation for data
715 (see Section \refersec{chap:datamemberentries}). }
718 \hypertarget{chap:DWATaccessibilitycppinheritedmembers}
720 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
721 attribute. If no accessibility attribute
722 is present, private access is assumed for an entry of a class
723 and public access is assumed for an entry of an interface,
727 \hypertarget{chap:DWATvirtualityvirtualityofbaseclass}
728 the class referenced by the inheritance entry serves
729 as a C++ virtual base class, the inheritance entry has a
730 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
732 \textit{For a C++ virtual base, the data member location attribute
733 will usually consist of a non-trivial location description.}
735 \subsection{Access Declarations}
736 \label{chap:accessdeclarations}
738 \textit{In C++, a derived class may contain access declarations that
739 change the accessibility of individual class members from the
740 overall accessibility specified by the inheritance declaration.
741 A single access declaration may refer to a set of overloaded
744 If a derived class or structure contains access declarations,
745 each such declaration may be represented by a debugging
746 information entry with the tag
747 \livetarg{chap:DWTAGaccessdeclaration}{DW\-\_TAG\-\_access\-\_declaration}.
749 such entry is a child of the class or structure type entry.
751 An access declaration entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
752 value is a null-terminated string representing the name used
753 in the declaration in the source program, including any class
754 or structure qualifiers.
756 An access declaration entry
757 \hypertarget{chap:DWATaccessibilitycppbaseclasses}
759 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
760 attribute describing the declared accessibility of the named
767 Each ``friend'' declared by a structure, union or class
768 \hypertarget{chap:DWATfriendfriendrelationship}
769 type may be represented by a debugging information entry
770 that is a child of the structure, union or class type entry;
771 the friend entry has the
772 tag \livetarg{chap:DWTAGfriend}{DW\-\_TAG\-\_friend}.
774 A friend entry has a \livelink{chap:DWATfriend}{DW\-\_AT\-\_friend} attribute, whose value is
775 a reference to the debugging information entry describing
776 the declaration of the friend.
779 \subsection{Data Member Entries}
780 \label{chap:datamemberentries}
782 A data member (as opposed to a member function) is
783 represented by a debugging information entry with the
784 tag \livetarg{chap:DWTAGmember}{DW\-\_TAG\-\_member}.
785 The member entry for a named member has
786 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null-terminated
787 string containing the member name as it appears in the source
788 program. If the member entry describes an anonymous union, the
789 name attribute is omitted or consists of a single zero byte.
791 The data member entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote
792 the type of that member.
794 A data member entry may have a \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
795 attribute. If no accessibility attribute is present, private
796 access is assumed for an entry of a class and public access
797 is assumed for an entry of a structure, union, or interface.
800 \hypertarget{chap:DWATmutablemutablepropertyofmemberdata}
801 entry may have a \livelink{chap:DWATmutable}{DW\-\_AT\-\_mutable} attribute,
802 which is a \livelink{chap:flag}{flag}.
803 This attribute indicates whether the data
804 member was declared with the mutable storage class specifier.
806 The beginning of a data member is described relative to
807 the beginning of the object in which it is immediately
808 contained. In general, the beginning is characterized by
809 both an address and a bit offset within the byte at that
810 address. When the storage for an entity includes all of
811 the bits in the beginning byte, the beginning bit offset is
814 Bit offsets in DWARF use the bit numbering and direction
815 conventions that are appropriate to the current language on
818 The member entry corresponding to a data member that is
819 \hypertarget{chap:DWATdatabitoffsetdatamemberbitlocation}
821 \hypertarget{chap:DWATdatamemberlocationdatamemberlocation}
822 in a structure, union or class may have either a
823 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute or a \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
824 attribute. If the beginning of the data member is the same as
825 the beginning of the containing entity then neither attribute
828 For a \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute there are two cases:
830 \begin{enumerate}[1.]
832 \item If the value is an integer constant, it is the offset
833 in bytes from the beginning of the containing entity. If
834 the beginning of the containing entity has a non-zero bit
835 offset then the beginning of the member entry has that same
838 \item Otherwise, the value must be a location description. In
839 this case, the beginning of the containing entity must be byte
840 aligned. The beginning address is pushed on the DWARF stack
841 before the location description is evaluated; the result of
842 the evaluation is the base address of the member entry.
844 \textit{The push on the DWARF expression stack of the base address of
845 the containing construct is equivalent to execution of the
846 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} operation
847 (see Section \refersec{chap:stackoperations});
848 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} therefore is not needed at the
849 beginning of a location description for a data member. The
850 result of the evaluation is a location--either an address or
851 the name of a register, not an offset to the member.}
853 \textit{A \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute that has the form of a
854 location description is not valid for a data member contained
855 in an entity that is not byte aligned because DWARF operations
856 do not allow for manipulating or computing bit offsets.}
860 For a \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} attribute, the value is an integer
862 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
863 that specifies the number of bits
864 from the beginning of the containing entity to the beginning
865 of the data member. This value must be greater than or equal
866 to zero, but is not limited to less than the number of bits
869 If the size of a data member is not the same as the size
870 of the type given for the data member, the data member has
871 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute whose
872 integer constant value
873 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
875 of storage needed to hold the value of the data member.
877 \textit{C and C++ bit fields typically require the use of the
878 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} and \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attributes.}
880 \textit{This Standard uses the following bit numbering and direction
881 conventions in examples. These conventions are for illustrative
882 purposes and other conventions may apply on particular
887 \item \textit{For big\dash endian architectures, bit offsets are
888 counted from high-order to low\dash order bits within a byte (or
889 larger storage unit); in this case, the bit offset identifies
890 the high\dash order bit of the object.}
892 \item \textit{For little\dash endian architectures, bit offsets are
893 counted from low\dash order to high\dash order bits within a byte (or
894 larger storage unit); in this case, the bit offset identifies
895 the low\dash order bit of the object.}
899 \textit{In either case, the bit so identified is defined as the beginning of the object.}
901 \textit{For example, take one possible representation of the following C structure definition in both big\dash and little\dash endian byte orders:}
912 \textit{The following diagrams show the structure layout
913 and data bit offsets for example big\dash\ and little\dash endian
914 architectures, respectively. Both diagrams show a structure
915 that begins at address A and whose size is four bytes. Also,
916 high order bits are to the left and low order bits are to
919 \textit{Big\dash Endian Data Bit Offsets:}
927 Addresses increase ->
928 | A | A + 1 | A + 2 | A + 3 |
930 Data bit offsets increase ->
931 +---------------+---------------+---------------+---------------+
932 |0 4|5 10|11 15|16 23|24 31|
933 | j | k | m | n | <pad> |
935 +---------------------------------------------------------------+
938 \textit{Little\dash Endian Data Bit Offsets:}
944 <- Addresses increase
945 | A | A + 1 | A + 2 | A + 3 |
947 <- Data bit offsets increase
949 +---------------+---------------+---------------+---------------+
950 |31 24|23 16|15 11|10 5|4 0|
951 | <pad> | n | m | k | j |
953 +---------------------------------------------------------------+
957 \textit{Note that data member bit offsets in this example are the
958 same for both big\dash\ and little\dash endian architectures even
959 though the fields are allocated in different directions
960 (high\dash order to low-order versus low\dash order to high\dash order);
961 the bit naming conventions for memory and/or registers of
962 the target architecture may or may not make this seem natural.}
964 \textit{For a more extensive example showing nested and packed records
966 Appendix \refersec{app:pascalexample}.}
968 \textit{Attribute \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} is new in DWARF Version 4 and
969 is also used for base types
970 (see Section \refersec{chap:basetypeentries}).
972 \livetarg{chap:DWATbitoffsetdatamemberbitlocation}
973 attributes \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} and \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} when used to
974 identify the beginning of bit field data members as defined
975 in DWARF V3 and earlier. The earlier attributes are defined
976 in a manner suitable for bit field members on big-endian
977 architectures but which is either awkward or incomplete for
978 use on little-endian architectures. (\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} also
979 has other uses that are not affected by this change.)}
981 \textit{The \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}, \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
982 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
983 attribute combination is deprecated for data members in DWARF
984 Version 4, but implementations may continue to support this
985 use for compatibility.}
987 \textit{The DWARF Version 3 definitions of these attributes are
990 \begin{myindentpara}{1cm}
991 \textit{If the data member entry describes a bit field, then that
992 entry has the following attributes:}
995 \item \textit{A \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute whose value (see Section
996 2.19) is the number of bytes that contain an instance of the
997 bit field and any padding bits.}
999 \textit{The byte size attribute may be omitted if the size of the
1000 object containing the bit field can be inferred from the type
1001 attribute of the data member containing the bit field.}
1003 \item \textit{A \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} attribute whose value (see Section
1004 2.19) is the number of bits to the left of the leftmost
1005 (most significant) bit of the bit field value.}
1007 \item \textit{A \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute whose value (see Section
1008 2.19) is the number of bits occupied by the bit field value.}
1012 \textit{The location description for a bit field calculates the address
1013 of an anonymous object containing the bit field. The address
1014 is relative to the structure, union, or class that most closely
1015 encloses the bit field declaration. The number of bytes in this
1016 anonymous object is the value of the byte size attribute of
1017 the bit field. The offset (in bits) from the most significant
1018 bit of the anonymous object to the most significant bit of
1019 the bit field is the value of the bit offset attribute.}
1023 \textit{Diagrams similar to the above that show the use of the
1024 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}, \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} attribute
1025 combination may be found in the DWARF Version 3 Standard.}
1027 \textit{In comparing DWARF Versions 3 and 4, note that DWARF V4
1028 defines the following combinations of attributes:}
1031 \item \textit{either \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} or
1032 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} (to specify the beginning of the
1035 % FIXME: the indentation of the following line is suspect.
1036 \textit{optionally together with}
1038 \item \textit{either \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} (to
1039 specify the size of the data member)}
1043 \textit{DWARF V3 defines the following combinations}
1046 \item \textit{\livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} (to specify the beginning
1047 of the data member, except this specification is only partial
1048 in the case of a bit field) }
1050 % FIXME: the indentation of the following line is suspect.
1051 \textit{optionally together with}
1053 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}, \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1054 (to further specify the beginning of a bit field data member
1055 as well as specify the size of the data member) }
1058 \subsection{Member Function Entries}
1059 \label{chap:memberfunctionentries}
1061 A member function is represented by a debugging information
1062 entry with the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}. The member function entry
1063 may contain the same attributes and follows the same rules
1064 as non\dash member global subroutine entries
1065 (see Section \refersec{chap:subroutineandentrypointentries}).
1067 A member function entry may have a \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
1068 attribute. If no accessibility attribute is present, private
1069 access is assumed for an entry of a class and public access
1070 is assumed for an entry of a structure, union or interface.
1073 \hypertarget{chap:DWATvirtualityvirtualityoffunction}
1074 the member function entry describes a virtual function,
1075 then that entry has a
1076 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
1079 \hypertarget{chap:DWATexplicitexplicitpropertyofmemberfunction}
1080 the member function entry describes an explicit member
1081 function, then that entry has a
1082 \livelink{chap:DWATexplicit}{DW\-\_AT\-\_explicit} attribute.
1085 \hypertarget{chap:DWATvtableelemlocationvirtualfunctiontablevtableslot}
1086 entry for a virtual function also has a
1087 \livelink{chap:DWATvtableelemlocation}{DW\-\_AT\-\_vtable\-\_elem\-\_location} attribute whose value contains
1088 a location description yielding the address of the slot
1089 for the function within the virtual function table for the
1090 enclosing class. The address of an object of the enclosing
1091 type is pushed onto the expression stack before the location
1092 description is evaluated.
1095 \hypertarget{chap:DWATobjectpointerobjectthisselfpointerofmemberfunction}
1096 the member function entry describes a non\dash static member
1097 function, then that entry has a \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer} attribute
1098 whose value is a reference to the formal parameter entry
1099 that corresponds to the object for which the function is
1100 called. The name attribute of that formal parameter is defined
1101 by the current language (for example, this for C++ or self
1102 for Objective C and some other languages). That parameter
1103 also has a \livelink{chap:DWATartificial}{DW\-\_AT\-\_artificial} attribute whose value is true.
1105 Conversely, if the member function entry describes a static
1106 member function, the entry does not have a \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer}
1109 If the member function entry describes a non\dash static member
1110 function that has a const\dash volatile qualification, then
1111 the entry describes a non\dash static member function whose
1112 object formal parameter has a type that has an equivalent
1113 const\dash volatile qualification.
1115 If a subroutine entry represents the defining declaration
1116 of a member function and that definition appears outside of
1117 the body of the enclosing class declaration, the subroutine
1118 entry has a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute, whose value is
1119 a reference to the debugging information entry representing
1120 the declaration of this function member. The referenced entry
1121 will be a child of some class (or structure) type entry.
1123 Subroutine entries containing the \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
1124 attribute do not need to duplicate information provided
1125 by the declaration entry referenced by the specification
1126 attribute. In particular, such entries do not need to contain
1127 attributes for the name or return type of the function member
1128 whose definition they represent.
1130 \subsection{Class Template Instantiations}
1131 \label{chap:classtemplateinstantiations}
1133 \textit{In C++ a class template is a generic definition of a class
1134 type that may be instantiated when an instance of the class
1135 is declared or defined. The generic description of the
1136 class may include both parameterized types and parameterized
1137 constant values. DWARF does not represent the generic template
1138 definition, but does represent each instantiation.}
1140 A class template instantiation is represented by a
1141 debugging information entry with the tag \livelink{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
1142 \livelink{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type} or \livelink{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type}. With five
1143 exceptions, such an entry will contain the same attributes
1144 and have the same types of child entries as would an entry
1145 for a class type defined explicitly using the instantiation
1146 types and values. The exceptions are:
1148 \begin{enumerate}[1.]
1149 \item Each formal parameterized type declaration appearing in the
1150 template definition is represented by a debugging information
1151 entry with the tag \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}. Each
1152 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is
1153 a null\dash terminated string containing the name of the formal
1154 type parameter as it appears in the source program. The
1155 template type parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1156 describing the actual type by which the formal is replaced
1157 for this instantiation.
1159 \item Each formal parameterized value declaration appearing in the
1160 template definition is represented by a debugging information
1162 tag \livetarg{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}.
1164 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is
1165 a null\dash terminated string containing the name of the formal
1166 value parameter as it appears in the source program.
1168 \hypertarget{chap:DWATconstvaluetemplatevalueparameter}
1169 template value parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1170 describing the type of the parameterized value. Finally,
1171 the template value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value}
1172 attribute, whose value is the actual constant value of the
1173 value parameter for this instantiation as represented on the
1174 target architecture.
1176 \item The class type entry and each of its child entries references
1177 a template type parameter entry in any circumstance where the
1178 source template definition references a formal parameterized
1179 type. Similarly, the class type entry and each of its child
1180 entries references a template value parameter entry in any
1181 circumstance where the source template definition references
1182 a formal parameterized value.
1184 \item If the compiler has generated a special compilation unit to
1185 hold the template instantiation and that special compilation
1186 unit has a different name from the compilation unit containing
1187 the template definition, the name attribute for the debugging
1188 information entry representing the special compilation unit
1189 should be empty or omitted.
1191 \item If the class type entry representing the template
1192 instantiation or any of its child entries contains declaration
1193 coordinate attributes, those attributes should refer to
1194 the source for the template definition, not to any source
1195 generated artificially by the compiler.
1199 \subsection{Variant Entries}
1200 \label{chap:variantentries}
1202 A variant part of a structure is represented by a debugging
1203 information entry with the
1204 tag \livetarg{chap:DWTAGvariantpart}{DW\-\_TAG\-\_variant\-\_part} and is
1205 owned by the corresponding structure type entry.
1207 If the variant part has a discriminant, the discriminant is
1208 \hypertarget{chap:DWATdiscrdiscriminantofvariantpart}
1209 represented by a separate debugging information entry which
1210 is a child of the variant part entry. This entry has the form
1211 of a structure data member entry. The variant part entry will
1213 \livelink{chap:DWATdiscr}{DW\-\_AT\-\_discr} attribute whose value is a reference to
1214 the member entry for the discriminant.
1216 If the variant part does not have a discriminant (tag field),
1217 the variant part entry has a
1218 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to represent
1221 Each variant of a particular variant part is represented by
1222 \hypertarget{chap:DWATdiscrvaluediscriminantvalue}
1223 a debugging information entry with the
1224 tag \livetarg{chap:DWTAGvariant}{DW\-\_TAG\-\_variant}
1225 and is a child of the variant part entry. The value that
1226 selects a given variant may be represented in one of three
1227 ways. The variant entry may have a
1228 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value} attribute
1229 whose value represents a single case label. The value of this
1230 attribute is encoded as an LEB128 number. The number is signed
1231 if the tag type for the variant part containing this variant
1232 is a signed type. The number is unsigned if the tag type is
1236 \hypertarget{chap:DWATdiscrlistlistofdiscriminantvalues}
1237 the variant entry may contain a
1238 \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list}
1239 attribute, whose value represents a list of discriminant
1240 values. This list is represented by any of the
1241 \livelink{chap:block}{block} forms and
1242 may contain a mixture of case labels and label ranges. Each
1243 item on the list is prefixed with a discriminant value
1244 descriptor that determines whether the list item represents
1245 a single label or a label range. A single case label is
1246 represented as an LEB128 number as defined above for the
1247 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value} attribute. A label range is represented by
1248 two LEB128 numbers, the low value of the range followed by the
1249 high value. Both values follow the rules for signedness just
1250 described. The discriminant value descriptor is an integer
1251 constant that may have one of the values given in
1252 Figure \refersec{fig:discriminantdescriptorvalues}.
1254 \begin{figure}[here]
1255 \autorows[0pt]{c}{1}{l}{
1256 \addtoindex{DW\-\_DSC\-\_label},
1257 \addtoindex{DW\-\_DSC\-\_range}
1259 \caption{Discriminant descriptor values}\label{fig:discriminantdescriptorvalues}
1262 If a variant entry has neither a \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value}
1263 attribute nor a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute, or if it has
1264 a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute with 0 size, the variant is a
1267 The components selected by a particular variant are represented
1268 by debugging information entries owned by the corresponding
1269 variant entry and appear in the same order as the corresponding
1270 declarations in the source program.
1272 \section{Condition Entries}
1273 \label{chap:conditionentries}
1275 \textit{COBOL has the notion of a ``level\dash 88 condition'' that
1276 associates a data item, called the conditional variable, with
1277 a set of one or more constant values and/or value ranges.
1278 Semantically, the condition is ‛true’ if the conditional
1279 variable's value matches any of the described constants,
1280 and the condition is ‛false’ otherwise.}
1282 The \livetarg{chap:DWTAGcondition}{DW\-\_TAG\-\_condition} debugging information entry
1284 logical condition that tests whether a given data item’s
1285 value matches one of a set of constant values. If a name
1286 has been given to the condition, the condition entry has a
1287 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
1288 giving the condition name as it appears in the source program.
1290 The condition entry's parent entry describes the conditional
1291 variable; normally this will be a \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable},
1292 \livelink{chap:DWTAGmember}{DW\-\_TAG\-\_member} or \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter} entry. If the parent
1293 entry has an array type, the condition can test any individual
1294 element, but not the array as a whole. The condition entry
1295 implicitly specifies a “comparison type” that is the
1296 type of an array element if the parent has an array type;
1297 otherwise it is the type of the parent entry.
1299 The condition entry owns \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} and/or
1300 \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} entries that describe the constant
1301 values associated with the condition. If any child entry has
1302 a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute, that attribute should describe a type
1303 compatible with the comparison type (according to the source
1304 language); otherwise the child’s type is the same as the
1307 \textit{For conditional variables with alphanumeric types, COBOL
1308 permits a source program to provide ranges of alphanumeric
1309 constants in the condition. Normally a subrange type entry
1310 does not describe ranges of strings; however, this can be
1311 represented using bounds attributes that are references to
1312 constant entries describing strings. A subrange type entry may
1313 refer to constant entries that are siblings of the subrange
1317 \section{Enumeration Type Entries}
1318 \label{chap:enumerationtypeentries}
1320 \textit{An “enumeration type” is a scalar that can assume one of
1321 a fixed number of symbolic values.}
1323 An enumeration type is represented by a debugging information
1325 \livetarg{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}.
1327 If a name has been given to the enumeration type in the source
1328 program, then the corresponding enumeration type entry has
1329 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated
1330 string containing the enumeration type name as it appears
1331 in the source program. This entry also has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1332 attribute whose integer constant value is the number of bytes
1333 required to hold an instance of the enumeration.
1335 The enumeration type entry may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1336 which refers to the underlying data type used to implement
1339 If an enumeration type has type safe semantics such that
1341 \begin{enumerate}[1.]
1342 \item Enumerators are contained in the scope of the enumeration type, and/or
1344 \item Enumerators are not implicitly converted to another type
1347 then the enumeration type entry may have a \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}
1348 attribute, which is a \livelink{chap:flag}{flag}.
1349 In a language that offers only
1350 one kind of enumeration declaration, this attribute is not
1353 \textit{In C or C++, the underlying type will be the appropriate
1354 integral type determined by the compiler from the properties of
1355 \hypertarget{chap:DWATenumclasstypesafeenumerationdefinition}
1356 the enumeration literal values. A C++ type declaration written
1357 using enum class declares a strongly typed enumeration and
1358 is represented using \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type} in combination
1359 with \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}.}
1361 Each enumeration literal is represented by a debugging
1362 information entry with the
1363 tag \livetarg{chap:DWTAGenumerator}{DW\-\_TAG\-\_enumerator}.
1365 such entry is a child of the enumeration type entry, and the
1366 enumerator entries appear in the same order as the declarations
1367 of the enumeration literals in the source program.
1369 Each enumerator entry has a
1370 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
1371 value is a null\dash terminated string containing the name of the
1372 \hypertarget{chap:DWATconstvalueenumerationliteralvalue}
1373 enumeration literal as it appears in the source program.
1374 Each enumerator entry also has a
1375 \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value} attribute,
1376 whose value is the actual numeric value of the enumerator as
1377 represented on the target system.
1380 If the enumeration type occurs as the description of a
1381 dimension of an array type, and the stride for that dimension
1382 \hypertarget{chap:DWATbytestrideenumerationstridedimensionofarraytype}
1383 is different than what would otherwise be determined, then
1384 \hypertarget{chap:DWATbitstrideenumerationstridedimensionofarraytype}
1385 the enumeration type entry has either a \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1386 or \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute which specifies the separation
1387 between successive elements along the dimension as described
1389 Section \refersec{chap:visibilityofdeclarations}.
1390 The value of the \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1391 is interpreted as bits and the value of the \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1392 attribute is interpreted as bytes.
1395 \section{Subroutine Type Entries}
1396 \label{chap:subroutinetypeentries}
1398 It is possible in C to declare pointers to subroutines
1399 that return a value of a specific type. In both C and C++,
1400 it is possible to declare pointers to subroutines that not
1401 only return a value of a specific type, but accept only
1402 arguments of specific types. The type of such pointers would
1403 be described with a ``pointer to'' modifier applied to a
1404 user\dash defined type.
1406 A subroutine type is represented by a debugging information
1408 tag \livetarg{chap:DWTAGsubroutinetype}{DW\-\_TAG\-\_subroutine\-\_type}.
1410 been given to the subroutine type in the source program,
1411 then the corresponding subroutine type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
1412 attribute whose value is a null\dash terminated string containing
1413 the subroutine type name as it appears in the source program.
1415 If the subroutine type describes a function that returns
1416 a value, then the subroutine type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
1417 attribute to denote the type returned by the subroutine. If
1418 the types of the arguments are necessary to describe the
1419 subroutine type, then the corresponding subroutine type
1420 entry owns debugging information entries that describe the
1421 arguments. These debugging information entries appear in the
1422 order that the corresponding argument types appear in the
1425 In C there is a difference between the types of functions
1426 declared using function prototype style declarations and
1427 those declared using non\dash prototype declarations.
1430 \hypertarget{chap:DWATprototypedsubroutineprototype}
1431 subroutine entry declared with a function prototype style
1432 declaration may have a
1433 \livelink{chap:DWATprototyped}{DW\-\_AT\-\_prototyped} attribute, which is
1434 a \livelink{chap:flag}{flag}.
1436 Each debugging information entry owned by a subroutine
1437 type entry has a tag whose value has one of two possible
1440 \begin{enumerate}[1.]
1441 \item The formal parameters of a parameter list (that have a
1442 specific type) are represented by a debugging information entry
1443 with the tag \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter}. Each formal parameter
1444 entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute that refers to the type of
1445 the formal parameter.
1447 \item The unspecified parameters of a variable parameter list
1448 are represented by a debugging information entry with the
1449 tag \livelink{chap:DWTAGunspecifiedparameters}{DW\-\_TAG\-\_unspecified\-\_parameters}.
1454 \section{String Type Entries}
1455 \label{chap:stringtypeentries}
1458 A ``string'' is a sequence of characters that have specific
1459 semantics and operations that separate them from arrays of
1460 characters. Fortran is one of the languages that has a string
1461 type. Note that ``string'' in this context refers to a target
1462 machine concept, not the class string as used in this document
1463 (except for the name attribute).
1465 A string type is represented by a debugging information entry
1466 with the tag \livetarg{chap:DWTAGstringtype}{DW\-\_TAG\-\_string\-\_type}.
1467 If a name has been given to
1468 the string type in the source program, then the corresponding
1469 string type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is
1470 a null\dash terminated string containing the string type name as
1471 it appears in the source program.
1474 \hypertarget{chap:DWATstringlengthstringlengthofstringtype}
1475 string type entry may have a
1476 \livelink{chap:DWATstringlength}{DW\-\_AT\-\_string\-\_length} attribute
1477 whose value is a location description yielding the location
1478 where the length of the string is stored in the program. The
1479 string type entry may also have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute
1480 or \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
1481 (see Section \refersec{chap:byteandbitsizes})
1482 is the size of the data to be retrieved from the location
1483 referenced by the string length attribute. If no (byte or bit)
1484 size attribute is present, the size of the data to be retrieved
1485 is the same as the size of an address on the target machine.
1487 If no string length attribute is present, the string type
1488 entry may have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1489 attribute, whose value
1490 (see Section \refersec{chap:byteandbitsizes})
1492 storage needed to hold a value of the string type.
1495 \section{Set Type Entries}
1496 \label{chap:settypeentries}
1498 \textit{Pascal provides the concept of a “set,” which represents
1499 a group of values of ordinal type.}
1501 A set is represented by a debugging information entry with
1502 the tag \livetarg{chap:DWTAGsettype}{DW\-\_TAG\-\_set\-\_type}.
1503 If a name has been given to the
1504 set type, then the set type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1505 whose value is a null\dash terminated string containing the
1506 set type name as it appears in the source program.
1508 The set type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote the
1509 type of an element of the set.
1511 If the amount of storage allocated to hold each element of an
1512 object of the given set type is different from the amount of
1513 storage that is normally allocated to hold an individual object
1514 of the indicated element type, then the set type entry has
1515 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute, or \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
1516 whose value (see Section \refersec{chap:byteandbitsizes}) is
1517 the amount of storage needed to hold a value of the set type.
1520 \section{Subrange Type Entries}
1521 \label{chap:subrangetypeentries}
1523 \textit{Several languages support the concept of a ``subrange''
1524 type object. These objects can represent a subset of the
1525 values that an object of the basis type for the subrange can
1526 represent. Subrange type entries may also be used to represent
1527 the bounds of array dimensions.}
1529 A subrange type is represented by a debugging information
1531 tag \livetarg{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type}.
1533 given to the subrange type, then the subrange type entry
1534 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated
1535 string containing the subrange type name as it appears in
1538 The subrange entry may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to describe
1539 the type of object, called the basis type, of whose values
1540 this subrange is a subset.
1542 If the amount of storage allocated to hold each element of an
1543 object of the given subrange type is different from the amount
1544 of storage that is normally allocated to hold an individual
1545 object of the indicated element type, then the subrange
1546 type entry has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1547 attribute, whose value
1548 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1550 storage needed to hold a value of the subrange type.
1553 \hypertarget{chap:DWATthreadsscaledupcarrayboundthreadsscalfactor}
1554 subrange entry may have a \livelink{chap:DWATthreadsscaled}{DW\-\_AT\-\_threads\-\_scaled} attribute,
1555 which is a \livelink{chap:flag}{flag}.
1556 If present, this attribute indicates whether
1557 this subrange represents a UPC array bound which is scaled
1558 by the runtime THREADS value (the number of UPC threads in
1559 this execution of the program).
1561 \textit{This allows the representation of a UPC shared array such as}
1564 int shared foo[34*THREADS][10][20];
1568 \hypertarget{chap:DWATlowerboundlowerboundofsubrange}
1570 \hypertarget{chap:DWATupperboundupperboundofsubrange}
1571 entry may have the attributes
1572 \livelink{chap:DWATlowerbound}{DW\-\_AT\-\_lower\-\_bound}
1573 and \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound} to specify, respectively, the lower
1574 and upper bound values of the subrange. The \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound}
1576 \hypertarget{chap:DWATcountelementsofsubrangetype}
1577 may be replaced by a
1578 \livelink{chap:DWATcount}{DW\-\_AT\-\_count} attribute, whose
1579 value describes the number of elements in the subrange rather
1580 than the value of the last element. The value of each of
1581 these attributes is determined as described in
1582 Section \refersec{chap:staticanddynamicvaluesofattributes}.
1584 If the lower bound value is missing, the value is assumed to
1585 be a language\dash dependent default constant. The default lower
1586 bound is 0 for C, C++, D, Java, Objective C, Objective C++,
1587 Python, and UPC. The default lower bound is 1 for Ada, COBOL,
1588 Fortran, Modula\dash 2, Pascal and PL/I.
1590 \textit{No other default lower bound values are currently defined.}
1592 If the upper bound and count are missing, then the upper bound value is
1595 If the subrange entry has no type attribute describing the
1596 basis type, the basis type is assumed to be the same as
1597 the object described by the lower bound attribute (if it
1598 references an object). If there is no lower bound attribute,
1599 or that attribute does not reference an object, the basis type
1600 is the type of the upper bound or count attribute (if either
1601 of them references an object). If there is no upper bound or
1602 count attribute, or neither references an object, the type is
1603 assumed to be the same type, in the source language of the
1604 compilation unit containing the subrange entry, as a signed
1605 integer with the same size as an address on the target machine.
1607 If the subrange type occurs as the description of a dimension
1608 of an array type, and the stride for that dimension is
1609 \hypertarget{chap:DWATbytestridesubrangestridedimensionofarraytype}
1610 different than what would otherwise be determined, then
1611 \hypertarget{chap:DWATbitstridesubrangestridedimensionofarraytype}
1612 the subrange type entry has either a \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride} or
1613 \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute which specifies the separation
1614 between successive elements along the dimension as described
1616 Section \refersec{chap:byteandbitsizes}.
1618 \textit{Note that the stride can be negative.}
1620 \section{Pointer to Member Type Entries}
1621 \label{chap:pointertomembertypeentries}
1623 \textit{In C++, a pointer to a data or function member of a class or
1624 structure is a unique type.}
1626 A debugging information entry representing the type of an
1627 object that is a pointer to a structure or class member has
1628 the tag \livetarg{chap:DWTAGptrtomembertype}{DW\-\_TAG\-\_ptr\-\_to\-\_member\-\_type}.
1630 If the pointer to member type has a name, the pointer to
1631 member entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a
1632 null\dash terminated string containing the type name as it appears
1633 in the source program.
1635 The pointer to member entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to
1636 describe the type of the class or structure member to which
1637 objects of this type may point.
1639 The pointer to member entry also
1640 \hypertarget{chap:DWATcontainingtypecontainingtypeofpointertomembertype}
1642 \livelink{chap:DWATcontainingtype}{DW\-\_AT\-\_containing\-\_type}
1643 attribute, whose value is a reference to a debugging
1644 information entry for the class or structure to whose members
1645 objects of this type may point.
1648 \hypertarget{chap:DWATuselocationmemberlocationforpointertomembertype}
1649 pointer to member entry has a
1650 \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} attribute
1651 whose value is a location description that computes the
1652 address of the member of the class to which the pointer to
1653 member entry points.
1655 \textit{The method used to find the address of a given member of a
1656 class or structure is common to any instance of that class
1657 or structure and to any instance of the pointer or member
1658 type. The method is thus associated with the type entry,
1659 rather than with each instance of the type.}
1661 The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is used in conjunction
1662 with the location descriptions for a particular object of the
1663 given pointer to member type and for a particular structure or
1664 class instance. The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} attribute expects two
1665 values to be pushed onto the DWARF expression stack before
1666 the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is evaluated. The first
1667 value pushed is the value of the pointer to member object
1668 itself. The second value pushed is the base address of the
1669 entire structure or union instance containing the member
1670 whose address is being calculated.
1672 \textit{For an expression such as}
1677 % FIXME: object and mbr\_ptr should be distinguished from italic. See DW4.
1678 \textit{where mbr\_ptr has some pointer to member type, a debugger should:}
1680 \textit{1. Push the value of mbr\_ptr onto the DWARF expression stack.}
1682 \textit{2. Push the base address of object onto the DWARF expression stack.}
1684 \textit{3. Evaluate the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description
1685 given in the type of mbr\_ptr.}
1687 \section{File Type Entries}
1688 \label{chap:filetypeentries}
1690 \textit{Some languages, such as Pascal, provide a data type to represent
1693 A file type is represented by a debugging information entry
1695 \livetarg{chap:DWTAGfiletype}{DW\-\_TAG\-\_file\-\_type}.
1696 If the file type has a name,
1697 the file type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value
1698 is a null\dash terminated string containing the type name as it
1699 appears in the source program.
1701 The file type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
1702 the type of the objects contained in the file.
1704 The file type entry also has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or
1705 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
1706 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1707 is the amount of storage need to hold a value of the file type.
1709 \section{Dynamic Type Properties}
1710 \label{chap:dynamictypeproperties}
1711 \subsection{Data Location}
1712 \label{chap:datalocation}
1714 \textit{Some languages may represent objects using descriptors to hold
1715 information, including a location and/or run\dash time parameters,
1716 about the data that represents the value for that object.}
1718 \hypertarget{chap:DWATdatalocationindirectiontoactualdata}
1719 The \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
1720 attribute may be used with any
1721 type that provides one or more levels of hidden indirection
1722 and/or run\dash time parameters in its representation. Its value
1723 is a location description. The result of evaluating this
1724 description yields the location of the data for an object.
1725 When this attribute is omitted, the address of the data is
1726 the same as the address of the object.
1728 \textit{This location description will typically begin with
1729 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address}
1730 which loads the address of the
1731 object which can then serve as a descriptor in subsequent
1732 calculation. For an example using
1733 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
1734 for a Fortran 90 array, see
1735 Appendix \refersec{app:fortran90example}.}
1737 \subsection{Allocation and Association Status}
1738 \label{chap:allocationandassociationstatus}
1740 \textit{Some languages, such as Fortran 90, provide types whose values
1741 may be dynamically allocated or associated with a variable
1742 under explicit program control.}
1744 \hypertarget{chap:DWATallocatedallocationstatusoftypes}
1746 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated}
1747 attribute may optionally be used with any
1748 type for which objects of the type can be explicitly allocated
1749 and deallocated. The presence of the attribute indicates that
1750 objects of the type are allocatable and deallocatable. The
1751 integer value of the attribute (see below) specifies whether
1752 an object of the type is
1753 currently allocated or not.
1755 \hypertarget{chap:DWATassociatedassociationstatusoftypes}
1757 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute
1758 may optionally be used with
1759 any type for which objects of the type can be dynamically
1760 associated with other objects. The presence of the attribute
1761 indicates that objects of the type can be associated. The
1762 integer value of the attribute (see below) indicates whether
1763 an object of the type is currently associated or not.
1765 While these attributes are defined specifically with Fortran
1766 90 ALLOCATABLE and POINTER types in mind, usage is not limited
1767 to just that language.
1769 The value of these attributes is determined as described in
1770 Section \refersec{chap:staticanddynamicvaluesofattributes}.
1772 A non\dash zero value is interpreted as allocated or associated,
1773 and zero is interpreted as not allocated or not associated.
1775 \textit{For Fortran 90, if the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute is present,
1776 the type has the POINTER property where either the parent
1777 variable is never associated with a dynamic object or the
1778 implementation does not track whether the associated object
1779 is static or dynamic. If the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute is
1780 present and the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute is not, the type
1781 has the ALLOCATABLE property. If both attributes are present,
1782 then the type should be assumed to have the POINTER property
1783 (and not ALLOCATABLE); the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute may then
1784 be used to indicate that the association status of the object
1785 resulted from execution of an ALLOCATE statement rather than
1786 pointer assignment.}
1788 \textit{For examples using \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} for Ada and Fortran 90
1790 see Appendix \refersec{app:aggregateexamples}.}
1794 \section{Template Alias Entries}
1795 \label{chap:templatealiasentries}
1797 A type named using a template alias is represented
1798 by a debugging information entry with the tag
1799 \livetarg{chap:DWTAGtemplatealias}{DW\-\_TAG\-\_template\-\_alias}.
1800 The template alias entry has a
1801 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
1802 containing the name of the template alias as it appears in
1803 the source program. The template alias entry also contains a
1804 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is a reference to the type
1805 named by the template alias. The template alias entry has
1806 the following child entries:
1808 \begin{enumerate}[1.]
1809 \item Each formal parameterized type declaration appearing
1810 in the template alias declaration is represented
1811 by a debugging information entry with the tag
1812 \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}. Each such entry may have
1813 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a null\dash terminated
1814 string containing the name of the formal type parameter as it
1815 appears in the source program. The template type parameter
1816 entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing the actual
1817 type by which the formal is replaced for this instantiation.
1819 \item Each formal parameterized value declaration
1820 appearing in the template alias declaration is
1821 represented by a debugging information entry with the tag
1822 \livelink{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}. Each such entry may have
1823 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a null\dash terminated
1824 string containing the name of the formal value parameter
1825 as it appears in the source program. The template value
1826 parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
1827 the type of the parameterized value. Finally, the template
1828 value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value} attribute, whose
1829 value is the actual constant value of the value parameter for
1830 this instantiation as represented on the target architecture.