2 \label{chap:typeentries}
3 This section presents the debugging information entries
4 that describe program types: base types, modified types and
5 user\dash defined types.
7 If the scope of the declaration of a named type begins after
8 \hypertarget{chap:DWATstartscopetypedeclaration}
9 the low pc value for the scope most closely enclosing the
10 declaration, the declaration may have a
11 \livelink{chap:DWATstartscope}{DW\-\_AT\-\_start\-\_scope}
12 attribute as described for objects in
13 Section \refersec{chap:dataobjectentries}.
15 \section{Base Type Entries}
16 \label{chap:basetypeentries}
18 \textit{A base type is a data type that is not defined in terms of
19 other data types. Each programming language has a set of base
20 types that are considered to be built into that language.}
22 A base type is represented by a debugging information entry
24 \livetarg{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}.
26 A \addtoindex{base type entry}
27 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is
28 a null\dash terminated string containing the name of the base type
29 as recognized by the programming language of the compilation
30 unit containing the base type entry.
32 A base type entry has a \livelink{chap:DWATencoding}{DW\-\_AT\-\_encoding} attribute describing
33 how the base type is encoded and is to be interpreted. The
34 value of this attribute is an integer constant. The set of
35 values and their meanings for the \livelink{chap:DWATencoding}{DW\-\_AT\-\_encoding} attribute
37 Figure \refersec{fig:encodingattributevalues}
41 may have a \livelink{chap:DWATendianity}{DW\-\_AT\-\_endianity} attribute
42 \addtoindexx{endianity attribute}
44 Section \refersec{chap:dataobjectentries}.
45 If omitted, the encoding assumes the representation that
46 is the default for the target architecture.
49 \hypertarget{chap:DWATbytesizedataobjectordatatypesize}
50 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute
51 \hypertarget{chap:DWATbitsizebasetypebitsize}
52 or a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
53 \addtoindex{bit size attribute}
54 whose integer constant value
55 (see Section \refersec{chap:byteandbitsizes})
56 is the amount of storage needed to hold
59 \textit{For example, the
60 \addtoindex{C} type int on a machine that uses 32\dash bit
61 integers is represented by a base type entry with a name
62 attribute whose value is “int”, an encoding attribute
63 whose value is \livelink{chap:DWATEsigned}{DW\-\_ATE\-\_signed}
64 and a byte size attribute whose value is 4.}
66 If the value of an object of the given type does not fully
67 occupy the storage described by a byte size attribute,
68 \hypertarget{chap:DWATdatabitoffsetbasetypebitlocation}
69 the base type entry may also have
70 \addtoindexx{bit size attribute}
72 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and a
73 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} attribute,
75 \addtoindexx{data bit offset attribute}
77 integer constant values (
78 see Section \refersec{chap:staticanddynamicvaluesofattributes}).
80 attribute describes the actual size in bits used to represent
81 values of the given type. The data bit offset attribute is the
82 offset in bits from the beginning of the containing storage to
83 the beginning of the value. Bits that are part of the offset
84 are padding. The data bit offset uses the bit numbering and
85 direction conventions that are appropriate to the current
87 target system to locate the beginning of the storage and
88 value. If this attribute is omitted a default data bit offset
92 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
94 \addtoindexx{bit offset attribute}
96 \addtoindexx{data bit offset attribute}
98 \addtoindex{DWARF Version 4} and
99 is also used for bit field members
100 (see Section \refersec{chap:datamemberentries}).
102 \hypertarget{chap:DWATbitoffsetbasetypebitlocation}
103 replaces the attribute
104 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
106 \addtoindexx{bit offset attribute (V3)}
107 types as defined in DWARF V3 and earlier. The earlier attribute
108 is defined in a manner suitable for bit field members on
109 big\dash endian architectures but which is wasteful for use on
110 little\dash endian architectures.}
112 \textit{The attribute \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} is
114 \addtoindex{DWARF Version 4}
115 for use in base types, but implementations may continue to
116 support its use for compatibility.}
119 \addtoindex{DWARF Version 3}
120 definition of these attributes is as follows.}
122 \begin{myindentpara}{1cm}
123 \textit{A base type entry has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
124 attribute, whose value
125 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
126 is the size in bytes of the storage unit
127 used to represent an object of the given type.}
129 \textit{If the value of an object of the given type does not fully
130 occupy the storage unit described by the byte size attribute,
131 the base type entry may have a
132 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
133 \addtoindexx{bit size attribute (V3)}
135 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} attribute, both of whose values
136 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
137 are integers. The bit size attribute describes the actual
138 size in bits used to represent a value of the given type.
139 The bit offset attribute describes the offset in bits of the
140 high order bit of a value of the given type from the high
141 order bit of the storage unit used to contain that value.}
146 \addtoindexx{DWARF Version 3}
148 \addtoindexx{DWARF Version 4} and
149 4, note that DWARF V4
150 defines the following combinations of attributes:}
153 \item \textit{DW\-\_AT\-\_byte\-\_size}
154 \item \textit{DW\-\_AT\-\_bit\-\_size}
155 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
156 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
157 and optionally \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}}
160 \addtoindexx{DWARF Version 3}
161 defines the following combinations:
162 % FIXME: the figure below interferes with the following
163 % bullet list, which looks horrible as a result.
165 \item \textit{DW\-\_AT\-\_byte\-\_size}
166 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
167 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
168 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}}
171 \begin{figure}[!here]
173 \begin{tabular}{lp{9cm}}
174 Name&Meaning\\ \hline
175 \livetarg{chap:DWATEaddress}{DW\-\_ATE\-\_address} & linear machine address (for
176 segmented addresses see
177 Section \refersec{chap:segmentedaddresses}) \\
178 \livetarg{chap:DWATEboolean}{DW\-\_ATE\-\_boolean}& true or false \\
180 \livetarg{chap:DWATEcomplexfloat}{DW\-\_ATE\-\_complex\-\_float}& complex binary
181 floating\dash point number \\
182 \livetarg{chap:DWATEfloat}{DW\-\_ATE\-\_float} & binary floating\dash point number \\
183 \livetarg{chap:DWATEimaginaryfloat}{DW\-\_ATE\-\_imaginary\-\_float}& imaginary binary
184 floating\dash point number \\
185 \livetarg{chap:DWATEsigned}{DW\-\_ATE\-\_signed}& signed binary integer \\
186 \livetarg{chap:DWATEsignedchar}{DW\-\_ATE\-\_signed\-\_char}& signed character \\
187 \livetarg{chap:DWATEunsigned}{DW\-\_ATE\-\_unsigned} & unsigned binary integer \\
188 \livetarg{chap:DWATEunsignedchar}{DW\-\_ATE\-\_unsigned\-\_char} & unsigned character \\
189 \livetarg{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} & packed decimal \\
190 \livetarg{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string}& numeric string \\
191 \livetarg{chap:DWATEedited}{DW\-\_ATE\-\_edited} & edited string \\
192 \livetarg{chap:DWATEsignedfixed}{DW\-\_ATE\-\_signed\-\_fixed} & signed fixed\dash point scaled integer \\
193 \livetarg{chap:DWATEunsignedfixed}{DW\-\_ATE\-\_unsigned\-\_fixed}& unsigned fixed\dash point scaled integer \\
194 \livetarg{chap:DWATEdecimalfloat}{DW\-\_ATE\-\_decimal\-\_float} & decimal floating\dash point number \\
195 \livetarg{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} & Unicode character \\
197 \caption{Encoding attribute values}
198 \label{fig:encodingattributevalues}
201 \textit{The \livelink{chap:DWATEdecimalfloat}{DW\-\_ATE\-\_decimal\-\_float} encoding is intended for
202 floating\dash point representations that have a power\dash of\dash ten
203 exponent, such as that specified in IEEE 754R.}
205 \textit{The \livelink{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} encoding is intended for Unicode string
206 encodings (see the Universal Character Set standard,
207 ISO/IEC 10646\dash 1:1993). For example, the
208 \addtoindex{C++} type char16\_t is
209 represented by a base type entry with a name attribute whose
210 value is “char16\_t”, an encoding attribute whose value
211 is \livelink{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} and a byte size attribute whose value is 2.}
214 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal}
216 \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string}
218 represent packed and unpacked decimal string numeric data
219 types, respectively, either of which may be
221 \addtoindexx{decimal scale attribute}
223 \addtoindexx{decimal sign attribute}
225 \addtoindexx{digit count attribute}
227 \hypertarget{chap:DWATdecimalsigndecimalsignrepresentation}
229 \hypertarget{chap:DWATdigitcountdigitcountforpackeddecimalornumericstringtype}
230 base types are used in combination with
231 \livelink{chap:DWATdecimalsign}{DW\-\_AT\-\_decimal\-\_sign},
232 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and
233 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale}
236 A \livelink{chap:DWATdecimalsign}{DW\-\_AT\-\_decimal\-\_sign} attribute
237 \addtoindexx{decimal sign attribute}
238 is an integer constant that
239 conveys the representation of the sign of the decimal type
240 (see Figure \refersec{fig:decimalsignattributevalues}).
241 Its integer constant value is interpreted to
242 mean that the type has a leading overpunch, trailing overpunch,
243 leading separate or trailing separate sign representation or,
244 alternatively, no sign at all.
247 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count}
249 \addtoindexx{digit count attribute}
250 is an integer constant
251 value that represents the number of digits in an instance of
254 \hypertarget{chap:DWATdecimalscaledecimalscalefactor}
255 The \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale}
257 \addtoindexx{decimal scale attribute}
258 is an integer constant value
259 that represents the exponent of the base ten scale factor to
260 be applied to an instance of the type. A scale of zero puts the
261 decimal point immediately to the right of the least significant
262 digit. Positive scale moves the decimal point to the right
263 and implies that additional zero digits on the right are not
264 stored in an instance of the type. Negative scale moves the
265 decimal point to the left; if the absolute value of the scale
266 is larger than the digit count, this implies additional zero
267 digits on the left are not stored in an instance of the type.
269 The \livelink{chap:DWATEedited}{DW\-\_ATE\-\_edited}
271 \hypertarget{chap:DWATpicturestringpicturestringfornumericstringtype}
272 type is used to represent an edited
273 numeric or alphanumeric data type. It is used in combination
274 with an \livelink{chap:DWATpicturestring}{DW\-\_AT\-\_picture\-\_string} attribute whose value is a
275 null\dash terminated string containing the target\dash dependent picture
276 string associated with the type.
278 If the edited base type entry describes an edited numeric
279 data type, the edited type entry has a \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and a
280 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attribute.
281 \addtoindexx{decimal scale attribute}
282 These attributes have the same
283 interpretation as described for the
284 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} and
285 \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base
286 types. If the edited type entry
287 describes an edited alphanumeric data type, the edited type
288 entry does not have these attributes.
291 \textit{The presence or absence of the \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and
292 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attributes
293 \addtoindexx{decimal scale attribute}
294 allows a debugger to easily
295 distinguish edited numeric from edited alphanumeric, although
296 in principle the digit count and scale are derivable by
297 interpreting the picture string.}
299 The \livelink{chap:DWATEsignedfixed}{DW\-\_ATE\-\_signed\-\_fixed} and \livelink{chap:DWATEunsignedfixed}{DW\-\_ATE\-\_unsigned\-\_fixed} entries
300 describe signed and unsigned fixed\dash point binary data types,
303 The fixed binary type entries have
304 \addtoindexx{digit count attribute}
306 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count}
307 attribute with the same interpretation as described for the
308 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} and \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base types.
310 For a data type with a decimal scale factor, the fixed binary
312 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attribute
313 \addtoindexx{decimal scale attribute}
315 interpretation as described for the
316 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal}
317 and \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base types.
319 \hypertarget{chap:DWATbinaryscalebinaryscalefactorforfixedpointtype}
320 For a data type with a binary scale factor, the fixed
321 \addtoindexx{binary scale attribute}
322 binary type entry has a
323 \livelink{chap:DWATbinaryscale}{DW\-\_AT\-\_binary\-\_scale} attribute.
325 \livelink{chap:DWATbinaryscale}{DW\-\_AT\-\_binary\-\_scale} attribute
326 is an integer constant value
327 that represents the exponent of the base two scale factor to
328 be applied to an instance of the type. Zero scale puts the
329 binary point immediately to the right of the least significant
330 bit. Positive scale moves the binary point to the right and
331 implies that additional zero bits on the right are not stored
332 in an instance of the type. Negative scale moves the binary
333 point to the left; if the absolute value of the scale is
334 larger than the number of bits, this implies additional zero
335 bits on the left are not stored in an instance of the type.
338 \hypertarget{chap:DWATsmallscalefactorforfixedpointtype}
339 a data type with a non\dash decimal and non\dash binary scale factor,
340 the fixed binary type entry has a
341 \livelink{chap:DWATsmall}{DW\-\_AT\-\_small} attribute which
343 \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} entry. The scale factor value
344 is interpreted in accordance with the value defined by the
345 \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} entry. The value represented is the product
346 of the integer value in memory and the associated constant
349 \textit{The \livelink{chap:DWATsmall}{DW\-\_AT\-\_small} attribute
350 is defined with the \addtoindex{Ada} small
355 \begin{tabular}{lp{9cm}}
356 Name&Meaning\\ \hline
357 \livetarg{chap:DWDSunsigned}{DW\-\_DS\-\_unsigned} & unsigned \\
358 \livetarg{chap:DWDSleadingoverpunch}{DW\-\_DS\-\_leading\-\_overpunch} & Sign
359 is encoded in the most significant digit in a target\dash dependent manner \\
360 \livetarg{chap:DWDStrailingoverpunch}{DW\-\_DS\-\_trailing\-\_overpunch} & Sign
361 is encoded in the least significant digit in a target\dash dependent manner \\
362 \livetarg{chap:DWDSleadingseparate}{DW\-\_DS\-\_leading\-\_separate}
363 & Decimal type: Sign is a ``+'' or ``-'' character
364 to the left of the most significant digit. \\
365 \livetarg{chap:DWDStrailingseparate}{DW\-\_DS\-\_trailing\-\_separate}
366 & Decimal type: Sign is a ``+'' or ``-'' character
367 to the right of the least significant digit. \\
368 &Packed decimal type: Least significant nibble contains
369 a target\dash dependent value
370 indicating positive or negative. \\
372 \caption{Decimal sign attribute values}
373 \label{fig:decimalsignattributevalues}
376 \section{Unspecified Type Entries}
377 \label{chap:unspecifiedtypeentries}
378 \addtoindexx{unspecified type entry}
379 \addtoindexx{void type|see{unspecified type entry}}
380 Some languages have constructs in which a type
381 may be left unspecified or the absence of a type
383 may be explicitly indicated.
385 An unspecified (implicit, unknown, ambiguous or nonexistent)
386 type is represented by a debugging information entry with
387 the tag \livetarg{chap:DWTAGunspecifiedtype}{DW\-\_TAG\-\_unspecified\-\_type}.
388 If a name has been given
389 to the type, then the corresponding unspecified type entry
390 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is
391 a null\dash terminated
392 string containing the name as it appears in the source program.
394 The interpretation of this debugging information entry is
395 intentionally left flexible to allow it to be interpreted
396 appropriately in different languages. For example, in
397 \addtoindex{C} and \addtoindex{C++}
398 the language implementation can provide an unspecified type
399 entry with the name “void” which can be referenced by the
400 type attribute of pointer types and typedef declarations for
402 % FIXME: the following reference was wrong in DW4 so DavidA guessed
404 Sections \refersec{chap:unspecifiedtypeentries} and
405 %The following reference was valid, so the following is probably correct.
406 Section \refersec{chap:typedefentries},
407 respectively). As another
408 example, in \addtoindex{Ada} such an unspecified type entry can be referred
409 to by the type attribute of an access type where the denoted
410 type is incomplete (the name is declared as a type but the
411 definition is deferred to a separate compilation unit).
413 \section{Type Modifier Entries}
414 \label{chap:typemodifierentries}
415 \addtoindexx{type modifier entry}
417 A base or user\dash defined type may be modified in different ways
418 in different languages. A type modifier is represented in
419 DWARF by a debugging information entry with one of the tags
421 Figure \refersec{fig:typemodifiertags}.
423 If a name has been given to the modified type in the source
424 program, then the corresponding modified type entry has
425 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null-terminated
426 string containing the modified type name as it appears in
429 Each of the type modifier entries has a
430 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute,
431 whose value is a reference to a debugging information entry
432 describing a base type, a user-defined type or another type
435 A modified type entry describing a pointer or reference
436 type (using \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type},
437 \livelink{chap:DWTAGreferencetype}{DW\-\_TAG\-\_reference\-\_type} or
438 \livelink{chap:DWTAGrvaluereferencetype}{DW\-\_TAG\-\_rvalue\-\_reference\-\_type})
439 % Another instance of no-good-place-to-put-index entry.
441 \addtoindexx{address class!attribute}
443 \hypertarget{chap:DWATadressclasspointerorreferencetypes}
445 \livelink{chap:DWATaddressclass}{DW\-\_AT\-\_address\-\_class}
446 attribute to describe how objects having the given pointer
447 or reference type ought to be dereferenced.
449 A modified type entry describing a shared qualified type
450 (using \livelink{chap:DWTAGsharedtype}{DW\-\_TAG\-\_shared\-\_type}) may have a
451 \livelink{chap:DWATcount}{DW\-\_AT\-\_count} attribute
452 \addtoindexx{count attribute}
453 whose value is a constant expressing the blocksize of the
454 type. If no count attribute is present, then the “infinite”
455 blocksize is assumed.
457 When multiple type modifiers are chained together to modify
458 a base or user-defined type, the tree ordering reflects the
459 semantics of the applicable lanuage rather than the textual
460 order in the source presentation.
464 \begin{tabular}{lp{9cm}}
465 Name&Meaning\\ \hline
466 \livetarg{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} & C or C++ const qualified type
467 \addtoindexx{const qualified type entry} \addtoindexx{C} \addtoindexx{C++} \\
468 \livetarg{chap:DWTAGpackedtype}{DW\-\_TAG\-\_packed\-\_type}& Pascal or Ada packed type
469 \addtoindexx{packed qualified type entry} \addtoindexx{Ada} \addtoindexx{Pascal} \\
470 \livetarg{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} & Pointer to an object of
471 the type being modified \addtoindexx{pointer qualified type entry} \\
472 \livetarg{chap:DWTAGreferencetype}{DW\-\_TAG\-\_reference\-\_type}& C++ (lvalue) reference
473 to an object of the type
474 being modified \addtoindexx{reference qualified type entry} \\
475 \livetarg{chap:DWTAGrestricttype}{DW\-\_TAG\-\_restrict\-\_type}&C restrict qualified type
476 \addtoindexx{restricted qualified type entry} \\
477 \livetarg{chap:DWTAGrvaluereferencetype}{DW\-\_TAG\-\_rvalue\-\_reference\-\_type} & C++
478 rvalue reference to an object of the type being modified
479 \addtoindexx{rvalue reference qualified type entry} \\
480 \livetarg{chap:DWTAGsharedtype}{DW\-\_TAG\-\_shared\-\_type}&UPC shared qualified type
481 \addtoindexx{shared qualified type entry} \\
482 \livetarg{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type}&C or C++ volatile qualified type
483 \addtoindex{volatile qualified type entry} \\
485 \caption{Type modifier tags}
486 \label{fig:typemodifiertags}
489 % The following prevents splitting the examples up.
490 % FIXME perhaps there is a better way. We could box the verbatim,
491 % see memman.pdf on verbatims.
493 \textit{As examples of how tye modifiers are ordered, take the following C
497 const unsigned char * volatile p;
498 which represents a volatile pointer to a constant
499 character. This is encoded in DWARF as:
500 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}(p) -->
501 \livelink{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type} -->
502 \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} -->
503 \livelink{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} -->
504 \livelink{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}(unsigned char)
506 volatile unsigned char * const restrict p;
507 on the other hand, represents a restricted constant
508 pointer to a volatile character. This is encoded as:
509 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}(p) -->
510 \livelink{chap:DWTAGrestricttype}{DW\-\_TAG\-\_restrict\-\_type} -->
511 \livelink{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} -->
512 \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} -->
513 \livelink{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type} -->
514 \livelink{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}(unsigned char)
518 \section{Typedef Entries}
519 \label{chap:typedefentries}
520 A named type that is defined in terms of another type
521 definition is represented by a debugging information entry with
522 the tag \livetarg{chap:DWTAGtypedef}{DW\-\_TAG\-\_typedef}.
523 The typedef entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
524 attribute whose value is a null-terminated string containing
525 the name of the typedef as it appears in the source program.
527 The typedef entry may also contain a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose
528 value is a reference to the type named by the typedef. If
529 the debugging information entry for a typedef represents
530 a declaration of the type that is not also a definition,
531 it does not contain a type attribute.
533 \textit{Depending on the language, a named type that is defined in
534 terms of another type may be called a type alias, a subtype,
535 a constrained type and other terms. A type name declared with
536 no defining details may be termed an incomplete, forward
537 or hidden type. While the DWARF \livelink{chap:DWTAGtypedef}{DW\-\_TAG\-\_typedef} entry was
538 originally inspired by the like named construct in
539 \addtoindex{C} and \addtoindex{C++},
540 it is broadly suitable for similar constructs (by whatever
541 source syntax) in other languages.}
543 \section{Array Type Entries}
544 \label{chap:arraytypeentries}
546 Many languages share the concept of an ``array,'' which is
547 \addtoindexx{array type entry}
548 a table of components of identical type.
550 An array type is represented by a debugging information entry
551 with the tag \livetarg{chap:DWTAGarraytype}{DW\-\_TAG\-\_array\-\_type}.
554 \addtoindexx{array!declaration of type}
555 the array type in the source program, then the corresponding
556 array type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a
557 null-terminated string containing the array type name as it
558 appears in the source program.
561 \hypertarget{chap:DWATorderingarrayrowcolumnordering}
562 array type entry describing a multidimensional array may
563 \addtoindexx{array!element ordering}
564 have a \livelink{chap:DWATordering}{DW\-\_AT\-\_ordering} attribute whose integer constant value is
565 interpreted to mean either row-major or column-major ordering
566 of array elements. The set of values and their meanings
567 for the ordering attribute are listed in
568 Figure \refersec{fig:arrayordering}.
570 ordering attribute is present, the default ordering for the
571 source language (which is indicated by the \livelink{chap:DWATlanguage}{DW\-\_AT\-\_language}
572 attribute of the enclosing compilation unit entry) is assumed.
575 \autorows[0pt]{c}{1}{l}{
576 \livetarg{chap:DWORDcolmajor}{DW\-\_ORD\-\_col\-\_major},
577 \livetarg{chap:DWORDrowmajor}{DW\-\_ORD\-\_row\-\_major}
579 \caption{Array ordering}\label{fig:arrayordering}
582 The ordering attribute may optionally appear on one-dimensional
583 arrays; it will be ignored.
585 An array type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
586 \addtoindexx{array!element type}
588 the type of each element of the array.
590 If the amount of storage allocated to hold each element of an
591 object of the given array type is different from the amount
592 of storage that is normally allocated to hold an individual
593 \hypertarget{chap:DWATbitstridearrayelementstrideofarraytype}
595 \hypertarget{chap:DWATbytestridearrayelementstrideofarraytype}
596 indicated element type, then the array type
597 \addtoindexx{bit stride attribute}
599 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
601 \addtoindexx{byte stride attribute}
602 a \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride}
604 \addtoindexx{bit stride attribute}
606 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
608 element of the array.
610 The array type entry may have either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a
611 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
612 (see Section \refersec{chap:byteandbitsizes}),
614 amount of storage needed to hold an instance of the array type.
616 \textit{If the size of the array can be determined statically at
617 compile time, this value can usually be computed by multiplying
618 the number of array elements by the size of each element.}
621 Each array dimension is described by a debugging information
622 entry with either the tag \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} or the tag
623 \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}. These entries are
625 array type entry and are ordered to reflect the appearance of
626 the dimensions in the source program (i.e., leftmost dimension
627 first, next to leftmost second, and so on).
629 In languages, such as C, in which there is no concept of
630 a “multidimensional array”, an array of arrays may
631 be represented by a debugging information entry for a
632 multidimensional array.
634 Other attributes especially applicable to arrays are
635 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated},
636 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} and
637 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location},
638 which are described in
639 Section \refersec{chap:dynamictypeproperties}.
640 For relevant examples,
642 Appendix \refersec{app:fortran90example}.
644 \section{ Structure, Union, Class and Interface Type Entries}
645 \label{chap:structureunionclassandinterfacetypeentries}
647 \textit{The languages
649 \addtoindex{C++}, and
650 \addtoindex{Pascal}, among others, allow the
651 programmer to define types that are collections of related
652 components. In \addtoindex{C} and \addtoindex{C++}, these collections are called
653 “structures.” In \addtoindex{Pascal}, they are called “records.”
654 The components may be of different types. The components are
655 called “members” in \addtoindex{C} and
656 \addtoindex{C++}, and “fields” in \addtoindex{Pascal}.}
658 \textit{The components of these collections each exist in their
659 own space in computer memory. The components of a C or C++
660 “union” all coexist in the same memory.}
662 \textit{\addtoindex{Pascal} and
663 other languages have a “discriminated union,”
664 \addtoindex{discriminated union|see {variant entry}}
665 also called a “variant record.” Here, selection of a
666 number of alternative substructures (“variants”) is based
667 on the value of a component that is not part of any of those
668 substructures (the “discriminant”).}
670 \textit{\addtoindex{C++} and
671 \addtoindex{Java} have the notion of ``class'', which is in some
672 ways similar to a structure. A class may have “member
673 functions” which are subroutines that are within the scope
674 of a class or structure.}
676 \textit{The \addtoindex{C++} notion of
677 structure is more general than in \addtoindex{C}, being
678 equivalent to a class with minor differences. Accordingly,
679 in the following discussion statements about
680 \addtoindex{C++} classes may
681 be understood to apply to \addtoindex{C++} structures as well.}
683 \subsection{Structure, Union and Class Type Entries}
684 \label{chap:structureunionandclasstypeentries}
687 Structure, union, and class types are represented by debugging
688 information entries with
689 the tags \livetarg{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type},
690 \livetarg{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type},
691 and \livetarg{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
692 respectively. If a name has been given to the structure,
693 union, or class in the source program, then the corresponding
694 structure type, union type, or class type entry has a
695 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
696 containing the type name as it appears in the source program.
698 The members of a structure, union, or class are represented
699 by debugging information entries that are owned by the
700 corresponding structure type, union type, or class type entry
701 and appear in the same order as the corresponding declarations
702 in the source program.
704 A structure type, union type or class type entry may have
705 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a
706 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
707 \hypertarget{chap:DWATbitsizedatamemberbitsize}
708 (see Section \refersec{chap:byteandbitsizes}),
709 whose value is the amount of storage needed
710 to hold an instance of the structure, union or class type,
711 including any padding. An incomplete structure, union or
712 class type is represented by a structure, union or class
713 entry that does not have a byte size attribute and that has
714 \addtoindexx{declaration attribute}
715 a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
717 If the complete declaration of a type has been placed in
718 \hypertarget{chap:DWATsignaturetypesignature}
720 (see Section \refersec{chap:separatetypeunitentries}),
722 declaration of that type in the compilation unit may provide
723 the unique 64\dash bit signature of the type using a \livelink{chap:DWATsignature}{DW\-\_AT\-\_signature}
726 If a structure, union or class entry represents the definition
727 of a structure, class or union member corresponding to a prior
728 incomplete structure, class or union, the entry may have a
729 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute whose value is a reference to
730 the debugging information entry representing that incomplete
733 Structure, union and class entries containing the
734 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute do not need to duplicate
735 information provided by the declaration entry referenced by the
736 specification attribute. In particular, such entries do not
737 need to contain an attribute for the name of the structure,
738 class or union they represent if such information is already
739 provided in the declaration.
741 \textit{For \addtoindex{C} and \addtoindex{C++},
743 \addtoindexx{data member|see {member entry (data)}}
744 member declarations occurring within
745 the declaration of a structure, union or class type are
746 considered to be “definitions” of those members, with
747 the exception of “static” data members, whose definitions
748 appear outside of the declaration of the enclosing structure,
749 union or class type. Function member declarations appearing
750 within a structure, union or class type declaration are
751 definitions only if the body of the function also appears
752 within the type declaration.}
754 If the definition for a given member of the structure, union
755 or class does not appear within the body of the declaration,
756 that member also has a debugging information entry describing
757 its definition. That latter entry has a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
758 attribute referencing the debugging information entry
759 owned by the body of the structure, union or class entry and
760 representing a non\dash defining declaration of the data, function
761 or type member. The referenced entry will not have information
762 about the location of that member (low and high pc attributes
763 for function members, location descriptions for data members)
764 and will have a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
766 \textit{Consider a nested class whose
767 definition occurs outside of the containing class definition, as in:}
776 \textit{The two different structs can be described in
777 different compilation units to
778 facilitate DWARF space compression
779 (see Appendix \refersec{app:usingcompilationunits}).}
781 \subsection{Interface Type Entries}
782 \label{chap:interfacetypeentries}
784 \textit{The \addtoindex{Java} language defines ``interface'' types.
786 in Java is similar to a \addtoindex{C++} or
787 \addtoindex{Java} class with only abstract
788 methods and constant data members.}
790 Interface types are represented by debugging information
792 tag \livetarg{chap:DWTAGinterfacetype}{DW\-\_TAG\-\_interface\-\_type}.
794 An interface type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
795 value is a null-terminated string containing the type name
796 as it appears in the source program.
798 The members of an interface are represented by debugging
799 information entries that are owned by the interface type
800 entry and that appear in the same order as the corresponding
801 declarations in the source program.
803 \subsection{Derived or Extended Structs, Classes and Interfaces}
804 \label{chap:derivedorextendedstructsclasesandinterfaces}
806 \textit{In \addtoindex{C++}, a class (or struct)
808 \addtoindexx{derived type (C++)|see{inheritance entry}}
809 be ``derived from'' or be a
810 ``subclass of'' another class. In Java, an interface may ``extend''
811 one or more other interfaces, and a class may ``extend'' another
812 class and/or ``implement'' one or more interfaces. All of these
813 relationships may be described using the following. Note that
814 in Java, the distinction between extends and implements is
815 implied by the entities at the two ends of the relationship.}
817 A class type or interface type entry that describes a
818 derived, extended or implementing class or interface owns
819 debugging information entries describing each of the classes
820 or interfaces it is derived from, extending or implementing,
821 respectively, ordered as they were in the source program. Each
823 tag \livetarg{chap:DWTAGinheritance}{DW\-\_TAG\-\_inheritance}.
825 An inheritance entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is
826 a reference to the debugging information entry describing the
827 class or interface from which the parent class or structure
828 of the inheritance entry is derived, extended or implementing.
830 An inheritance entry for a class that derives from or extends
831 \hypertarget{chap:DWATdatamemberlocationinheritedmemberlocation}
832 another class or struct also has
833 \addtoindexx{data member location attribute}
835 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
836 attribute, whose value describes the location of the beginning
837 of the inherited type relative to the beginning address of the
838 derived class. If that value is a constant, it is the offset
839 in bytes from the beginning of the class to the beginning of
840 the inherited type. Otherwise, the value must be a location
841 description. In this latter case, the beginning address of
842 the derived class is pushed on the expression stack before
843 the location description is evaluated and the result of the
844 evaluation is the location of the inherited type.
846 \textit{The interpretation of the value of this attribute for
847 inherited types is the same as the interpretation for data
849 (see Section \refersec{chap:datamemberentries}). }
852 \hypertarget{chap:DWATaccessibilitycppinheritedmembers}
854 \addtoindexx{accessibility attribute}
856 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
857 attribute. If no accessibility attribute
858 is present, private access is assumed for an entry of a class
859 and public access is assumed for an entry of an interface,
863 \hypertarget{chap:DWATvirtualityvirtualityofbaseclass}
864 the class referenced by the inheritance entry serves
865 as a \addtoindex{C++} virtual base class, the inheritance entry has a
866 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
868 \textit{For a \addtoindex{C++} virtual base, the
869 \addtoindex{data member location attribute}
870 will usually consist of a non-trivial location description.}
872 \subsection{Access Declarations}
873 \label{chap:accessdeclarations}
875 \textit{In \addtoindex{C++}, a derived class may contain access declarations that
876 \addtoindex{access declaration entry}
877 change the accessibility of individual class members from the
878 overall accessibility specified by the inheritance declaration.
879 A single access declaration may refer to a set of overloaded
882 If a derived class or structure contains access declarations,
883 each such declaration may be represented by a debugging
884 information entry with the tag
885 \livetarg{chap:DWTAGaccessdeclaration}{DW\-\_TAG\-\_access\-\_declaration}.
887 such entry is a child of the class or structure type entry.
889 An access declaration entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
890 value is a null-terminated string representing the name used
891 in the declaration in the source program, including any class
892 or structure qualifiers.
894 An access declaration entry
895 \hypertarget{chap:DWATaccessibilitycppbaseclasses}
898 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
899 attribute describing the declared accessibility of the named
906 Each ``friend'' declared by a structure, union or class
907 \hypertarget{chap:DWATfriendfriendrelationship}
908 type may be represented by a debugging information entry
909 that is a child of the structure, union or class type entry;
910 the friend entry has the
911 tag \livetarg{chap:DWTAGfriend}{DW\-\_TAG\-\_friend}.
913 A friend entry has a \livelink{chap:DWATfriend}{DW\-\_AT\-\_friend} attribute, whose value is
914 a reference to the debugging information entry describing
915 the declaration of the friend.
918 \subsection{Data Member Entries}
919 \label{chap:datamemberentries}
921 A data member (as opposed to a member function) is
922 represented by a debugging information entry with the
923 tag \livetarg{chap:DWTAGmember}{DW\-\_TAG\-\_member}.
924 The member entry for a named member has
925 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null-terminated
926 string containing the member name as it appears in the source
927 program. If the member entry describes an
928 \addtoindex{anonymous union},
930 name attribute is omitted or consists of a single zero byte.
932 The data member entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote
933 the type of that member.
935 A data member entry may
936 \addtoindexx{accessibility attribute}
938 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
939 attribute. If no accessibility attribute is present, private
940 access is assumed for an entry of a class and public access
941 is assumed for an entry of a structure, union, or interface.
944 \hypertarget{chap:DWATmutablemutablepropertyofmemberdata}
945 entry may have a \livelink{chap:DWATmutable}{DW\-\_AT\-\_mutable} attribute,
946 which is a \livelink{chap:flag}{flag}.
947 This attribute indicates whether the data
948 member was declared with the mutable storage class specifier.
950 The beginning of a data member
951 \addtoindex{beginning of a data member}
952 is described relative to
953 \addtoindexx{beginning of an object}
954 the beginning of the object in which it is immediately
955 contained. In general, the beginning is characterized by
956 both an address and a bit offset within the byte at that
957 address. When the storage for an entity includes all of
958 the bits in the beginning byte, the beginning bit offset is
961 Bit offsets in DWARF use the bit numbering and direction
962 conventions that are appropriate to the current language on
965 The member entry corresponding to a data member that is
966 \hypertarget{chap:DWATdatabitoffsetdatamemberbitlocation}
968 \hypertarget{chap:DWATdatamemberlocationdatamemberlocation}
969 in a structure, union or class may have either
970 \addtoindexx{data member location attribute}
972 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute or a
973 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
974 attribute. If the beginning of the data member is the same as
975 the beginning of the containing entity then neither attribute
978 For a \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute
980 \addtoindexx{data member location attribute}
983 \begin{enumerate}[1.]
985 \item If the value is an integer constant, it is the offset
986 in bytes from the beginning of the containing entity. If
987 the beginning of the containing entity has a non-zero bit
988 offset then the beginning of the member entry has that same
991 \item Otherwise, the value must be a location description. In
992 this case, the beginning of the containing entity must be byte
993 aligned. The beginning address is pushed on the DWARF stack
994 before the location description is evaluated; the result of
995 the evaluation is the base address of the member entry.
997 \textit{The push on the DWARF expression stack of the base address of
998 the containing construct is equivalent to execution of the
999 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} operation
1000 (see Section \refersec{chap:stackoperations});
1001 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} therefore
1002 is not needed at the
1003 beginning of a location description for a data member. The
1004 result of the evaluation is a location--either an address or
1005 the name of a register, not an offset to the member.}
1007 \textit{A \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1009 \addtoindexx{data member location attribute}
1010 that has the form of a
1011 location description is not valid for a data member contained
1012 in an entity that is not byte aligned because DWARF operations
1013 do not allow for manipulating or computing bit offsets.}
1017 For a \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} attribute,
1018 the value is an integer constant
1019 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1020 that specifies the number of bits
1021 from the beginning of the containing entity to the beginning
1022 of the data member. This value must be greater than or equal
1023 to zero, but is not limited to less than the number of bits
1026 If the size of a data member is not the same as the size
1027 of the type given for the data member, the data member has
1028 \addtoindexx{bit size attribute}
1029 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1030 or a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute whose
1031 integer constant value
1032 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1034 of storage needed to hold the value of the data member.
1036 \textit{\addtoindex{C} and \addtoindex{C++}
1038 \addtoindex{bit fields}
1040 \addtoindexx{data bit offset}
1042 \addtoindexx{data bit size}
1044 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} and
1045 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attributes.}
1047 \textit{This Standard uses the following bit numbering and direction
1048 conventions in examples. These conventions are for illustrative
1049 purposes and other conventions may apply on particular
1054 \item \textit{For big\dash endian architectures, bit offsets are
1055 counted from high-order to low\dash order bits within a byte (or
1056 larger storage unit); in this case, the bit offset identifies
1057 the high\dash order bit of the object.}
1059 \item \textit{For little\dash endian architectures, bit offsets are
1060 counted from low\dash order to high\dash order bits within a byte (or
1061 larger storage unit); in this case, the bit offset identifies
1062 the low\dash order bit of the object.}
1066 \textit{In either case, the bit so identified is defined as the
1067 \addtoindexx{beginning of an object}
1068 beginning of the object.}
1070 \textit{For example, take one possible representation of the following
1071 \addtoindex{C} structure definition
1072 in both big\dash and little\dash endian byte orders:}
1083 \textit{The following diagrams show the structure layout
1084 and data bit offsets for example big\dash\ and little\dash endian
1085 architectures, respectively. Both diagrams show a structure
1086 that begins at address A and whose size is four bytes. Also,
1087 high order bits are to the left and low order bits are to
1090 \textit{Big\dash Endian Data Bit Offsets:}
1098 Addresses increase ->
1099 | A | A + 1 | A + 2 | A + 3 |
1101 Data bit offsets increase ->
1102 +---------------+---------------+---------------+---------------+
1103 |0 4|5 10|11 15|16 23|24 31|
1104 | j | k | m | n | <pad> |
1106 +---------------------------------------------------------------+
1109 \textit{Little\dash Endian Data Bit Offsets:}
1115 <- Addresses increase
1116 | A | A + 1 | A + 2 | A + 3 |
1118 <- Data bit offsets increase
1120 +---------------+---------------+---------------+---------------+
1121 |31 24|23 16|15 11|10 5|4 0|
1122 | <pad> | n | m | k | j |
1124 +---------------------------------------------------------------+
1128 \textit{Note that data member bit offsets in this example are the
1129 same for both big\dash\ and little\dash endian architectures even
1130 though the fields are allocated in different directions
1131 (high\dash order to low-order versus low\dash order to high\dash order);
1132 the bit naming conventions for memory and/or registers of
1133 the target architecture may or may not make this seem natural.}
1135 \textit{For a more extensive example showing nested and packed records
1137 Appendix \refersec{app:pascalexample}.}
1139 \textit{Attribute \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1141 \addtoindex{DWARF Version 4}
1142 and is also used for base types
1144 \refersec{chap:basetypeentries}).
1146 \livetarg{chap:DWATbitoffsetdatamemberbitlocation}
1147 attributes \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} and
1148 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} when used to
1149 identify the beginning of bit field data members as defined
1150 in DWARF V3 and earlier. The earlier attributes are defined
1151 in a manner suitable for bit field members on big-endian
1152 architectures but which is either awkward or incomplete for
1153 use on little-endian architectures.
1154 (\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} also
1155 has other uses that are not affected by this change.)}
1157 \textit{The \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1158 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1159 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1160 attribute combination is deprecated for data members in DWARF
1161 Version 4, but implementations may continue to support this
1162 use for compatibility.}
1165 \addtoindex{DWARF Version 3}
1166 definitions of these attributes are
1169 \begin{myindentpara}{1cm}
1170 \textit{If the data member entry describes a bit field, then that
1171 entry has the following attributes:}
1174 \item \textit{A \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1175 attribute whose value
1176 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1177 is the number of bytes that contain an instance of the
1178 bit field and any padding bits.}
1180 \textit{The byte size attribute may be omitted if the size of the
1181 object containing the bit field can be inferred from the type
1182 attribute of the data member containing the bit field.}
1184 \item \textit{A \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1186 \addtoindexx{bit offset attribute (V3)}
1188 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1189 is the number of bits to the left of the leftmost
1190 (most significant) bit of the bit field value.}
1192 \item \textit{A \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1194 \addtoindexx{bit size attribute (V3)}
1196 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1197 is the number of bits occupied by the bit field value.}
1201 \textit{The location description for a bit field calculates the address
1202 of an anonymous object containing the bit field. The address
1203 is relative to the structure, union, or class that most closely
1204 encloses the bit field declaration. The number of bytes in this
1205 anonymous object is the value of the byte size attribute of
1206 the bit field. The offset (in bits) from the most significant
1207 bit of the anonymous object to the most significant bit of
1208 the bit field is the value of the bit offset attribute.}
1212 \textit{Diagrams similar to the above that show the use of the
1213 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1214 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1215 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} attribute
1216 combination may be found in the
1217 \addtoindex{DWARF Version 3} Standard.}
1219 \textit{In comparing
1221 \addtoindexx{DWARF Version 3}
1223 \addtoindexx{DWARF Version 4}
1224 4, note that DWARF V4
1225 defines the following combinations of attributes:}
1228 \item \textit{either \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1230 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1231 (to specify the beginning of the data member)}
1233 % FIXME: the indentation of the following line is suspect.
1234 \textit{optionally together with}
1236 \item \textit{either \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or
1237 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} (to
1238 specify the size of the data member)}
1242 \textit{DWARF V3 defines the following combinations}
1245 \item \textit{\livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1246 (to specify the beginning
1247 of the data member, except this specification is only partial
1248 in the case of a bit field) }
1250 % FIXME: the indentation of the following line is suspect.
1251 \textit{optionally together with}
1253 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1254 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1255 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1256 (to further specify the beginning of a bit field data member
1257 as well as specify the size of the data member) }
1260 \subsection{Member Function Entries}
1261 \label{chap:memberfunctionentries}
1263 A member function is represented by a debugging information
1264 entry with the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}.
1265 The member function entry
1266 may contain the same attributes and follows the same rules
1267 as non\dash member global subroutine entries
1268 (see Section \refersec{chap:subroutineandentrypointentries}).
1271 \addtoindexx{accessibility attribute}
1272 member function entry may have a
1273 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
1274 attribute. If no accessibility attribute is present, private
1275 access is assumed for an entry of a class and public access
1276 is assumed for an entry of a structure, union or interface.
1279 \hypertarget{chap:DWATvirtualityvirtualityoffunction}
1280 the member function entry describes a virtual function,
1281 then that entry has a
1282 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
1285 \hypertarget{chap:DWATexplicitexplicitpropertyofmemberfunction}
1286 the member function entry describes an explicit member
1287 function, then that entry has a
1288 \livelink{chap:DWATexplicit}{DW\-\_AT\-\_explicit} attribute.
1291 \hypertarget{chap:DWATvtableelemlocationvirtualfunctiontablevtableslot}
1292 entry for a virtual function also has a
1293 \livelink{chap:DWATvtableelemlocation}{DW\-\_AT\-\_vtable\-\_elem\-\_location}
1294 \addtoindexi{attribute}{vtable element location attribute} whose value contains
1295 a location description yielding the address of the slot
1296 for the function within the virtual function table for the
1297 enclosing class. The address of an object of the enclosing
1298 type is pushed onto the expression stack before the location
1299 description is evaluated.
1302 \hypertarget{chap:DWATobjectpointerobjectthisselfpointerofmemberfunction}
1303 the member function entry describes a non\dash static member
1304 function, then that entry has a \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer}
1306 whose value is a reference to the formal parameter entry
1307 that corresponds to the object for which the function is
1308 called. The name attribute of that formal parameter is defined
1309 by the current language (for example,
1310 this for \addtoindex{C++} or self
1311 for \addtoindex{Objective C}
1312 and some other languages). That parameter
1313 also has a \livelink{chap:DWATartificial}{DW\-\_AT\-\_artificial} attribute whose value is true.
1315 Conversely, if the member function entry describes a static
1316 member function, the entry does not have a
1317 \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer}
1320 If the member function entry describes a non\dash static member
1321 function that has a const\dash volatile qualification, then
1322 the entry describes a non\dash static member function whose
1323 object formal parameter has a type that has an equivalent
1324 const\dash volatile qualification.
1326 If a subroutine entry represents the defining declaration
1327 of a member function and that definition appears outside of
1328 the body of the enclosing class declaration, the subroutine
1329 entry has a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
1330 attribute, whose value is
1331 a reference to the debugging information entry representing
1332 the declaration of this function member. The referenced entry
1333 will be a child of some class (or structure) type entry.
1335 Subroutine entries containing the \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
1336 attribute do not need to duplicate information provided
1337 by the declaration entry referenced by the specification
1338 attribute. In particular, such entries do not need to contain
1339 attributes for the name or return type of the function member
1340 whose definition they represent.
1342 \subsection{Class Template Instantiations}
1343 \label{chap:classtemplateinstantiations}
1345 \textit{In \addtoindex{C++} a class template is a generic definition of a class
1346 type that may be instantiated when an instance of the class
1347 is declared or defined. The generic description of the
1348 class may include both parameterized types and parameterized
1349 constant values. DWARF does not represent the generic template
1350 definition, but does represent each instantiation.}
1352 A class template instantiation is represented by a
1353 debugging information entry with the tag \livelink{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
1354 \livelink{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type} or
1355 \livelink{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type}. With five
1356 exceptions, such an entry will contain the same attributes
1357 and have the same types of child entries as would an entry
1358 for a class type defined explicitly using the instantiation
1359 types and values. The exceptions are:
1361 \begin{enumerate}[1.]
1362 \item Each formal parameterized type declaration appearing in the
1363 template definition is represented by a debugging information
1365 \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}. Each
1366 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is
1367 a null\dash terminated string containing the name of the formal
1368 type parameter as it appears in the source program. The
1369 template type parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1370 describing the actual type by which the formal is replaced
1371 for this instantiation.
1373 \item Each formal parameterized value declaration appearing in the
1374 template definition is represented by a debugging information
1376 tag \livetarg{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}.
1378 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is
1379 a null\dash terminated string containing the name of the formal
1380 value parameter as it appears in the source program.
1382 \hypertarget{chap:DWATconstvaluetemplatevalueparameter}
1383 template value parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1384 describing the type of the parameterized value. Finally,
1385 the template value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value}
1386 attribute, whose value is the actual constant value of the
1387 value parameter for this instantiation as represented on the
1388 target architecture.
1390 \item The class type entry and each of its child entries references
1391 a template type parameter entry in any circumstance where the
1392 source template definition references a formal parameterized
1393 type. Similarly, the class type entry and each of its child
1394 entries references a template value parameter entry in any
1395 circumstance where the source template definition references
1396 a formal parameterized value.
1398 \item If the compiler has generated a special compilation unit to
1399 hold the template instantiation and that special compilation
1400 unit has a different name from the compilation unit containing
1401 the template definition, the name attribute for the debugging
1402 information entry representing the special compilation unit
1403 should be empty or omitted.
1405 \item If the class type entry representing the template
1406 instantiation or any of its child entries contains declaration
1407 coordinate attributes, those attributes should refer to
1408 the source for the template definition, not to any source
1409 generated artificially by the compiler.
1413 \subsection{Variant Entries}
1414 \label{chap:variantentries}
1416 A variant part of a structure is represented by a debugging
1417 information entry\addtoindexx{variant part entry} with the
1418 tag \livetarg{chap:DWTAGvariantpart}{DW\-\_TAG\-\_variant\-\_part} and is
1419 owned by the corresponding structure type entry.
1421 If the variant part has a discriminant, the discriminant is
1422 \hypertarget{chap:DWATdiscrdiscriminantofvariantpart}
1424 \addtoindexx{discriminant (entry)}
1425 separate debugging information entry which
1426 is a child of the variant part entry. This entry has the form
1427 of a structure data member entry. The variant part entry will
1428 \addtoindexx{discriminant attribute}
1430 \livelink{chap:DWATdiscr}{DW\-\_AT\-\_discr} attribute
1431 whose value is a reference to
1432 the member entry for the discriminant.
1434 If the variant part does not have a discriminant (tag field),
1435 the variant part entry has a
1436 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to represent
1439 Each variant of a particular variant part is represented by
1440 \hypertarget{chap:DWATdiscrvaluediscriminantvalue}
1441 a debugging information entry\addtoindexx{variant entry} with the
1442 tag \livetarg{chap:DWTAGvariant}{DW\-\_TAG\-\_variant}
1443 and is a child of the variant part entry. The value that
1444 selects a given variant may be represented in one of three
1445 ways. The variant entry may have a
1446 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value} attribute
1447 whose value represents a single case label. The value of this
1448 attribute is encoded as an LEB128 number. The number is signed
1449 if the tag type for the variant part containing this variant
1450 is a signed type. The number is unsigned if the tag type is
1454 \hypertarget{chap:DWATdiscrlistlistofdiscriminantvalues}
1455 the variant entry may contain
1456 \addtoindexx{discriminant list attribute}
1458 \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list}
1459 attribute, whose value represents a list of discriminant
1460 values. This list is represented by any of the
1461 \livelink{chap:block}{block} forms and
1462 may contain a mixture of case labels and label ranges. Each
1463 item on the list is prefixed with a discriminant value
1464 descriptor that determines whether the list item represents
1465 a single label or a label range. A single case label is
1466 represented as an LEB128 number as defined above for
1467 \addtoindexx{discriminant value attribute}
1469 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value}
1470 attribute. A label range is represented by
1471 two LEB128 numbers, the low value of the range followed by the
1472 high value. Both values follow the rules for signedness just
1473 described. The discriminant value descriptor is an integer
1474 constant that may have one of the values given in
1475 Figure \refersec{fig:discriminantdescriptorvalues}.
1477 \begin{figure}[here]
1478 \autorows[0pt]{c}{1}{l}{
1479 \addtoindex{DW\-\_DSC\-\_label},
1480 \addtoindex{DW\-\_DSC\-\_range}
1482 \caption{Discriminant descriptor values}\label{fig:discriminantdescriptorvalues}
1485 If a variant entry has neither a \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value}
1486 attribute nor a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute, or if it has
1487 a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute with 0 size, the variant is a
1490 The components selected by a particular variant are represented
1491 by debugging information entries owned by the corresponding
1492 variant entry and appear in the same order as the corresponding
1493 declarations in the source program.
1495 \section{Condition Entries}
1496 \label{chap:conditionentries}
1498 \textit{COBOL has the notion of a ``level\dash 88 condition'' that
1499 associates a data item, called the conditional variable, with
1500 a set of one or more constant values and/or value ranges.
1501 Semantically, the condition is ‛true’ if the conditional
1502 variable's value matches any of the described constants,
1503 and the condition is ‛false’ otherwise.}
1505 The \livetarg{chap:DWTAGcondition}{DW\-\_TAG\-\_condition}
1506 debugging information entry\addtoindexx{condition entry}
1508 logical condition that tests whether a given data item’s
1509 value matches one of a set of constant values. If a name
1510 has been given to the condition, the condition entry has a
1511 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
1512 giving the condition name as it appears in the source program.
1514 The condition entry's parent entry describes the conditional
1515 variable; normally this will be a \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable},
1516 \livelink{chap:DWTAGmember}{DW\-\_TAG\-\_member} or
1517 \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter} entry. If the parent
1518 entry has an array type, the condition can test any individual
1519 element, but not the array as a whole. The condition entry
1520 implicitly specifies a “comparison type” that is the
1521 type of an array element if the parent has an array type;
1522 otherwise it is the type of the parent entry.
1524 The condition entry owns \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} and/or
1525 \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} entries that describe the constant
1526 values associated with the condition. If any child entry has
1527 a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute, that attribute should describe a type
1528 compatible with the comparison type (according to the source
1529 language); otherwise the child’s type is the same as the
1532 \textit{For conditional variables with alphanumeric types, COBOL
1533 permits a source program to provide ranges of alphanumeric
1534 constants in the condition. Normally a subrange type entry
1535 does not describe ranges of strings; however, this can be
1536 represented using bounds attributes that are references to
1537 constant entries describing strings. A subrange type entry may
1538 refer to constant entries that are siblings of the subrange
1542 \section{Enumeration Type Entries}
1543 \label{chap:enumerationtypeentries}
1545 \textit{An “enumeration type” is a scalar that can assume one of
1546 a fixed number of symbolic values.}
1548 An enumeration type is represented by a debugging information
1550 \livetarg{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}.
1552 If a name has been given to the enumeration type in the source
1553 program, then the corresponding enumeration type entry has
1554 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated
1555 string containing the enumeration type name as it appears
1556 in the source program. This entry also has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1557 attribute whose integer constant value is the number of bytes
1558 required to hold an instance of the enumeration.
1560 The enumeration type entry may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1561 which refers to the underlying data type used to implement
1564 If an enumeration type has type safe semantics such that
1566 \begin{enumerate}[1.]
1567 \item Enumerators are contained in the scope of the enumeration type, and/or
1569 \item Enumerators are not implicitly converted to another type
1572 then the enumeration type entry may have a \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}
1573 attribute, which is a \livelink{chap:flag}{flag}.
1574 In a language that offers only
1575 one kind of enumeration declaration, this attribute is not
1578 \textit{In \addtoindex{C} or \addtoindex{C++},
1579 the underlying type will be the appropriate
1580 integral type determined by the compiler from the properties of
1581 \hypertarget{chap:DWATenumclasstypesafeenumerationdefinition}
1582 the enumeration literal values. A \addtoindex{C++} type declaration written
1583 using enum class declares a strongly typed enumeration and
1584 is represented using \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}
1585 in combination with \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}.}
1587 Each enumeration literal is represented by a debugging
1588 information entry with the
1589 tag \livetarg{chap:DWTAGenumerator}{DW\-\_TAG\-\_enumerator}.
1591 such entry is a child of the enumeration type entry, and the
1592 enumerator entries appear in the same order as the declarations
1593 of the enumeration literals in the source program.
1595 Each enumerator entry has a
1596 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
1597 value is a null\dash terminated string containing the name of the
1598 \hypertarget{chap:DWATconstvalueenumerationliteralvalue}
1599 enumeration literal as it appears in the source program.
1600 Each enumerator entry also has a
1601 \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value} attribute,
1602 whose value is the actual numeric value of the enumerator as
1603 represented on the target system.
1606 If the enumeration type occurs as the description of a
1607 dimension of an array type, and the stride for that dimension
1608 \hypertarget{chap:DWATbytestrideenumerationstridedimensionofarraytype}
1609 is different than what would otherwise be determined, then
1610 \hypertarget{chap:DWATbitstrideenumerationstridedimensionofarraytype}
1611 the enumeration type entry has either a
1612 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1613 or \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1614 \addtoindexx{bit stride attribute}
1615 which specifies the separation
1616 between successive elements along the dimension as described
1618 Section \refersec{chap:visibilityofdeclarations}.
1620 \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1621 \addtoindexx{bit stride attribute}
1622 is interpreted as bits and the value of
1623 \addtoindexx{byte stride attribute}
1625 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1626 attribute is interpreted as bytes.
1629 \section{Subroutine Type Entries}
1630 \label{chap:subroutinetypeentries}
1632 It is possible in \addtoindex{C}
1633 to declare pointers to subroutines
1634 that return a value of a specific type. In both
1635 \addtoindex{C} and \addtoindex{C++},
1636 it is possible to declare pointers to subroutines that not
1637 only return a value of a specific type, but accept only
1638 arguments of specific types. The type of such pointers would
1639 be described with a ``pointer to'' modifier applied to a
1640 user\dash defined type.
1642 A subroutine type is represented by a debugging information
1644 tag \livetarg{chap:DWTAGsubroutinetype}{DW\-\_TAG\-\_subroutine\-\_type}.
1646 been given to the subroutine type in the source program,
1647 then the corresponding subroutine type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
1648 attribute whose value is a null\dash terminated string containing
1649 the subroutine type name as it appears in the source program.
1651 If the subroutine type describes a function that returns
1652 a value, then the subroutine type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
1653 attribute to denote the type returned by the subroutine. If
1654 the types of the arguments are necessary to describe the
1655 subroutine type, then the corresponding subroutine type
1656 entry owns debugging information entries that describe the
1657 arguments. These debugging information entries appear in the
1658 order that the corresponding argument types appear in the
1661 In \addtoindex{C} there
1662 is a difference between the types of functions
1663 declared using function prototype style declarations and
1664 those declared using non\dash prototype declarations.
1667 \hypertarget{chap:DWATprototypedsubroutineprototype}
1668 subroutine entry declared with a function prototype style
1669 declaration may have a
1670 \livelink{chap:DWATprototyped}{DW\-\_AT\-\_prototyped} attribute, which is
1671 a \livelink{chap:flag}{flag}.
1673 Each debugging information entry owned by a subroutine
1674 type entry has a tag whose value has one of two possible
1677 \begin{enumerate}[1.]
1678 \item The formal parameters of a parameter list (that have a
1679 specific type) are represented by a debugging information entry
1680 with the tag \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter}.
1681 Each formal parameter
1682 entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute that refers to the type of
1683 the formal parameter.
1685 \item The unspecified parameters of a variable parameter list
1686 \addtoindexx{unspecified parameters entry}
1688 \addtoindexx{... parameters|see{unspecified parameters entry}}
1689 represented by a debugging information entry with the
1690 tag \livelink{chap:DWTAGunspecifiedparameters}{DW\-\_TAG\-\_unspecified\-\_parameters}.
1695 \section{String Type Entries}
1696 \label{chap:stringtypeentries}
1699 A ``string'' is a sequence of characters that have specific
1700 semantics and operations that separate them from arrays of
1701 characters. Fortran is one of the languages that has a string
1702 type. Note that ``string'' in this context refers to a target
1703 machine concept, not the class string as used in this document
1704 (except for the name attribute).
1706 A string type is represented by a debugging information entry
1707 with the tag \livetarg{chap:DWTAGstringtype}{DW\-\_TAG\-\_string\-\_type}.
1708 If a name has been given to
1709 the string type in the source program, then the corresponding
1710 string type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is
1711 a null\dash terminated string containing the string type name as
1712 it appears in the source program.
1715 \hypertarget{chap:DWATstringlengthstringlengthofstringtype}
1716 string type entry may have a
1717 \livelink{chap:DWATstringlength}{DW\-\_AT\-\_string\-\_length} attribute
1718 whose value is a location description yielding the location
1719 where the length of the string is stored in the program. The
1720 string type entry may also have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute
1721 or \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
1722 (see Section \refersec{chap:byteandbitsizes})
1723 is the size of the data to be retrieved from the location
1724 referenced by the string length attribute. If no (byte or bit)
1725 size attribute is present, the size of the data to be retrieved
1726 is the same as the size of an address on the target machine.
1728 If no string length attribute is present, the string type
1729 entry may have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or
1730 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1731 attribute, whose value
1732 (see Section \refersec{chap:byteandbitsizes})
1734 storage needed to hold a value of the string type.
1737 \section{Set Type Entries}
1738 \label{chap:settypeentries}
1740 \textit{Pascal provides the concept of a “set,” which represents
1741 a group of values of ordinal type.}
1743 A set is represented by a debugging information entry with
1744 the tag \livetarg{chap:DWTAGsettype}{DW\-\_TAG\-\_set\-\_type}.
1745 If a name has been given to the
1746 set type, then the set type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1747 whose value is a null\dash terminated string containing the
1748 set type name as it appears in the source program.
1750 The set type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote the
1751 type of an element of the set.
1753 If the amount of storage allocated to hold each element of an
1754 object of the given set type is different from the amount of
1755 storage that is normally allocated to hold an individual object
1756 of the indicated element type, then the set type entry has
1757 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute, or
1758 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
1759 whose value (see Section \refersec{chap:byteandbitsizes}) is
1760 the amount of storage needed to hold a value of the set type.
1763 \section{Subrange Type Entries}
1764 \label{chap:subrangetypeentries}
1766 \textit{Several languages support the concept of a ``subrange''
1767 type object. These objects can represent a subset of the
1768 values that an object of the basis type for the subrange can
1769 represent. Subrange type entries may also be used to represent
1770 the bounds of array dimensions.}
1772 A subrange type is represented by a debugging information
1774 tag \livetarg{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type}.
1776 given to the subrange type, then the subrange type entry
1777 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated
1778 string containing the subrange type name as it appears in
1781 The subrange entry may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to describe
1782 the type of object, called the basis type, of whose values
1783 this subrange is a subset.
1785 If the amount of storage allocated to hold each element of an
1786 object of the given subrange type is different from the amount
1787 of storage that is normally allocated to hold an individual
1788 object of the indicated element type, then the subrange
1789 type entry has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or
1790 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1791 attribute, whose value
1792 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1794 storage needed to hold a value of the subrange type.
1797 \hypertarget{chap:DWATthreadsscaledupcarrayboundthreadsscalfactor}
1798 subrange entry may have a \livelink{chap:DWATthreadsscaled}{DW\-\_AT\-\_threads\-\_scaled} attribute,
1799 which is a \livelink{chap:flag}{flag}.
1800 If present, this attribute indicates whether
1801 this subrange represents a UPC array bound which is scaled
1802 by the runtime THREADS value (the number of UPC threads in
1803 this execution of the program).
1805 \textit{This allows the representation of a UPC shared array such as}
1808 int shared foo[34*THREADS][10][20];
1812 \hypertarget{chap:DWATlowerboundlowerboundofsubrange}
1814 \hypertarget{chap:DWATupperboundupperboundofsubrange}
1815 entry may have the attributes
1816 \livelink{chap:DWATlowerbound}{DW\-\_AT\-\_lower\-\_bound}
1817 and \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound} to specify, respectively, the lower
1818 and upper bound values of the subrange. The
1819 \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound}
1821 \hypertarget{chap:DWATcountelementsofsubrangetype}
1823 % FIXME: The following matches DWARF4: odd as there is no default count.
1824 \addtoindexx{count attribute!default}
1826 \addtoindexx{count attribute}
1828 \livelink{chap:DWATcount}{DW\-\_AT\-\_count} attribute,
1830 value describes the number of elements in the subrange rather
1831 than the value of the last element. The value of each of
1832 these attributes is determined as described in
1833 Section \refersec{chap:staticanddynamicvaluesofattributes}.
1835 If the lower bound value is missing, the value is assumed to
1836 be a language\dash dependent default constant. The default lower
1838 \addtoindex{C}, \addtoindex{C++},
1841 \addtoindex{Objective C},
1842 \addtoindex{Objective C++},
1843 \addtoindex{Python}, and
1845 The default lower bound is 1 for
1846 \addtoindex{Ada}, \addtoindex{COBOL},
1847 \addtoindex{Fortran},
1848 \addtoindex{Modula}\dash 2,
1849 \addtoindex{Pascal} and
1852 \textit{No other default lower bound values are currently defined.}
1854 If the upper bound and count are missing, then the upper bound value is
1857 If the subrange entry has no type attribute describing the
1858 basis type, the basis type is assumed to be the same as
1859 the object described by the lower bound attribute (if it
1860 references an object). If there is no lower bound attribute,
1861 or that attribute does not reference an object, the basis type
1862 is the type of the upper bound or \addtoindex{count attribute}
1864 of them references an object). If there is no upper bound or
1865 count attribute, or neither references an object, the type is
1866 assumed to be the same type, in the source language of the
1867 compilation unit containing the subrange entry, as a signed
1868 integer with the same size as an address on the target machine.
1870 If the subrange type occurs as the description of a dimension
1871 of an array type, and the stride for that dimension is
1872 \hypertarget{chap:DWATbytestridesubrangestridedimensionofarraytype}
1873 different than what would otherwise be determined, then
1874 \hypertarget{chap:DWATbitstridesubrangestridedimensionofarraytype}
1875 the subrange type entry has either
1876 \addtoindexx{byte stride attribute}
1878 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride} or
1879 \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1880 \addtoindexx{bit stride attribute}
1881 which specifies the separation
1882 between successive elements along the dimension as described
1884 Section \refersec{chap:byteandbitsizes}.
1886 \textit{Note that the stride can be negative.}
1888 \section{Pointer to Member Type Entries}
1889 \label{chap:pointertomembertypeentries}
1891 \textit{In \addtoindex{C++}, a pointer to a data or function member of a class or
1892 structure is a unique type.}
1894 A debugging information entry representing the type of an
1895 object that is a pointer to a structure or class member has
1896 the tag \livetarg{chap:DWTAGptrtomembertype}{DW\-\_TAG\-\_ptr\-\_to\-\_member\-\_type}.
1898 If the pointer to member type has a name, the pointer to
1899 member entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a
1900 null\dash terminated string containing the type name as it appears
1901 in the source program.
1903 The pointer to member entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to
1904 describe the type of the class or structure member to which
1905 objects of this type may point.
1907 The pointer to member entry also
1908 \hypertarget{chap:DWATcontainingtypecontainingtypeofpointertomembertype}
1910 \livelink{chap:DWATcontainingtype}{DW\-\_AT\-\_containing\-\_type}
1911 attribute, whose value is a reference to a debugging
1912 information entry for the class or structure to whose members
1913 objects of this type may point.
1916 \hypertarget{chap:DWATuselocationmemberlocationforpointertomembertype}
1917 pointer to member entry has a
1918 \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} attribute
1919 whose value is a location description that computes the
1920 address of the member of the class to which the pointer to
1921 member entry points.
1923 \textit{The method used to find the address of a given member of a
1924 class or structure is common to any instance of that class
1925 or structure and to any instance of the pointer or member
1926 type. The method is thus associated with the type entry,
1927 rather than with each instance of the type.}
1929 The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is used in conjunction
1930 with the location descriptions for a particular object of the
1931 given pointer to member type and for a particular structure or
1932 class instance. The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location}
1933 attribute expects two values to be
1934 \addtoindexi{pushed}{address!implicit push for member operator}
1935 onto the DWARF expression stack before
1936 the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is evaluated.
1938 \addtoindexi{pushed}{address!implicit push for member operator}
1939 is the value of the pointer to member object
1940 itself. The second value
1941 \addtoindexi{pushed}{address!implicit push for member operator}
1942 is the base address of the
1943 entire structure or union instance containing the member
1944 whose address is being calculated.
1946 \textit{For an expression such as}
1951 % FIXME: object and mbr\_ptr should be distinguished from italic. See DW4.
1952 \textit{where mbr\_ptr has some pointer to member type, a debugger should:}
1954 \textit{1. Push the value of mbr\_ptr onto the DWARF expression stack.}
1956 \textit{2. Push the base address of object onto the DWARF expression stack.}
1958 \textit{3. Evaluate the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description
1959 given in the type of mbr\_ptr.}
1961 \section{File Type Entries}
1962 \label{chap:filetypeentries}
1964 \textit{Some languages, such as Pascal, provide a data type to represent
1967 A file type is represented by a debugging information entry
1969 \livetarg{chap:DWTAGfiletype}{DW\-\_TAG\-\_file\-\_type}.
1970 If the file type has a name,
1971 the file type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value
1972 is a null\dash terminated string containing the type name as it
1973 appears in the source program.
1975 The file type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
1976 the type of the objects contained in the file.
1978 The file type entry also
1979 \addtoindexx{byte size}
1981 \addtoindexx{bit size}
1983 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or
1984 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
1985 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1986 is the amount of storage need to hold a value of the file type.
1988 \section{Dynamic Type Properties}
1989 \label{chap:dynamictypeproperties}
1990 \subsection{Data Location}
1991 \label{chap:datalocation}
1993 \textit{Some languages may represent objects using descriptors to hold
1994 information, including a location and/or run\dash time parameters,
1995 about the data that represents the value for that object.}
1997 \hypertarget{chap:DWATdatalocationindirectiontoactualdata}
1998 The \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
1999 attribute may be used with any
2000 type that provides one or more levels of hidden indirection
2001 and/or run\dash time parameters in its representation. Its value
2002 is a location description. The result of evaluating this
2003 description yields the location of the data for an object.
2004 When this attribute is omitted, the address of the data is
2005 the same as the address of the object.
2007 \textit{This location description will typically begin with
2008 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address}
2009 which loads the address of the
2010 object which can then serve as a descriptor in subsequent
2011 calculation. For an example using
2012 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
2013 for a Fortran 90 array, see
2014 Appendix \refersec{app:fortran90example}.}
2016 \subsection{Allocation and Association Status}
2017 \label{chap:allocationandassociationstatus}
2019 \textit{Some languages, such as Fortran 90, provide types whose values
2020 may be dynamically allocated or associated with a variable
2021 under explicit program control.}
2023 \hypertarget{chap:DWATallocatedallocationstatusoftypes}
2025 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated}
2027 \addtoindexx{allocated attribute}
2028 may optionally be used with any
2029 type for which objects of the type can be explicitly allocated
2030 and deallocated. The presence of the attribute indicates that
2031 objects of the type are allocatable and deallocatable. The
2032 integer value of the attribute (see below) specifies whether
2033 an object of the type is
2034 currently allocated or not.
2036 \hypertarget{chap:DWATassociatedassociationstatusoftypes}
2038 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute
2040 \addtoindexx{associated attribute}
2041 optionally be used with
2042 any type for which objects of the type can be dynamically
2043 associated with other objects. The presence of the attribute
2044 indicates that objects of the type can be associated. The
2045 integer value of the attribute (see below) indicates whether
2046 an object of the type is currently associated or not.
2048 While these attributes are defined specifically with Fortran
2049 90 ALLOCATABLE and POINTER types in mind, usage is not limited
2050 to just that language.
2052 The value of these attributes is determined as described in
2053 Section \refersec{chap:staticanddynamicvaluesofattributes}.
2055 A non\dash zero value is interpreted as allocated or associated,
2056 and zero is interpreted as not allocated or not associated.
2058 \textit{For \addtoindex{Fortran} 90,
2059 if the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated}
2060 attribute is present,
2061 the type has the POINTER property where either the parent
2062 variable is never associated with a dynamic object or the
2063 implementation does not track whether the associated object
2064 is static or dynamic. If the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute is
2065 present and the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute is not, the type
2066 has the ALLOCATABLE property. If both attributes are present,
2067 then the type should be assumed to have the POINTER property
2068 (and not ALLOCATABLE); the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute may then
2069 be used to indicate that the association status of the object
2070 resulted from execution of an ALLOCATE statement rather than
2071 pointer assignment.}
2073 \textit{For examples using
2074 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} for \addtoindex{Ada} and
2075 \addtoindex{Fortran} 90
2077 see Appendix \refersec{app:aggregateexamples}.}
2081 \section{Template Alias Entries}
2082 \label{chap:templatealiasentries}
2084 A type named using a template alias is represented
2085 by a debugging information entry with the tag
2086 \livetarg{chap:DWTAGtemplatealias}{DW\-\_TAG\-\_template\-\_alias}.
2087 The template alias entry has a
2088 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
2089 containing the name of the template alias as it appears in
2090 the source program. The template alias entry also contains a
2091 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is a reference to the type
2092 named by the template alias. The template alias entry has
2093 the following child entries:
2095 \begin{enumerate}[1.]
2096 \item Each formal parameterized type declaration appearing
2097 in the template alias declaration is represented
2098 by a debugging information entry with the tag
2099 \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}.
2100 Each such entry may have
2101 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a null\dash terminated
2102 string containing the name of the formal type parameter as it
2103 appears in the source program. The template type parameter
2104 entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing the actual
2105 type by which the formal is replaced for this instantiation.
2107 \item Each formal parameterized value declaration
2108 appearing in the template alias declaration is
2109 represented by a debugging information entry with the tag
2110 \livelink{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}.
2111 Each such entry may have
2112 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a null\dash terminated
2113 string containing the name of the formal value parameter
2114 as it appears in the source program. The template value
2115 parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
2116 the type of the parameterized value. Finally, the template
2117 value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value}
2118 attribute, whose value is the actual constant value of the value parameter for
2119 this instantiation as represented on the target architecture.