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.
33 \addtoindexx{encoding attribute}
34 a \livelink{chap:DWATencoding}{DW\-\_AT\-\_encoding} attribute describing
35 how the base type is encoded and is to be interpreted. The
36 value of this attribute is an integer constant. The set of
37 values and their meanings for the \livelink{chap:DWATencoding}{DW\-\_AT\-\_encoding} attribute
39 Figure \refersec{fig:encodingattributevalues}
43 may have a \livelink{chap:DWATendianity}{DW\-\_AT\-\_endianity} attribute
44 \addtoindexx{endianity attribute}
46 Section \refersec{chap:dataobjectentries}.
47 If omitted, the encoding assumes the representation that
48 is the default for the target architecture.
51 \hypertarget{chap:DWATbytesizedataobjectordatatypesize}
52 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute
53 \hypertarget{chap:DWATbitsizebasetypebitsize}
54 or a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
55 \addtoindex{bit size attribute}
56 whose integer constant value
57 (see Section \refersec{chap:byteandbitsizes})
58 is the amount of storage needed to hold
61 \textit{For example, the
62 \addtoindex{C} type int on a machine that uses 32\dash bit
63 integers is represented by a base type entry with a name
64 attribute whose value is “int”, an encoding attribute
65 whose value is \livelink{chap:DWATEsigned}{DW\-\_ATE\-\_signed}
66 and a byte size attribute whose value is 4.}
68 If the value of an object of the given type does not fully
69 occupy the storage described by a byte size attribute,
70 \hypertarget{chap:DWATdatabitoffsetbasetypebitlocation}
71 the base type entry may also have
72 \addtoindexx{bit size attribute}
74 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and a
75 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} attribute,
77 \addtoindexx{data bit offset attribute}
79 integer constant values (
80 see Section \refersec{chap:staticanddynamicvaluesofattributes}).
82 attribute describes the actual size in bits used to represent
83 values of the given type. The data bit offset attribute is the
84 offset in bits from the beginning of the containing storage to
85 the beginning of the value. Bits that are part of the offset
86 are padding. The data bit offset uses the bit numbering and
87 direction conventions that are appropriate to the current
89 target system to locate the beginning of the storage and
90 value. If this attribute is omitted a default data bit offset
94 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
96 \addtoindexx{bit offset attribute}
98 \addtoindexx{data bit offset attribute}
100 \addtoindex{DWARF Version 4} and
101 is also used for bit field members
102 (see Section \refersec{chap:datamemberentries}).
104 \hypertarget{chap:DWATbitoffsetbasetypebitlocation}
105 replaces the attribute
106 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
108 \addtoindexx{bit offset attribute (V3)}
109 types as defined in DWARF V3 and earlier. The earlier attribute
110 is defined in a manner suitable for bit field members on
111 big\dash endian architectures but which is wasteful for use on
112 little\dash endian architectures.}
114 \textit{The attribute \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} is
116 \addtoindex{DWARF Version 4}
117 for use in base types, but implementations may continue to
118 support its use for compatibility.}
121 \addtoindex{DWARF Version 3}
122 definition of these attributes is as follows.}
124 \begin{myindentpara}{1cm}
125 \textit{A base type entry has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
126 attribute, whose value
127 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
128 is the size in bytes of the storage unit
129 used to represent an object of the given type.}
131 \textit{If the value of an object of the given type does not fully
132 occupy the storage unit described by the byte size attribute,
133 the base type entry may have a
134 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
135 \addtoindexx{bit size attribute (V3)}
137 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} attribute, both of whose values
138 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
139 are integers. The bit size attribute describes the actual
140 size in bits used to represent a value of the given type.
141 The bit offset attribute describes the offset in bits of the
142 high order bit of a value of the given type from the high
143 order bit of the storage unit used to contain that value.}
148 \addtoindexx{DWARF Version 3}
150 \addtoindexx{DWARF Version 4} and
151 4, note that DWARF V4
152 defines the following combinations of attributes:}
155 \item \textit{DW\-\_AT\-\_byte\-\_size}
156 \item \textit{DW\-\_AT\-\_bit\-\_size}
157 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
158 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
159 and optionally \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}}
162 \addtoindexx{DWARF Version 3}
163 defines the following combinations:
164 % FIXME: the figure below interferes with the following
165 % bullet list, which looks horrible as a result.
167 \item \textit{DW\-\_AT\-\_byte\-\_size}
168 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
169 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
170 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}}
173 \begin{figure}[!here]
175 \begin{tabular}{lp{9cm}}
176 Name&Meaning\\ \hline
177 \livetarg{chap:DWATEaddress}{DW\-\_ATE\-\_address} & linear machine address (for
178 segmented addresses see
179 Section \refersec{chap:segmentedaddresses}) \\
180 \livetarg{chap:DWATEboolean}{DW\-\_ATE\-\_boolean}& true or false \\
182 \livetarg{chap:DWATEcomplexfloat}{DW\-\_ATE\-\_complex\-\_float}& complex binary
183 floating\dash point number \\
184 \livetarg{chap:DWATEfloat}{DW\-\_ATE\-\_float} & binary floating\dash point number \\
185 \livetarg{chap:DWATEimaginaryfloat}{DW\-\_ATE\-\_imaginary\-\_float}& imaginary binary
186 floating\dash point number \\
187 \livetarg{chap:DWATEsigned}{DW\-\_ATE\-\_signed}& signed binary integer \\
188 \livetarg{chap:DWATEsignedchar}{DW\-\_ATE\-\_signed\-\_char}& signed character \\
189 \livetarg{chap:DWATEunsigned}{DW\-\_ATE\-\_unsigned} & unsigned binary integer \\
190 \livetarg{chap:DWATEunsignedchar}{DW\-\_ATE\-\_unsigned\-\_char} & unsigned character \\
191 \livetarg{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} & packed decimal \\
192 \livetarg{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string}& numeric string \\
193 \livetarg{chap:DWATEedited}{DW\-\_ATE\-\_edited} & edited string \\
194 \livetarg{chap:DWATEsignedfixed}{DW\-\_ATE\-\_signed\-\_fixed} & signed fixed\dash point scaled integer \\
195 \livetarg{chap:DWATEunsignedfixed}{DW\-\_ATE\-\_unsigned\-\_fixed}& unsigned fixed\dash point scaled integer \\
196 \livetarg{chap:DWATEdecimalfloat}{DW\-\_ATE\-\_decimal\-\_float} & decimal floating\dash point number \\
197 \livetarg{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} & Unicode character \\
199 \caption{Encoding attribute values}
200 \label{fig:encodingattributevalues}
203 \textit{The \livelink{chap:DWATEdecimalfloat}{DW\-\_ATE\-\_decimal\-\_float} encoding is intended for
204 floating\dash point representations that have a power\dash of\dash ten
205 exponent, such as that specified in IEEE 754R.}
207 \textit{The \livelink{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} encoding is intended for Unicode string
208 encodings (see the Universal Character Set standard,
209 ISO/IEC 10646\dash 1:1993). For example, the
210 \addtoindex{C++} type char16\_t is
211 represented by a base type entry with a name attribute whose
212 value is “char16\_t”, an encoding attribute whose value
213 is \livelink{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} and a byte size attribute whose value is 2.}
216 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal}
218 \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string}
220 represent packed and unpacked decimal string numeric data
221 types, respectively, either of which may be
223 \addtoindexx{decimal scale attribute}
225 \addtoindexx{decimal sign attribute}
227 \addtoindexx{digit count attribute}
229 \hypertarget{chap:DWATdecimalsigndecimalsignrepresentation}
231 \hypertarget{chap:DWATdigitcountdigitcountforpackeddecimalornumericstringtype}
232 base types are used in combination with
233 \livelink{chap:DWATdecimalsign}{DW\-\_AT\-\_decimal\-\_sign},
234 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and
235 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale}
238 A \livelink{chap:DWATdecimalsign}{DW\-\_AT\-\_decimal\-\_sign} attribute
239 \addtoindexx{decimal sign attribute}
240 is an integer constant that
241 conveys the representation of the sign of the decimal type
242 (see Figure \refersec{fig:decimalsignattributevalues}).
243 Its integer constant value is interpreted to
244 mean that the type has a leading overpunch, trailing overpunch,
245 leading separate or trailing separate sign representation or,
246 alternatively, no sign at all.
249 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count}
251 \addtoindexx{digit count attribute}
252 is an integer constant
253 value that represents the number of digits in an instance of
256 \hypertarget{chap:DWATdecimalscaledecimalscalefactor}
257 The \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale}
259 \addtoindexx{decimal scale attribute}
260 is an integer constant value
261 that represents the exponent of the base ten scale factor to
262 be applied to an instance of the type. A scale of zero puts the
263 decimal point immediately to the right of the least significant
264 digit. Positive scale moves the decimal point to the right
265 and implies that additional zero digits on the right are not
266 stored in an instance of the type. Negative scale moves the
267 decimal point to the left; if the absolute value of the scale
268 is larger than the digit count, this implies additional zero
269 digits on the left are not stored in an instance of the type.
271 The \livelink{chap:DWATEedited}{DW\-\_ATE\-\_edited}
273 \hypertarget{chap:DWATpicturestringpicturestringfornumericstringtype}
274 type is used to represent an edited
275 numeric or alphanumeric data type. It is used in combination
276 with an \livelink{chap:DWATpicturestring}{DW\-\_AT\-\_picture\-\_string} attribute whose value is a
277 null\dash terminated string containing the target\dash dependent picture
278 string associated with the type.
280 If the edited base type entry describes an edited numeric
281 data type, the edited type entry has a \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and a
282 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attribute.
283 \addtoindexx{decimal scale attribute}
284 These attributes have the same
285 interpretation as described for the
286 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} and
287 \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base
288 types. If the edited type entry
289 describes an edited alphanumeric data type, the edited type
290 entry does not have these attributes.
293 \textit{The presence or absence of the \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and
294 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attributes
295 \addtoindexx{decimal scale attribute}
296 allows a debugger to easily
297 distinguish edited numeric from edited alphanumeric, although
298 in principle the digit count and scale are derivable by
299 interpreting the picture string.}
301 The \livelink{chap:DWATEsignedfixed}{DW\-\_ATE\-\_signed\-\_fixed} and \livelink{chap:DWATEunsignedfixed}{DW\-\_ATE\-\_unsigned\-\_fixed} entries
302 describe signed and unsigned fixed\dash point binary data types,
305 The fixed binary type entries have
306 \addtoindexx{digit count attribute}
308 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count}
309 attribute with the same interpretation as described for the
310 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} and \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base types.
312 For a data type with a decimal scale factor, the fixed binary
314 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attribute
315 \addtoindexx{decimal scale attribute}
317 interpretation as described for the
318 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal}
319 and \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base types.
321 \hypertarget{chap:DWATbinaryscalebinaryscalefactorforfixedpointtype}
322 For a data type with a binary scale factor, the fixed
323 \addtoindexx{binary scale attribute}
324 binary type entry has a
325 \livelink{chap:DWATbinaryscale}{DW\-\_AT\-\_binary\-\_scale} attribute.
327 \livelink{chap:DWATbinaryscale}{DW\-\_AT\-\_binary\-\_scale} attribute
328 is an integer constant value
329 that represents the exponent of the base two scale factor to
330 be applied to an instance of the type. Zero scale puts the
331 binary point immediately to the right of the least significant
332 bit. Positive scale moves the binary point to the right and
333 implies that additional zero bits on the right are not stored
334 in an instance of the type. Negative scale moves the binary
335 point to the left; if the absolute value of the scale is
336 larger than the number of bits, this implies additional zero
337 bits on the left are not stored in an instance of the type.
340 \hypertarget{chap:DWATsmallscalefactorforfixedpointtype}
341 a data type with a non\dash decimal and non\dash binary scale factor,
342 the fixed binary type entry has a
343 \livelink{chap:DWATsmall}{DW\-\_AT\-\_small} attribute which
345 \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} entry. The scale factor value
346 is interpreted in accordance with the value defined by the
347 \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} entry. The value represented is the product
348 of the integer value in memory and the associated constant
351 \textit{The \livelink{chap:DWATsmall}{DW\-\_AT\-\_small} attribute
352 is defined with the \addtoindex{Ada} small
357 \begin{tabular}{lp{9cm}}
358 Name&Meaning\\ \hline
359 \livetarg{chap:DWDSunsigned}{DW\-\_DS\-\_unsigned} & unsigned \\
360 \livetarg{chap:DWDSleadingoverpunch}{DW\-\_DS\-\_leading\-\_overpunch} & Sign
361 is encoded in the most significant digit in a target\dash dependent manner \\
362 \livetarg{chap:DWDStrailingoverpunch}{DW\-\_DS\-\_trailing\-\_overpunch} & Sign
363 is encoded in the least significant digit in a target\dash dependent manner \\
364 \livetarg{chap:DWDSleadingseparate}{DW\-\_DS\-\_leading\-\_separate}
365 & Decimal type: Sign is a ``+'' or ``-'' character
366 to the left of the most significant digit. \\
367 \livetarg{chap:DWDStrailingseparate}{DW\-\_DS\-\_trailing\-\_separate}
368 & Decimal type: Sign is a ``+'' or ``-'' character
369 to the right of the least significant digit. \\
370 &Packed decimal type: Least significant nibble contains
371 a target\dash dependent value
372 indicating positive or negative. \\
374 \caption{Decimal sign attribute values}
375 \label{fig:decimalsignattributevalues}
378 \section{Unspecified Type Entries}
379 \label{chap:unspecifiedtypeentries}
380 \addtoindexx{unspecified type entry}
381 \addtoindexx{void type|see{unspecified type entry}}
382 Some languages have constructs in which a type
383 may be left unspecified or the absence of a type
384 may be explicitly indicated.
386 An unspecified (implicit, unknown, ambiguous or nonexistent)
387 type is represented by a debugging information entry with
388 the tag \livetarg{chap:DWTAGunspecifiedtype}{DW\-\_TAG\-\_unspecified\-\_type}.
389 If a name has been given
390 to the type, then the corresponding unspecified type entry
391 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is
392 a null\dash terminated
393 string containing the name as it appears in the source program.
395 The interpretation of this debugging information entry is
396 intentionally left flexible to allow it to be interpreted
397 appropriately in different languages. For example, in
398 \addtoindex{C} and \addtoindex{C++}
399 the language implementation can provide an unspecified type
400 entry with the name “void” which can be referenced by the
401 type attribute of pointer types and typedef declarations for
403 % FIXME: the following reference was wrong in DW4 so DavidA guessed
405 Sections \refersec{chap:unspecifiedtypeentries} and
406 %The following reference was valid, so the following is probably correct.
407 Section \refersec{chap:typedefentries},
408 respectively). As another
409 example, in \addtoindex{Ada} such an unspecified type entry can be referred
410 to by the type attribute of an access type where the denoted
411 type is incomplete (the name is declared as a type but the
412 definition is deferred to a separate compilation unit).
414 \section{Type Modifier Entries}
415 \label{chap:typemodifierentries}
416 \addtoindexx{type modifier entry}
418 A base or user\dash defined type may be modified in different ways
419 in different languages. A type modifier is represented in
420 DWARF by a debugging information entry with one of the tags
422 Figure \refersec{fig:typemodifiertags}.
424 If a name has been given to the modified type in the source
425 program, then the corresponding modified type entry has
426 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null-terminated
427 string containing the modified type name as it appears in
430 Each of the type modifier entries has a
431 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute,
432 whose value is a reference to a debugging information entry
433 describing a base type, a user-defined type or another type
436 A modified type entry describing a pointer or reference
437 type (using \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type},
438 \livelink{chap:DWTAGreferencetype}{DW\-\_TAG\-\_reference\-\_type} or
439 \livelink{chap:DWTAGrvaluereferencetype}{DW\-\_TAG\-\_rvalue\-\_reference\-\_type})
440 % Another instance of no-good-place-to-put-index entry.
442 \addtoindexx{address class!attribute}
444 \hypertarget{chap:DWATadressclasspointerorreferencetypes}
446 \livelink{chap:DWATaddressclass}{DW\-\_AT\-\_address\-\_class}
447 attribute to describe how objects having the given pointer
448 or reference type ought to be dereferenced.
450 A modified type entry describing a shared qualified type
451 (using \livelink{chap:DWTAGsharedtype}{DW\-\_TAG\-\_shared\-\_type}) may have a
452 \livelink{chap:DWATcount}{DW\-\_AT\-\_count} attribute
453 \addtoindexx{count attribute}
454 whose value is a constant expressing the blocksize of the
455 type. If no count attribute is present, then the “infinite”
456 blocksize is assumed.
458 When multiple type modifiers are chained together to modify
459 a base or user-defined type, the tree ordering reflects the
460 semantics of the applicable lanuage rather than the textual
461 order in the source presentation.
465 \begin{tabular}{lp{9cm}}
466 Name&Meaning\\ \hline
467 \livetarg{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} & C or C++ const qualified type
468 \addtoindexx{const qualified type entry} \addtoindexx{C} \addtoindexx{C++} \\
469 \livetarg{chap:DWTAGpackedtype}{DW\-\_TAG\-\_packed\-\_type}& Pascal or Ada packed type
470 \addtoindexx{packed qualified type entry} \addtoindexx{Ada} \addtoindexx{Pascal} \\
471 \livetarg{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} & Pointer to an object of
472 the type being modified \addtoindexx{pointer qualified type entry} \\
473 \livetarg{chap:DWTAGreferencetype}{DW\-\_TAG\-\_reference\-\_type}& C++ (lvalue) reference
474 to an object of the type
475 being modified \addtoindexx{reference qualified type entry} \\
476 \livetarg{chap:DWTAGrestricttype}{DW\-\_TAG\-\_restrict\-\_type}&C restrict qualified type
477 \addtoindexx{restricted qualified type entry} \\
478 \livetarg{chap:DWTAGrvaluereferencetype}{DW\-\_TAG\-\_rvalue\-\_reference\-\_type} & C++
479 rvalue reference to an object of the type being modified
480 \addtoindexx{rvalue reference qualified type entry} \\
481 \livetarg{chap:DWTAGsharedtype}{DW\-\_TAG\-\_shared\-\_type}&UPC shared qualified type
482 \addtoindexx{shared qualified type entry} \\
483 \livetarg{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type}&C or C++ volatile qualified type
484 \addtoindex{volatile qualified type entry} \\
486 \caption{Type modifier tags}
487 \label{fig:typemodifiertags}
490 %The following clearpage prevents splitting the example across pages.
492 \textit{As examples of how type modifiers are ordered, take the following C
496 const unsigned char * volatile p;
497 which represents a volatile pointer to a constant
498 character. This is encoded in DWARF as:
499 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}(p) -->
500 \livelink{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type} -->
501 \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} -->
502 \livelink{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} -->
503 \livelink{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}(unsigned char)
505 volatile unsigned char * const restrict p;
506 on the other hand, represents a restricted constant
507 pointer to a volatile character. This is encoded as:
508 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}(p) -->
509 \livelink{chap:DWTAGrestricttype}{DW\-\_TAG\-\_restrict\-\_type} -->
510 \livelink{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} -->
511 \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} -->
512 \livelink{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type} -->
513 \livelink{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}(unsigned char)
517 \section{Typedef Entries}
518 \label{chap:typedefentries}
519 A named type that is defined in terms of another type
520 definition is represented by a debugging information entry with
521 the tag \livetarg{chap:DWTAGtypedef}{DW\-\_TAG\-\_typedef}.
522 The typedef entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
523 attribute whose value is a null-terminated string containing
524 the name of the typedef as it appears in the source program.
526 The typedef entry may also contain a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose
527 value is a reference to the type named by the typedef. If
528 the debugging information entry for a typedef represents
529 a declaration of the type that is not also a definition,
530 it does not contain a type attribute.
532 \textit{Depending on the language, a named type that is defined in
533 terms of another type may be called a type alias, a subtype,
534 a constrained type and other terms. A type name declared with
535 no defining details may be termed an incomplete, forward
536 or hidden type. While the DWARF \livelink{chap:DWTAGtypedef}{DW\-\_TAG\-\_typedef} entry was
537 originally inspired by the like named construct in
538 \addtoindex{C} and \addtoindex{C++},
539 it is broadly suitable for similar constructs (by whatever
540 source syntax) in other languages.}
542 \section{Array Type Entries}
543 \label{chap:arraytypeentries}
545 Many languages share the concept of an ``array,'' which is
546 \addtoindexx{array type entry}
547 a table of components of identical type.
549 An array type is represented by a debugging information entry
550 with the tag \livetarg{chap:DWTAGarraytype}{DW\-\_TAG\-\_array\-\_type}.
553 \addtoindexx{array!declaration of type}
554 the array type in the source program, then the corresponding
555 array type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a
556 null-terminated string containing the array type name as it
557 appears in the source program.
560 \hypertarget{chap:DWATorderingarrayrowcolumnordering}
561 array type entry describing a multidimensional array may
562 \addtoindexx{array!element ordering}
563 have a \livelink{chap:DWATordering}{DW\-\_AT\-\_ordering} attribute whose integer constant value is
564 interpreted to mean either row-major or column-major ordering
565 of array elements. The set of values and their meanings
566 for the ordering attribute are listed in
567 Figure \refersec{fig:arrayordering}.
569 ordering attribute is present, the default ordering for the
570 source language (which is indicated by the \livelink{chap:DWATlanguage}{DW\-\_AT\-\_language}
571 attribute of the enclosing compilation unit entry) is assumed.
574 \autorows[0pt]{c}{1}{l}{
575 \livetarg{chap:DWORDcolmajor}{DW\-\_ORD\-\_col\-\_major},
576 \livetarg{chap:DWORDrowmajor}{DW\-\_ORD\-\_row\-\_major}
578 \caption{Array ordering}\label{fig:arrayordering}
581 The ordering attribute may optionally appear on one-dimensional
582 arrays; it will be ignored.
584 An array type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
585 \addtoindexx{array!element type}
587 the type of each element of the array.
589 If the amount of storage allocated to hold each element of an
590 object of the given array type is different from the amount
591 of storage that is normally allocated to hold an individual
592 \hypertarget{chap:DWATbitstridearrayelementstrideofarraytype}
594 \hypertarget{chap:DWATbytestridearrayelementstrideofarraytype}
595 indicated element type, then the array type
596 \addtoindexx{bit stride attribute}
598 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
600 \addtoindexx{byte stride attribute}
601 a \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride}
603 \addtoindexx{bit stride attribute}
605 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
607 element of the array.
609 The array type entry may have either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a
610 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
611 (see Section \refersec{chap:byteandbitsizes}),
613 amount of storage needed to hold an instance of the array type.
615 \textit{If the size of the array can be determined statically at
616 compile time, this value can usually be computed by multiplying
617 the number of array elements by the size of each element.}
620 Each array dimension is described by a debugging information
621 entry with either the tag \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} or the
622 \addtoindexx{enumeration type entry!as array dimension}
624 \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}. These entries are
626 array type entry and are ordered to reflect the appearance of
627 the dimensions in the source program (i.e., leftmost dimension
628 first, next to leftmost second, and so on).
630 In languages, such as C, in which there is no concept of
631 a “multidimensional array”, an array of arrays may
632 be represented by a debugging information entry for a
633 multidimensional array.
635 Other attributes especially applicable to arrays are
636 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated},
637 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} and
638 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location},
639 which are described in
640 Section \refersec{chap:dynamictypeproperties}.
641 For relevant examples,
643 Appendix \refersec{app:fortran90example}.
645 \section{ Structure, Union, Class and Interface Type Entries}
646 \label{chap:structureunionclassandinterfacetypeentries}
648 \textit{The languages
650 \addtoindex{C++}, and
651 \addtoindex{Pascal}, among others, allow the
652 programmer to define types that are collections of related
653 components. In \addtoindex{C} and \addtoindex{C++}, these collections are called
654 “structures.” In \addtoindex{Pascal}, they are called “records.”
655 The components may be of different types. The components are
656 called “members” in \addtoindex{C} and
657 \addtoindex{C++}, and “fields” in \addtoindex{Pascal}.}
659 \textit{The components of these collections each exist in their
660 own space in computer memory. The components of a C or C++
661 “union” all coexist in the same memory.}
663 \textit{\addtoindex{Pascal} and
664 other languages have a “discriminated union,”
665 \addtoindex{discriminated union|see {variant entry}}
666 also called a “variant record.” Here, selection of a
667 number of alternative substructures (“variants”) is based
668 on the value of a component that is not part of any of those
669 substructures (the “discriminant”).}
671 \textit{\addtoindex{C++} and
672 \addtoindex{Java} have the notion of ``class'', which is in some
673 ways similar to a structure. A class may have “member
674 functions” which are subroutines that are within the scope
675 of a class or structure.}
677 \textit{The \addtoindex{C++} notion of
678 structure is more general than in \addtoindex{C}, being
679 equivalent to a class with minor differences. Accordingly,
680 in the following discussion statements about
681 \addtoindex{C++} classes may
682 be understood to apply to \addtoindex{C++} structures as well.}
684 \subsection{Structure, Union and Class Type Entries}
685 \label{chap:structureunionandclasstypeentries}
688 Structure, union, and class types are represented by debugging
689 information entries with
690 the tags \livetarg{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type},
691 \livetarg{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type},
692 and \livetarg{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
693 respectively. If a name has been given to the structure,
694 union, or class in the source program, then the corresponding
695 structure type, union type, or class type entry has a
696 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
697 containing the type name as it appears in the source program.
699 The members of a structure, union, or class are represented
700 by debugging information entries that are owned by the
701 corresponding structure type, union type, or class type entry
702 and appear in the same order as the corresponding declarations
703 in the source program.
705 A structure type, union type or class type entry may have
706 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a
707 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
708 \hypertarget{chap:DWATbitsizedatamemberbitsize}
709 (see Section \refersec{chap:byteandbitsizes}),
710 whose value is the amount of storage needed
711 to hold an instance of the structure, union or class type,
712 including any padding. An incomplete structure, union or
713 class type is represented by a structure, union or class
714 entry that does not have a byte size attribute and that has
715 \addtoindexx{declaration attribute}
716 a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
718 If the complete declaration of a type has been placed in
719 \hypertarget{chap:DWATsignaturetypesignature}
721 (see Section \refersec{chap:separatetypeunitentries}),
723 declaration of that type in the compilation unit may provide
724 the unique 64\dash bit signature of the type using a \livelink{chap:DWATsignature}{DW\-\_AT\-\_signature}
727 If a structure, union or class entry represents the definition
728 of a structure, class or union member corresponding to a prior
729 incomplete structure, class or union, the entry may have a
730 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute whose value is a reference to
731 the debugging information entry representing that incomplete
734 Structure, union and class entries containing the
735 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute do not need to duplicate
736 information provided by the declaration entry referenced by the
737 specification attribute. In particular, such entries do not
738 need to contain an attribute for the name of the structure,
739 class or union they represent if such information is already
740 provided in the declaration.
742 \textit{For \addtoindex{C} and \addtoindex{C++},
744 \addtoindexx{data member|see {member entry (data)}}
745 member declarations occurring within
746 the declaration of a structure, union or class type are
747 considered to be “definitions” of those members, with
748 the exception of “static” data members, whose definitions
749 appear outside of the declaration of the enclosing structure,
750 union or class type. Function member declarations appearing
751 within a structure, union or class type declaration are
752 definitions only if the body of the function also appears
753 within the type declaration.}
755 If the definition for a given member of the structure, union
756 or class does not appear within the body of the declaration,
757 that member also has a debugging information entry describing
758 its definition. That latter entry has a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
759 attribute referencing the debugging information entry
760 owned by the body of the structure, union or class entry and
761 representing a non\dash defining declaration of the data, function
762 or type member. The referenced entry will not have information
763 about the location of that member (low and high pc attributes
764 for function members, location descriptions for data members)
765 and will have a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
767 \textit{Consider a nested class whose
768 definition occurs outside of the containing class definition, as in:}
777 \textit{The two different structs can be described in
778 different compilation units to
779 facilitate DWARF space compression
780 (see Appendix \refersec{app:usingcompilationunits}).}
782 \subsection{Interface Type Entries}
783 \label{chap:interfacetypeentries}
785 \textit{The \addtoindex{Java} language defines ``interface'' types.
787 in Java is similar to a \addtoindex{C++} or
788 \addtoindex{Java} class with only abstract
789 methods and constant data members.}
791 Interface types are represented by debugging information
793 tag \livetarg{chap:DWTAGinterfacetype}{DW\-\_TAG\-\_interface\-\_type}.
795 An interface type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
796 value is a null-terminated string containing the type name
797 as it appears in the source program.
799 The members of an interface are represented by debugging
800 information entries that are owned by the interface type
801 entry and that appear in the same order as the corresponding
802 declarations in the source program.
804 \subsection{Derived or Extended Structs, Classes and Interfaces}
805 \label{chap:derivedorextendedstructsclasesandinterfaces}
807 \textit{In \addtoindex{C++}, a class (or struct)
809 \addtoindexx{derived type (C++)|see{inheritance entry}}
810 be ``derived from'' or be a
811 ``subclass of'' another class. In Java, an interface may ``extend''
812 \addtoindexx{extended type (Java)|see{inheritance entry}}
813 one or more other interfaces, and a class may ``extend'' another
814 class and/or ``implement'' one or more interfaces. All of these
815 relationships may be described using the following. Note that
816 in Java, the distinction between extends and implements is
817 implied by the entities at the two ends of the relationship.}
819 A class type or interface type entry that describes a
820 derived, extended or implementing class or interface owns
821 debugging information entries describing each of the classes
822 or interfaces it is derived from, extending or implementing,
823 respectively, ordered as they were in the source program. Each
825 tag \livetarg{chap:DWTAGinheritance}{DW\-\_TAG\-\_inheritance}.
827 An inheritance entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is
828 a reference to the debugging information entry describing the
829 class or interface from which the parent class or structure
830 of the inheritance entry is derived, extended or implementing.
832 An inheritance entry for a class that derives from or extends
833 \hypertarget{chap:DWATdatamemberlocationinheritedmemberlocation}
834 another class or struct also has
835 \addtoindexx{data member location attribute}
837 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
838 attribute, whose value describes the location of the beginning
839 of the inherited type relative to the beginning address of the
840 derived class. If that value is a constant, it is the offset
841 in bytes from the beginning of the class to the beginning of
842 the inherited type. Otherwise, the value must be a location
843 description. In this latter case, the beginning address of
844 the derived class is pushed on the expression stack before
845 the location description is evaluated and the result of the
846 evaluation is the location of the inherited type.
848 \textit{The interpretation of the value of this attribute for
849 inherited types is the same as the interpretation for data
851 (see Section \refersec{chap:datamemberentries}). }
854 \hypertarget{chap:DWATaccessibilitycppinheritedmembers}
856 \addtoindexx{accessibility attribute}
858 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
859 attribute. If no accessibility attribute
860 is present, private access is assumed for an entry of a class
861 and public access is assumed for an entry of an interface,
865 \hypertarget{chap:DWATvirtualityvirtualityofbaseclass}
866 the class referenced by the inheritance entry serves
867 as a \addtoindex{C++} virtual base class, the inheritance entry has a
868 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
870 \textit{For a \addtoindex{C++} virtual base, the
871 \addtoindex{data member location attribute}
872 will usually consist of a non-trivial location description.}
874 \subsection{Access Declarations}
875 \label{chap:accessdeclarations}
877 \textit{In \addtoindex{C++}, a derived class may contain access declarations that
878 \addtoindex{access declaration entry}
879 change the accessibility of individual class members from the
880 overall accessibility specified by the inheritance declaration.
881 A single access declaration may refer to a set of overloaded
884 If a derived class or structure contains access declarations,
885 each such declaration may be represented by a debugging
886 information entry with the tag
887 \livetarg{chap:DWTAGaccessdeclaration}{DW\-\_TAG\-\_access\-\_declaration}.
889 such entry is a child of the class or structure type entry.
891 An access declaration entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
892 value is a null-terminated string representing the name used
893 in the declaration in the source program, including any class
894 or structure qualifiers.
896 An access declaration entry
897 \hypertarget{chap:DWATaccessibilitycppbaseclasses}
900 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
901 attribute describing the declared accessibility of the named
908 Each ``friend'' declared by a structure, union or class
909 \hypertarget{chap:DWATfriendfriendrelationship}
910 type may be represented by a debugging information entry
911 that is a child of the structure, union or class type entry;
912 the friend entry has the
913 tag \livetarg{chap:DWTAGfriend}{DW\-\_TAG\-\_friend}.
915 A friend entry has a \livelink{chap:DWATfriend}{DW\-\_AT\-\_friend} attribute, whose value is
916 a reference to the debugging information entry describing
917 the declaration of the friend.
920 \subsection{Data Member Entries}
921 \label{chap:datamemberentries}
923 A data member (as opposed to a member function) is
924 represented by a debugging information entry with the
925 tag \livetarg{chap:DWTAGmember}{DW\-\_TAG\-\_member}.
926 The member entry for a named member has
927 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null-terminated
928 string containing the member name as it appears in the source
929 program. If the member entry describes an
930 \addtoindex{anonymous union},
932 name attribute is omitted or consists of a single zero byte.
934 The data member entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote
935 the type of that member.
937 A data member entry may
938 \addtoindexx{accessibility attribute}
940 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
941 attribute. If no accessibility attribute is present, private
942 access is assumed for an entry of a class and public access
943 is assumed for an entry of a structure, union, or interface.
946 \hypertarget{chap:DWATmutablemutablepropertyofmemberdata}
947 entry may have a \livelink{chap:DWATmutable}{DW\-\_AT\-\_mutable} attribute,
948 which is a \livelink{chap:flag}{flag}.
949 This attribute indicates whether the data
950 member was declared with the mutable storage class specifier.
952 The beginning of a data member
953 \addtoindex{beginning of a data member}
954 is described relative to
955 \addtoindexx{beginning of an object}
956 the beginning of the object in which it is immediately
957 contained. In general, the beginning is characterized by
958 both an address and a bit offset within the byte at that
959 address. When the storage for an entity includes all of
960 the bits in the beginning byte, the beginning bit offset is
963 Bit offsets in DWARF use the bit numbering and direction
964 conventions that are appropriate to the current language on
967 The member entry corresponding to a data member that is
968 \hypertarget{chap:DWATdatabitoffsetdatamemberbitlocation}
970 \hypertarget{chap:DWATdatamemberlocationdatamemberlocation}
971 in a structure, union or class may have either
972 \addtoindexx{data member location attribute}
974 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute or a
975 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
976 attribute. If the beginning of the data member is the same as
977 the beginning of the containing entity then neither attribute
980 For a \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute
982 \addtoindexx{data member location attribute}
985 \begin{enumerate}[1.]
987 \item If the value is an integer constant, it is the offset
988 in bytes from the beginning of the containing entity. If
989 the beginning of the containing entity has a non-zero bit
990 offset then the beginning of the member entry has that same
993 \item Otherwise, the value must be a location description. In
994 this case, the beginning of the containing entity must be byte
995 aligned. The beginning address is pushed on the DWARF stack
996 before the location description is evaluated; the result of
997 the evaluation is the base address of the member entry.
999 \textit{The push on the DWARF expression stack of the base address of
1000 the containing construct is equivalent to execution of the
1001 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} operation
1002 (see Section \refersec{chap:stackoperations});
1003 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} therefore
1004 is not needed at the
1005 beginning of a location description for a data member. The
1006 result of the evaluation is a location--either an address or
1007 the name of a register, not an offset to the member.}
1009 \textit{A \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1011 \addtoindexx{data member location attribute}
1012 that has the form of a
1013 location description is not valid for a data member contained
1014 in an entity that is not byte aligned because DWARF operations
1015 do not allow for manipulating or computing bit offsets.}
1019 For a \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} attribute,
1020 the value is an integer constant
1021 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1022 that specifies the number of bits
1023 from the beginning of the containing entity to the beginning
1024 of the data member. This value must be greater than or equal
1025 to zero, but is not limited to less than the number of bits
1028 If the size of a data member is not the same as the size
1029 of the type given for the data member, the data member has
1030 \addtoindexx{bit size attribute}
1031 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1032 or a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute whose
1033 integer constant value
1034 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1036 of storage needed to hold the value of the data member.
1038 \textit{\addtoindex{C} and \addtoindex{C++}
1040 \addtoindex{bit fields}
1042 \addtoindexx{data bit offset}
1044 \addtoindexx{data bit size}
1046 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} and
1047 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attributes.}
1049 \textit{This Standard uses the following bit numbering and direction
1050 conventions in examples. These conventions are for illustrative
1051 purposes and other conventions may apply on particular
1056 \item \textit{For big\dash endian architectures, bit offsets are
1057 counted from high-order to low\dash order bits within a byte (or
1058 larger storage unit); in this case, the bit offset identifies
1059 the high\dash order bit of the object.}
1061 \item \textit{For little\dash endian architectures, bit offsets are
1062 counted from low\dash order to high\dash order bits within a byte (or
1063 larger storage unit); in this case, the bit offset identifies
1064 the low\dash order bit of the object.}
1068 \textit{In either case, the bit so identified is defined as the
1069 \addtoindexx{beginning of an object}
1070 beginning of the object.}
1072 \textit{For example, take one possible representation of the following
1073 \addtoindex{C} structure definition
1074 in both big\dash and little\dash endian byte orders:}
1085 \textit{The following diagrams show the structure layout
1086 and data bit offsets for example big\dash\ and little\dash endian
1087 architectures, respectively. Both diagrams show a structure
1088 that begins at address A and whose size is four bytes. Also,
1089 high order bits are to the left and low order bits are to
1092 \textit{Big\dash Endian Data Bit Offsets:}
1100 Addresses increase ->
1101 | A | A + 1 | A + 2 | A + 3 |
1103 Data bit offsets increase ->
1104 +---------------+---------------+---------------+---------------+
1105 |0 4|5 10|11 15|16 23|24 31|
1106 | j | k | m | n | <pad> |
1108 +---------------------------------------------------------------+
1111 \textit{Little\dash Endian Data Bit Offsets:}
1117 <- Addresses increase
1118 | A | A + 1 | A + 2 | A + 3 |
1120 <- Data bit offsets increase
1122 +---------------+---------------+---------------+---------------+
1123 |31 24|23 16|15 11|10 5|4 0|
1124 | <pad> | n | m | k | j |
1126 +---------------------------------------------------------------+
1130 \textit{Note that data member bit offsets in this example are the
1131 same for both big\dash\ and little\dash endian architectures even
1132 though the fields are allocated in different directions
1133 (high\dash order to low-order versus low\dash order to high\dash order);
1134 the bit naming conventions for memory and/or registers of
1135 the target architecture may or may not make this seem natural.}
1137 \textit{For a more extensive example showing nested and packed records
1139 Appendix \refersec{app:pascalexample}.}
1141 \textit{Attribute \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1143 \addtoindex{DWARF Version 4}
1144 and is also used for base types
1146 \refersec{chap:basetypeentries}).
1148 \livetarg{chap:DWATbitoffsetdatamemberbitlocation}
1149 attributes \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} and
1150 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} when used to
1151 identify the beginning of bit field data members as defined
1152 in DWARF V3 and earlier. The earlier attributes are defined
1153 in a manner suitable for bit field members on big-endian
1154 architectures but which is either awkward or incomplete for
1155 use on little-endian architectures.
1156 (\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} also
1157 has other uses that are not affected by this change.)}
1159 \textit{The \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1160 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1161 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1162 attribute combination is deprecated for data members in DWARF
1163 Version 4, but implementations may continue to support this
1164 use for compatibility.}
1167 \addtoindex{DWARF Version 3}
1168 definitions of these attributes are
1171 \begin{myindentpara}{1cm}
1172 \textit{If the data member entry describes a bit field, then that
1173 entry has the following attributes:}
1176 \item \textit{A \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1177 attribute whose value
1178 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1179 is the number of bytes that contain an instance of the
1180 bit field and any padding bits.}
1182 \textit{The byte size attribute may be omitted if the size of the
1183 object containing the bit field can be inferred from the type
1184 attribute of the data member containing the bit field.}
1186 \item \textit{A \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1188 \addtoindexx{bit offset attribute (V3)}
1190 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1191 is the number of bits to the left of the leftmost
1192 (most significant) bit of the bit field value.}
1194 \item \textit{A \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1196 \addtoindexx{bit size attribute (V3)}
1198 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1199 is the number of bits occupied by the bit field value.}
1203 \textit{The location description for a bit field calculates the address
1204 of an anonymous object containing the bit field. The address
1205 is relative to the structure, union, or class that most closely
1206 encloses the bit field declaration. The number of bytes in this
1207 anonymous object is the value of the byte size attribute of
1208 the bit field. The offset (in bits) from the most significant
1209 bit of the anonymous object to the most significant bit of
1210 the bit field is the value of the bit offset attribute.}
1214 \textit{Diagrams similar to the above that show the use of the
1215 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1216 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1217 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} attribute
1218 combination may be found in the
1219 \addtoindex{DWARF Version 3} Standard.}
1221 \textit{In comparing
1223 \addtoindexx{DWARF Version 3}
1225 \addtoindexx{DWARF Version 4}
1226 4, note that DWARF V4
1227 defines the following combinations of attributes:}
1230 \item \textit{either \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1232 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1233 (to specify the beginning of the data member)}
1235 % FIXME: the indentation of the following line is suspect.
1236 \textit{optionally together with}
1238 \item \textit{either \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or
1239 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} (to
1240 specify the size of the data member)}
1244 \textit{DWARF V3 defines the following combinations}
1247 \item \textit{\livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1248 (to specify the beginning
1249 of the data member, except this specification is only partial
1250 in the case of a bit field) }
1252 % FIXME: the indentation of the following line is suspect.
1253 \textit{optionally together with}
1255 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1256 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1257 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1258 (to further specify the beginning of a bit field data member
1259 as well as specify the size of the data member) }
1262 \subsection{Member Function Entries}
1263 \label{chap:memberfunctionentries}
1265 A member function is represented by a debugging information
1266 entry with the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}.
1267 The member function entry
1268 may contain the same attributes and follows the same rules
1269 as non\dash member global subroutine entries
1270 (see Section \refersec{chap:subroutineandentrypointentries}).
1273 \addtoindexx{accessibility attribute}
1274 member function entry may have a
1275 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
1276 attribute. If no accessibility attribute is present, private
1277 access is assumed for an entry of a class and public access
1278 is assumed for an entry of a structure, union or interface.
1281 \hypertarget{chap:DWATvirtualityvirtualityoffunction}
1282 the member function entry describes a virtual function,
1283 then that entry has a
1284 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
1287 \hypertarget{chap:DWATexplicitexplicitpropertyofmemberfunction}
1288 the member function entry describes an explicit member
1289 function, then that entry has
1290 \addtoindexx{explicit attribute}
1292 \livelink{chap:DWATexplicit}{DW\-\_AT\-\_explicit} attribute.
1295 \hypertarget{chap:DWATvtableelemlocationvirtualfunctiontablevtableslot}
1296 entry for a virtual function also has a
1297 \livelink{chap:DWATvtableelemlocation}{DW\-\_AT\-\_vtable\-\_elem\-\_location}
1298 \addtoindexi{attribute}{vtable element location attribute} whose value contains
1299 a location description yielding the address of the slot
1300 for the function within the virtual function table for the
1301 enclosing class. The address of an object of the enclosing
1302 type is pushed onto the expression stack before the location
1303 description is evaluated.
1306 \hypertarget{chap:DWATobjectpointerobjectthisselfpointerofmemberfunction}
1307 the member function entry describes a non\dash static member
1308 function, then that entry has a \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer}
1310 whose value is a reference to the formal parameter entry
1311 that corresponds to the object for which the function is
1312 called. The name attribute of that formal parameter is defined
1313 by the current language (for example,
1314 this for \addtoindex{C++} or self
1315 for \addtoindex{Objective C}
1316 and some other languages). That parameter
1317 also has a \livelink{chap:DWATartificial}{DW\-\_AT\-\_artificial} attribute whose value is true.
1319 Conversely, if the member function entry describes a static
1320 member function, the entry does not have a
1321 \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer}
1324 If the member function entry describes a non\dash static member
1325 function that has a const\dash volatile qualification, then
1326 the entry describes a non\dash static member function whose
1327 object formal parameter has a type that has an equivalent
1328 const\dash volatile qualification.
1330 If a subroutine entry represents the defining declaration
1331 of a member function and that definition appears outside of
1332 the body of the enclosing class declaration, the subroutine
1333 entry has a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
1334 attribute, whose value is
1335 a reference to the debugging information entry representing
1336 the declaration of this function member. The referenced entry
1337 will be a child of some class (or structure) type entry.
1339 Subroutine entries containing the \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
1340 attribute do not need to duplicate information provided
1341 by the declaration entry referenced by the specification
1342 attribute. In particular, such entries do not need to contain
1343 attributes for the name or return type of the function member
1344 whose definition they represent.
1346 \subsection{Class Template Instantiations}
1347 \label{chap:classtemplateinstantiations}
1349 \textit{In \addtoindex{C++} a class template is a generic definition of a class
1350 type that may be instantiated when an instance of the class
1351 is declared or defined. The generic description of the
1352 class may include both parameterized types and parameterized
1353 constant values. DWARF does not represent the generic template
1354 definition, but does represent each instantiation.}
1356 A class template instantiation is represented by a
1357 debugging information entry with the tag \livelink{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
1358 \livelink{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type} or
1359 \livelink{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type}. With five
1360 exceptions, such an entry will contain the same attributes
1361 and have the same types of child entries as would an entry
1362 for a class type defined explicitly using the instantiation
1363 types and values. The exceptions are:
1365 \begin{enumerate}[1.]
1366 \item Each formal parameterized type declaration appearing in the
1367 template definition is represented by a debugging information
1369 \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}. Each
1370 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is
1371 a null\dash terminated string containing the name of the formal
1372 type parameter as it appears in the source program. The
1373 template type parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1374 describing the actual type by which the formal is replaced
1375 for this instantiation.
1377 \item Each formal parameterized value declaration appearing in the
1378 template definition is represented by a debugging information
1380 tag \livetarg{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}.
1382 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is
1383 a null\dash terminated string containing the name of the formal
1384 value parameter as it appears in the source program.
1386 \hypertarget{chap:DWATconstvaluetemplatevalueparameter}
1387 template value parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1388 describing the type of the parameterized value. Finally,
1389 the template value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value}
1390 attribute, whose value is the actual constant value of the
1391 value parameter for this instantiation as represented on the
1392 target architecture.
1394 \item The class type entry and each of its child entries references
1395 a template type parameter entry in any circumstance where the
1396 source template definition references a formal parameterized
1397 type. Similarly, the class type entry and each of its child
1398 entries references a template value parameter entry in any
1399 circumstance where the source template definition references
1400 a formal parameterized value.
1402 \item If the compiler has generated a special compilation unit to
1403 hold the template instantiation and that special compilation
1404 unit has a different name from the compilation unit containing
1405 the template definition, the name attribute for the debugging
1406 information entry representing the special compilation unit
1407 should be empty or omitted.
1409 \item If the class type entry representing the template
1410 instantiation or any of its child entries contains declaration
1411 coordinate attributes, those attributes should refer to
1412 the source for the template definition, not to any source
1413 generated artificially by the compiler.
1417 \subsection{Variant Entries}
1418 \label{chap:variantentries}
1420 A variant part of a structure is represented by a debugging
1421 information entry\addtoindexx{variant part entry} with the
1422 tag \livetarg{chap:DWTAGvariantpart}{DW\-\_TAG\-\_variant\-\_part} and is
1423 owned by the corresponding structure type entry.
1425 If the variant part has a discriminant, the discriminant is
1426 \hypertarget{chap:DWATdiscrdiscriminantofvariantpart}
1428 \addtoindexx{discriminant (entry)}
1429 separate debugging information entry which
1430 is a child of the variant part entry. This entry has the form
1431 of a structure data member entry. The variant part entry will
1432 \addtoindexx{discriminant attribute}
1434 \livelink{chap:DWATdiscr}{DW\-\_AT\-\_discr} attribute
1435 whose value is a reference to
1436 the member entry for the discriminant.
1438 If the variant part does not have a discriminant (tag field),
1439 the variant part entry has a
1440 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to represent
1443 Each variant of a particular variant part is represented by
1444 \hypertarget{chap:DWATdiscrvaluediscriminantvalue}
1445 a debugging information entry\addtoindexx{variant entry} with the
1446 tag \livetarg{chap:DWTAGvariant}{DW\-\_TAG\-\_variant}
1447 and is a child of the variant part entry. The value that
1448 selects a given variant may be represented in one of three
1449 ways. The variant entry may have a
1450 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value} attribute
1451 whose value represents a single case label. The value of this
1452 attribute is encoded as an LEB128 number. The number is signed
1453 if the tag type for the variant part containing this variant
1454 is a signed type. The number is unsigned if the tag type is
1458 \hypertarget{chap:DWATdiscrlistlistofdiscriminantvalues}
1459 the variant entry may contain
1460 \addtoindexx{discriminant list attribute}
1462 \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list}
1463 attribute, whose value represents a list of discriminant
1464 values. This list is represented by any of the
1465 \livelink{chap:block}{block} forms and
1466 may contain a mixture of case labels and label ranges. Each
1467 item on the list is prefixed with a discriminant value
1468 descriptor that determines whether the list item represents
1469 a single label or a label range. A single case label is
1470 represented as an LEB128 number as defined above for
1471 \addtoindexx{discriminant value attribute}
1473 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value}
1474 attribute. A label range is represented by
1475 two LEB128 numbers, the low value of the range followed by the
1476 high value. Both values follow the rules for signedness just
1477 described. The discriminant value descriptor is an integer
1478 constant that may have one of the values given in
1479 Figure \refersec{fig:discriminantdescriptorvalues}.
1481 \begin{figure}[here]
1482 \autorows[0pt]{c}{1}{l}{
1483 \addtoindex{DW\-\_DSC\-\_label},
1484 \addtoindex{DW\-\_DSC\-\_range}
1486 \caption{Discriminant descriptor values}\label{fig:discriminantdescriptorvalues}
1489 If a variant entry has neither a \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value}
1490 attribute nor a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute, or if it has
1491 a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute with 0 size, the variant is a
1494 The components selected by a particular variant are represented
1495 by debugging information entries owned by the corresponding
1496 variant entry and appear in the same order as the corresponding
1497 declarations in the source program.
1499 \section{Condition Entries}
1500 \label{chap:conditionentries}
1502 \textit{COBOL has the notion of a ``level\dash 88 condition'' that
1503 associates a data item, called the conditional variable, with
1504 a set of one or more constant values and/or value ranges.
1505 Semantically, the condition is ‛true’ if the conditional
1506 variable's value matches any of the described constants,
1507 and the condition is ‛false’ otherwise.}
1509 The \livetarg{chap:DWTAGcondition}{DW\-\_TAG\-\_condition}
1510 debugging information entry\addtoindexx{condition entry}
1512 logical condition that tests whether a given data item’s
1513 value matches one of a set of constant values. If a name
1514 has been given to the condition, the condition entry has a
1515 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
1516 giving the condition name as it appears in the source program.
1518 The condition entry's parent entry describes the conditional
1519 variable; normally this will be a \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable},
1520 \livelink{chap:DWTAGmember}{DW\-\_TAG\-\_member} or
1521 \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter} entry. If the parent
1522 entry has an array type, the condition can test any individual
1523 element, but not the array as a whole. The condition entry
1524 implicitly specifies a “comparison type” that is the
1525 type of an array element if the parent has an array type;
1526 otherwise it is the type of the parent entry.
1528 The condition entry owns \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} and/or
1529 \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} entries that describe the constant
1530 values associated with the condition. If any child entry has
1531 a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute, that attribute should describe a type
1532 compatible with the comparison type (according to the source
1533 language); otherwise the child’s type is the same as the
1536 \textit{For conditional variables with alphanumeric types, COBOL
1537 permits a source program to provide ranges of alphanumeric
1538 constants in the condition. Normally a subrange type entry
1539 does not describe ranges of strings; however, this can be
1540 represented using bounds attributes that are references to
1541 constant entries describing strings. A subrange type entry may
1542 refer to constant entries that are siblings of the subrange
1546 \section{Enumeration Type Entries}
1547 \label{chap:enumerationtypeentries}
1549 \textit{An “enumeration type” is a scalar that can assume one of
1550 a fixed number of symbolic values.}
1552 An enumeration type is represented by a debugging information
1554 \livetarg{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}.
1556 If a name has been given to the enumeration type in the source
1557 program, then the corresponding enumeration type entry has
1558 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated
1559 string containing the enumeration type name as it appears
1560 in the source program. This entry also has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1561 attribute whose integer constant value is the number of bytes
1562 required to hold an instance of the enumeration.
1564 The \addtoindex{enumeration type entry}
1565 may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1566 which refers to the underlying data type used to implement
1569 If an enumeration type has type safe
1572 \begin{enumerate}[1.]
1573 \item Enumerators are contained in the scope of the enumeration type, and/or
1575 \item Enumerators are not implicitly converted to another type
1578 then the \addtoindex{enumeration type entry} may
1579 \addtoindexx{enum class|see{type-safe enumeration}}
1580 have a \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}
1581 attribute, which is a \livelink{chap:flag}{flag}.
1582 In a language that offers only
1583 one kind of enumeration declaration, this attribute is not
1586 \textit{In \addtoindex{C} or \addtoindex{C++},
1587 the underlying type will be the appropriate
1588 integral type determined by the compiler from the properties of
1589 \hypertarget{chap:DWATenumclasstypesafeenumerationdefinition}
1590 the enumeration literal values.
1591 A \addtoindex{C++} type declaration written
1592 using enum class declares a strongly typed enumeration and
1593 is represented using \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}
1594 in combination with \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}.}
1596 Each enumeration literal is represented by a debugging
1597 \addtoindexx{enumeration literal|see{enumeration entry}}
1598 information entry with the
1599 tag \livetarg{chap:DWTAGenumerator}{DW\-\_TAG\-\_enumerator}.
1601 such entry is a child of the
1602 \addtoindex{enumeration type entry}, and the
1603 enumerator entries appear in the same order as the declarations
1604 of the enumeration literals in the source program.
1606 Each \addtoindex{enumerator entry} has a
1607 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
1608 value is a null\dash terminated string containing the name of the
1609 \hypertarget{chap:DWATconstvalueenumerationliteralvalue}
1610 enumeration literal as it appears in the source program.
1611 Each enumerator entry also has a
1612 \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value} attribute,
1613 whose value is the actual numeric value of the enumerator as
1614 represented on the target system.
1617 If the enumeration type occurs as the description of a
1618 \addtoindexx{enumeration type endry!as array dimension}
1619 dimension of an array type, and the stride for that dimension
1620 \hypertarget{chap:DWATbytestrideenumerationstridedimensionofarraytype}
1621 is different than what would otherwise be determined, then
1622 \hypertarget{chap:DWATbitstrideenumerationstridedimensionofarraytype}
1623 the enumeration type entry has either a
1624 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1625 or \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1626 \addtoindexx{bit stride attribute}
1627 which specifies the separation
1628 between successive elements along the dimension as described
1630 Section \refersec{chap:visibilityofdeclarations}.
1632 \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1633 \addtoindexx{bit stride attribute}
1634 is interpreted as bits and the value of
1635 \addtoindexx{byte stride attribute}
1637 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1638 attribute is interpreted as bytes.
1641 \section{Subroutine Type Entries}
1642 \label{chap:subroutinetypeentries}
1644 It is possible in \addtoindex{C}
1645 to declare pointers to subroutines
1646 that return a value of a specific type. In both
1647 \addtoindex{C} and \addtoindex{C++},
1648 it is possible to declare pointers to subroutines that not
1649 only return a value of a specific type, but accept only
1650 arguments of specific types. The type of such pointers would
1651 be described with a ``pointer to'' modifier applied to a
1652 user\dash defined type.
1654 A subroutine type is represented by a debugging information
1656 tag \livetarg{chap:DWTAGsubroutinetype}{DW\-\_TAG\-\_subroutine\-\_type}.
1658 been given to the subroutine type in the source program,
1659 then the corresponding subroutine type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
1660 attribute whose value is a null\dash terminated string containing
1661 the subroutine type name as it appears in the source program.
1663 If the subroutine type describes a function that returns
1664 a value, then the subroutine type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
1665 attribute to denote the type returned by the subroutine. If
1666 the types of the arguments are necessary to describe the
1667 subroutine type, then the corresponding subroutine type
1668 entry owns debugging information entries that describe the
1669 arguments. These debugging information entries appear in the
1670 order that the corresponding argument types appear in the
1673 In \addtoindex{C} there
1674 is a difference between the types of functions
1675 declared using function prototype style declarations and
1676 those declared using non\dash prototype declarations.
1679 \hypertarget{chap:DWATprototypedsubroutineprototype}
1680 subroutine entry declared with a function prototype style
1681 declaration may have a
1682 \livelink{chap:DWATprototyped}{DW\-\_AT\-\_prototyped} attribute, which is
1683 a \livelink{chap:flag}{flag}.
1685 Each debugging information entry owned by a subroutine
1686 type entry has a tag whose value has one of two possible
1689 \begin{enumerate}[1.]
1690 \item The formal parameters of a parameter list (that have a
1691 specific type) are represented by a debugging information entry
1692 with the tag \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter}.
1693 Each formal parameter
1694 entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute that refers to the type of
1695 the formal parameter.
1697 \item The unspecified parameters of a variable parameter list
1698 \addtoindexx{unspecified parameters entry}
1700 \addtoindexx{... parameters|see{unspecified parameters entry}}
1701 represented by a debugging information entry with the
1702 tag \livelink{chap:DWTAGunspecifiedparameters}{DW\-\_TAG\-\_unspecified\-\_parameters}.
1707 \section{String Type Entries}
1708 \label{chap:stringtypeentries}
1711 A ``string'' is a sequence of characters that have specific
1712 semantics and operations that separate them from arrays of
1713 characters. Fortran is one of the languages that has a string
1714 type. Note that ``string'' in this context refers to a target
1715 machine concept, not the class string as used in this document
1716 (except for the name attribute).
1718 A string type is represented by a debugging information entry
1719 with the tag \livetarg{chap:DWTAGstringtype}{DW\-\_TAG\-\_string\-\_type}.
1720 If a name has been given to
1721 the string type in the source program, then the corresponding
1722 string type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is
1723 a null\dash terminated string containing the string type name as
1724 it appears in the source program.
1727 \hypertarget{chap:DWATstringlengthstringlengthofstringtype}
1728 string type entry may have a
1729 \livelink{chap:DWATstringlength}{DW\-\_AT\-\_string\-\_length} attribute
1730 whose value is a location description yielding the location
1731 where the length of the string is stored in the program. The
1732 string type entry may also have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute
1733 or \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
1734 (see Section \refersec{chap:byteandbitsizes})
1735 is the size of the data to be retrieved from the location
1736 referenced by the string length attribute. If no (byte or bit)
1737 size attribute is present, the size of the data to be retrieved
1738 is the same as the size of an address on the target machine.
1740 If no string length attribute is present, the string type
1741 entry may have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or
1742 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1743 attribute, whose value
1744 (see Section \refersec{chap:byteandbitsizes})
1746 storage needed to hold a value of the string type.
1749 \section{Set Type Entries}
1750 \label{chap:settypeentries}
1752 \textit{Pascal provides the concept of a “set,” which represents
1753 a group of values of ordinal type.}
1755 A set is represented by a debugging information entry with
1756 the tag \livetarg{chap:DWTAGsettype}{DW\-\_TAG\-\_set\-\_type}.
1757 If a name has been given to the
1758 set type, then the set type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1759 whose value is a null\dash terminated string containing the
1760 set type name as it appears in the source program.
1762 The set type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote the
1763 type of an element of the set.
1765 If the amount of storage allocated to hold each element of an
1766 object of the given set type is different from the amount of
1767 storage that is normally allocated to hold an individual object
1768 of the indicated element type, then the set type entry has
1769 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute, or
1770 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
1771 whose value (see Section \refersec{chap:byteandbitsizes}) is
1772 the amount of storage needed to hold a value of the set type.
1775 \section{Subrange Type Entries}
1776 \label{chap:subrangetypeentries}
1778 \textit{Several languages support the concept of a ``subrange''
1779 type object. These objects can represent a subset of the
1780 values that an object of the basis type for the subrange can
1781 represent. Subrange type entries may also be used to represent
1782 the bounds of array dimensions.}
1784 A subrange type is represented by a debugging information
1786 tag \livetarg{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type}.
1788 given to the subrange type, then the subrange type entry
1789 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated
1790 string containing the subrange type name as it appears in
1793 The subrange entry may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to describe
1794 the type of object, called the basis type, of whose values
1795 this subrange is a subset.
1797 If the amount of storage allocated to hold each element of an
1798 object of the given subrange type is different from the amount
1799 of storage that is normally allocated to hold an individual
1800 object of the indicated element type, then the subrange
1801 type entry has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or
1802 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1803 attribute, whose value
1804 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1806 storage needed to hold a value of the subrange type.
1809 \hypertarget{chap:DWATthreadsscaledupcarrayboundthreadsscalfactor}
1810 subrange entry may have a \livelink{chap:DWATthreadsscaled}{DW\-\_AT\-\_threads\-\_scaled} attribute,
1811 which is a \livelink{chap:flag}{flag}.
1812 If present, this attribute indicates whether
1813 this subrange represents a UPC array bound which is scaled
1814 by the runtime THREADS value (the number of UPC threads in
1815 this execution of the program).
1817 \textit{This allows the representation of a UPC shared array such as}
1820 int shared foo[34*THREADS][10][20];
1824 \hypertarget{chap:DWATlowerboundlowerboundofsubrange}
1826 \hypertarget{chap:DWATupperboundupperboundofsubrange}
1827 entry may have the attributes
1828 \livelink{chap:DWATlowerbound}{DW\-\_AT\-\_lower\-\_bound}
1829 and \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound} to specify, respectively, the lower
1830 and upper bound values of the subrange. The
1831 \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound}
1833 \hypertarget{chap:DWATcountelementsofsubrangetype}
1835 % FIXME: The following matches DWARF4: odd as there is no default count.
1836 \addtoindexx{count attribute!default}
1838 \addtoindexx{count attribute}
1840 \livelink{chap:DWATcount}{DW\-\_AT\-\_count} attribute,
1842 value describes the number of elements in the subrange rather
1843 than the value of the last element. The value of each of
1844 these attributes is determined as described in
1845 Section \refersec{chap:staticanddynamicvaluesofattributes}.
1847 If the lower bound value is missing, the value is assumed to
1848 be a language\dash dependent default constant. The default lower
1850 \addtoindex{C}, \addtoindex{C++},
1853 \addtoindex{Objective C},
1854 \addtoindex{Objective C++},
1855 \addtoindex{Python}, and
1857 The default lower bound is 1 for
1858 \addtoindex{Ada}, \addtoindex{COBOL},
1859 \addtoindex{Fortran},
1860 \addtoindex{Modula}\dash 2,
1861 \addtoindex{Pascal} and
1864 \textit{No other default lower bound values are currently defined.}
1866 If the upper bound and count are missing, then the upper bound value is
1869 If the subrange entry has no type attribute describing the
1870 basis type, the basis type is assumed to be the same as
1871 the object described by the lower bound attribute (if it
1872 references an object). If there is no lower bound attribute,
1873 or that attribute does not reference an object, the basis type
1874 is the type of the upper bound or \addtoindex{count attribute}
1876 of them references an object). If there is no upper bound or
1877 count attribute, or neither references an object, the type is
1878 assumed to be the same type, in the source language of the
1879 compilation unit containing the subrange entry, as a signed
1880 integer with the same size as an address on the target machine.
1882 If the subrange type occurs as the description of a dimension
1883 of an array type, and the stride for that dimension is
1884 \hypertarget{chap:DWATbytestridesubrangestridedimensionofarraytype}
1885 different than what would otherwise be determined, then
1886 \hypertarget{chap:DWATbitstridesubrangestridedimensionofarraytype}
1887 the subrange type entry has either
1888 \addtoindexx{byte stride attribute}
1890 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride} or
1891 \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1892 \addtoindexx{bit stride attribute}
1893 which specifies the separation
1894 between successive elements along the dimension as described
1896 Section \refersec{chap:byteandbitsizes}.
1898 \textit{Note that the stride can be negative.}
1900 \section{Pointer to Member Type Entries}
1901 \label{chap:pointertomembertypeentries}
1903 \textit{In \addtoindex{C++}, a pointer to a data or function member of a class or
1904 structure is a unique type.}
1906 A debugging information entry representing the type of an
1907 object that is a pointer to a structure or class member has
1908 the tag \livetarg{chap:DWTAGptrtomembertype}{DW\-\_TAG\-\_ptr\-\_to\-\_member\-\_type}.
1910 If the pointer to member type has a name, the pointer to
1911 member entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a
1912 null\dash terminated string containing the type name as it appears
1913 in the source program.
1915 The pointer to member entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to
1916 describe the type of the class or structure member to which
1917 objects of this type may point.
1919 The pointer to member entry also
1920 \hypertarget{chap:DWATcontainingtypecontainingtypeofpointertomembertype}
1922 \livelink{chap:DWATcontainingtype}{DW\-\_AT\-\_containing\-\_type}
1923 attribute, whose value is a reference to a debugging
1924 information entry for the class or structure to whose members
1925 objects of this type may point.
1928 \hypertarget{chap:DWATuselocationmemberlocationforpointertomembertype}
1929 pointer to member entry has a
1930 \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} attribute
1931 whose value is a location description that computes the
1932 address of the member of the class to which the pointer to
1933 member entry points.
1935 \textit{The method used to find the address of a given member of a
1936 class or structure is common to any instance of that class
1937 or structure and to any instance of the pointer or member
1938 type. The method is thus associated with the type entry,
1939 rather than with each instance of the type.}
1941 The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is used in conjunction
1942 with the location descriptions for a particular object of the
1943 given pointer to member type and for a particular structure or
1944 class instance. The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location}
1945 attribute expects two values to be
1946 \addtoindexi{pushed}{address!implicit push for member operator}
1947 onto the DWARF expression stack before
1948 the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is evaluated.
1950 \addtoindexi{pushed}{address!implicit push for member operator}
1951 is the value of the pointer to member object
1952 itself. The second value
1953 \addtoindexi{pushed}{address!implicit push for member operator}
1954 is the base address of the
1955 entire structure or union instance containing the member
1956 whose address is being calculated.
1958 \textit{For an expression such as}
1963 % FIXME: object and mbr\_ptr should be distinguished from italic. See DW4.
1964 \textit{where mbr\_ptr has some pointer to member type, a debugger should:}
1966 \textit{1. Push the value of mbr\_ptr onto the DWARF expression stack.}
1968 \textit{2. Push the base address of object onto the DWARF expression stack.}
1970 \textit{3. Evaluate the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description
1971 given in the type of mbr\_ptr.}
1973 \section{File Type Entries}
1974 \label{chap:filetypeentries}
1976 \textit{Some languages, such as Pascal, provide a data type to represent
1979 A file type is represented by a debugging information entry
1981 \livetarg{chap:DWTAGfiletype}{DW\-\_TAG\-\_file\-\_type}.
1982 If the file type has a name,
1983 the file type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value
1984 is a null\dash terminated string containing the type name as it
1985 appears in the source program.
1987 The file type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
1988 the type of the objects contained in the file.
1990 The file type entry also
1991 \addtoindexx{byte size}
1993 \addtoindexx{bit size}
1995 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or
1996 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
1997 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1998 is the amount of storage need to hold a value of the file type.
2000 \section{Dynamic Type Properties}
2001 \label{chap:dynamictypeproperties}
2002 \subsection{Data Location}
2003 \label{chap:datalocation}
2005 \textit{Some languages may represent objects using descriptors to hold
2006 information, including a location and/or run\dash time parameters,
2007 about the data that represents the value for that object.}
2009 \hypertarget{chap:DWATdatalocationindirectiontoactualdata}
2010 The \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
2011 attribute may be used with any
2012 type that provides one or more levels of hidden indirection
2013 and/or run\dash time parameters in its representation. Its value
2014 is a location description. The result of evaluating this
2015 description yields the location of the data for an object.
2016 When this attribute is omitted, the address of the data is
2017 the same as the address of the object.
2019 \textit{This location description will typically begin with
2020 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address}
2021 which loads the address of the
2022 object which can then serve as a descriptor in subsequent
2023 calculation. For an example using
2024 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
2025 for a Fortran 90 array, see
2026 Appendix \refersec{app:fortran90example}.}
2028 \subsection{Allocation and Association Status}
2029 \label{chap:allocationandassociationstatus}
2031 \textit{Some languages, such as Fortran 90, provide types whose values
2032 may be dynamically allocated or associated with a variable
2033 under explicit program control.}
2035 \hypertarget{chap:DWATallocatedallocationstatusoftypes}
2037 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated}
2039 \addtoindexx{allocated attribute}
2040 may optionally be used with any
2041 type for which objects of the type can be explicitly allocated
2042 and deallocated. The presence of the attribute indicates that
2043 objects of the type are allocatable and deallocatable. The
2044 integer value of the attribute (see below) specifies whether
2045 an object of the type is
2046 currently allocated or not.
2048 \hypertarget{chap:DWATassociatedassociationstatusoftypes}
2050 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute
2052 \addtoindexx{associated attribute}
2053 optionally be used with
2054 any type for which objects of the type can be dynamically
2055 associated with other objects. The presence of the attribute
2056 indicates that objects of the type can be associated. The
2057 integer value of the attribute (see below) indicates whether
2058 an object of the type is currently associated or not.
2060 While these attributes are defined specifically with Fortran
2061 90 ALLOCATABLE and POINTER types in mind, usage is not limited
2062 to just that language.
2064 The value of these attributes is determined as described in
2065 Section \refersec{chap:staticanddynamicvaluesofattributes}.
2067 A non\dash zero value is interpreted as allocated or associated,
2068 and zero is interpreted as not allocated or not associated.
2070 \textit{For \addtoindex{Fortran} 90,
2071 if the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated}
2072 attribute is present,
2073 the type has the POINTER property where either the parent
2074 variable is never associated with a dynamic object or the
2075 implementation does not track whether the associated object
2076 is static or dynamic. If the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute is
2077 present and the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute is not, the type
2078 has the ALLOCATABLE property. If both attributes are present,
2079 then the type should be assumed to have the POINTER property
2080 (and not ALLOCATABLE); the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute may then
2081 be used to indicate that the association status of the object
2082 resulted from execution of an ALLOCATE statement rather than
2083 pointer assignment.}
2085 \textit{For examples using
2086 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} for \addtoindex{Ada} and
2087 \addtoindex{Fortran} 90
2089 see Appendix \refersec{app:aggregateexamples}.}
2093 \section{Template Alias Entries}
2094 \label{chap:templatealiasentries}
2096 A type named using a template alias is represented
2097 by a debugging information entry with the tag
2098 \livetarg{chap:DWTAGtemplatealias}{DW\-\_TAG\-\_template\-\_alias}.
2099 The template alias entry has a
2100 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
2101 containing the name of the template alias as it appears in
2102 the source program. The template alias entry also contains a
2103 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is a reference to the type
2104 named by the template alias. The template alias entry has
2105 the following child entries:
2107 \begin{enumerate}[1.]
2108 \item Each formal parameterized type declaration appearing
2109 in the template alias declaration is represented
2110 by a debugging information entry with the tag
2111 \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}.
2112 Each such entry may have
2113 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a null\dash terminated
2114 string containing the name of the formal type parameter as it
2115 appears in the source program. The template type parameter
2116 entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing the actual
2117 type by which the formal is replaced for this instantiation.
2119 \item Each formal parameterized value declaration
2120 appearing in the template alias declaration is
2121 represented by a debugging information entry with the tag
2122 \livelink{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}.
2123 Each such entry may have
2124 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a null\dash terminated
2125 string containing the name of the formal value parameter
2126 as it appears in the source program. The template value
2127 parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
2128 the type of the parameterized value. Finally, the template
2129 value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value}
2130 attribute, whose value is the actual constant value of the value parameter for
2131 this instantiation as represented on the target architecture.