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
20 \addtoindexx{fundamental type|see{base type entry}}
21 Each programming language has a set of base
22 types that are considered to be built into that language.}
24 A base type is represented by a debugging information entry
26 \livetarg{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}.
28 A \addtoindex{base type entry}
29 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is
30 a null\dash terminated string containing the name of the base type
31 as recognized by the programming language of the compilation
32 unit containing the base type entry.
35 \addtoindexx{encoding attribute}
36 a \livelink{chap:DWATencoding}{DW\-\_AT\-\_encoding} attribute describing
37 how the base type is encoded and is to be interpreted. The
38 value of this attribute is an integer constant. The set of
39 values and their meanings for the \livelink{chap:DWATencoding}{DW\-\_AT\-\_encoding} attribute
41 Figure \refersec{fig:encodingattributevalues}
45 may have a \livelink{chap:DWATendianity}{DW\-\_AT\-\_endianity} attribute
46 \addtoindexx{endianity attribute}
48 Section \refersec{chap:dataobjectentries}.
49 If omitted, the encoding assumes the representation that
50 is the default for the target architecture.
53 \hypertarget{chap:DWATbytesizedataobjectordatatypesize}
54 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute
55 \hypertarget{chap:DWATbitsizebasetypebitsize}
56 or a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
57 \addtoindex{bit size attribute}
58 whose integer constant value
59 (see Section \refersec{chap:byteandbitsizes})
60 is the amount of storage needed to hold
63 \textit{For example, the
64 \addtoindex{C} type int on a machine that uses 32\dash bit
65 integers is represented by a base type entry with a name
66 attribute whose value is “int”, an encoding attribute
67 whose value is \livelink{chap:DWATEsigned}{DW\-\_ATE\-\_signed}
68 and a byte size attribute whose value is 4.}
70 If the value of an object of the given type does not fully
71 occupy the storage described by a byte size attribute,
72 \hypertarget{chap:DWATdatabitoffsetbasetypebitlocation}
73 the base type entry may also have
74 \addtoindexx{bit size attribute}
76 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and a
77 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} attribute,
79 \addtoindexx{data bit offset attribute}
81 integer constant values (
82 see Section \refersec{chap:staticanddynamicvaluesofattributes}).
84 attribute describes the actual size in bits used to represent
85 values of the given type. The data bit offset attribute is the
86 offset in bits from the beginning of the containing storage to
87 the beginning of the value. Bits that are part of the offset
88 are padding. The data bit offset uses the bit numbering and
89 direction conventions that are appropriate to the current
91 target system to locate the beginning of the storage and
92 value. If this attribute is omitted a default data bit offset
96 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
98 \addtoindexx{bit offset attribute}
100 \addtoindexx{data bit offset attribute}
102 \addtoindex{DWARF Version 4} and
103 is also used for bit field members
104 (see Section \refersec{chap:datamemberentries}).
106 \hypertarget{chap:DWATbitoffsetbasetypebitlocation}
107 replaces the attribute
108 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
110 \addtoindexx{bit offset attribute (V3)}
111 types as defined in DWARF V3 and earlier. The earlier attribute
112 is defined in a manner suitable for bit field members on
113 big\dash endian architectures but which is wasteful for use on
114 little\dash endian architectures.}
116 \textit{The attribute \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} is
118 \addtoindex{DWARF Version 4}
119 for use in base types, but implementations may continue to
120 support its use for compatibility.}
123 \addtoindex{DWARF Version 3}
124 definition of these attributes is as follows.}
126 \begin{myindentpara}{1cm}
127 \textit{A base type entry has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
128 attribute, whose value
129 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
130 is the size in bytes of the storage unit
131 used to represent an object of the given type.}
133 \textit{If the value of an object of the given type does not fully
134 occupy the storage unit described by the byte size attribute,
135 the base type entry may have a
136 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
137 \addtoindexx{bit size attribute (V3)}
139 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} attribute, both of whose values
140 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
141 are integers. The bit size attribute describes the actual
142 size in bits used to represent a value of the given type.
143 The bit offset attribute describes the offset in bits of the
144 high order bit of a value of the given type from the high
145 order bit of the storage unit used to contain that value.}
150 \addtoindexx{DWARF Version 3}
152 \addtoindexx{DWARF Version 4} and
153 4, note that DWARF V4
154 defines the following combinations of attributes:}
157 \item \textit{DW\-\_AT\-\_byte\-\_size}
158 \item \textit{DW\-\_AT\-\_bit\-\_size}
159 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
160 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
161 and optionally \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}}
164 \addtoindexx{DWARF Version 3}
165 defines the following combinations:
166 % FIXME: the figure below interferes with the following
167 % bullet list, which looks horrible as a result.
169 \item \textit{DW\-\_AT\-\_byte\-\_size}
170 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
171 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
172 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}}
175 \begin{figure}[!here]
177 \begin{tabular}{lp{9cm}}
178 Name&Meaning\\ \hline
179 \livetarg{chap:DWATEaddress}{DW\-\_ATE\-\_address} & linear machine address (for
180 segmented addresses see
181 Section \refersec{chap:segmentedaddresses}) \\
182 \livetarg{chap:DWATEboolean}{DW\-\_ATE\-\_boolean}& true or false \\
184 \livetarg{chap:DWATEcomplexfloat}{DW\-\_ATE\-\_complex\-\_float}& complex binary
185 floating\dash point number \\
186 \livetarg{chap:DWATEfloat}{DW\-\_ATE\-\_float} & binary floating\dash point number \\
187 \livetarg{chap:DWATEimaginaryfloat}{DW\-\_ATE\-\_imaginary\-\_float}& imaginary binary
188 floating\dash point number \\
189 \livetarg{chap:DWATEsigned}{DW\-\_ATE\-\_signed}& signed binary integer \\
190 \livetarg{chap:DWATEsignedchar}{DW\-\_ATE\-\_signed\-\_char}& signed character \\
191 \livetarg{chap:DWATEunsigned}{DW\-\_ATE\-\_unsigned} & unsigned binary integer \\
192 \livetarg{chap:DWATEunsignedchar}{DW\-\_ATE\-\_unsigned\-\_char} & unsigned character \\
193 \livetarg{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} & packed decimal \\
194 \livetarg{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string}& numeric string \\
195 \livetarg{chap:DWATEedited}{DW\-\_ATE\-\_edited} & edited string \\
196 \livetarg{chap:DWATEsignedfixed}{DW\-\_ATE\-\_signed\-\_fixed} & signed fixed\dash point scaled integer \\
197 \livetarg{chap:DWATEunsignedfixed}{DW\-\_ATE\-\_unsigned\-\_fixed}& unsigned fixed\dash point scaled integer \\
198 \livetarg{chap:DWATEdecimalfloat}{DW\-\_ATE\-\_decimal\-\_float} & decimal floating\dash point number \\
199 \livetarg{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} & Unicode character \\
201 \caption{Encoding attribute values}
202 \label{fig:encodingattributevalues}
205 \textit{The \livelink{chap:DWATEdecimalfloat}{DW\-\_ATE\-\_decimal\-\_float} encoding is intended for
206 floating\dash point representations that have a power\dash of\dash ten
207 exponent, such as that specified in IEEE 754R.}
209 \textit{The \livelink{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} encoding is intended for Unicode string
210 encodings (see the Universal Character Set standard,
211 ISO/IEC 10646\dash 1:1993). For example, the
212 \addtoindex{C++} type char16\_t is
213 represented by a base type entry with a name attribute whose
214 value is “char16\_t”, an encoding attribute whose value
215 is \livelink{chap:DWATEUTF}{DW\-\_ATE\-\_UTF} and a byte size attribute whose value is 2.}
218 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal}
220 \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string}
222 represent packed and unpacked decimal string numeric data
223 types, respectively, either of which may be
225 \addtoindexx{decimal scale attribute}
227 \addtoindexx{decimal sign attribute}
229 \addtoindexx{digit count attribute}
231 \hypertarget{chap:DWATdecimalsigndecimalsignrepresentation}
233 \hypertarget{chap:DWATdigitcountdigitcountforpackeddecimalornumericstringtype}
234 base types are used in combination with
235 \livelink{chap:DWATdecimalsign}{DW\-\_AT\-\_decimal\-\_sign},
236 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and
237 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale}
240 A \livelink{chap:DWATdecimalsign}{DW\-\_AT\-\_decimal\-\_sign} attribute
241 \addtoindexx{decimal sign attribute}
242 is an integer constant that
243 conveys the representation of the sign of the decimal type
244 (see Figure \refersec{fig:decimalsignattributevalues}).
245 Its integer constant value is interpreted to
246 mean that the type has a leading overpunch, trailing overpunch,
247 leading separate or trailing separate sign representation or,
248 alternatively, no sign at all.
251 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count}
253 \addtoindexx{digit count attribute}
254 is an integer constant
255 value that represents the number of digits in an instance of
258 \hypertarget{chap:DWATdecimalscaledecimalscalefactor}
259 The \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale}
261 \addtoindexx{decimal scale attribute}
262 is an integer constant value
263 that represents the exponent of the base ten scale factor to
264 be applied to an instance of the type. A scale of zero puts the
265 decimal point immediately to the right of the least significant
266 digit. Positive scale moves the decimal point to the right
267 and implies that additional zero digits on the right are not
268 stored in an instance of the type. Negative scale moves the
269 decimal point to the left; if the absolute value of the scale
270 is larger than the digit count, this implies additional zero
271 digits on the left are not stored in an instance of the type.
273 The \livelink{chap:DWATEedited}{DW\-\_ATE\-\_edited}
275 \hypertarget{chap:DWATpicturestringpicturestringfornumericstringtype}
276 type is used to represent an edited
277 numeric or alphanumeric data type. It is used in combination
278 with an \livelink{chap:DWATpicturestring}{DW\-\_AT\-\_picture\-\_string} attribute whose value is a
279 null\dash terminated string containing the target\dash dependent picture
280 string associated with the type.
282 If the edited base type entry describes an edited numeric
283 data type, the edited type entry has a \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and a
284 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attribute.
285 \addtoindexx{decimal scale attribute}
286 These attributes have the same
287 interpretation as described for the
288 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} and
289 \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base
290 types. If the edited type entry
291 describes an edited alphanumeric data type, the edited type
292 entry does not have these attributes.
295 \textit{The presence or absence of the \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count} and
296 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attributes
297 \addtoindexx{decimal scale attribute}
298 allows a debugger to easily
299 distinguish edited numeric from edited alphanumeric, although
300 in principle the digit count and scale are derivable by
301 interpreting the picture string.}
303 The \livelink{chap:DWATEsignedfixed}{DW\-\_ATE\-\_signed\-\_fixed} and \livelink{chap:DWATEunsignedfixed}{DW\-\_ATE\-\_unsigned\-\_fixed} entries
304 describe signed and unsigned fixed\dash point binary data types,
307 The fixed binary type entries have
308 \addtoindexx{digit count attribute}
310 \livelink{chap:DWATdigitcount}{DW\-\_AT\-\_digit\-\_count}
311 attribute with the same interpretation as described for the
312 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal} and \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base types.
314 For a data type with a decimal scale factor, the fixed binary
316 \livelink{chap:DWATdecimalscale}{DW\-\_AT\-\_decimal\-\_scale} attribute
317 \addtoindexx{decimal scale attribute}
319 interpretation as described for the
320 \livelink{chap:DWATEpackeddecimal}{DW\-\_ATE\-\_packed\-\_decimal}
321 and \livelink{chap:DWATEnumericstring}{DW\-\_ATE\-\_numeric\-\_string} base types.
323 \hypertarget{chap:DWATbinaryscalebinaryscalefactorforfixedpointtype}
324 For a data type with a binary scale factor, the fixed
325 \addtoindexx{binary scale attribute}
326 binary type entry has a
327 \livelink{chap:DWATbinaryscale}{DW\-\_AT\-\_binary\-\_scale} attribute.
329 \livelink{chap:DWATbinaryscale}{DW\-\_AT\-\_binary\-\_scale} attribute
330 is an integer constant value
331 that represents the exponent of the base two scale factor to
332 be applied to an instance of the type. Zero scale puts the
333 binary point immediately to the right of the least significant
334 bit. Positive scale moves the binary point to the right and
335 implies that additional zero bits on the right are not stored
336 in an instance of the type. Negative scale moves the binary
337 point to the left; if the absolute value of the scale is
338 larger than the number of bits, this implies additional zero
339 bits on the left are not stored in an instance of the type.
342 \hypertarget{chap:DWATsmallscalefactorforfixedpointtype}
343 a data type with a non\dash decimal and non\dash binary scale factor,
344 the fixed binary type entry has a
345 \livelink{chap:DWATsmall}{DW\-\_AT\-\_small} attribute which
347 \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} entry. The scale factor value
348 is interpreted in accordance with the value defined by the
349 \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} entry. The value represented is the product
350 of the integer value in memory and the associated constant
353 \textit{The \livelink{chap:DWATsmall}{DW\-\_AT\-\_small} attribute
354 is defined with the \addtoindex{Ada} small
359 \begin{tabular}{lp{9cm}}
360 Name&Meaning\\ \hline
361 \livetarg{chap:DWDSunsigned}{DW\-\_DS\-\_unsigned} & unsigned \\
362 \livetarg{chap:DWDSleadingoverpunch}{DW\-\_DS\-\_leading\-\_overpunch} & Sign
363 is encoded in the most significant digit in a target\dash dependent manner \\
364 \livetarg{chap:DWDStrailingoverpunch}{DW\-\_DS\-\_trailing\-\_overpunch} & Sign
365 is encoded in the least significant digit in a target\dash dependent manner \\
366 \livetarg{chap:DWDSleadingseparate}{DW\-\_DS\-\_leading\-\_separate}
367 & Decimal type: Sign is a ``+'' or ``-'' character
368 to the left of the most significant digit. \\
369 \livetarg{chap:DWDStrailingseparate}{DW\-\_DS\-\_trailing\-\_separate}
370 & Decimal type: Sign is a ``+'' or ``-'' character
371 to the right of the least significant digit. \\
372 &Packed decimal type: Least significant nibble contains
373 a target\dash dependent value
374 indicating positive or negative. \\
376 \caption{Decimal sign attribute values}
377 \label{fig:decimalsignattributevalues}
380 \section{Unspecified Type Entries}
381 \label{chap:unspecifiedtypeentries}
382 \addtoindexx{unspecified type entry}
383 \addtoindexx{void type|see{unspecified type entry}}
384 Some languages have constructs in which a type
385 may be left unspecified or the absence of a type
386 may be explicitly indicated.
388 An unspecified (implicit, unknown, ambiguous or nonexistent)
389 type is represented by a debugging information entry with
390 the tag \livetarg{chap:DWTAGunspecifiedtype}{DW\-\_TAG\-\_unspecified\-\_type}.
391 If a name has been given
392 to the type, then the corresponding unspecified type entry
393 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is
394 a null\dash terminated
395 string containing the name as it appears in the source program.
397 The interpretation of this debugging information entry is
398 intentionally left flexible to allow it to be interpreted
399 appropriately in different languages. For example, in
400 \addtoindex{C} and \addtoindex{C++}
401 the language implementation can provide an unspecified type
402 entry with the name “void” which can be referenced by the
403 type attribute of pointer types and typedef declarations for
405 % FIXME: the following reference was wrong in DW4 so DavidA guessed
407 Sections \refersec{chap:unspecifiedtypeentries} and
408 %The following reference was valid, so the following is probably correct.
409 Section \refersec{chap:typedefentries},
410 respectively). As another
411 example, in \addtoindex{Ada} such an unspecified type entry can be referred
412 to by the type attribute of an access type where the denoted
413 type is incomplete (the name is declared as a type but the
414 definition is deferred to a separate compilation unit).
416 \section{Type Modifier Entries}
417 \label{chap:typemodifierentries}
418 \addtoindexx{type modifier entry}
420 A base or user\dash defined type may be modified in different ways
421 in different languages. A type modifier is represented in
422 DWARF by a debugging information entry with one of the tags
424 Figure \refersec{fig:typemodifiertags}.
426 If a name has been given to the modified type in the source
427 program, then the corresponding modified type entry has
428 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null-terminated
429 string containing the modified type name as it appears in
432 Each of the type modifier entries has a
433 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute,
434 whose value is a reference to a debugging information entry
435 describing a base type, a user-defined type or another type
438 A modified type entry describing a pointer or reference
439 type (using \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type},
440 \livelink{chap:DWTAGreferencetype}{DW\-\_TAG\-\_reference\-\_type} or
441 \livelink{chap:DWTAGrvaluereferencetype}{DW\-\_TAG\-\_rvalue\-\_reference\-\_type})
442 % Another instance of no-good-place-to-put-index entry.
444 \addtoindexx{address class!attribute}
446 \hypertarget{chap:DWATadressclasspointerorreferencetypes}
448 \livelink{chap:DWATaddressclass}{DW\-\_AT\-\_address\-\_class}
449 attribute to describe how objects having the given pointer
450 or reference type ought to be dereferenced.
452 A modified type entry describing a shared qualified type
453 (using \livelink{chap:DWTAGsharedtype}{DW\-\_TAG\-\_shared\-\_type}) may have a
454 \livelink{chap:DWATcount}{DW\-\_AT\-\_count} attribute
455 \addtoindexx{count attribute}
456 whose value is a constant expressing the blocksize of the
457 type. If no count attribute is present, then the “infinite”
458 blocksize is assumed.
460 When multiple type modifiers are chained together to modify
461 a base or user-defined type, the tree ordering reflects the
462 semantics of the applicable lanuage rather than the textual
463 order in the source presentation.
467 \begin{tabular}{lp{9cm}}
468 Name&Meaning\\ \hline
469 \livetarg{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} & C or C++ const qualified type
470 \addtoindexx{const qualified type entry} \addtoindexx{C} \addtoindexx{C++} \\
471 \livetarg{chap:DWTAGpackedtype}{DW\-\_TAG\-\_packed\-\_type}& Pascal or Ada packed type
472 \addtoindexx{packed qualified type entry} \addtoindexx{Ada} \addtoindexx{Pascal} \\
473 \livetarg{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} & Pointer to an object of
474 the type being modified \addtoindexx{pointer qualified type entry} \\
475 \livetarg{chap:DWTAGreferencetype}{DW\-\_TAG\-\_reference\-\_type}& C++ (lvalue) reference
476 to an object of the type
477 being modified \addtoindexx{reference qualified type entry} \\
478 \livetarg{chap:DWTAGrestricttype}{DW\-\_TAG\-\_restrict\-\_type}&C restrict qualified type
479 \addtoindexx{restricted qualified type entry} \\
480 \livetarg{chap:DWTAGrvaluereferencetype}{DW\-\_TAG\-\_rvalue\-\_reference\-\_type} & C++
481 rvalue reference to an object of the type being modified
482 \addtoindexx{rvalue reference qualified type entry} \\
483 \livetarg{chap:DWTAGsharedtype}{DW\-\_TAG\-\_shared\-\_type}&UPC shared qualified type
484 \addtoindexx{shared qualified type entry} \\
485 \livetarg{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type}&C or C++ volatile qualified type
486 \addtoindex{volatile qualified type entry} \\
488 \caption{Type modifier tags}
489 \label{fig:typemodifiertags}
492 %The following clearpage prevents splitting the example across pages.
494 \textit{As examples of how type modifiers are ordered, take the following C
498 const unsigned char * volatile p;
499 which represents a volatile pointer to a constant
500 character. This is encoded in DWARF as:
501 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}(p) -->
502 \livelink{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type} -->
503 \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} -->
504 \livelink{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} -->
505 \livelink{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}(unsigned char)
507 volatile unsigned char * const restrict p;
508 on the other hand, represents a restricted constant
509 pointer to a volatile character. This is encoded as:
510 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}(p) -->
511 \livelink{chap:DWTAGrestricttype}{DW\-\_TAG\-\_restrict\-\_type} -->
512 \livelink{chap:DWTAGconsttype}{DW\-\_TAG\-\_const\-\_type} -->
513 \livelink{chap:DWTAGpointertype}{DW\-\_TAG\-\_pointer\-\_type} -->
514 \livelink{chap:DWTAGvolatiletype}{DW\-\_TAG\-\_volatile\-\_type} -->
515 \livelink{chap:DWTAGbasetype}{DW\-\_TAG\-\_base\-\_type}(unsigned char)
519 \section{Typedef Entries}
520 \label{chap:typedefentries}
521 A named type that is defined in terms of another type
522 definition is represented by a debugging information entry with
523 the tag \livetarg{chap:DWTAGtypedef}{DW\-\_TAG\-\_typedef}.
524 The typedef entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
525 attribute whose value is a null-terminated string containing
526 the name of the typedef as it appears in the source program.
528 The typedef entry may also contain a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose
529 value is a reference to the type named by the typedef. If
530 the debugging information entry for a typedef represents
531 a declaration of the type that is not also a definition,
532 it does not contain a type attribute.
534 \textit{Depending on the language, a named type that is defined in
535 terms of another type may be called a type alias, a subtype,
536 a constrained type and other terms. A type name declared with
537 no defining details may be termed an incomplete, forward
538 or hidden type. While the DWARF \livelink{chap:DWTAGtypedef}{DW\-\_TAG\-\_typedef} entry was
539 originally inspired by the like named construct in
540 \addtoindex{C} and \addtoindex{C++},
541 it is broadly suitable for similar constructs (by whatever
542 source syntax) in other languages.}
544 \section{Array Type Entries}
545 \label{chap:arraytypeentries}
547 Many languages share the concept of an ``array,'' which is
548 \addtoindexx{array type entry}
549 a table of components of identical type.
551 An array type is represented by a debugging information entry
552 with the tag \livetarg{chap:DWTAGarraytype}{DW\-\_TAG\-\_array\-\_type}.
555 \addtoindexx{array!declaration of type}
556 the array type in the source program, then the corresponding
557 array type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a
558 null-terminated string containing the array type name as it
559 appears in the source program.
562 \hypertarget{chap:DWATorderingarrayrowcolumnordering}
563 array type entry describing a multidimensional array may
564 \addtoindexx{array!element ordering}
565 have a \livelink{chap:DWATordering}{DW\-\_AT\-\_ordering} attribute whose integer constant value is
566 interpreted to mean either row-major or column-major ordering
567 of array elements. The set of values and their meanings
568 for the ordering attribute are listed in
569 Figure \refersec{fig:arrayordering}.
571 ordering attribute is present, the default ordering for the
572 source language (which is indicated by the \livelink{chap:DWATlanguage}{DW\-\_AT\-\_language}
573 attribute of the enclosing compilation unit entry) is assumed.
576 \autorows[0pt]{c}{1}{l}{
577 \livetarg{chap:DWORDcolmajor}{DW\-\_ORD\-\_col\-\_major},
578 \livetarg{chap:DWORDrowmajor}{DW\-\_ORD\-\_row\-\_major}
580 \caption{Array ordering}\label{fig:arrayordering}
583 The ordering attribute may optionally appear on one-dimensional
584 arrays; it will be ignored.
586 An array type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
587 \addtoindexx{array!element type}
589 the type of each element of the array.
591 If the amount of storage allocated to hold each element of an
592 object of the given array type is different from the amount
593 of storage that is normally allocated to hold an individual
594 \hypertarget{chap:DWATbitstridearrayelementstrideofarraytype}
596 \hypertarget{chap:DWATbytestridearrayelementstrideofarraytype}
597 indicated element type, then the array type
598 \addtoindexx{bit stride attribute}
600 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
602 \addtoindexx{byte stride attribute}
603 a \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride}
605 \addtoindexx{bit stride attribute}
607 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
609 element of the array.
611 The array type entry may have either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a
612 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
613 (see Section \refersec{chap:byteandbitsizes}),
615 amount of storage needed to hold an instance of the array type.
617 \textit{If the size of the array can be determined statically at
618 compile time, this value can usually be computed by multiplying
619 the number of array elements by the size of each element.}
622 Each array dimension is described by a debugging information
623 entry with either the tag \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} or the
624 \addtoindexx{enumeration type entry!as array dimension}
626 \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}. These entries are
628 array type entry and are ordered to reflect the appearance of
629 the dimensions in the source program (i.e., leftmost dimension
630 first, next to leftmost second, and so on).
632 In languages, such as C, in which there is no concept of
633 a “multidimensional array”, an array of arrays may
634 be represented by a debugging information entry for a
635 multidimensional array.
637 Other attributes especially applicable to arrays are
638 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated},
639 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} and
640 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location},
641 which are described in
642 Section \refersec{chap:dynamictypeproperties}.
643 For relevant examples,
645 Appendix \refersec{app:fortran90example}.
647 \section{ Structure, Union, Class and Interface Type Entries}
648 \label{chap:structureunionclassandinterfacetypeentries}
650 \textit{The languages
652 \addtoindex{C++}, and
653 \addtoindex{Pascal}, among others, allow the
654 programmer to define types that are collections of related
655 components. In \addtoindex{C} and \addtoindex{C++}, these collections are called
656 “structures.” In \addtoindex{Pascal}, they are called “records.”
657 The components may be of different types. The components are
658 called “members” in \addtoindex{C} and
659 \addtoindex{C++}, and “fields” in \addtoindex{Pascal}.}
661 \textit{The components of these collections each exist in their
662 own space in computer memory. The components of a C or C++
663 “union” all coexist in the same memory.}
665 \textit{\addtoindex{Pascal} and
666 other languages have a “discriminated union,”
667 \addtoindex{discriminated union|see {variant entry}}
668 also called a “variant record.” Here, selection of a
669 number of alternative substructures (“variants”) is based
670 on the value of a component that is not part of any of those
671 substructures (the “discriminant”).}
673 \textit{\addtoindex{C++} and
674 \addtoindex{Java} have the notion of ``class'', which is in some
675 ways similar to a structure. A class may have “member
676 functions” which are subroutines that are within the scope
677 of a class or structure.}
679 \textit{The \addtoindex{C++} notion of
680 structure is more general than in \addtoindex{C}, being
681 equivalent to a class with minor differences. Accordingly,
682 in the following discussion statements about
683 \addtoindex{C++} classes may
684 be understood to apply to \addtoindex{C++} structures as well.}
686 \subsection{Structure, Union and Class Type Entries}
687 \label{chap:structureunionandclasstypeentries}
690 Structure, union, and class types are represented by debugging
691 information entries with
692 the tags \livetarg{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type},
693 \livetarg{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type},
694 and \livetarg{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
695 respectively. If a name has been given to the structure,
696 union, or class in the source program, then the corresponding
697 structure type, union type, or class type entry has a
698 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
699 containing the type name as it appears in the source program.
701 The members of a structure, union, or class are represented
702 by debugging information entries that are owned by the
703 corresponding structure type, union type, or class type entry
704 and appear in the same order as the corresponding declarations
705 in the source program.
707 A structure type, union type or class type entry may have
708 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or a
709 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
710 \hypertarget{chap:DWATbitsizedatamemberbitsize}
711 (see Section \refersec{chap:byteandbitsizes}),
712 whose value is the amount of storage needed
713 to hold an instance of the structure, union or class type,
714 including any padding. An incomplete structure, union or
715 class type is represented by a structure, union or class
716 entry that does not have a byte size attribute and that has
717 \addtoindexx{declaration attribute}
718 a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
720 If the complete declaration of a type has been placed in
721 \hypertarget{chap:DWATsignaturetypesignature}
723 (see Section \refersec{chap:separatetypeunitentries}),
725 declaration of that type in the compilation unit may provide
726 the unique 64\dash bit signature of the type using a \livelink{chap:DWATsignature}{DW\-\_AT\-\_signature}
729 If a structure, union or class entry represents the definition
730 of a structure, class or union member corresponding to a prior
731 incomplete structure, class or union, the entry may have a
732 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute whose value is a reference to
733 the debugging information entry representing that incomplete
736 Structure, union and class entries containing the
737 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute do not need to duplicate
738 information provided by the declaration entry referenced by the
739 specification attribute. In particular, such entries do not
740 need to contain an attribute for the name of the structure,
741 class or union they represent if such information is already
742 provided in the declaration.
744 \textit{For \addtoindex{C} and \addtoindex{C++},
746 \addtoindexx{data member|see {member entry (data)}}
747 member declarations occurring within
748 the declaration of a structure, union or class type are
749 considered to be “definitions” of those members, with
750 the exception of “static” data members, whose definitions
751 appear outside of the declaration of the enclosing structure,
752 union or class type. Function member declarations appearing
753 within a structure, union or class type declaration are
754 definitions only if the body of the function also appears
755 within the type declaration.}
757 If the definition for a given member of the structure, union
758 or class does not appear within the body of the declaration,
759 that member also has a debugging information entry describing
760 its definition. That latter entry has a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
761 attribute referencing the debugging information entry
762 owned by the body of the structure, union or class entry and
763 representing a non\dash defining declaration of the data, function
764 or type member. The referenced entry will not have information
765 about the location of that member (low and high pc attributes
766 for function members, location descriptions for data members)
767 and will have a \livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration} attribute.
769 \textit{Consider a nested class whose
770 definition occurs outside of the containing class definition, as in:}
779 \textit{The two different structs can be described in
780 different compilation units to
781 facilitate DWARF space compression
782 (see Appendix \refersec{app:usingcompilationunits}).}
784 \subsection{Interface Type Entries}
785 \label{chap:interfacetypeentries}
787 \textit{The \addtoindex{Java} language defines ``interface'' types.
789 in Java is similar to a \addtoindex{C++} or
790 \addtoindex{Java} class with only abstract
791 methods and constant data members.}
793 Interface types are represented by debugging information
795 tag \livetarg{chap:DWTAGinterfacetype}{DW\-\_TAG\-\_interface\-\_type}.
797 An interface type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
798 value is a null-terminated string containing the type name
799 as it appears in the source program.
801 The members of an interface are represented by debugging
802 information entries that are owned by the interface type
803 entry and that appear in the same order as the corresponding
804 declarations in the source program.
806 \subsection{Derived or Extended Structs, Classes and Interfaces}
807 \label{chap:derivedorextendedstructsclasesandinterfaces}
809 \textit{In \addtoindex{C++}, a class (or struct)
811 \addtoindexx{derived type (C++)|see{inheritance entry}}
812 be ``derived from'' or be a
813 ``subclass of'' another class. In Java, an interface may ``extend''
814 \addtoindexx{extended type (Java)|see{inheritance entry}}
815 one or more other interfaces, and a class may ``extend'' another
816 class and/or ``implement'' one or more interfaces. All of these
817 relationships may be described using the following. Note that
818 in Java, the distinction between extends and implements is
819 implied by the entities at the two ends of the relationship.}
821 A class type or interface type entry that describes a
822 derived, extended or implementing class or interface owns
823 debugging information entries describing each of the classes
824 or interfaces it is derived from, extending or implementing,
825 respectively, ordered as they were in the source program. Each
827 tag \livetarg{chap:DWTAGinheritance}{DW\-\_TAG\-\_inheritance}.
829 An inheritance entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is
830 a reference to the debugging information entry describing the
831 class or interface from which the parent class or structure
832 of the inheritance entry is derived, extended or implementing.
834 An inheritance entry for a class that derives from or extends
835 \hypertarget{chap:DWATdatamemberlocationinheritedmemberlocation}
836 another class or struct also has
837 \addtoindexx{data member location attribute}
839 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
840 attribute, whose value describes the location of the beginning
841 of the inherited type relative to the beginning address of the
842 derived class. If that value is a constant, it is the offset
843 in bytes from the beginning of the class to the beginning of
844 the inherited type. Otherwise, the value must be a location
845 description. In this latter case, the beginning address of
846 the derived class is pushed on the expression stack before
847 the location description is evaluated and the result of the
848 evaluation is the location of the inherited type.
850 \textit{The interpretation of the value of this attribute for
851 inherited types is the same as the interpretation for data
853 (see Section \refersec{chap:datamemberentries}). }
856 \hypertarget{chap:DWATaccessibilitycppinheritedmembers}
858 \addtoindexx{accessibility attribute}
860 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
861 attribute. If no accessibility attribute
862 is present, private access is assumed for an entry of a class
863 and public access is assumed for an entry of an interface,
867 \hypertarget{chap:DWATvirtualityvirtualityofbaseclass}
868 the class referenced by the inheritance entry serves
869 as a \addtoindex{C++} virtual base class, the inheritance entry has a
870 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
872 \textit{For a \addtoindex{C++} virtual base, the
873 \addtoindex{data member location attribute}
874 will usually consist of a non-trivial location description.}
876 \subsection{Access Declarations}
877 \label{chap:accessdeclarations}
879 \textit{In \addtoindex{C++}, a derived class may contain access declarations that
880 \addtoindex{access declaration entry}
881 change the accessibility of individual class members from the
882 overall accessibility specified by the inheritance declaration.
883 A single access declaration may refer to a set of overloaded
886 If a derived class or structure contains access declarations,
887 each such declaration may be represented by a debugging
888 information entry with the tag
889 \livetarg{chap:DWTAGaccessdeclaration}{DW\-\_TAG\-\_access\-\_declaration}.
891 such entry is a child of the class or structure type entry.
893 An access declaration entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
894 value is a null-terminated string representing the name used
895 in the declaration in the source program, including any class
896 or structure qualifiers.
898 An access declaration entry
899 \hypertarget{chap:DWATaccessibilitycppbaseclasses}
902 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
903 attribute describing the declared accessibility of the named
911 \addtoindexx{friend entry}
912 declared by a structure, union or class
913 \hypertarget{chap:DWATfriendfriendrelationship}
914 type may be represented by a debugging information entry
915 that is a child of the structure, union or class type entry;
916 the friend entry has the
917 tag \livetarg{chap:DWTAGfriend}{DW\-\_TAG\-\_friend}.
920 \addtoindexx{friend attribute}
921 a \livelink{chap:DWATfriend}{DW\-\_AT\-\_friend} attribute, whose value is
922 a reference to the debugging information entry describing
923 the declaration of the friend.
926 \subsection{Data Member Entries}
927 \label{chap:datamemberentries}
929 A data member (as opposed to a member function) is
930 represented by a debugging information entry with the
931 tag \livetarg{chap:DWTAGmember}{DW\-\_TAG\-\_member}.
932 The member entry for a named member has
933 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null-terminated
934 string containing the member name as it appears in the source
935 program. If the member entry describes an
936 \addtoindex{anonymous union},
938 name attribute is omitted or consists of a single zero byte.
940 The data member entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote
941 the type of that member.
943 A data member entry may
944 \addtoindexx{accessibility attribute}
946 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
947 attribute. If no accessibility attribute is present, private
948 access is assumed for an entry of a class and public access
949 is assumed for an entry of a structure, union, or interface.
952 \hypertarget{chap:DWATmutablemutablepropertyofmemberdata}
953 entry may have a \livelink{chap:DWATmutable}{DW\-\_AT\-\_mutable} attribute,
954 which is a \livelink{chap:flag}{flag}.
955 This attribute indicates whether the data
956 member was declared with the mutable storage class specifier.
958 The beginning of a data member
959 \addtoindex{beginning of a data member}
960 is described relative to
961 \addtoindexx{beginning of an object}
962 the beginning of the object in which it is immediately
963 contained. In general, the beginning is characterized by
964 both an address and a bit offset within the byte at that
965 address. When the storage for an entity includes all of
966 the bits in the beginning byte, the beginning bit offset is
969 Bit offsets in DWARF use the bit numbering and direction
970 conventions that are appropriate to the current language on
973 The member entry corresponding to a data member that is
974 \hypertarget{chap:DWATdatabitoffsetdatamemberbitlocation}
976 \hypertarget{chap:DWATdatamemberlocationdatamemberlocation}
977 in a structure, union or class may have either
978 \addtoindexx{data member location attribute}
980 \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute or a
981 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
982 attribute. If the beginning of the data member is the same as
983 the beginning of the containing entity then neither attribute
986 For a \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location} attribute
988 \addtoindexx{data member location attribute}
991 \begin{enumerate}[1.]
993 \item If the value is an integer constant, it is the offset
994 in bytes from the beginning of the containing entity. If
995 the beginning of the containing entity has a non-zero bit
996 offset then the beginning of the member entry has that same
999 \item Otherwise, the value must be a location description. In
1000 this case, the beginning of the containing entity must be byte
1001 aligned. The beginning address is pushed on the DWARF stack
1002 before the location description is evaluated; the result of
1003 the evaluation is the base address of the member entry.
1005 \textit{The push on the DWARF expression stack of the base address of
1006 the containing construct is equivalent to execution of the
1007 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} operation
1008 (see Section \refersec{chap:stackoperations});
1009 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address} therefore
1010 is not needed at the
1011 beginning of a location description for a data member. The
1012 result of the evaluation is a location--either an address or
1013 the name of a register, not an offset to the member.}
1015 \textit{A \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1017 \addtoindexx{data member location attribute}
1018 that has the form of a
1019 location description is not valid for a data member contained
1020 in an entity that is not byte aligned because DWARF operations
1021 do not allow for manipulating or computing bit offsets.}
1025 For a \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} attribute,
1026 the value is an integer constant
1027 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1028 that specifies the number of bits
1029 from the beginning of the containing entity to the beginning
1030 of the data member. This value must be greater than or equal
1031 to zero, but is not limited to less than the number of bits
1034 If the size of a data member is not the same as the size
1035 of the type given for the data member, the data member has
1036 \addtoindexx{bit size attribute}
1037 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1038 or a \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute whose
1039 integer constant value
1040 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1042 of storage needed to hold the value of the data member.
1044 \textit{\addtoindex{C} and \addtoindex{C++}
1046 \addtoindex{bit fields}
1048 \addtoindexx{data bit offset}
1050 \addtoindexx{data bit size}
1052 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset} and
1053 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attributes.}
1055 \textit{This Standard uses the following bit numbering and direction
1056 conventions in examples. These conventions are for illustrative
1057 purposes and other conventions may apply on particular
1062 \item \textit{For big\dash endian architectures, bit offsets are
1063 counted from high-order to low\dash order bits within a byte (or
1064 larger storage unit); in this case, the bit offset identifies
1065 the high\dash order bit of the object.}
1067 \item \textit{For little\dash endian architectures, bit offsets are
1068 counted from low\dash order to high\dash order bits within a byte (or
1069 larger storage unit); in this case, the bit offset identifies
1070 the low\dash order bit of the object.}
1074 \textit{In either case, the bit so identified is defined as the
1075 \addtoindexx{beginning of an object}
1076 beginning of the object.}
1078 \textit{For example, take one possible representation of the following
1079 \addtoindex{C} structure definition
1080 in both big\dash and little\dash endian byte orders:}
1091 \textit{The following diagrams show the structure layout
1092 and data bit offsets for example big\dash\ and little\dash endian
1093 architectures, respectively. Both diagrams show a structure
1094 that begins at address A and whose size is four bytes. Also,
1095 high order bits are to the left and low order bits are to
1098 \textit{Big\dash Endian Data Bit Offsets:}
1106 Addresses increase ->
1107 | A | A + 1 | A + 2 | A + 3 |
1109 Data bit offsets increase ->
1110 +---------------+---------------+---------------+---------------+
1111 |0 4|5 10|11 15|16 23|24 31|
1112 | j | k | m | n | <pad> |
1114 +---------------------------------------------------------------+
1117 \textit{Little\dash Endian Data Bit Offsets:}
1123 <- Addresses increase
1124 | A | A + 1 | A + 2 | A + 3 |
1126 <- Data bit offsets increase
1128 +---------------+---------------+---------------+---------------+
1129 |31 24|23 16|15 11|10 5|4 0|
1130 | <pad> | n | m | k | j |
1132 +---------------------------------------------------------------+
1136 \textit{Note that data member bit offsets in this example are the
1137 same for both big\dash\ and little\dash endian architectures even
1138 though the fields are allocated in different directions
1139 (high\dash order to low-order versus low\dash order to high\dash order);
1140 the bit naming conventions for memory and/or registers of
1141 the target architecture may or may not make this seem natural.}
1143 \textit{For a more extensive example showing nested and packed records
1145 Appendix \refersec{app:pascalexample}.}
1147 \textit{Attribute \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1149 \addtoindex{DWARF Version 4}
1150 and is also used for base types
1152 \refersec{chap:basetypeentries}).
1154 \livetarg{chap:DWATbitoffsetdatamemberbitlocation}
1155 attributes \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} and
1156 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} when used to
1157 identify the beginning of bit field data members as defined
1158 in DWARF V3 and earlier. The earlier attributes are defined
1159 in a manner suitable for bit field members on big-endian
1160 architectures but which is either awkward or incomplete for
1161 use on little-endian architectures.
1162 (\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} also
1163 has other uses that are not affected by this change.)}
1165 \textit{The \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1166 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1167 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1168 attribute combination is deprecated for data members in DWARF
1169 Version 4, but implementations may continue to support this
1170 use for compatibility.}
1173 \addtoindex{DWARF Version 3}
1174 definitions of these attributes are
1177 \begin{myindentpara}{1cm}
1178 \textit{If the data member entry describes a bit field, then that
1179 entry has the following attributes:}
1182 \item \textit{A \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1183 attribute whose value
1184 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1185 is the number of bytes that contain an instance of the
1186 bit field and any padding bits.}
1188 \textit{The byte size attribute may be omitted if the size of the
1189 object containing the bit field can be inferred from the type
1190 attribute of the data member containing the bit field.}
1192 \item \textit{A \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1194 \addtoindexx{bit offset attribute (V3)}
1196 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1197 is the number of bits to the left of the leftmost
1198 (most significant) bit of the bit field value.}
1200 \item \textit{A \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1202 \addtoindexx{bit size attribute (V3)}
1204 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1205 is the number of bits occupied by the bit field value.}
1209 \textit{The location description for a bit field calculates the address
1210 of an anonymous object containing the bit field. The address
1211 is relative to the structure, union, or class that most closely
1212 encloses the bit field declaration. The number of bytes in this
1213 anonymous object is the value of the byte size attribute of
1214 the bit field. The offset (in bits) from the most significant
1215 bit of the anonymous object to the most significant bit of
1216 the bit field is the value of the bit offset attribute.}
1220 \textit{Diagrams similar to the above that show the use of the
1221 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1222 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1223 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset} attribute
1224 combination may be found in the
1225 \addtoindex{DWARF Version 3} Standard.}
1227 \textit{In comparing
1229 \addtoindexx{DWARF Version 3}
1231 \addtoindexx{DWARF Version 4}
1232 4, note that DWARF V4
1233 defines the following combinations of attributes:}
1236 \item \textit{either \livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1238 \livelink{chap:DWATdatabitoffset}{DW\-\_AT\-\_data\-\_bit\-\_offset}
1239 (to specify the beginning of the data member)}
1241 % FIXME: the indentation of the following line is suspect.
1242 \textit{optionally together with}
1244 \item \textit{either \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or
1245 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} (to
1246 specify the size of the data member)}
1250 \textit{DWARF V3 defines the following combinations}
1253 \item \textit{\livelink{chap:DWATdatamemberlocation}{DW\-\_AT\-\_data\-\_member\-\_location}
1254 (to specify the beginning
1255 of the data member, except this specification is only partial
1256 in the case of a bit field) }
1258 % FIXME: the indentation of the following line is suspect.
1259 \textit{optionally together with}
1261 \item \textit{\livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size},
1262 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} and
1263 \livelink{chap:DWATbitoffset}{DW\-\_AT\-\_bit\-\_offset}
1264 (to further specify the beginning of a bit field data member
1265 as well as specify the size of the data member) }
1268 \subsection{Member Function Entries}
1269 \label{chap:memberfunctionentries}
1271 A member function is represented by a debugging information
1272 entry with the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}.
1273 The member function entry
1274 may contain the same attributes and follows the same rules
1275 as non\dash member global subroutine entries
1276 (see Section \refersec{chap:subroutineandentrypointentries}).
1279 \addtoindexx{accessibility attribute}
1280 member function entry may have a
1281 \livelink{chap:DWATaccessibility}{DW\-\_AT\-\_accessibility}
1282 attribute. If no accessibility attribute is present, private
1283 access is assumed for an entry of a class and public access
1284 is assumed for an entry of a structure, union or interface.
1287 \hypertarget{chap:DWATvirtualityvirtualityoffunction}
1288 the member function entry describes a virtual function,
1289 then that entry has a
1290 \livelink{chap:DWATvirtuality}{DW\-\_AT\-\_virtuality} attribute.
1293 \hypertarget{chap:DWATexplicitexplicitpropertyofmemberfunction}
1294 the member function entry describes an explicit member
1295 function, then that entry has
1296 \addtoindexx{explicit attribute}
1298 \livelink{chap:DWATexplicit}{DW\-\_AT\-\_explicit} attribute.
1301 \hypertarget{chap:DWATvtableelemlocationvirtualfunctiontablevtableslot}
1302 entry for a virtual function also has a
1303 \livelink{chap:DWATvtableelemlocation}{DW\-\_AT\-\_vtable\-\_elem\-\_location}
1304 \addtoindexi{attribute}{vtable element location attribute} whose value contains
1305 a location description yielding the address of the slot
1306 for the function within the virtual function table for the
1307 enclosing class. The address of an object of the enclosing
1308 type is pushed onto the expression stack before the location
1309 description is evaluated.
1312 \hypertarget{chap:DWATobjectpointerobjectthisselfpointerofmemberfunction}
1313 the member function entry describes a non\dash static member
1314 function, then that entry has a \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer}
1316 whose value is a reference to the formal parameter entry
1317 that corresponds to the object for which the function is
1318 called. The name attribute of that formal parameter is defined
1319 by the current language (for example,
1320 this for \addtoindex{C++} or self
1321 for \addtoindex{Objective C}
1322 and some other languages). That parameter
1323 also has a \livelink{chap:DWATartificial}{DW\-\_AT\-\_artificial} attribute whose value is true.
1325 Conversely, if the member function entry describes a static
1326 member function, the entry does not have a
1327 \livelink{chap:DWATobjectpointer}{DW\-\_AT\-\_object\-\_pointer}
1330 If the member function entry describes a non\dash static member
1331 function that has a const\dash volatile qualification, then
1332 the entry describes a non\dash static member function whose
1333 object formal parameter has a type that has an equivalent
1334 const\dash volatile qualification.
1336 If a subroutine entry represents the defining declaration
1337 of a member function and that definition appears outside of
1338 the body of the enclosing class declaration, the subroutine
1339 entry has a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
1340 attribute, whose value is
1341 a reference to the debugging information entry representing
1342 the declaration of this function member. The referenced entry
1343 will be a child of some class (or structure) type entry.
1345 Subroutine entries containing the \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification}
1346 attribute do not need to duplicate information provided
1347 by the declaration entry referenced by the specification
1348 attribute. In particular, such entries do not need to contain
1349 attributes for the name or return type of the function member
1350 whose definition they represent.
1352 \subsection{Class Template Instantiations}
1353 \label{chap:classtemplateinstantiations}
1355 \textit{In \addtoindex{C++} a class template is a generic definition of a class
1356 type that may be instantiated when an instance of the class
1357 is declared or defined. The generic description of the
1358 class may include both parameterized types and parameterized
1359 constant values. DWARF does not represent the generic template
1360 definition, but does represent each instantiation.}
1362 A class template instantiation is represented by a
1363 debugging information entry with the tag \livelink{chap:DWTAGclasstype}{DW\-\_TAG\-\_class\-\_type},
1364 \livelink{chap:DWTAGstructuretype}{DW\-\_TAG\-\_structure\-\_type} or
1365 \livelink{chap:DWTAGuniontype}{DW\-\_TAG\-\_union\-\_type}. With five
1366 exceptions, such an entry will contain the same attributes
1367 and have the same types of child entries as would an entry
1368 for a class type defined explicitly using the instantiation
1369 types and values. The exceptions are:
1371 \begin{enumerate}[1.]
1372 \item Each formal parameterized type declaration appearing in the
1373 template definition is represented by a debugging information
1375 \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}. Each
1376 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is
1377 a null\dash terminated string containing the name of the formal
1378 type parameter as it appears in the source program. The
1379 template type parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1380 describing the actual type by which the formal is replaced
1381 for this instantiation.
1383 \item Each formal parameterized value declaration appearing in the
1384 template definition is represented by a debugging information
1386 tag \livetarg{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}.
1388 such entry may have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is
1389 a null\dash terminated string containing the name of the formal
1390 value parameter as it appears in the source program.
1392 \hypertarget{chap:DWATconstvaluetemplatevalueparameter}
1393 template value parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1394 describing the type of the parameterized value. Finally,
1395 the template value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value}
1396 attribute, whose value is the actual constant value of the
1397 value parameter for this instantiation as represented on the
1398 target architecture.
1400 \item The class type entry and each of its child entries references
1401 a template type parameter entry in any circumstance where the
1402 source template definition references a formal parameterized
1403 type. Similarly, the class type entry and each of its child
1404 entries references a template value parameter entry in any
1405 circumstance where the source template definition references
1406 a formal parameterized value.
1408 \item If the compiler has generated a special compilation unit to
1409 hold the template instantiation and that special compilation
1410 unit has a different name from the compilation unit containing
1411 the template definition, the name attribute for the debugging
1412 information entry representing the special compilation unit
1413 should be empty or omitted.
1415 \item If the class type entry representing the template
1416 instantiation or any of its child entries contains declaration
1417 coordinate attributes, those attributes should refer to
1418 the source for the template definition, not to any source
1419 generated artificially by the compiler.
1423 \subsection{Variant Entries}
1424 \label{chap:variantentries}
1426 A variant part of a structure is represented by a debugging
1427 information entry\addtoindexx{variant part entry} with the
1428 tag \livetarg{chap:DWTAGvariantpart}{DW\-\_TAG\-\_variant\-\_part} and is
1429 owned by the corresponding structure type entry.
1431 If the variant part has a discriminant, the discriminant is
1432 \hypertarget{chap:DWATdiscrdiscriminantofvariantpart}
1434 \addtoindexx{discriminant (entry)}
1435 separate debugging information entry which
1436 is a child of the variant part entry. This entry has the form
1437 of a structure data member entry. The variant part entry will
1438 \addtoindexx{discriminant attribute}
1440 \livelink{chap:DWATdiscr}{DW\-\_AT\-\_discr} attribute
1441 whose value is a reference to
1442 the member entry for the discriminant.
1444 If the variant part does not have a discriminant (tag field),
1445 the variant part entry has a
1446 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to represent
1449 Each variant of a particular variant part is represented by
1450 \hypertarget{chap:DWATdiscrvaluediscriminantvalue}
1451 a debugging information entry\addtoindexx{variant entry} with the
1452 tag \livetarg{chap:DWTAGvariant}{DW\-\_TAG\-\_variant}
1453 and is a child of the variant part entry. The value that
1454 selects a given variant may be represented in one of three
1455 ways. The variant entry may have a
1456 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value} attribute
1457 whose value represents a single case label. The value of this
1458 attribute is encoded as an LEB128 number. The number is signed
1459 if the tag type for the variant part containing this variant
1460 is a signed type. The number is unsigned if the tag type is
1464 \hypertarget{chap:DWATdiscrlistlistofdiscriminantvalues}
1465 the variant entry may contain
1466 \addtoindexx{discriminant list attribute}
1468 \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list}
1469 attribute, whose value represents a list of discriminant
1470 values. This list is represented by any of the
1471 \livelink{chap:block}{block} forms and
1472 may contain a mixture of case labels and label ranges. Each
1473 item on the list is prefixed with a discriminant value
1474 descriptor that determines whether the list item represents
1475 a single label or a label range. A single case label is
1476 represented as an LEB128 number as defined above for
1477 \addtoindexx{discriminant value attribute}
1479 \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value}
1480 attribute. A label range is represented by
1481 two LEB128 numbers, the low value of the range followed by the
1482 high value. Both values follow the rules for signedness just
1483 described. The discriminant value descriptor is an integer
1484 constant that may have one of the values given in
1485 Figure \refersec{fig:discriminantdescriptorvalues}.
1487 \begin{figure}[here]
1488 \autorows[0pt]{c}{1}{l}{
1489 \addtoindex{DW\-\_DSC\-\_label},
1490 \addtoindex{DW\-\_DSC\-\_range}
1492 \caption{Discriminant descriptor values}\label{fig:discriminantdescriptorvalues}
1495 If a variant entry has neither a \livelink{chap:DWATdiscrvalue}{DW\-\_AT\-\_discr\-\_value}
1496 attribute nor a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute, or if it has
1497 a \livelink{chap:DWATdiscrlist}{DW\-\_AT\-\_discr\-\_list} attribute with 0 size, the variant is a
1500 The components selected by a particular variant are represented
1501 by debugging information entries owned by the corresponding
1502 variant entry and appear in the same order as the corresponding
1503 declarations in the source program.
1505 \section{Condition Entries}
1506 \label{chap:conditionentries}
1508 \textit{COBOL has the notion of a ``level\dash 88 condition'' that
1509 associates a data item, called the conditional variable, with
1510 a set of one or more constant values and/or value ranges.
1511 Semantically, the condition is ‛true’ if the conditional
1512 variable's value matches any of the described constants,
1513 and the condition is ‛false’ otherwise.}
1515 The \livetarg{chap:DWTAGcondition}{DW\-\_TAG\-\_condition}
1516 debugging information entry\addtoindexx{condition entry}
1518 logical condition that tests whether a given data item’s
1519 value matches one of a set of constant values. If a name
1520 has been given to the condition, the condition entry has a
1521 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
1522 giving the condition name as it appears in the source program.
1524 The condition entry's parent entry describes the conditional
1525 variable; normally this will be a \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable},
1526 \livelink{chap:DWTAGmember}{DW\-\_TAG\-\_member} or
1527 \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter} entry.
1529 \addtoindexx{formal parameter entry}
1531 entry has an array type, the condition can test any individual
1532 element, but not the array as a whole. The condition entry
1533 implicitly specifies a “comparison type” that is the
1534 type of an array element if the parent has an array type;
1535 otherwise it is the type of the parent entry.
1537 The condition entry owns \livelink{chap:DWTAGconstant}{DW\-\_TAG\-\_constant} and/or
1538 \livelink{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type} entries that describe the constant
1539 values associated with the condition. If any child entry has
1540 a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute, that attribute should describe a type
1541 compatible with the comparison type (according to the source
1542 language); otherwise the child’s type is the same as the
1545 \textit{For conditional variables with alphanumeric types, COBOL
1546 permits a source program to provide ranges of alphanumeric
1547 constants in the condition. Normally a subrange type entry
1548 does not describe ranges of strings; however, this can be
1549 represented using bounds attributes that are references to
1550 constant entries describing strings. A subrange type entry may
1551 refer to constant entries that are siblings of the subrange
1555 \section{Enumeration Type Entries}
1556 \label{chap:enumerationtypeentries}
1558 \textit{An “enumeration type” is a scalar that can assume one of
1559 a fixed number of symbolic values.}
1561 An enumeration type is represented by a debugging information
1563 \livetarg{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}.
1565 If a name has been given to the enumeration type in the source
1566 program, then the corresponding enumeration type entry has
1567 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated
1568 string containing the enumeration type name as it appears
1569 in the source program. This entry also has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size}
1570 attribute whose integer constant value is the number of bytes
1571 required to hold an instance of the enumeration.
1573 The \addtoindex{enumeration type entry}
1574 may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1575 which refers to the underlying data type used to implement
1578 If an enumeration type has type safe
1581 \begin{enumerate}[1.]
1582 \item Enumerators are contained in the scope of the enumeration type, and/or
1584 \item Enumerators are not implicitly converted to another type
1587 then the \addtoindex{enumeration type entry} may
1588 \addtoindexx{enum class|see{type-safe enumeration}}
1589 have a \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}
1590 attribute, which is a \livelink{chap:flag}{flag}.
1591 In a language that offers only
1592 one kind of enumeration declaration, this attribute is not
1595 \textit{In \addtoindex{C} or \addtoindex{C++},
1596 the underlying type will be the appropriate
1597 integral type determined by the compiler from the properties of
1598 \hypertarget{chap:DWATenumclasstypesafeenumerationdefinition}
1599 the enumeration literal values.
1600 A \addtoindex{C++} type declaration written
1601 using enum class declares a strongly typed enumeration and
1602 is represented using \livelink{chap:DWTAGenumerationtype}{DW\-\_TAG\-\_enumeration\-\_type}
1603 in combination with \livelink{chap:DWATenumclass}{DW\-\_AT\-\_enum\-\_class}.}
1605 Each enumeration literal is represented by a debugging
1606 \addtoindexx{enumeration literal|see{enumeration entry}}
1607 information entry with the
1608 tag \livetarg{chap:DWTAGenumerator}{DW\-\_TAG\-\_enumerator}.
1610 such entry is a child of the
1611 \addtoindex{enumeration type entry}, and the
1612 enumerator entries appear in the same order as the declarations
1613 of the enumeration literals in the source program.
1615 Each \addtoindex{enumerator entry} has a
1616 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose
1617 value is a null\dash terminated string containing the name of the
1618 \hypertarget{chap:DWATconstvalueenumerationliteralvalue}
1619 enumeration literal as it appears in the source program.
1620 Each enumerator entry also has a
1621 \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value} attribute,
1622 whose value is the actual numeric value of the enumerator as
1623 represented on the target system.
1626 If the enumeration type occurs as the description of a
1627 \addtoindexx{enumeration type endry!as array dimension}
1628 dimension of an array type, and the stride for that dimension
1629 \hypertarget{chap:DWATbytestrideenumerationstridedimensionofarraytype}
1630 is different than what would otherwise be determined, then
1631 \hypertarget{chap:DWATbitstrideenumerationstridedimensionofarraytype}
1632 the enumeration type entry has either a
1633 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1634 or \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1635 \addtoindexx{bit stride attribute}
1636 which specifies the separation
1637 between successive elements along the dimension as described
1639 Section \refersec{chap:visibilityofdeclarations}.
1641 \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1642 \addtoindexx{bit stride attribute}
1643 is interpreted as bits and the value of
1644 \addtoindexx{byte stride attribute}
1646 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride}
1647 attribute is interpreted as bytes.
1650 \section{Subroutine Type Entries}
1651 \label{chap:subroutinetypeentries}
1653 It is possible in \addtoindex{C}
1654 to declare pointers to subroutines
1655 that return a value of a specific type. In both
1656 \addtoindex{C} and \addtoindex{C++},
1657 it is possible to declare pointers to subroutines that not
1658 only return a value of a specific type, but accept only
1659 arguments of specific types. The type of such pointers would
1660 be described with a ``pointer to'' modifier applied to a
1661 user\dash defined type.
1663 A subroutine type is represented by a debugging information
1665 tag \livetarg{chap:DWTAGsubroutinetype}{DW\-\_TAG\-\_subroutine\-\_type}.
1667 been given to the subroutine type in the source program,
1668 then the corresponding subroutine type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
1669 attribute whose value is a null\dash terminated string containing
1670 the subroutine type name as it appears in the source program.
1672 If the subroutine type describes a function that returns
1673 a value, then the subroutine type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
1674 attribute to denote the type returned by the subroutine. If
1675 the types of the arguments are necessary to describe the
1676 subroutine type, then the corresponding subroutine type
1677 entry owns debugging information entries that describe the
1678 arguments. These debugging information entries appear in the
1679 order that the corresponding argument types appear in the
1682 In \addtoindex{C} there
1683 is a difference between the types of functions
1684 declared using function prototype style declarations and
1685 those declared using non\dash prototype declarations.
1688 \hypertarget{chap:DWATprototypedsubroutineprototype}
1689 subroutine entry declared with a function prototype style
1690 declaration may have a
1691 \livelink{chap:DWATprototyped}{DW\-\_AT\-\_prototyped} attribute, which is
1692 a \livelink{chap:flag}{flag}.
1694 Each debugging information entry owned by a subroutine
1695 type entry has a tag whose value has one of two possible
1698 \begin{enumerate}[1.]
1699 \item The formal parameters of a parameter list (that have a
1700 specific type) are represented by a debugging information entry
1701 with the tag \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter}.
1702 Each formal parameter
1703 entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute that refers to the type of
1704 the formal parameter.
1706 \item The unspecified parameters of a variable parameter list
1707 \addtoindexx{unspecified parameters entry}
1709 \addtoindexx{... parameters|see{unspecified parameters entry}}
1710 represented by a debugging information entry with the
1711 tag \livelink{chap:DWTAGunspecifiedparameters}{DW\-\_TAG\-\_unspecified\-\_parameters}.
1716 \section{String Type Entries}
1717 \label{chap:stringtypeentries}
1720 A ``string'' is a sequence of characters that have specific
1721 semantics and operations that separate them from arrays of
1723 \addtoindex{Fortran} is one of the languages that has a string
1724 type. Note that ``string'' in this context refers to a target
1725 machine concept, not the class string as used in this document
1726 (except for the name attribute).
1728 A string type is represented by a debugging information entry
1729 with the tag \livetarg{chap:DWTAGstringtype}{DW\-\_TAG\-\_string\-\_type}.
1730 If a name has been given to
1731 the string type in the source program, then the corresponding
1732 string type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is
1733 a null\dash terminated string containing the string type name as
1734 it appears in the source program.
1737 \hypertarget{chap:DWATstringlengthstringlengthofstringtype}
1738 string type entry may have a
1739 \livelink{chap:DWATstringlength}{DW\-\_AT\-\_string\-\_length} attribute
1740 whose value is a location description yielding the location
1741 where the length of the string is stored in the program. The
1742 string type entry may also have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute
1743 or \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
1744 (see Section \refersec{chap:byteandbitsizes})
1745 is the size of the data to be retrieved from the location
1746 referenced by the string length attribute. If no (byte or bit)
1747 size attribute is present, the size of the data to be retrieved
1748 is the same as the size of an address on the target machine.
1750 If no string length attribute is present, the string type
1751 entry may have a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or
1752 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1753 attribute, whose value
1754 (see Section \refersec{chap:byteandbitsizes})
1756 storage needed to hold a value of the string type.
1759 \section{Set Type Entries}
1760 \label{chap:settypeentries}
1762 \textit{Pascal provides the concept of a “set,” which represents
1763 a group of values of ordinal type.}
1765 A set is represented by a debugging information entry with
1766 the tag \livetarg{chap:DWTAGsettype}{DW\-\_TAG\-\_set\-\_type}.
1767 If a name has been given to the
1768 set type, then the set type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
1769 whose value is a null\dash terminated string containing the
1770 set type name as it appears in the source program.
1772 The set type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to denote the
1773 type of an element of the set.
1775 If the amount of storage allocated to hold each element of an
1776 object of the given set type is different from the amount of
1777 storage that is normally allocated to hold an individual object
1778 of the indicated element type, then the set type entry has
1779 either a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute, or
1780 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute
1781 whose value (see Section \refersec{chap:byteandbitsizes}) is
1782 the amount of storage needed to hold a value of the set type.
1785 \section{Subrange Type Entries}
1786 \label{chap:subrangetypeentries}
1788 \textit{Several languages support the concept of a ``subrange''
1789 type object. These objects can represent a subset of the
1790 values that an object of the basis type for the subrange can
1791 represent. Subrange type entries may also be used to represent
1792 the bounds of array dimensions.}
1794 A subrange type is represented by a debugging information
1796 tag \livetarg{chap:DWTAGsubrangetype}{DW\-\_TAG\-\_subrange\-\_type}.
1798 given to the subrange type, then the subrange type entry
1799 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated
1800 string containing the subrange type name as it appears in
1803 The subrange entry may have a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to describe
1804 the type of object, called the basis type, of whose values
1805 this subrange is a subset.
1807 If the amount of storage allocated to hold each element of an
1808 object of the given subrange type is different from the amount
1809 of storage that is normally allocated to hold an individual
1810 object of the indicated element type, then the subrange
1811 type entry has a \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} attribute or
1812 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size}
1813 attribute, whose value
1814 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
1816 storage needed to hold a value of the subrange type.
1819 \hypertarget{chap:DWATthreadsscaledupcarrayboundthreadsscalfactor}
1820 subrange entry may have a \livelink{chap:DWATthreadsscaled}{DW\-\_AT\-\_threads\-\_scaled} attribute,
1821 which is a \livelink{chap:flag}{flag}.
1822 If present, this attribute indicates whether
1823 this subrange represents a UPC array bound which is scaled
1824 by the runtime THREADS value (the number of UPC threads in
1825 this execution of the program).
1827 \textit{This allows the representation of a UPC shared array such as}
1830 int shared foo[34*THREADS][10][20];
1834 \hypertarget{chap:DWATlowerboundlowerboundofsubrange}
1836 \hypertarget{chap:DWATupperboundupperboundofsubrange}
1837 entry may have the attributes
1838 \livelink{chap:DWATlowerbound}{DW\-\_AT\-\_lower\-\_bound}
1839 and \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound} to specify, respectively, the lower
1840 and upper bound values of the subrange. The
1841 \livelink{chap:DWATupperbound}{DW\-\_AT\-\_upper\-\_bound}
1843 \hypertarget{chap:DWATcountelementsofsubrangetype}
1845 % FIXME: The following matches DWARF4: odd as there is no default count.
1846 \addtoindexx{count attribute!default}
1848 \addtoindexx{count attribute}
1850 \livelink{chap:DWATcount}{DW\-\_AT\-\_count} attribute,
1852 value describes the number of elements in the subrange rather
1853 than the value of the last element. The value of each of
1854 these attributes is determined as described in
1855 Section \refersec{chap:staticanddynamicvaluesofattributes}.
1857 If the lower bound value is missing, the value is assumed to
1858 be a language\dash dependent default constant. The default lower
1860 \addtoindex{C}, \addtoindex{C++},
1863 \addtoindex{Objective C},
1864 \addtoindex{Objective C++},
1865 \addtoindex{Python}, and
1867 The default lower bound is 1 for
1868 \addtoindex{Ada}, \addtoindex{COBOL},
1869 \addtoindex{Fortran},
1870 \addtoindex{Modula}\dash 2,
1871 \addtoindex{Pascal} and
1874 \textit{No other default lower bound values are currently defined.}
1876 If the upper bound and count are missing, then the upper bound value is
1879 If the subrange entry has no type attribute describing the
1880 basis type, the basis type is assumed to be the same as
1881 the object described by the lower bound attribute (if it
1882 references an object). If there is no lower bound attribute,
1883 or that attribute does not reference an object, the basis type
1884 is the type of the upper bound or \addtoindex{count attribute}
1886 of them references an object). If there is no upper bound or
1887 count attribute, or neither references an object, the type is
1888 assumed to be the same type, in the source language of the
1889 compilation unit containing the subrange entry, as a signed
1890 integer with the same size as an address on the target machine.
1892 If the subrange type occurs as the description of a dimension
1893 of an array type, and the stride for that dimension is
1894 \hypertarget{chap:DWATbytestridesubrangestridedimensionofarraytype}
1895 different than what would otherwise be determined, then
1896 \hypertarget{chap:DWATbitstridesubrangestridedimensionofarraytype}
1897 the subrange type entry has either
1898 \addtoindexx{byte stride attribute}
1900 \livelink{chap:DWATbytestride}{DW\-\_AT\-\_byte\-\_stride} or
1901 \livelink{chap:DWATbitstride}{DW\-\_AT\-\_bit\-\_stride} attribute
1902 \addtoindexx{bit stride attribute}
1903 which specifies the separation
1904 between successive elements along the dimension as described
1906 Section \refersec{chap:byteandbitsizes}.
1908 \textit{Note that the stride can be negative.}
1910 \section{Pointer to Member Type Entries}
1911 \label{chap:pointertomembertypeentries}
1913 \textit{In \addtoindex{C++}, a pointer to a data or function member of a class or
1914 structure is a unique type.}
1916 A debugging information entry representing the type of an
1917 object that is a pointer to a structure or class member has
1918 the tag \livetarg{chap:DWTAGptrtomembertype}{DW\-\_TAG\-\_ptr\-\_to\-\_member\-\_type}.
1920 If the pointer to member type has a name, the pointer to
1921 member entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a
1922 null\dash terminated string containing the type name as it appears
1923 in the source program.
1925 The pointer to member entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute to
1926 describe the type of the class or structure member to which
1927 objects of this type may point.
1929 The pointer to member entry also
1930 \hypertarget{chap:DWATcontainingtypecontainingtypeofpointertomembertype}
1932 \livelink{chap:DWATcontainingtype}{DW\-\_AT\-\_containing\-\_type}
1933 attribute, whose value is a reference to a debugging
1934 information entry for the class or structure to whose members
1935 objects of this type may point.
1938 \hypertarget{chap:DWATuselocationmemberlocationforpointertomembertype}
1939 pointer to member entry has a
1940 \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} attribute
1941 whose value is a location description that computes the
1942 address of the member of the class to which the pointer to
1943 member entry points.
1945 \textit{The method used to find the address of a given member of a
1946 class or structure is common to any instance of that class
1947 or structure and to any instance of the pointer or member
1948 type. The method is thus associated with the type entry,
1949 rather than with each instance of the type.}
1951 The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is used in conjunction
1952 with the location descriptions for a particular object of the
1953 given pointer to member type and for a particular structure or
1954 class instance. The \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location}
1955 attribute expects two values to be
1956 \addtoindexi{pushed}{address!implicit push for member operator}
1957 onto the DWARF expression stack before
1958 the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description is evaluated.
1960 \addtoindexi{pushed}{address!implicit push for member operator}
1961 is the value of the pointer to member object
1962 itself. The second value
1963 \addtoindexi{pushed}{address!implicit push for member operator}
1964 is the base address of the
1965 entire structure or union instance containing the member
1966 whose address is being calculated.
1968 \textit{For an expression such as}
1973 % FIXME: object and mbr\_ptr should be distinguished from italic. See DW4.
1974 \textit{where mbr\_ptr has some pointer to member type, a debugger should:}
1976 \textit{1. Push the value of mbr\_ptr onto the DWARF expression stack.}
1978 \textit{2. Push the base address of object onto the DWARF expression stack.}
1980 \textit{3. Evaluate the \livelink{chap:DWATuselocation}{DW\-\_AT\-\_use\-\_location} description
1981 given in the type of mbr\_ptr.}
1983 \section{File Type Entries}
1984 \label{chap:filetypeentries}
1986 \textit{Some languages, such as Pascal, provide a data type to represent
1989 A file type is represented by a debugging information entry
1991 \addtoindexx{file type entry}
1993 \livetarg{chap:DWTAGfiletype}{DW\-\_TAG\-\_file\-\_type}.
1994 If the file type has a name,
1995 the file type entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value
1996 is a null\dash terminated string containing the type name as it
1997 appears in the source program.
1999 The file type entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
2000 the type of the objects contained in the file.
2002 The file type entry also
2003 \addtoindexx{byte size}
2005 \addtoindexx{bit size}
2007 \livelink{chap:DWATbytesize}{DW\-\_AT\-\_byte\-\_size} or
2008 \livelink{chap:DWATbitsize}{DW\-\_AT\-\_bit\-\_size} attribute, whose value
2009 (see Section \refersec{chap:staticanddynamicvaluesofattributes})
2010 is the amount of storage need to hold a value of the file type.
2012 \section{Dynamic Type Properties}
2013 \label{chap:dynamictypeproperties}
2014 \subsection{Data Location}
2015 \label{chap:datalocation}
2017 \textit{Some languages may represent objects using descriptors to hold
2018 information, including a location and/or run\dash time parameters,
2019 about the data that represents the value for that object.}
2021 \hypertarget{chap:DWATdatalocationindirectiontoactualdata}
2022 The \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
2023 attribute may be used with any
2024 \addtoindexx{data location attribute}
2025 type that provides one or more levels of
2026 \addtoindexx{hidden indirection|see{data location attribute}}
2028 and/or run\dash time parameters in its representation. Its value
2029 is a location description. The result of evaluating this
2030 description yields the location of the data for an object.
2031 When this attribute is omitted, the address of the data is
2032 the same as the address of the object.
2034 \textit{This location description will typically begin with
2035 \livelink{chap:DWOPpushobjectaddress}{DW\-\_OP\-\_push\-\_object\-\_address}
2036 which loads the address of the
2037 object which can then serve as a descriptor in subsequent
2038 calculation. For an example using
2039 \livelink{chap:DWATdatalocation}{DW\-\_AT\-\_data\-\_location}
2040 for a \addtoindex{Fortran 90 array}, see
2041 Appendix \refersec{app:fortran90example}.}
2043 \subsection{Allocation and Association Status}
2044 \label{chap:allocationandassociationstatus}
2046 \textit{Some languages, such as \addtoindex{Fortran 90},
2047 provide types whose values
2048 may be dynamically allocated or associated with a variable
2049 under explicit program control.}
2051 \hypertarget{chap:DWATallocatedallocationstatusoftypes}
2053 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated}
2055 \addtoindexx{allocated attribute}
2056 may optionally be used with any
2057 type for which objects of the type can be explicitly allocated
2058 and deallocated. The presence of the attribute indicates that
2059 objects of the type are allocatable and deallocatable. The
2060 integer value of the attribute (see below) specifies whether
2061 an object of the type is
2062 currently allocated or not.
2064 \hypertarget{chap:DWATassociatedassociationstatusoftypes}
2066 \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute
2068 \addtoindexx{associated attribute}
2069 optionally be used with
2070 any type for which objects of the type can be dynamically
2071 associated with other objects. The presence of the attribute
2072 indicates that objects of the type can be associated. The
2073 integer value of the attribute (see below) indicates whether
2074 an object of the type is currently associated or not.
2076 While these attributes are defined specifically with
2077 \addtoindex{Fortran 90} ALLOCATABLE and POINTER types
2078 in mind, usage is not limited
2079 to just that language.
2081 The value of these attributes is determined as described in
2082 Section \refersec{chap:staticanddynamicvaluesofattributes}.
2084 A non\dash zero value is interpreted as allocated or associated,
2085 and zero is interpreted as not allocated or not associated.
2087 \textit{For \addtoindex{Fortran 90},
2088 if the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated}
2089 attribute is present,
2090 the type has the POINTER property where either the parent
2091 variable is never associated with a dynamic object or the
2092 implementation does not track whether the associated object
2093 is static or dynamic. If the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute is
2094 present and the \livelink{chap:DWATassociated}{DW\-\_AT\-\_associated} attribute is not, the type
2095 has the ALLOCATABLE property. If both attributes are present,
2096 then the type should be assumed to have the POINTER property
2097 (and not ALLOCATABLE); the \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} attribute may then
2098 be used to indicate that the association status of the object
2099 resulted from execution of an ALLOCATE statement rather than
2100 pointer assignment.}
2102 \textit{For examples using
2103 \livelink{chap:DWATallocated}{DW\-\_AT\-\_allocated} for \addtoindex{Ada} and
2104 \addtoindex{Fortran 90}
2106 see Appendix \refersec{app:aggregateexamples}.}
2110 \section{Template Alias Entries}
2111 \label{chap:templatealiasentries}
2113 A type named using a template alias is represented
2114 by a debugging information entry with the tag
2115 \livetarg{chap:DWTAGtemplatealias}{DW\-\_TAG\-\_template\-\_alias}.
2116 The template alias entry has a
2117 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated string
2118 containing the name of the template alias as it appears in
2119 the source program. The template alias entry also contains a
2120 \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute whose value is a reference to the type
2121 named by the template alias. The template alias entry has
2122 the following child entries:
2124 \begin{enumerate}[1.]
2125 \item Each formal parameterized type declaration appearing
2126 in the template alias declaration is represented
2127 by a debugging information entry with the tag
2128 \livelink{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}.
2129 Each such entry may have
2130 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a null\dash terminated
2131 string containing the name of the formal type parameter as it
2132 appears in the source program. The template type parameter
2133 entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing the actual
2134 type by which the formal is replaced for this instantiation.
2136 \item Each formal parameterized value declaration
2137 appearing in the template alias declaration is
2138 represented by a debugging information entry with the tag
2139 \livelink{chap:DWTAGtemplatevalueparameter}{DW\-\_TAG\-\_template\-\_value\-\_parameter}.
2140 Each such entry may have
2141 a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a null\dash terminated
2142 string containing the name of the formal value parameter
2143 as it appears in the source program. The template value
2144 parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute describing
2145 the type of the parameterized value. Finally, the template
2146 value parameter entry has a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value}
2147 attribute, whose value is the actual constant value of the value parameter for
2148 this instantiation as represented on the target architecture.