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