1 \chapter{Data Representation}
2 \label{datarep:datarepresentation}
4 This section describes the binary representation of the
5 debugging information entry itself, of the attribute types
6 and of other fundamental elements described above.
9 \section{Vendor Extensibility}
10 \label{datarep:vendorextensibility}
11 \addtoindexx{vendor extensibility}
12 \addtoindexx{vendor specific extensions|see{vendor extensibility}}
15 \addtoindexx{extensibility|see{vendor extensibility}}
16 reserve a portion of the DWARF name space and ranges of
17 enumeration values for use for vendor specific extensions,
18 special labels are reserved for tag names, attribute names,
19 base type encodings, location operations, language names,
20 calling conventions and call frame instructions.
22 The labels denoting the beginning and end of the reserved
23 value range for vendor specific extensions consist of the
24 appropriate prefix (DW\_TAG, DW\_AT, DW\_END, DW\_ATE, DW\_OP,
25 DW\_LANG, DW\_LNE, DW\_CC or DW\_CFA respectively) followed by
26 \hypertarget{chap:DWXXXlohiuser}{}
27 \_lo\_user or \_hi\_user.
28 \textit{For example, for entry tags, the special
29 labels are DW\_TAG\_lo\_user and DW\_TAG\_hi\_user.}
30 Values in the range between \textit{prefix}\_lo\_user
31 and \textit{prefix}\_hi\_user inclusive,
32 are reserved for vendor specific extensions. Vendors may
33 use values in this range without conflicting with current or
34 future system\dash defined values. All other values are reserved
35 for use by the system.
37 \textit{There may also be codes for vendor specific extensions
38 between the number of standard line number opcodes and
39 the first special line number opcode. However, since the
40 number of standard opcodes varies with the DWARF version,
41 the range for extensions is also version dependent. Thus,
42 \livetarg{chap:DWLNSlouser}{DW\_LNS\_lo\_user} and
43 \livetarg{chap:DWLNShiuser}{DW\_LNS\_hi\_user} symbols are not defined.
46 Vendor defined tags, attributes, base type encodings, location
47 atoms, language names, line number actions, calling conventions
48 and call frame instructions, conventionally use the form
49 \text{prefix\_vendor\_id\_name}, where
50 \textit{vendor\_id}\addtoindexx{vendor id} is some identifying
51 character sequence chosen so as to avoid conflicts with
54 To ensure that extensions added by one vendor may be safely
55 ignored by consumers that do not understand those extensions,
56 the following rules should be followed:
57 \begin{enumerate}[1. ]
59 \item New attributes should be added in such a way that a
60 debugger may recognize the format of a new attribute value
61 without knowing the content of that attribute value.
63 \item The semantics of any new attributes should not alter
64 the semantics of previously existing attributes.
66 \item The semantics of any new tags should not conflict with
67 the semantics of previously existing tags.
69 \item Do not add any new forms of attribute value.
74 \section{Reserved Values}
75 \label{datarep:reservedvalues}
76 \subsection{Error Values}
77 \label{datarep:errorvalues}
78 \addtoindexx{reserved values!error}
81 \addtoindexx{error value}
82 a convenience for consumers of DWARF information, the value
83 0 is reserved in the encodings for attribute names, attribute
84 forms, base type encodings, location operations, languages,
85 line number program opcodes, macro information entries and tag
86 names to represent an error condition or unknown value. DWARF
87 does not specify names for these reserved values, since they
88 do not represent valid encodings for the given type and should
89 not appear in DWARF debugging information.
92 \subsection{Initial Length Values}
93 \label{datarep:initiallengthvalues}
94 \addtoindexx{reserved values!initial length}
96 An \livetarg{datarep:initiallengthvalues}{initial length field} is one of the length fields that occur
98 of those DWARF sections that
104 \dotdebugpubnames{}, and
105 \dotdebugpubtypes{}) or the length field
106 that occurs at the beginning of the CIE and FDE structures
107 in the \dotdebugframe{} section.
109 In an \addtoindex{initial length field}, the values \wfffffffzero through
110 \wffffffff are reserved by DWARF to indicate some form of
111 extension relative to \addtoindex{DWARF Version 2}; such values must not
112 be interpreted as a length field. The use of one such value,
113 \xffffffff, is defined below
114 (see Section \refersec{datarep:32bitand64bitdwarfformats});
116 the other values is reserved for possible future extensions.
120 \section{Executable Objects and Shared Objects}
121 \label{datarep:executableobjectsandsharedobjects}
123 The relocated addresses in the debugging information for an
124 executable object are virtual addresses and the relocated
125 addresses in the debugging information for a shared object
126 are offsets relative to the start of the lowest region of
127 memory loaded from that shared object.
129 \textit{This requirement makes the debugging information for
130 shared objects position independent. Virtual addresses in a
131 shared object may be calculated by adding the offset to the
132 base address at which the object was attached. This offset
133 is available in the run\dash time linker\textquoteright s data structures.}
137 \section{32-Bit and 64-Bit DWARF Formats}
138 \label{datarep:32bitand64bitdwarfformats}
139 \hypertarget{datarep:xxbitdwffmt}{}
140 \addtoindexx{32-bit DWARF format}
141 \addtoindexx{64-bit DWARF format}
142 There are two closely related file formats. In the 32\dash bit DWARF
143 format, all values that represent lengths of DWARF sections
144 and offsets relative to the beginning of DWARF sections are
145 represented using 32\dash bits. In the 64\dash bit DWARF format, all
146 values that represent lengths of DWARF sections and offsets
147 relative to the beginning of DWARF sections are represented
148 using 64\dash bits. A special convention applies to the initial
149 length field of certain DWARF sections, as well as the CIE and
150 FDE structures, so that the 32\dash bit and 64\dash bit DWARF formats
151 can coexist and be distinguished within a single linked object.
153 The differences between the 32\dash\ and 64\dash bit
155 detailed in the following:
156 \begin{enumerate}[1. ]
158 \item In the 32\dash bit DWARF format, an
159 \addtoindex{initial length field}
161 \addtoindexx{initial length field!encoding}
162 Section \refersec{datarep:initiallengthvalues})
163 is an unsigned 32\dash bit integer (which
164 must be less than \xfffffffzero); in the 64\dash bit DWARF format,
165 an \addtoindex{initial length field} is 96 bits in size,
168 \item The first 32\dash bits have the value \xffffffff.
170 \item The following 64\dash bits contain the actual length
171 represented as an unsigned 64\dash bit integer.
174 \textit{This representation allows a DWARF consumer to dynamically
175 detect that a DWARF section contribution is using the 64\dash bit
176 format and to adapt its processing accordingly.}
178 \item Section offset and section length
179 \hypertarget{datarep:sectionoffsetlength}{}
180 \addtoindexx{section length!use in headers}
182 \addtoindexx{section offset!use in headers}
183 in the headers of DWARF sections (other
184 \addtoindexx{initial length field}
186 \addtoindex{initial length}
187 fields) are listed following. In the 32\dash bit DWARF format these
188 are 32\dash bit unsigned integer values; in the 64\dash bit DWARF format,
190 \addtoindexx{section length!in .debug\_aranges header}
192 \addtoindexx{section length!in .debug\_pubnames header}
194 \addtoindexx{section length!in .debug\_pubtypes header}
195 unsigned integer values.
199 Section &Name & Role \\ \hline
200 \dotdebugaranges{} & \addtoindex{debug\_info\_offset} & offset in \dotdebuginfo{} \\
201 \dotdebugframe{}/CIE & \addtoindex{CIE\_id} & CIE distinguished value \\
202 \dotdebugframe{}/FDE & \addtoindex{CIE\_pointer} & offset in \dotdebugframe{} \\
203 \dotdebuginfo{} & \addtoindex{debug\_abbrev\_offset} & offset in \dotdebugabbrev{} \\
204 \dotdebugline{} & \addtoindex{header\_length} & length of header itself \\
205 \dotdebugpubnames{} & \addtoindex{debug\_info\_offset} & offset in \dotdebuginfo{} \\
206 & \addtoindex{debug\_info\_length} & length of \dotdebuginfo{} \\
208 \dotdebugpubtypes{} & \addtoindex{debug\_info\_offset} & offset in \dotdebuginfo{} \\
209 & \addtoindex{debug\_info\_length} & length of \dotdebuginfo{} \\
211 \dotdebugtypes{} & \addtoindex{debug\_abbrev\_offset} & offset in \dotdebugabbrev{} \\
212 & \addtoindex{type\_offset} & offset in \dotdebugtypes{} \\
217 The \texttt{CIE\_id} field in a CIE structure must be 64 bits because
218 it overlays the \texttt{CIE\_pointer} in a FDE structure; this implicit
219 union must be accessed to distinguish whether a CIE or FDE is
220 present, consequently, these two fields must exactly overlay
221 each other (both offset and size).
223 \item Within the body of the \dotdebuginfo{} or \dotdebugtypes{}
224 section, certain forms of attribute value depend on the choice
225 of DWARF format as follows. For the 32\dash bit DWARF format,
226 the value is a 32\dash bit unsigned integer; for the 64\dash bit DWARF
227 format, the value is a 64\dash bit unsigned integer.
230 Form & Role \\ \hline
231 \livelink{chap:DWFORMrefaddr}{DW\_FORM\_ref\_addr}& offset in \dotdebuginfo{} \\
232 \livelink{chap:DWFORMsecoffset}{DW\_FORM\_sec\_offset}& offset in a section other than \\
233 &\dotdebuginfo{} or \dotdebugstr{} \\
234 \livelink{chap:DWFORMstrp}{DW\_FORM\_strp}&offset in \dotdebugstr{} \\
235 \livelink{chap:DWOPcallref}{DW\_OP\_call\_ref}&offset in \dotdebuginfo{} \\
239 \item Within the body of the \dotdebugpubnames{} and
241 sections, the representation of the first field
242 of each tuple (which represents an offset in the
244 section) depends on the DWARF format as follows: in the
245 32\dash bit DWARF format, this field is a 32\dash bit unsigned integer;
246 in the 64\dash bit DWARF format, it is a 64\dash bit unsigned integer.
251 The 32\dash bit and 64\dash bit DWARF format conventions must \emph{not} be
252 intermixed within a single compilation unit.
254 \textit{Attribute values and section header fields that represent
255 addresses in the target program are not affected by these
258 A DWARF consumer that supports the 64\dash bit DWARF format must
259 support executables in which some compilation units use the
260 32\dash bit format and others use the 64\dash bit format provided that
261 the combination links correctly (that is, provided that there
262 are no link\dash time errors due to truncation or overflow). (An
263 implementation is not required to guarantee detection and
264 reporting of all such errors.)
266 \textit{It is expected that DWARF producing compilers will \emph{not} use
267 the 64\dash bit format \emph{by default}. In most cases, the division of
268 even very large applications into a number of executable and
269 shared objects will suffice to assure that the DWARF sections
270 within each individual linked object are less than 4 GBytes
271 in size. However, for those cases where needed, the 64\dash bit
272 format allows the unusual case to be handled as well. Even
273 in this case, it is expected that only application supplied
274 objects will need to be compiled using the 64\dash bit format;
275 separate 32\dash bit format versions of system supplied shared
276 executable libraries can still be used.}
280 \section{Format of Debugging Information}
281 \label{datarep:formatofdebugginginformation}
283 For each compilation unit compiled with a DWARF producer,
284 a contribution is made to the \dotdebuginfo{} section of
285 the object file. Each such contribution consists of a
286 compilation unit header
287 (see Section \refersec{datarep:compilationunitheader})
289 single \livelink{chap:DWTAGcompileunit}{DW\_TAG\_compile\_unit} or
290 \livelink{chap:DWTAGpartialunit}{DW\_TAG\_partial\_unit} debugging
291 information entry, together with its children.
293 For each type defined in a compilation unit, a contribution may
294 be made to the \dotdebugtypes{}
295 section of the object file. Each
296 such contribution consists of a
297 \addtoindex{type unit} header
298 (see Section \refersec{datarep:typeunitheader})
299 followed by a \livelink{chap:DWTAGtypeunit}{DW\_TAG\_type\_unit} entry, together with
302 Each debugging information entry begins with a code that
303 represents an entry in a separate
304 \addtoindex{abbreviations table}. This
305 code is followed directly by a series of attribute values.
307 The appropriate entry in the
308 \addtoindex{abbreviations table} guides the
309 interpretation of the information contained directly in the
311 \dotdebugtypes{} section.
314 Multiple debugging information entries may share the same
315 abbreviation table entry. Each compilation unit is associated
316 with a particular abbreviation table, but multiple compilation
317 units may share the same table.
318 \subsection{Unit Headers}
319 \label{datarep:unitheaders}
321 \subsubsection{Compilation Unit Header}
322 \label{datarep:compilationunitheader}
323 \begin{enumerate}[1. ]
325 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
326 \addttindexx{unit\_length}
327 A 4\dash byte or 12\dash byte
328 \addtoindexx{initial length}
329 unsigned integer representing the length
330 of the \dotdebuginfo{}
331 contribution for that compilation unit,
332 not including the length field itself. In the \thirtytwobitdwarfformat,
333 this is a 4\dash byte unsigned integer (which must be less
334 than \xfffffffzero); in the \sixtyfourbitdwarfformat, this consists
335 of the 4\dash byte value \wffffffff followed by an 8\dash byte unsigned
336 integer that gives the actual length
337 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
339 \item \texttt{version} (\addtoindex{uhalf}) \\
340 A 2\dash byte unsigned integer representing the version of the
341 DWARF information for the compilation unit \addtoindexx{version number!compilation unit}
342 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
343 The value in this field is 4.
345 \item \addttindex{debug\_abbrev\_offset} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
347 \addtoindexx{section offset!in .debug\_info header}
348 4\dash byte or 8\dash byte unsigned offset into the
350 section. This offset associates the compilation unit with a
351 particular set of debugging information entry abbreviations. In
352 the \thirtytwobitdwarfformat, this is a 4\dash byte unsigned length;
353 in the \sixtyfourbitdwarfformat, this is an 8\dash byte unsigned length
354 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
356 \item \texttt{address\_size} (\addtoindex{ubyte}) \\
357 A 1\dash byte unsigned integer representing the size in bytes of
358 \addttindexx{address\_size}
359 an address on the target architecture. If the system uses
360 \addtoindexx{address space!segmented}
361 segmented addressing, this value represents the size of the
362 offset portion of an address.
367 \subsubsection{Type Unit Header}
368 \label{datarep:typeunitheader}
370 The header for the series of debugging information entries
371 contributing to the description of a type that has been
372 placed in its own \addtoindex{type unit}, within the
373 \dotdebugtypes{} section,
374 consists of the following information:
375 \begin{enumerate}[1. ]
377 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
378 \addttindexx{unit\_length}
379 A 4\dash byte or 12\dash byte unsigned integer
380 \addtoindexx{initial length}
381 representing the length
382 of the \dotdebugtypes{} contribution for that compilation unit,
383 not including the length field itself. In the \thirtytwobitdwarfformat,
384 this is a 4\dash byte unsigned integer (which must be
385 less than \xfffffffzero); in the \sixtyfourbitdwarfformat, this
386 consists of the 4\dash byte value \wffffffff followed by an
387 8\dash byte unsigned integer that gives the actual length
388 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
390 \item \texttt{version} (\addtoindex{uhalf}) \\
391 A 2\dash byte unsigned integer representing the version of the
392 DWARF information for the
393 compilation unit\addtoindexx{version number!type unit}
394 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
395 The value in this field is 4.
397 \item \addttindex{debug\_abbrev\_offset} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
399 \addtoindexx{section offset!in .debug\_types header}
400 4\dash byte or 8\dash byte unsigned offset into the
402 section. This offset associates the compilation unit with a
403 particular set of debugging information entry abbreviations. In
404 the \thirtytwobitdwarfformat, this is a 4\dash byte unsigned length;
405 in the \sixtyfourbitdwarfformat, this is an 8\dash byte unsigned length
406 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
408 \item \texttt{address\_size} (ubyte) \\
409 A 1\dash byte unsigned integer representing the size
410 \addtoindexx{size of an address}
412 \addttindexx{address\_size}
413 an address on the target architecture. If the system uses
414 \addtoindexx{address space!segmented}
415 segmented addressing, this value represents the size of the
416 offset portion of an address.
419 \item \texttt{type\_signature} (8\dash byte unsigned integer) \\
420 \addtoindexx{type signature}
422 \addttindexx{type\_signature}
423 64\dash bit unique signature (see Section
424 \refersec{datarep:typesignaturecomputation})
425 of the type described in this type
428 \textit{An attribute that refers (using
429 \livelink{chap:DWFORMrefsig8}{DW\_FORM\_ref\_sig8}) to
430 the primary type contained in this
431 \addtoindex{type unit} uses this value.}
434 \item \texttt{type\_offset} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
435 \addttindexx{type\_offset}
436 A 4\dash byte or 8\dash byte unsigned offset
437 \addtoindexx{section offset!in .debug\_types header}
438 relative to the beginning
439 of the \addtoindex{type unit} header.
440 This offset refers to the debugging
441 information entry that describes the type. Because the type
442 may be nested inside a namespace or other structures, and may
443 contain references to other types that have not been placed in
444 separate type units, it is not necessarily either the first or
445 the only entry in the type unit. In the \thirtytwobitdwarfformat,
446 this is a 4\dash byte unsigned length; in the \sixtyfourbitdwarfformat,
447 this is an 8\dash byte unsigned length
448 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
452 \subsection{Debugging Information Entry}
453 \label{datarep:debugginginformationentry}
455 Each debugging information entry begins with an unsigned LEB128
456 number containing the abbreviation code for the entry. This
457 code represents an entry within the abbreviations table
458 associated with the compilation unit containing this entry. The
459 abbreviation code is followed by a series of attribute values.
461 On some architectures, there are alignment constraints on
462 section boundaries. To make it easier to pad debugging
463 information sections to satisfy such constraints, the
464 abbreviation code 0 is reserved. Debugging information entries
465 consisting of only the abbreviation code 0 are considered
468 \subsection{Abbreviations Tables}
469 \label{datarep:abbreviationstables}
471 The abbreviations tables for all compilation units
472 are contained in a separate object file section called
474 As mentioned before, multiple compilation
475 units may share the same abbreviations table.
477 The abbreviations table for a single compilation unit consists
478 of a series of abbreviation declarations. Each declaration
479 specifies the tag and attributes for a particular form of
480 debugging information entry. Each declaration begins with
481 an unsigned LEB128 number representing the abbreviation
482 code itself. It is this code that appears at the beginning
483 of a debugging information entry in the
486 section. As described above, the abbreviation
487 code 0 is reserved for null debugging information entries. The
488 abbreviation code is followed by another unsigned LEB128
489 number that encodes the entry\textquoteright s tag. The encodings for the
490 tag names are given in
491 Table \refersec{tab:tagencodings}.
494 \setlength{\extrarowheight}{0.1cm}
495 \begin{longtable}{l|l}
497 \caption{Tag encodings} \label{tab:tagencodings} \\
498 \hline \bfseries Tag name&\bfseries Value\\ \hline
500 \bfseries Tag name&\bfseries Value \\ \hline
502 \hline \emph{Continued on next page}
505 \ddag \ \textit{New in \addtoindex{DWARF Version 4}}
507 \livelink{chap:DWTAGarraytype}{DW\_TAG\_array\_type} &0x01 \\
508 \livelink{chap:DWTAGclasstype}{DW\_TAG\_class\_type}&0x02 \\
509 \livelink{chap:DWTAGentrypoint}{DW\_TAG\_entry\_point}&0x03 \\
510 \livelink{chap:DWTAGenumerationtype}{DW\_TAG\_enumeration\_type}&0x04 \\
511 \livelink{chap:DWTAGformalparameter}{DW\_TAG\_formal\_parameter}&0x05 \\
512 \livelink{chap:DWTAGimporteddeclaration}{DW\_TAG\_imported\_declaration}&0x08 \\
513 \livelink{chap:DWTAGlabel}{DW\_TAG\_label}&0x0a \\
514 \livelink{chap:DWTAGlexicalblock}{DW\_TAG\_lexical\_block}&0x0b \\
515 \livelink{chap:DWTAGmember}{DW\_TAG\_member}&0x0d \\
516 \livelink{chap:DWTAGpointertype}{DW\_TAG\_pointer\_type}&0x0f \\
517 \livelink{chap:DWTAGreferencetype}{DW\_TAG\_reference\_type}&0x10 \\
518 \livelink{chap:DWTAGcompileunit}{DW\_TAG\_compile\_unit}&0x11 \\
519 \livelink{chap:DWTAGstringtype}{DW\_TAG\_string\_type}&0x12 \\
520 \livelink{chap:DWTAGstructuretype}{DW\_TAG\_structure\_type}&0x13 \\
521 \livelink{chap:DWTAGsubroutinetype}{DW\_TAG\_subroutine\_type}&0x15 \\
522 \livelink{chap:DWTAGtypedef}{DW\_TAG\_typedef}&0x16 \\
523 \livelink{chap:DWTAGuniontype}{DW\_TAG\_union\_type}&0x17 \\
524 \livelink{chap:DWTAGunspecifiedparameters}{DW\_TAG\_unspecified\_parameters}&0x18 \\
525 \livelink{chap:DWTAGvariant}{DW\_TAG\_variant}&0x19 \\
526 \livelink{chap:DWTAGcommonblock}{DW\_TAG\_common\_block}&0x1a \\
527 \livelink{chap:DWTAGcommoninclusion}{DW\_TAG\_common\_inclusion}&0x1b \\
528 \livelink{chap:DWTAGinheritance}{DW\_TAG\_inheritance}&0x1c \\
529 \livelink{chap:DWTAGinlinedsubroutine}{DW\_TAG\_inlined\_subroutine}&0x1d \\
530 \livelink{chap:DWTAGmodule}{DW\_TAG\_module}&0x1e \\
531 \livelink{chap:DWTAGptrtomembertype}{DW\_TAG\_ptr\_to\_member\_type}&0x1f \\
532 \livelink{chap:DWTAGsettype}{DW\_TAG\_set\_type}&0x20 \\
533 \livelink{chap:DWTAGsubrangetype}{DW\_TAG\_subrange\_type}&0x21 \\
534 \livelink{chap:DWTAGwithstmt}{DW\_TAG\_with\_stmt}&0x22 \\
535 \livelink{chap:DWTAGaccessdeclaration}{DW\_TAG\_access\_declaration}&0x23 \\
536 \livelink{chap:DWTAGbasetype}{DW\_TAG\_base\_type}&0x24 \\
537 \livelink{chap:DWTAGcatchblock}{DW\_TAG\_catch\_block}&0x25 \\
538 \livelink{chap:DWTAGconsttype}{DW\_TAG\_const\_type}&0x26 \\
539 \livelink{chap:DWTAGconstant}{DW\_TAG\_constant}&0x27 \\
540 \livelink{chap:DWTAGenumerator}{DW\_TAG\_enumerator}&0x28 \\
541 \livelink{chap:DWTAGfiletype}{DW\_TAG\_file\_type}&0x29 \\
542 \livelink{chap:DWTAGfriend}{DW\_TAG\_friend}&0x2a \\
543 \livelink{chap:DWTAGnamelist}{DW\_TAG\_namelist}&0x2b \\
544 \livelink{chap:DWTAGnamelistitem}{DW\_TAG\_namelist\_item}&0x2c \\
545 \livelink{chap:DWTAGpackedtype}{DW\_TAG\_packed\_type}&0x2d \\
546 \livelink{chap:DWTAGsubprogram}{DW\_TAG\_subprogram}&0x2e \\
547 \livelink{chap:DWTAGtemplatetypeparameter}{DW\_TAG\_template\_type\_parameter}&0x2f \\
548 \livelink{chap:DWTAGtemplatevalueparameter}{DW\_TAG\_template\_value\_parameter}&0x30 \\
549 \livelink{chap:DWTAGthrowntype}{DW\_TAG\_thrown\_type}&0x31 \\
550 \livelink{chap:DWTAGtryblock}{DW\_TAG\_try\_block}&0x32 \\
551 \livelink{chap:DWTAGvariantpart}{DW\_TAG\_variant\_part}&0x33 \\
552 \livelink{chap:DWTAGvariable}{DW\_TAG\_variable}&0x34 \\
553 \livelink{chap:DWTAGvolatiletype}{DW\_TAG\_volatile\_type}&0x35 \\
554 \livelink{chap:DWTAGdwarfprocedure}{DW\_TAG\_dwarf\_procedure}&0x36 \\
555 \livelink{chap:DWTAGrestricttype}{DW\_TAG\_restrict\_type}&0x37 \\
556 \livelink{chap:DWTAGinterfacetype}{DW\_TAG\_interface\_type}&0x38 \\
557 \livelink{chap:DWTAGnamespace}{DW\_TAG\_namespace}&0x39 \\
558 \livelink{chap:DWTAGimportedmodule}{DW\_TAG\_imported\_module}&0x3a \\
559 \livelink{chap:DWTAGunspecifiedtype}{DW\_TAG\_unspecified\_type}&0x3b \\
560 \livelink{chap:DWTAGpartialunit}{DW\_TAG\_partial\_unit}&0x3c \\
561 \livelink{chap:DWTAGimportedunit}{DW\_TAG\_imported\_unit}&0x3d \\
562 \livelink{chap:DWTAGcondition}{DW\_TAG\_condition}&\xiiif \\
563 \livelink{chap:DWTAGsharedtype}{DW\_TAG\_shared\_type}&0x40 \\
564 \livelink{chap:DWTAGtypeunit}{DW\_TAG\_type\_unit} \ddag &0x41 \\
565 \livelink{chap:DWTAGrvaluereferencetype}{DW\_TAG\_rvalue\_reference\_type} \ddag &0x42 \\
566 \livelink{chap:DWTAGtemplatealias}{DW\_TAG\_template\_alias} \ddag &0x43 \\
567 \livelink{chap:DWXXXlohiuser}{DW\_TAG\_lo\_user}&0x4080 \\
568 \livelink{chap:DWXXXlohiuser}{DW\_TAG\_hi\_user}&\xffff \\
572 Following the tag encoding is a 1\dash byte value that determines
573 whether a debugging information entry using this abbreviation
574 has child entries or not. If the value is
575 \livetarg{chap:DWCHILDRENyes}{DW\_CHILDREN\_yes},
576 the next physically succeeding entry of any debugging
577 information entry using this abbreviation is the first
578 child of that entry. If the 1\dash byte value following the
579 abbreviation\textquoteright s tag encoding is
580 \livetarg{chap:DWCHILDRENno}{DW\_CHILDREN\_no}, the next
581 physically succeeding entry of any debugging information entry
582 using this abbreviation is a sibling of that entry. (Either
583 the first child or sibling entries may be null entries). The
584 encodings for the child determination byte are given in
585 Table \refersec{tab:childdeterminationencodings}
587 Section \refersec{chap:relationshipofdebugginginformationentries},
588 each chain of sibling entries is terminated by a null entry.)
592 \setlength{\extrarowheight}{0.1cm}
593 \begin{longtable}{l|l}
594 \caption{Child determination encodings}
595 \label{tab:childdeterminationencodings}
596 \addtoindexx{Child determination encodings} \\
597 \hline \bfseries Children determination name&\bfseries Value \\ \hline
599 \bfseries Children determination name&\bfseries Value \\ \hline
601 \hline \emph{Continued on next page}
605 \livelink{chap:DWCHILDRENno}{DW\_CHILDREN\_no}&0x00 \\
606 \livelink{chap:DWCHILDRENyes}{DW\_CHILDREN\_yes}&0x01 \\ \hline
610 Finally, the child encoding is followed by a series of
611 attribute specifications. Each attribute specification
612 consists of two parts. The first part is an unsigned LEB128
613 number representing the attribute\textquoteright s name. The second part
614 is an unsigned LEB128 number representing the attribute\textquoteright s
615 form. The series of attribute specifications ends with an
616 entry containing 0 for the name and 0 for the form.
619 \livetarg{chap:DWFORMindirect}{DW\_FORM\_indirect} is a special case. For
620 attributes with this form, the attribute value itself in the
623 section begins with an unsigned
624 LEB128 number that represents its form. This allows producers
625 to choose forms for particular attributes
626 \addtoindexx{abbreviations table!dynamic forms in}
628 without having to add a new entry to the abbreviations table.
630 The abbreviations for a given compilation unit end with an
631 entry consisting of a 0 byte for the abbreviation code.
634 Appendix \refersec{app:compilationunitsandabbreviationstableexample}
635 for a depiction of the organization of the
636 debugging information.}
639 \subsection{Attribute Encodings}
640 \label{datarep:attributeencodings}
642 The encodings for the attribute names are given in
643 Table \refersec{tab:attributeencodings}.
645 The attribute form governs how the value of the attribute is
646 encoded. There are nine classes of form, listed below. Each
647 class is a set of forms which have related representations
648 and which are given a common interpretation according to the
649 attribute in which the form is used.
651 Form \livetarg{chap:DWFORMsecoffset}{DW\_FORM\_sec\_offset}
653 \addtoindexx{rangelistptr class}
655 \addtoindexx{macptr class}
657 \addtoindexx{loclistptr class}
659 \addtoindexx{lineptr class}
660 namely \livelink{chap:classlineptr}{lineptr},
661 \livelink{chap:classloclistptr}{loclistptr},
662 \livelink{chap:classmacptr}{macptr} or
663 \livelink{chap:classrangelistptr}{rangelistptr}; the list
664 of classes allowed by the applicable attribute in
665 Table \refersec{tab:attributeencodings}
666 determines the class of the form.
668 \textit{In DWARF V3 the forms \livelink{chap:DWFORMdata4}{DW\_FORM\_data4} and
669 \livelink{chap:DWFORMdata8}{DW\_FORM\_data8} were
670 \addtoindexx{lineptr class}
672 \addtoindexx{rangelistptr class}
674 \addtoindexx{macptr class}
676 \addtoindexx{loclistptr class}
677 class constant \addtoindexx{constant class}
678 or one of the classes
679 \livelink{chap:classlineptr}{lineptr},
680 \livelink{chap:classloclistptr}{loclistptr},
681 \livelink{chap:classmacptr}{macptr} or
682 \livelink{chap:classrangelistptr}{rangelistptr}, depending on context. In
684 \livelink{chap:DWFORMdata4}{DW\_FORM\_data4} and
685 \livelink{chap:DWFORMdata8}{DW\_FORM\_data8} are members of class
686 constant in all cases.
688 \livelink{chap:DWFORMsecoffset}{DW\_FORM\_sec\_offset} replaces
689 their usage for the other classes.}
691 Each possible form belongs to one or more of the following classes:
694 \item \livelinki{chap:classaddress}{address}{address class} \\
695 \livetarg{datarep:classaddress}{}
696 Represented as an object of appropriate size to hold an
697 address on the target machine
698 (\livetarg{chap:DWFORMaddr}{DW\_FORM\_addr}).
700 encoded in the compilation unit header
701 (see Section \refersec{datarep:compilationunitheader}).
702 This address is relocatable in a relocatable object file and
703 is relocated in an executable file or shared object.
705 \item \livelink{chap:classblock}{block} \\
706 \livetarg{datarep:classblock}{}
707 Blocks come in four forms:
709 \begin{myindentpara}{1cm}
710 A 1\dash byte length followed by 0 to 255 contiguous information
711 bytes (\livetarg{chap:DWFORMblock1}{DW\_FORM\_block1}).
714 \begin{myindentpara}{1cm}
715 A 2\dash byte length followed by 0 to 65,535 contiguous information
716 bytes (\livetarg{chap:DWFORMblock2}{DW\_FORM\_block2}).
719 \begin{myindentpara}{1cm}
720 A 4\dash byte length followed by 0 to 4,294,967,295 contiguous
721 information bytes (\livetarg{chap:DWFORMblock4}{DW\_FORM\_block4}).
724 \begin{myindentpara}{1cm}
725 An unsigned LEB128 length followed by the number of bytes
726 specified by the length (\livetarg{chap:DWFORMblock}{DW\_FORM\_block}).
729 In all forms, the length is the number of information bytes
730 that follow. The information bytes may contain any mixture
731 of relocated (or relocatable) addresses, references to other
732 debugging information entries or data bytes.
734 \item \livelinki{chap:classconstant}{constant}{constant class} \\
735 \livetarg{datarep:classconstant}{}
736 There are six forms of constants. There are fixed length
737 constant data forms for one, two, four and eight byte values
739 \livetarg{chap:DWFORMdata1}{DW\_FORM\_data1},
740 \livetarg{chap:DWFORMdata2}{DW\_FORM\_data2},
741 \livetarg{chap:DWFORMdata4}{DW\_FORM\_data4},
742 and \livetarg{chap:DWFORMdata8}{DW\_FORM\_data8}).
743 There are also variable length constant
744 data forms encoded using LEB128 numbers (see below). Both
745 signed (\livetarg{chap:DWFORMsdata}{DW\_FORM\_sdata}) and unsigned
746 (\livetarg{chap:DWFORMudata}{DW\_FORM\_udata}) variable
747 length constants are available
749 The data in \livelink{chap:DWFORMdata1}{DW\_FORM\_data1},
750 \livelink{chap:DWFORMdata2}{DW\_FORM\_data2},
751 \livelink{chap:DWFORMdata4}{DW\_FORM\_data4} and
752 \livelink{chap:DWFORMdata8}{DW\_FORM\_data8}
753 can be anything. Depending on context, it may
754 be a signed integer, an unsigned integer, a floating\dash point
755 constant, or anything else. A consumer must use context to
756 know how to interpret the bits, which if they are target
757 machine data (such as an integer or floating point constant)
758 will be in target machine byte\dash order.
760 \textit{If one of the \livetarg{chap:DWFORMdata}{DW\_FORM\_data}\textless n\textgreater
761 forms is used to represent a
762 signed or unsigned integer, it can be hard for a consumer
763 to discover the context necessary to determine which
764 interpretation is intended. Producers are therefore strongly
765 encouraged to use \livelink{chap:DWFORMsdata}{DW\_FORM\_sdata} or
766 \livelink{chap:DWFORMudata}{DW\_FORM\_udata} for signed and
767 unsigned integers respectively, rather than
768 \livelink{chap:DWFORMdata}{DW\_FORM\_data}\textless n\textgreater.}
771 \item \livelinki{chap:classexprloc}{exprloc}{exprloc class} \\
772 \livetarg{datarep:classexprloc}{}
773 This is an unsigned LEB128 length followed by the
774 number of information bytes specified by the length
775 (\livetarg{chap:DWFORMexprloc}{DW\_FORM\_exprloc}).
776 The information bytes contain a DWARF expression
777 (see Section \refersec{chap:dwarfexpressions})
778 or location description
779 (see Section \refersec{chap:locationdescriptions}).
781 \item \livelinki{chap:classflag}{flag}{flag class} \\
782 \livetarg{datarep:classflag}{}
783 A flag \addtoindexx{flag class}
784 is represented explicitly as a single byte of data
785 (\livetarg{chap:DWFORMflag}{DW\_FORM\_flag}) or
786 implicitly (\livetarg{chap:DWFORMflagpresent}{DW\_FORM\_flag\_present}).
788 first case, if the \nolink{flag} has value zero, it indicates the
789 absence of the attribute; if the \nolink{flag} has a non\dash zero value,
790 it indicates the presence of the attribute. In the second
791 case, the attribute is implicitly indicated as present, and
792 no value is encoded in the debugging information entry itself.
794 \item \livelinki{chap:classlineptr}{lineptr}{lineptr class} \\
795 \livetarg{datarep:classlineptr}{}
796 This is an offset into
797 \addtoindexx{section offset!in class lineptr value}
799 \dotdebugline{} section
800 (\livelink{chap:DWFORMsecoffset}{DW\_FORM\_sec\_offset}).
801 It consists of an offset from the beginning of the
803 section to the first byte of
804 the data making up the line number list for the compilation
806 It is relocatable in a relocatable object file, and
807 relocated in an executable or shared object. In the
808 \thirtytwobitdwarfformat, this offset is a 4\dash byte unsigned value;
809 in the \sixtyfourbitdwarfformat, it is an 8\dash byte unsigned value
810 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
813 \item \livelinki{chap:classloclistptr}{loclistptr}{loclistptr class} \\
814 \livetarg{datarep:classloclistptr}{}
815 This is an offset into the
818 (\livelink{chap:DWFORMsecoffset}{DW\_FORM\_sec\_offset}).
819 It consists of an offset from the
820 \addtoindexx{section offset!in class loclistptr value}
823 section to the first byte of
824 the data making up the
825 \addtoindex{location list} for the compilation unit.
826 It is relocatable in a relocatable object file, and
827 relocated in an executable or shared object. In the
828 \thirtytwobitdwarfformat, this offset is a 4\dash byte unsigned value;
829 in the \sixtyfourbitdwarfformat, it is an 8\dash byte unsigned value
830 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
833 \item \livelinki{chap:classmacptr}{macptr}{macptr class} \\
834 \livetarg{datarep:classmacptr}{}
836 \addtoindexx{section offset!in class macptr value}
838 \dotdebugmacinfo{} section
839 (\livelink{chap:DWFORMsecoffset}{DW\_FORM\_sec\_offset}).
840 It consists of an offset from the
841 beginning of the \dotdebugmacinfo{}
842 section to the first byte of
843 the data making up the macro information list for the compilation
845 It is relocatable in a relocatable object file, and
846 relocated in an executable or shared object. In the
847 \thirtytwobitdwarfformat, this offset is a 4\dash byte unsigned value;
848 in the \sixtyfourbitdwarfformat, it is an 8\dash byte unsigned value
849 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
852 \item \livelinki{chap:classrangelistptr}{rangelistptr}{rangelistptr class} \\
853 \livetarg{datarep:classrangelistptr}{}
855 \addtoindexx{section offset!in class rangelistptr value}
856 offset into the \dotdebugranges{} section
857 (\livelink{chap:DWFORMsecoffset}{DW\_FORM\_sec\_offset}).
859 offset from the beginning of the
860 \dotdebugranges{} section
861 to the beginning of the non\dash contiguous address ranges
862 information for the referencing entity.
864 a relocatable object file, and relocated in an executable or
865 shared object. In the \thirtytwobitdwarfformat, this offset
866 is a 4\dash byte unsigned value; in the 64\dash bit DWARF
867 format, it is an 8\dash byte unsigned value (see Section
868 \refersec{datarep:32bitand64bitdwarfformats}).
871 \textit{Because classes \livelink{chap:classlineptr}{lineptr},
872 \livelink{chap:classloclistptr}{loclistptr},
873 \livelink{chap:classmacptr}{macptr} and
874 \livelink{chap:classrangelistptr}{rangelistptr}
875 share a common representation, it is not possible for an
876 attribute to allow more than one of these classes}
880 \item \livelinki{chap:classreference}{reference}{reference class} \\
881 \livetarg{datarep:classreference}{}
882 There are three types of reference.
885 \addtoindexx{reference class}
886 first type of reference can identify any debugging
887 information entry within the containing unit.
890 \addtoindexx{section offset!in class reference value}
891 offset from the first byte of the compilation
892 header for the compilation unit containing the reference. There
893 are five forms for this type of reference. There are fixed
894 length forms for one, two, four and eight byte offsets
895 (respectively, \livetarg{chap:DWFORMref1}{DW\_FORM\_ref1},
896 \livetarg{chap:DWFORMref2}{DW\_FORM\_ref2},
897 \livetarg{chap:DWFORMref4}{DW\_FORM\_ref4},
898 and \livetarg{chap:DWFORMref8}{DW\_FORM\_ref8}).
899 There is also an unsigned variable
900 length offset encoded form that uses unsigned LEB128 numbers
901 (\livetarg{chap:DWFORMrefudata}{DW\_FORM\_ref\_udata}).
902 Because this type of reference is within
903 the containing compilation unit no relocation of the value
906 The second type of reference can identify any debugging
907 information entry within a
908 \dotdebuginfo{} section; in particular,
909 it may refer to an entry in a different compilation unit
910 from the unit containing the reference, and may refer to an
911 entry in a different shared object. This type of reference
912 (\livetarg{chap:DWFORMrefaddr}{DW\_FORM\_ref\_addr})
913 is an offset from the beginning of the
915 section of the target executable or shared object;
916 it is relocatable in a relocatable object file and frequently
917 relocated in an executable file or shared object. For
918 references from one shared object or static executable file
919 to another, the relocation and identification of the target
920 object must be performed by the consumer. In the
921 \thirtytwobitdwarfformat, this offset is a 4\dash byte unsigned value;
922 in the \sixtyfourbitdwarfformat, it is an 8\dash byte
924 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
926 \textit{A debugging information entry that may be referenced by
927 another compilation unit using
928 \livelink{chap:DWFORMrefaddr}{DW\_FORM\_ref\_addr} must have a
929 global symbolic name.}
931 \textit{For a reference from one executable or shared object to
932 another, the reference is resolved by the debugger to identify
933 the shared object or executable and the offset into that
934 object\textquoteright s \dotdebuginfo{}
935 section in the same fashion as the run
936 time loader, either when the debug information is first read,
937 or when the reference is used.}
939 The third type of reference can identify any debugging
940 information type entry that has been placed in its own
941 \addtoindex{type unit}. This type of
942 reference (\livetarg{chap:DWFORMrefsig8}{DW\_FORM\_ref\_sig8}) is the
943 \addtoindexx{type signature}
944 64\dash bit type signature
945 (see Section \refersec{datarep:typesignaturecomputation})
949 \textit{The use of compilation unit relative references will reduce the
950 number of link\dash time relocations and so speed up linking. The
951 use of the second and third type of reference allows for the
952 sharing of information, such as types, across compilation
955 \textit{A reference to any kind of compilation unit identifies the
956 debugging information entry for that unit, not the preceding
959 \item \livelinki{chap:classstring}{string}{string class} \\
960 \livetarg{datarep:classstring}{}
961 A string is a sequence of contiguous non\dash null bytes followed by
963 \addtoindexx{string class}
964 A string may be represented immediately in the
965 debugging information entry itself
966 (\livetarg{chap:DWFORMstring}{DW\_FORM\_string}), or may
968 \addtoindexx{section offset!in class string value}
969 offset into a string table contained in
970 the \dotdebugstr{} section of the object file
971 (\livetarg{chap:DWFORMstrp}{DW\_FORM\_strp}). In
972 the \thirtytwobitdwarfformat, the representation of a
973 \livelink{chap:DWFORMstrp}{DW\_FORM\_strp}
974 value is a 4\dash byte unsigned offset; in the \sixtyfourbitdwarfformat,
975 it is an 8\dash byte unsigned offset
976 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
978 If the \livelink{chap:DWATuseUTF8}{DW\_AT\_use\_UTF8}
979 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8} attribute is specified for the
980 compilation unit entry, string values are encoded using the
981 UTF\dash 8 (\addtoindex{Unicode} Transformation Format\dash 8) from the Universal
982 Character Set standard (ISO/IEC 10646\dash 1:1993). Otherwise,
983 the string representation is unspecified.
985 \textit{The \addtoindex{Unicode} Standard Version 3 is fully compatible with
986 ISO/IEC 10646\dash 1:1993. It contains all the same characters
987 and encoding points as ISO/IEC 10646, as well as additional
988 information about the characters and their use.}
990 \textit{Earlier versions of DWARF did not specify the representation
991 of strings; for compatibility, this version also does
992 not. However, the UTF\dash 8 representation is strongly recommended.}
996 In no case does an attribute use
997 \addtoindexx{rangelistptr class}
999 \addtoindexx{loclistptr class}
1001 \addtoindexx{lineptr class}
1003 \addtoindexx{macptr class}
1004 classes \livelink{chap:classlineptr}{lineptr},
1005 \livelink{chap:classloclistptr}{loclistptr}, \livelink{chap:classmacptr}{macptr} or
1006 \livelink{chap:classrangelistptr}{rangelistptr} to point into either the
1007 \dotdebuginfo{} or \dotdebugstr{} section.
1009 The form encodings are listed in
1010 Table \refersec{tab:attributeformencodings}.
1014 \setlength{\extrarowheight}{0.1cm}
1015 \begin{longtable}{l|l|l}
1016 \caption{Attribute encodings}
1017 \label{tab:attributeencodings}
1018 \addtoindexx{attribute encodings} \\
1019 \hline \bfseries Attribute name&\bfseries Value &\bfseries Classes \\ \hline
1021 \bfseries Attribute name&\bfseries Value &\bfseries Classes\\ \hline
1023 \hline \emph{Continued on next page}
1026 \ddag \ \textit{New in \addtoindex{DWARF Version 4}}
1028 \livelink{chap:DWATsibling}{DW\_AT\_sibling}&0x01&\livelink{chap:classreference}{reference}
1029 \addtoindexx{sibling attribute!encoding} \\
1030 \livelink{chap:DWATlocation}{DW\_AT\_location}&0x02&\livelink{chap:classexprloc}{exprloc},
1031 \livelink{chap:classloclistptr}{loclistptr}\addtoindexx{location attribute!encoding} \\
1032 \livelink{chap:DWATname}{DW\_AT\_name}&0x03&\livelink{chap:classstring}{string}
1033 \addtoindexx{name attribute!encoding} \\
1034 \livelink{chap:DWATordering}{DW\_AT\_ordering}&0x09&\livelink{chap:classconstant}{constant}
1035 \addtoindexx{ordering attribute!encoding} \\
1036 \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size}&0x0b&\livelink{chap:classconstant}{constant}, \livelink{chap:classexprloc}{exprloc},
1037 \livelink{chap:classreference}{reference} \addtoindexx{byte size attribute!encoding} \\
1038 \livelink{chap:DWATbitoffset}{DW\_AT\_bit\_offset}&0x0c&\livelink{chap:classconstant}{constant},
1039 \livelink{chap:classexprloc}{exprloc}, \livelink{chap:classreference}{reference} \addtoindexx{bit offset attribute!encoding} \\
1040 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size}&0x0d&\livelink{chap:classconstant}{constant},
1041 \livelink{chap:classexprloc}{exprloc}, \livelink{chap:classreference}{reference} \addtoindexx{bit size attribute!encoding} \\
1042 \livelink{chap:DWATstmtlist}{DW\_AT\_stmt\_list}&0x10&\livelink{chap:classlineptr}{lineptr}
1043 \addtoindexx{statement list attribute!encoding} \\
1044 \livelink{chap:DWATlowpc}{DW\_AT\_low\_pc}&0x11&\livelink{chap:classaddress}{address}
1045 \addtoindexx{low PC attribute!encoding} \\
1046 \livelink{chap:DWAThighpc}{DW\_AT\_high\_pc}&0x12&\livelink{chap:classaddress}{address}, \livelink{chap:classconstant}{constant}
1047 \addtoindexx{high PC attribute!encoding} \\
1048 \livelink{chap:DWATlanguage}{DW\_AT\_language}&0x13&\livelink{chap:classconstant}{constant}
1049 \addtoindexx{language attribute!encoding} \\
1050 \livelink{chap:DWATdiscr}{DW\_AT\_discr}&0x15&\livelink{chap:classreference}{reference}
1051 \addtoindexx{discriminant attribute!encoding} \\
1052 \livelink{chap:DWATdiscrvalue}{DW\_AT\_discr\_value}&0x16&\livelink{chap:classconstant}{constant}
1053 \addtoindexx{discriminant value attribute!encoding} \\
1054 \livelink{chap:DWATvisibility}{DW\_AT\_visibility}&0x17&\livelink{chap:classconstant}{constant}
1055 \addtoindexx{visibility attribute!encoding} \\
1056 \livelink{chap:DWATimport}{DW\_AT\_import}&0x18&\livelink{chap:classreference}{reference}
1057 \addtoindexx{import attribute!encoding} \\
1058 \livelink{chap:DWATstringlength}{DW\_AT\_string\_length}&0x19&\livelink{chap:classexprloc}{exprloc},
1059 \livelink{chap:classloclistptr}{loclistptr} \addtoindexx{string length attribute!encoding} \\
1060 \livelink{chap:DWATcommonreference}{DW\_AT\_common\_reference}&0x1a&\livelink{chap:classreference}{reference}
1061 \addtoindexx{common reference attribute!encoding} \\
1062 \livelink{chap:DWATcompdir}{DW\_AT\_comp\_dir}&0x1b&\livelink{chap:classstring}{string}
1063 \addtoindexx{compilation directory attribute!encoding} \\
1064 \livelink{chap:DWATconstvalue}{DW\_AT\_const\_value}&0x1c&\livelink{chap:classblock}{block}, \livelink{chap:classconstant}{constant}, \livelink{chap:classstring}{string}
1065 \addtoindexx{constant value attribute!encoding} \\
1066 \livelink{chap:DWATcontainingtype}{DW\_AT\_containing\_type}&0x1d&\livelink{chap:classreference}{reference}
1067 \addtoindexx{containing type attribute!encoding} \\
1068 \livelink{chap:DWATdefaultvalue}{DW\_AT\_default\_value}&0x1e&\livelink{chap:classreference}{reference}
1069 \addtoindexx{default value attribute!encoding} \\
1070 \livelink{chap:DWATinline}{DW\_AT\_inline}&0x20&\livelink{chap:classconstant}{constant}
1071 \addtoindexx{inline attribute!encoding} \\
1072 \livelink{chap:DWATisoptional}{DW\_AT\_is\_optional}&0x21&\livelink{chap:classflag}{flag}
1073 \addtoindexx{is optional attribute!encoding} \\
1074 \livelink{chap:DWATlowerbound}{DW\_AT\_lower\_bound}&0x22&\livelink{chap:classconstant}{constant},
1075 \livelink{chap:classexprloc}{exprloc}, \livelink{chap:classreference}{reference} \addtoindexx{lower bound attribute!encoding} \\
1076 \livelink{chap:DWATproducer}{DW\_AT\_producer}&0x25&\livelink{chap:classstring}{string} \addtoindexx{producer attribute!encoding} \\
1077 \livelink{chap:DWATprototyped}{DW\_AT\_prototyped}&0x27&\livelink{chap:classflag}{flag}
1078 \addtoindexx{prototyped attribute!encoding} \\
1079 \livelink{chap:DWATreturnaddr}{DW\_AT\_return\_addr}&0x2a&\livelink{chap:classexprloc}{exprloc},
1080 \livelink{chap:classloclistptr}{loclistptr} \addtoindexx{return address attribute!encoding} \\
1081 % FIXME: lower case , not Constant
1082 \livelink{chap:DWATstartscope}{DW\_AT\_start\_scope}&0x2c&\livelink{chap:classconstant}{constant},
1083 \livelink{chap:classrangelistptr}{rangelistptr} \addtoindexx{start scope attribute!encoding} \\
1084 \livelink{chap:DWATbitstride}{DW\_AT\_bit\_stride}&0x2e&\livelink{chap:classconstant}{constant},
1085 \livelink{chap:classexprloc}{exprloc}, \livelink{chap:classreference}{reference} \addtoindexx{bit stride attribute!encoding} \\
1086 \livelink{chap:DWATupperbound}{DW\_AT\_upper\_bound}&0x2f&\livelink{chap:classconstant}{constant},
1087 \livelink{chap:classexprloc}{exprloc}, \livelink{chap:classreference}{reference} \addtoindexx{upper bound attribute!encoding} \\
1088 \livelink{chap:DWATabstractorigin}{DW\_AT\_abstract\_origin}&0x31&\livelink{chap:classreference}{reference}
1089 \addtoindexx{abstract origin attribute!encoding} \\
1090 \livelink{chap:DWATaccessibility}{DW\_AT\_accessibility}&0x32&\livelink{chap:classconstant}{constant}
1091 \addtoindexx{accessibility attribute!encoding} \\
1092 \livelink{chap:DWATaddressclass}{DW\_AT\_address\_class}&0x33&\livelink{chap:classconstant}{constant}
1093 \addtoindexx{address class attribute!encoding} \\
1094 \livelink{chap:DWATartificial}{DW\_AT\_artificial}&0x34&\livelink{chap:classflag}{flag}
1095 \addtoindexx{artificial attribute!encoding} \\
1096 \livelink{chap:DWATbasetypes}{DW\_AT\_base\_types}&0x35&\livelink{chap:classreference}{reference}
1097 \addtoindexx{base types attribute!encoding} \\
1098 \livelink{chap:DWATcallingconvention}{DW\_AT\_calling\_convention}&0x36&\livelink{chap:classconstant}{constant}
1099 \addtoindexx{calling convention attribute!encoding} \\
1100 \livelink{chap:DWATcount}{DW\_AT\_count}&0x37&\livelink{chap:classconstant}{constant}, \livelink{chap:classexprloc}{exprloc}, \livelink{chap:classreference}{reference}
1101 \addtoindexx{count attribute!encoding} \\
1102 \livelink{chap:DWATdatamemberlocation}{DW\_AT\_data\_member\_location}&0x38&\livelink{chap:classconstant}{constant},
1103 \livelink{chap:classexprloc}{exprloc}, \livelink{chap:classloclistptr}{loclistptr}
1104 \addtoindexx{data member attribute!encoding} \\
1105 \livelink{chap:DWATdeclcolumn}{DW\_AT\_decl\_column}&0x39&\livelink{chap:classconstant}{constant}
1106 \addtoindexx{declaration column attribute!encoding} \\
1107 \livelink{chap:DWATdeclfile}{DW\_AT\_decl\_file}&0x3a&\livelink{chap:classconstant}{constant}
1108 \addtoindexx{declaration file attribute!encoding} \\
1109 \livelink{chap:DWATdeclline}{DW\_AT\_decl\_line}&0x3b&\livelink{chap:classconstant}{constant}
1110 \addtoindexx{declaration line attribute!encoding} \\
1111 \livelink{chap:DWATdeclaration}{DW\_AT\_declaration}&0x3c&\livelink{chap:classflag}{flag}
1112 \addtoindexx{declaration attribute!encoding} \\
1113 \livelink{chap:DWATdiscrlist}{DW\_AT\_discr\_list}&0x3d&\livelink{chap:classblock}{block}
1114 \addtoindexx{discriminant list attribute!encoding} \\
1115 \livelink{chap:DWATencoding}{DW\_AT\_encoding}&0x3e&\livelink{chap:classconstant}{constant}
1116 \addtoindexx{encoding attribute!encoding} \\
1117 \livelink{chap:DWATexternal}{DW\_AT\_external}&\xiiif&\livelink{chap:classflag}{flag}
1118 \addtoindexx{external attribute!encoding} \\
1119 \livelink{chap:DWATframebase}{DW\_AT\_frame\_base}&0x40&\livelink{chap:classexprloc}{exprloc},
1120 \livelink{chap:classloclistptr}{loclistptr} \addtoindexx{frame base attribute!encoding} \\
1121 \livelink{chap:DWATfriend}{DW\_AT\_friend}&0x41&\livelink{chap:classreference}{reference}
1122 \addtoindexx{friend attribute!encoding} \\
1123 \livelink{chap:DWATidentifiercase}{DW\_AT\_identifier\_case}&0x42&\livelink{chap:classconstant}{constant}
1124 \addtoindexx{identifier case attribute!encoding} \\
1125 \livelink{chap:DWATmacroinfo}{DW\_AT\_macro\_info}&0x43&\livelink{chap:classmacptr}{macptr}
1126 \addtoindexx{macro information attribute!encoding} \\
1127 \livelink{chap:DWATnamelistitem}{DW\_AT\_namelist\_item}&0x44&\livelink{chap:classreference}{reference}
1128 \addtoindexx{name list item attribute!encoding} \\
1129 \livelink{chap:DWATpriority}{DW\_AT\_priority}&0x45&\livelink{chap:classreference}{reference}
1130 \addtoindexx{priority attribute!encoding} \\
1131 \livelink{chap:DWATsegment}{DW\_AT\_segment}&0x46&\livelink{chap:classexprloc}{exprloc},
1132 \livelink{chap:classloclistptr}{loclistptr} \addtoindexx{segment attribute!encoding} \\
1133 \livelink{chap:DWATspecification}{DW\_AT\_specification}&0x47&\livelink{chap:classreference}{reference}
1134 \addtoindexx{specification attribute!encoding} \\
1135 \livelink{chap:DWATstaticlink}{DW\_AT\_static\_link}&0x48&\livelink{chap:classexprloc}{exprloc},
1136 \livelink{chap:classloclistptr}{loclistptr} \addtoindexx{static link attribute!encoding} \\
1137 \livelink{chap:DWATtype}{DW\_AT\_type}&0x49&\livelink{chap:classreference}{reference}
1138 \addtoindexx{type attribute!encoding} \\
1139 \livelink{chap:DWATuselocation}{DW\_AT\_use\_location}&0x4a&\livelink{chap:classexprloc}{exprloc},
1140 \livelink{chap:classloclistptr}{loclistptr} \addtoindexx{location list attribute!encoding} \\
1141 \livelink{chap:DWATvariableparameter}{DW\_AT\_variable\_parameter}&0x4b&\livelink{chap:classflag}{flag}
1142 \addtoindexx{variable parameter attribute!encoding} \\
1143 \livelink{chap:DWATvirtuality}{DW\_AT\_virtuality}&0x4c&\livelink{chap:classconstant}{constant}
1144 \addtoindexx{virtuality attribute!encoding} \\
1145 \livelink{chap:DWATvtableelemlocation}{DW\_AT\_vtable\_elem\_location}&0x4d&\livelink{chap:classexprloc}{exprloc},
1146 \livelink{chap:classloclistptr}{loclistptr} \addtoindexx{vtable element location attribute!encoding} \\
1147 \livelink{chap:DWATallocated}{DW\_AT\_allocated}&0x4e&\livelink{chap:classconstant}{constant}, \livelink{chap:classexprloc}{exprloc},
1148 \livelink{chap:classreference}{reference} \addtoindexx{allocated attribute!encoding} \\
1149 \livelink{chap:DWATassociated}{DW\_AT\_associated}&0x4f&\livelink{chap:classconstant}{constant}, \livelink{chap:classexprloc}{exprloc},
1150 \livelink{chap:classreference}{reference} \addtoindexx{associated attribute!encoding} \\
1151 \livelink{chap:DWATdatalocation}{DW\_AT\_data\_location}&0x50&\livelink{chap:classexprloc}{exprloc}
1152 \addtoindexx{data location attribute!encoding} \\
1153 \livelink{chap:DWATbytestride}{DW\_AT\_byte\_stride}&0x51&\livelink{chap:classconstant}{constant}, \livelink{chap:classexprloc}{exprloc},
1154 \livelink{chap:classreference}{reference} \addtoindexx{byte stride attribute!encoding} \\
1155 \livelink{chap:DWATentrypc}{DW\_AT\_entry\_pc}&0x52&\livelink{chap:classaddress}{address}
1156 \addtoindexx{entry pc attribute!encoding} \\
1157 \livelink{chap:DWATuseUTF8}{DW\_AT\_use\_UTF8}&0x53&\livelink{chap:classflag}{flag}
1158 \addtoindexx{use UTF8 attribute!encoding}\addtoindexx{UTF-8} \\
1159 \livelink{chap:DWATextension}{DW\_AT\_extension}&0x54&\livelink{chap:classreference}{reference}
1160 \addtoindexx{extension attribute!encoding} \\
1161 \livelink{chap:DWATranges}{DW\_AT\_ranges}&0x55&\livelink{chap:classrangelistptr}{rangelistptr}
1162 \addtoindexx{ranges attribute!encoding} \\
1163 \livelink{chap:DWATtrampoline}{DW\_AT\_trampoline}&0x56&\livelink{chap:classaddress}{address}, \livelink{chap:classflag}{flag},
1164 \livelink{chap:classreference}{reference}, \livelink{chap:classstring}{string} \addtoindexx{trampoline attribute!encoding} \\
1165 \livelink{chap:DWATcallcolumn}{DW\_AT\_call\_column}&0x57&\livelink{chap:classconstant}{constant}
1166 \addtoindexx{call column attribute!encoding} \\
1167 \livelink{chap:DWATcallfile}{DW\_AT\_call\_file}&0x58&\livelink{chap:classconstant}{constant}
1168 \addtoindexx{call file attribute!encoding} \\
1169 \livelink{chap:DWATcallline}{DW\_AT\_call\_line}&0x59&\livelink{chap:classconstant}{constant}
1170 \addtoindexx{call line attribute!encoding} \\
1171 \livelink{chap:DWATdescription}{DW\_AT\_description}&0x5a&\livelink{chap:classstring}{string}
1172 \addtoindexx{description attribute!encoding} \\
1173 \livelink{chap:DWATbinaryscale}{DW\_AT\_binary\_scale}&0x5b&\livelink{chap:classconstant}{constant}
1174 \addtoindexx{binary scale attribute!encoding} \\
1175 \livelink{chap:DWATdecimalscale}{DW\_AT\_decimal\_scale}&0x5c&\livelink{chap:classconstant}{constant}
1176 \addtoindexx{decimal scale attribute!encoding} \\
1177 \livelink{chap:DWATsmall}{DW\_AT\_small} &0x5d&\livelink{chap:classreference}{reference}
1178 \addtoindexx{small attribute!encoding} \\
1179 \livelink{chap:DWATdecimalsign}{DW\_AT\_decimal\_sign}&0x5e&\livelink{chap:classconstant}{constant}
1180 \addtoindexx{decimal scale attribute!encoding} \\
1181 \livelink{chap:DWATdigitcount}{DW\_AT\_digit\_count}&0x5f&\livelink{chap:classconstant}{constant}
1182 \addtoindexx{digit count attribute!encoding} \\
1183 \livelink{chap:DWATpicturestring}{DW\_AT\_picture\_string}&0x60&\livelink{chap:classstring}{string}
1184 \addtoindexx{picture string attribute!encoding} \\
1185 \livelink{chap:DWATmutable}{DW\_AT\_mutable}&0x61&\livelink{chap:classflag}{flag}
1186 \addtoindexx{mutable attribute!encoding} \\
1187 \livelink{chap:DWATthreadsscaled}{DW\_AT\_threads\_scaled}&0x62&\livelink{chap:classflag}{flag}
1188 \addtoindexx{thread scaled attribute!encoding} \\
1189 \livelink{chap:DWATexplicit}{DW\_AT\_explicit}&0x63&\livelink{chap:classflag}{flag}
1190 \addtoindexx{explicit attribute!encoding} \\
1191 \livelink{chap:DWATobjectpointer}{DW\_AT\_object\_pointer}&0x64&\livelink{chap:classreference}{reference}
1192 \addtoindexx{object pointer attribute!encoding} \\
1193 \livelink{chap:DWATendianity}{DW\_AT\_endianity}&0x65&\livelink{chap:classconstant}{constant}
1194 \addtoindexx{endianity attribute!encoding} \\
1195 \livelink{chap:DWATelemental}{DW\_AT\_elemental}&0x66&\livelink{chap:classflag}{flag}
1196 \addtoindexx{elemental attribute!encoding} \\
1197 \livelink{chap:DWATpure}{DW\_AT\_pure}&0x67&\livelink{chap:classflag}{flag}
1198 \addtoindexx{pure attribute!encoding} \\
1199 \livelink{chap:DWATrecursive}{DW\_AT\_recursive}&0x68&\livelink{chap:classflag}{flag}
1200 \addtoindexx{recursive attribute!encoding} \\
1201 \livelink{chap:DWATsignature}{DW\_AT\_signature} \ddag &0x69&\livelink{chap:classreference}{reference}
1202 \addtoindexx{signature attribute!encoding} \\
1203 \livelink{chap:DWATmainsubprogram}{DW\_AT\_main\_subprogram} \ddag &0x6a&\livelink{chap:classflag}{flag}
1204 \addtoindexx{main subprogram attribute!encoding} \\
1205 \livelink{chap:DWATdatabitoffset}{DW\_AT\_data\_bit\_offset} \ddag &0x6b&\livelink{chap:classconstant}{constant}
1206 \addtoindexx{data bit offset attribute!encoding} \\
1207 \livelink{chap:DWATconstexpr}{DW\_AT\_const\_expr} \ddag &0x6c&\livelink{chap:classflag}{flag}
1208 \addtoindexx{constant expression attribute!encoding} \\
1209 \livelink{chap:DWATenumclass}{DW\_AT\_enum\_class} \ddag &0x6d&\livelink{chap:classflag}{flag}
1210 \addtoindexx{enumeration class attribute!encoding} \\
1211 \livelink{chap:DWATlinkagename}{DW\_AT\_linkage\_name} \ddag &0x6e&\livelink{chap:classstring}{string}
1212 \addtoindexx{linkage name attribute!encoding} \\
1213 \livelink{chap:DWXXXlohiuser}{DW\_AT\_lo\_user}&0x2000 & --- \addtoindexx{low user attribute encoding} \\
1214 \livelink{chap:DWXXXlohiuser}{DW\_AT\_hi\_user}&\xiiifff& --- \addtoindexx{high user attribute encoding} \\
1220 \setlength{\extrarowheight}{0.1cm}
1221 \begin{longtable}{l|l|l}
1222 \caption{Attribute form encodings} \label{tab:attributeformencodings} \\
1223 \hline \bfseries Form name&\bfseries Value &\bfseries Classes \\ \hline
1225 \bfseries Form name&\bfseries Value &\bfseries Classes\\ \hline
1227 \hline \emph{Continued on next page}
1230 \ddag \ \textit{New in \addtoindex{DWARF Version 4}}
1232 \livelink{chap:DWFORMaddr}{DW\_FORM\_addr}&0x01&\livelink{chap:classaddress}{address} \\
1233 \livelink{chap:DWFORMblock2}{DW\_FORM\_block2}&0x03&\livelink{chap:classblock}{block} \\
1234 \livelink{chap:DWFORMblock4}{DW\_FORM\_block4}&0x04&\livelink{chap:classblock}{block} \\
1235 \livelink{chap:DWFORMdata2}{DW\_FORM\_data2}&0x05&\livelink{chap:classconstant}{constant} \\
1236 \livelink{chap:DWFORMdata4}{DW\_FORM\_data4}&0x06&\livelink{chap:classconstant}{constant} \\
1237 \livelink{chap:DWFORMdata8}{DW\_FORM\_data8}&0x07&\livelink{chap:classconstant}{constant} \\
1238 \livelink{chap:DWFORMstring}{DW\_FORM\_string}&0x08&\livelink{chap:classstring}{string} \\
1239 \livelink{chap:DWFORMblock}{DW\_FORM\_block}&0x09&\livelink{chap:classblock}{block} \\
1240 \livelink{chap:DWFORMblock1}{DW\_FORM\_block1}&0x0a&\livelink{chap:classblock}{block} \\
1241 \livelink{chap:DWFORMdata1}{DW\_FORM\_data1}&0x0b&\livelink{chap:classconstant}{constant} \\
1242 \livelink{chap:DWFORMflag}{DW\_FORM\_flag}&0x0c&\livelink{chap:classflag}{flag} \\
1243 \livelink{chap:DWFORMsdata}{DW\_FORM\_sdata}&0x0d&\livelink{chap:classconstant}{constant} \\
1244 \livelink{chap:DWFORMstrp}{DW\_FORM\_strp}&0x0e&\livelink{chap:classstring}{string} \\
1245 \livelink{chap:DWFORMudata}{DW\_FORM\_udata}&0x0f&\livelink{chap:classconstant}{constant} \\
1246 \livelink{chap:DWFORMrefaddr}{DW\_FORM\_ref\_addr}&0x10&\livelink{chap:classreference}{reference} \\
1247 \livelink{chap:DWFORMref1}{DW\_FORM\_ref1}&0x11&\livelink{chap:classreference}{reference} \\
1248 \livelink{chap:DWFORMref2}{DW\_FORM\_ref2}&0x12&\livelink{chap:classreference}{reference} \\
1249 \livelink{chap:DWFORMref4}{DW\_FORM\_ref4}&0x13&\livelink{chap:classreference}{reference} \\
1250 \livelink{chap:DWFORMref8}{DW\_FORM\_ref8}&0x14&\livelink{chap:classreference}{reference} \\
1251 \livelink{chap:DWFORMrefudata}{DW\_FORM\_ref\_udata}&0x15&\livelink{chap:classreference}{reference} \\
1252 \livelink{chap:DWFORMindirect}{DW\_FORM\_indirect}&0x16&(see Section \refersec{datarep:abbreviationstables}) \\
1253 \livelink{chap:DWFORMsecoffset}{DW\_FORM\_sec\_offset} \ddag &0x17&\livelink{chap:classlineptr}{lineptr}, \livelink{chap:classloclistptr}{loclistptr}, \livelink{chap:classmacptr}{macptr}, \livelink{chap:classrangelistptr}{rangelistptr} \\
1254 \livelink{chap:DWFORMexprloc}{DW\_FORM\_exprloc} \ddag &0x18&\livelink{chap:classexprloc}{exprloc} \\
1255 \livelink{chap:DWFORMflagpresent}{DW\_FORM\_flag\_present} \ddag &0x19&\livelink{chap:classflag}{flag} \\
1256 \livelink{chap:DWFORMrefsig8}{DW\_FORM\_ref\_sig8} \ddag &0x20&\livelink{chap:classreference}{reference} \\
1263 \section{Variable Length Data}
1264 \label{datarep:variablelengthdata}
1265 \addtoindexx{variable length data|see {LEB128}}
1267 \addtoindexx{Little Endian Base 128|see{LEB128}}
1268 encoded using ``Little Endian Base 128''
1269 \addtoindexx{little-endian encoding|see{endian attribute}}
1271 \addtoindexx{LEB128}
1272 LEB128 is a scheme for encoding integers
1273 densely that exploits the assumption that most integers are
1276 \textit{This encoding is equally suitable whether the target machine
1277 architecture represents data in big\dash\ endian or little\dash endian
1278 order. It is ``little\dash endian'' only in the sense that it
1279 avoids using space to represent the ``big'' end of an
1280 unsigned integer, when the big end is all zeroes or sign
1283 Unsigned LEB128 (ULEB128) numbers are encoded as follows:
1284 \addtoindexx{LEB128!unsigned, encoding as}
1285 start at the low order end of an unsigned integer and chop
1286 it into 7\dash bit chunks. Place each chunk into the low order 7
1287 bits of a byte. Typically, several of the high order bytes
1288 will be zero; discard them. Emit the remaining bytes in a
1289 stream, starting with the low order byte; set the high order
1290 bit on each byte except the last emitted byte. The high bit
1291 of zero on the last byte indicates to the decoder that it
1292 has encountered the last byte.
1294 The integer zero is a special case, consisting of a single
1297 Table \refersec{tab:examplesofunsignedleb128encodings}
1298 gives some examples of unsigned LEB128 numbers. The
1299 0x80 in each case is the high order bit of the byte, indicating
1300 that an additional byte follows.
1303 The encoding for signed, two\textquoteright s complement LEB128 (SLEB128)
1304 \addtoindexx{LEB128!signed, encoding as}
1305 numbers is similar, except that the criterion for discarding
1306 high order bytes is not whether they are zero, but whether
1307 they consist entirely of sign extension bits. Consider the
1308 32\dash bit integer -2. The three high level bytes of the number
1309 are sign extension, thus LEB128 would represent it as a single
1310 byte containing the low order 7 bits, with the high order
1311 bit cleared to indicate the end of the byte stream. Note
1312 that there is nothing within the LEB128 representation that
1313 indicates whether an encoded number is signed or unsigned. The
1314 decoder must know what type of number to expect.
1315 Table \refersec{tab:examplesofunsignedleb128encodings}
1316 gives some examples of unsigned LEB128 numbers and
1317 Table \refersec{tab:examplesofsignedleb128encodings}
1318 gives some examples of signed LEB128
1321 \textit{Appendix \refersec{app:variablelengthdataencodingdecodinginformative}
1322 \addtoindexx{LEB128!examples}
1323 gives algorithms for encoding and decoding these forms.}
1327 \setlength{\extrarowheight}{0.1cm}
1328 \begin{longtable}{l|l|l}
1329 \caption{Examples of unsigned LEB128 encodings}
1330 \label{tab:examplesofunsignedleb128encodings}
1331 \addtoindexx{LEB128 encoding!examples} \\
1332 \hline \bfseries Number&\bfseries First byte &\bfseries Second byte \\ \hline
1334 \bfseries Number&\bfseries First Byte &\bfseries Second byte\\ \hline
1336 \hline \emph{Continued on next page}
1342 128& 0 + 0x80 & 1 \\
1343 129& 1 + 0x80 & 1 \\
1344 130& 2 + 0x80 & 1 \\
1345 12857& 57 + 0x80 & 100 \\
1352 \setlength{\extrarowheight}{0.1cm}
1353 \begin{longtable}{l|l|l}
1354 \caption{Examples of signed LEB128 encodings} \label{tab:examplesofsignedleb128encodings} \\
1355 \hline \bfseries Number&\bfseries First byte &\bfseries Second byte \\ \hline
1357 \bfseries Number&\bfseries First Byte &\bfseries Second byte\\ \hline
1359 \hline \emph{Continued on next page}
1365 127& 127 + 0x80 & 0 \\
1366 -127& 1 + 0x80 & 0x7f \\
1367 128& 0 + 0x80 & 1 \\
1368 -128& 0 + 0x80 & 0x7f \\
1369 129& 1 + 0x80 & 1 \\
1370 -129& 0x7f + 0x80 & 0x7e \\
1377 \section{DWARF Expressions and Location Descriptions}
1378 \label{datarep:dwarfexpressionsandlocationdescriptions}
1379 \subsection{DWARF Expressions}
1380 \label{datarep:dwarfexpressions}
1383 \addtoindexx{DWARF Expression!operator encoding}
1384 DWARF expression is stored in a \nolink{block} of contiguous
1385 bytes. The bytes form a sequence of operations. Each operation
1386 is a 1\dash byte code that identifies that operation, followed by
1387 zero or more bytes of additional data. The encodings for the
1388 operations are described in
1389 Table \refersec{tab:dwarfoperationencodings}.
1392 \setlength{\extrarowheight}{0.1cm}
1393 \begin{longtable}{l|l|c|l}
1394 \caption{DWARF operation encodings} \label{tab:dwarfoperationencodings} \\
1395 \hline & &\bfseries No. of &\\
1396 \bfseries Operation&\bfseries Code &\bfseries Operands &\bfseries Notes\\ \hline
1398 & &\bfseries No. of &\\
1399 \bfseries Operation&\bfseries Code &\bfseries Operands &\bfseries Notes\\ \hline
1401 \hline \emph{Continued on next page}
1404 \ddag \ \textit{New in \addtoindex{DWARF Version 4}}
1407 \livelink{chap:DWOPaddr}{DW\_OP\_addr}&0x03&1 & constant address \\
1408 & & &(size target specific) \\
1410 \livelink{chap:DWOPderef}{DW\_OP\_deref}&0x06&0 & \\
1413 \livelink{chap:DWOPconst1u}{DW\_OP\_const1u}&0x08&1&1\dash byte constant \\
1414 \livelink{chap:DWOPconst1s}{DW\_OP\_const1s}&0x09&1&1\dash byte constant \\
1415 \livelink{chap:DWOPconst2u}{DW\_OP\_const2u}&0x0a&1&2\dash byte constant \\
1416 \livelink{chap:DWOPconst2s}{DW\_OP\_const2s}&0x0b&1&2\dash byte constant \\
1417 \livelink{chap:DWOPconst4u}{DW\_OP\_const4u}&0x0c&1&4\dash byte constant \\
1418 \livelink{chap:DWOPconst4s}{DW\_OP\_const4s}&0x0d&1&4\dash byte constant \\
1419 \livelink{chap:DWOPconst8u}{DW\_OP\_const8u}&0x0e&1&8\dash byte constant \\
1420 \livelink{chap:DWOPconst8s}{DW\_OP\_const8s}&0x0f&1&8\dash byte constant \\
1421 \livelink{chap:DWOPconstu}{DW\_OP\_constu}&0x10&1&ULEB128 constant \\
1422 \livelink{chap:DWOPconsts}{DW\_OP\_consts}&0x11&1&SLEB128 constant \\
1423 \livelink{chap:DWOPdup}{DW\_OP\_dup}&0x12&0 & \\
1424 \livelink{chap:DWOPdrop}{DW\_OP\_drop}&0x13&0 & \\
1425 \livelink{chap:DWOPover}{DW\_OP\_over}&0x14&0 & \\
1426 \livelink{chap:DWOPpick}{DW\_OP\_pick}&0x15&1&1\dash byte stack index \\
1427 \livelink{chap:DWOPswap}{DW\_OP\_swap}&0x16&0 & \\
1428 \livelink{chap:DWOProt}{DW\_OP\_rot}&0x17&0 & \\
1429 \livelink{chap:DWOPxderef}{DW\_OP\_xderef}&0x18&0 & \\
1430 \livelink{chap:DWOPabs}{DW\_OP\_abs}&0x19&0 & \\
1431 \livelink{chap:DWOPand}{DW\_OP\_and}&0x1a&0 & \\
1432 \livelink{chap:DWOPdiv}{DW\_OP\_div}&0x1b&0 & \\
1436 \livelink{chap:DWOPminus}{DW\_OP\_minus}&0x1c&0 & \\
1437 \livelink{chap:DWOPmod}{DW\_OP\_mod}&0x1d&0 & \\
1438 \livelink{chap:DWOPmul}{DW\_OP\_mul}&0x1e&0 & \\
1439 \livelink{chap:DWOPneg}{DW\_OP\_neg}&0x1f&0 & \\
1440 \livelink{chap:DWOPnot}{DW\_OP\_not}&0x20&0 & \\
1441 \livelink{chap:DWOPor}{DW\_OP\_or}&0x21&0 & \\
1442 \livelink{chap:DWOPplus}{DW\_OP\_plus}&0x22&0 & \\
1443 \livelink{chap:DWOPplusuconst}{DW\_OP\_plus\_uconst}&0x23&1&ULEB128 addend \\
1444 \livelink{chap:DWOPshl}{DW\_OP\_shl}&0x24&0 & \\
1445 \livelink{chap:DWOPshr}{DW\_OP\_shr}&0x25&0 & \\
1446 \livelink{chap:DWOPshra}{DW\_OP\_shra}&0x26&0 & \\
1447 \livelink{chap:DWOPxor}{DW\_OP\_xor}&0x27&0 & \\
1449 \livelink{chap:DWOPbra}{DW\_OP\_bra}&0x28&1 & signed 2\dash byte constant \\
1450 \livelink{chap:DWOPeq}{DW\_OP\_eq}&0x29&0 & \\
1451 \livelink{chap:DWOPge}{DW\_OP\_ge}&0x2a&0 & \\
1452 \livelink{chap:DWOPgt}{DW\_OP\_gt}&0x2b&0 & \\
1453 \livelink{chap:DWOPle}{DW\_OP\_le}&0x2c&0 & \\
1454 \livelink{chap:DWOPlt}{DW\_OP\_lt}&0x2d&0 & \\
1455 \livelink{chap:DWOPne}{DW\_OP\_ne}&0x2e&0 & \\
1456 \livelink{chap:DWOPskip}{DW\_OP\_skip}&0x2f&1&signed 2\dash byte constant \\ \hline
1458 \livelink{chap:DWOPlit0}{DW\_OP\_lit0}&0x30 & 0 & \\
1459 \livelink{chap:DWOPlit1}{DW\_OP\_lit1}&0x31 & 0& literals 0 .. 31 = \\
1460 \ldots & & &\hspace{0.5cm}(\livelink{chap:DWOPlit0}{DW\_OP\_lit0} + literal) \\
1461 \livelink{chap:DWOPlit31}{DW\_OP\_lit31}&0x4f & 0 & \\ \hline
1463 \livelink{chap:DWOPreg0}{DW\_OP\_reg0} & 0x50 & 0 & \\
1464 \livelink{chap:DWOPreg1}{DW\_OP\_reg1} & 0x51 & 0® 0 .. 31 = \\
1465 \ldots & & &\hspace{0.5cm}(\livelink{chap:DWOPreg0}{DW\_OP\_reg0} + regnum) \\
1466 \livelink{chap:DWOPreg31}{DW\_OP\_reg31} & 0x6f & 0 & \\ \hline
1468 \livelink{chap:DWOPbreg0}{DW\_OP\_breg0} & 0x70 &1 & SLEB128 offset \\
1469 \livelink{chap:DWOPbreg1}{DW\_OP\_breg1} & 0x71 & 1 &base register 0 .. 31 = \\
1470 ... & & &\hspace{0.5cm}(\livelink{chap:DWOPbreg0}{DW\_OP\_breg0} + regnum) \\
1471 \livelink{chap:DWOPbreg31}{DW\_OP\_breg31} & 0x8f & 1 & \\ \hline
1473 \livelink{chap:DWOPregx}{DW\_OP\_regx} & 0x90 &1&ULEB128 register \\
1474 \livelink{chap:DWOPfbreg}{DW\_OP\_fbreg} & 0x91&1&SLEB128 offset \\
1475 \livelink{chap:DWOPbregx}{DW\_OP\_bregx} & 0x92&2 &ULEB128 register followed \\
1476 & & & by SLEB128 offset \\
1477 \livelink{chap:DWOPpiece}{DW\_OP\_piece} & 0x93 &1& ULEB128 size of piece addressed \\
1478 \livelink{chap:DWOPderefsize}{DW\_OP\_deref\_size} & 0x94 &1& 1-byte size of data retrieved \\
1479 \livelink{chap:DWOPxderefsize}{DW\_OP\_xderef\_size} & 0x95&1&1-byte size of data retrieved \\
1480 \livelink{chap:DWOPnop}{DW\_OP\_nop} & 0x96 &0& \\
1483 \livelink{chap:DWOPpushobjectaddress}{DW\_OP\_push\_object\_address}&0x97&0 & \\
1484 \livelink{chap:DWOPcall2}{DW\_OP\_call2}&0x98&1& 2\dash byte offset of DIE \\
1485 \livelink{chap:DWOPcall4}{DW\_OP\_call4}&0x99&1& 4\dash byte offset of DIE \\
1486 \livelink{chap:DWOPcallref}{DW\_OP\_call\_ref}&0x9a&1& 4\dash\ or 8\dash byte\\
1487 &&& offset of DIE \\
1488 \livelink{chap:DWOPformtlsaddress}{DW\_OP\_form\_tls\_address}&0x9b &0& \\
1489 \livelink{chap:DWOPcallframecfa}{DW\_OP\_call\_frame\_cfa} &0x9c &0& \\
1490 \livelink{chap:DWOPbitpiece}{DW\_OP\_bit\_piece}&0x9d &2&ULEB128 size followed by \\
1492 \livelink{chap:DWOPimplicitvalue}{DW\_OP\_implicit\_value} \ddag &0x9e &2&ULEB128 size followed by \\
1493 &&&\nolink{block} of that size\\
1494 \livelink{chap:DWOPstackvalue}{DW\_OP\_stack\_value} \ddag &0x9f &0& \\
1495 \livelink{chap:DWXXXlohiuser}{DW\_OP\_lo\_user} &0xe0 && \\
1496 \livelink{chap:DWXXXlohiuser}{DW\_OP\_hi\_user} &\xff && \\
1502 \subsection{Location Descriptions}
1503 \label{datarep:locationdescriptions}
1505 A location description is used to compute the
1506 location of a variable or other entity.
1508 \subsection{Location Lists}
1509 \label{datarep:locationlists}
1511 Each entry in a \addtoindex{location list} is either a location list entry,
1512 a base address selection entry, or an
1513 \addtoindexx{end of list entry!in location list}
1516 A \addtoindex{location list} entry consists of two address offsets followed
1517 by a 2\dash byte length, followed by a block of contiguous bytes
1518 that contains a DWARF location description. The length
1519 specifies the number of bytes in that block. The two offsets
1520 are the same size as an address on the target machine.
1523 A base address selection entry and an
1524 \addtoindexx{end of list entry!in location list}
1525 end of list entry each
1526 consist of two (constant or relocated) address offsets. The two
1527 offsets are the same size as an address on the target machine.
1529 For a \addtoindex{location list} to be specified, the base address of
1530 \addtoindexx{base address selection entry!in location list}
1531 the corresponding compilation unit must be defined
1532 (see Section \refersec{chap:normalandpartialcompilationunitentries}).
1534 \section{Base Type Attribute Encodings}
1535 \label{datarep:basetypeattributeencodings}
1537 The encodings of the
1538 \hypertarget{chap:DWATencodingencodingofbasetype}
1540 \addtoindexx{encoding attribute!encoding}
1542 \livelink{chap:DWATencoding}{DW\_AT\_encoding}
1543 attribute are given in
1544 Table \refersec{tab:basetypeencodingvalues}
1547 \setlength{\extrarowheight}{0.1cm}
1548 \begin{longtable}{l|c}
1549 \caption{Base type encoding values} \label{tab:basetypeencodingvalues} \\
1550 \hline \bfseries Base type encoding code name&\bfseries Value \\ \hline
1552 \bfseries Base type encoding code name&\bfseries Value\\ \hline
1554 \hline \emph{Continued on next page}
1557 \ddag \ \textit{New in \addtoindex{DWARF Version 4}}
1560 \livelink{chap:DWATEaddress}{DW\_ATE\_address}&0x01 \\
1561 \livelink{chap:DWATEboolean}{DW\_ATE\_boolean}&0x02 \\
1562 \livelink{chap:DWATEcomplexfloat}{DW\_ATE\_complex\_float}&0x03 \\
1563 \livelink{chap:DWATEfloat}{DW\_ATE\_float}&0x04 \\
1564 \livelink{chap:DWATEsigned}{DW\_ATE\_signed}&0x05 \\
1565 \livelink{chap:DWATEsignedchar}{DW\_ATE\_signed\_char}&0x06 \\
1566 \livelink{chap:DWATEunsigned}{DW\_ATE\_unsigned}&0x07 \\
1567 \livelink{chap:DWATEunsignedchar}{DW\_ATE\_unsigned\_char}&0x08 \\
1568 \livelink{chap:DWATEimaginaryfloat}{DW\_ATE\_imaginary\_float}&0x09 \\
1569 \livelink{chap:DWATEpackeddecimal}{DW\_ATE\_packed\_decimal}&0x0a \\
1570 \livelink{chap:DWATEnumericstring}{DW\_ATE\_numeric\_string}&0x0b \\
1571 \livelink{chap:DWATEedited}{DW\_ATE\_edited}&0x0c \\
1572 \livelink{chap:DWATEsignedfixed}{DW\_ATE\_signed\_fixed}&0x0d \\
1573 \livelink{chap:DWATEunsignedfixed}{DW\_ATE\_unsigned\_fixed}&0x0e \\
1574 \livelink{chap:DWATEdecimalfloat}{DW\_ATE\_decimal\_float} & 0x0f \\
1575 \livelink{chap:DWATEUTF}{DW\_ATE\_UTF} \ddag & 0x10 \\
1576 \livelink{chap:DWXXXlohiuser}{DW\_ATE\_lo\_user} & 0x80 \\
1577 \livelink{chap:DWXXXlohiuser}{DW\_ATE\_hi\_user} & \xff \\
1583 The encodings of the constants used in the
1584 \livelink{chap:DWATdecimalsign}{DW\_AT\_decimal\_sign} attribute
1586 Table \refersec{tab:decimalsignencodings}.
1590 \setlength{\extrarowheight}{0.1cm}
1591 \begin{longtable}{l|c}
1592 \caption{Decimal sign encodings} \label{tab:decimalsignencodings} \\
1593 \hline \bfseries Decimal sign code name&\bfseries Value \\ \hline
1595 \bfseries Decimal sign code name&\bfseries Value\\ \hline
1597 \hline \emph{Continued on next page}
1602 \livelink{chap:DWDSunsigned}{DW\_DS\_unsigned} & 0x01 \\
1603 \livelink{chap:DWDSleadingoverpunch}{DW\_DS\_leading\_overpunch} & 0x02 \\
1604 \livelink{chap:DWDStrailingoverpunch}{DW\_DS\_trailing\_overpunch} & 0x03 \\
1605 \livelink{chap:DWDSleadingseparate}{DW\_DS\_leading\_separate} & 0x04 \\
1606 \livelink{chap:DWDStrailingseparate}{DW\_DS\_trailing\_separate} & 0x05 \\
1611 The encodings of the constants used in the
1612 \livelink{chap:DWATendianity}{DW\_AT\_endianity} attribute are given in
1613 Table \refersec{tab:endianityencodings}.
1616 \setlength{\extrarowheight}{0.1cm}
1617 \begin{longtable}{l|c}
1618 \caption{Endianity encodings} \label{tab:endianityencodings}\\
1619 \hline \bfseries Endian code name&\bfseries Value \\ \hline
1621 \bfseries Endian code name&\bfseries Value\\ \hline
1623 \hline \emph{Continued on next page}
1628 \livelink{chap:DWENDdefault}{DW\_END\_default} & 0x00 \\
1629 \livelink{chap:DWENDbig}{DW\_END\_big} & 0x01 \\
1630 \livelink{chap:DWENDlittle}{DW\_END\_little} & 0x02 \\
1631 \livelink{chap:DWXXXlohiuser}{DW\_END\_lo\_user} & 0x40 \\
1632 \livelink{chap:DWXXXlohiuser}{DW\_END\_hi\_user} & \xff \\
1637 \section{Accessibility Codes}
1638 \label{datarep:accessibilitycodes}
1639 The encodings of the constants used in the
1640 \livelink{chap:DWATaccessibility}{DW\_AT\_accessibility}
1642 \addtoindexx{accessibility attribute!encoding}
1644 Table \refersec{tab:accessibilityencodings}.
1647 \setlength{\extrarowheight}{0.1cm}
1648 \begin{longtable}{l|c}
1649 \caption{Accessibility encodings} \label{tab:accessibilityencodings}\\
1650 \hline \bfseries Accessibility code name&\bfseries Value \\ \hline
1652 \bfseries Accessibility code name&\bfseries Value\\ \hline
1654 \hline \emph{Continued on next page}
1659 \livelink{chap:DWACCESSpublic}{DW\_ACCESS\_public}&0x01 \\
1660 \livelink{chap:DWACCESSprotected}{DW\_ACCESS\_protected}&0x02 \\
1661 \livelink{chap:DWACCESSprivate}{DW\_ACCESS\_private}&0x03 \\
1667 \section{Visibility Codes}
1668 \label{datarep:visibilitycodes}
1669 The encodings of the constants used in the
1670 \livelink{chap:DWATvisibility}{DW\_AT\_visibility} attribute are given in
1671 Table \refersec{tab:visibilityencodings}.
1674 \setlength{\extrarowheight}{0.1cm}
1675 \begin{longtable}{l|c}
1676 \caption{Visibility encodings} \label{tab:visibilityencodings}\\
1677 \hline \bfseries Visiibility code name&\bfseries Value \\ \hline
1679 \bfseries Visibility code name&\bfseries Value\\ \hline
1681 \hline \emph{Continued on next page}
1686 \livelink{chap:DWVISlocal}{DW\_VIS\_local}&0x01 \\
1687 \livelink{chap:DWVISexported}{DW\_VIS\_exported}&0x02 \\
1688 \livelink{chap:DWVISqualified}{DW\_VIS\_qualified}&0x03 \\
1693 \section{Virtuality Codes}
1694 \label{datarep:vitualitycodes}
1696 The encodings of the constants used in the
1697 \livelink{chap:DWATvirtuality}{DW\_AT\_virtuality} attribute are given in
1698 Table \refersec{tab:virtualityencodings}.
1701 \setlength{\extrarowheight}{0.1cm}
1702 \begin{longtable}{l|c}
1703 \caption{Virtuality encodings} \label{tab:virtualityencodings}\\
1704 \hline \bfseries Virtuality code name&\bfseries Value \\ \hline
1706 \bfseries Virtuality code name&\bfseries Value\\ \hline
1708 \hline \emph{Continued on next page}
1713 \livelink{chap:DWVIRTUALITYnone}{DW\_VIRTUALITY\_none}&0x00 \\
1714 \livelink{chap:DWVIRTUALITYvirtual}{DW\_VIRTUALITY\_virtual}&0x01 \\
1715 \livelink{chap:DWVIRTUALITYpurevirtual}{DW\_VIRTUALITY\_pure\_virtual}&0x02 \\
1723 \livelink{chap:DWVIRTUALITYnone}{DW\_VIRTUALITY\_none} is equivalent to the absence of the
1724 \livelink{chap:DWATvirtuality}{DW\_AT\_virtuality}
1727 \section{Source Languages}
1728 \label{datarep:sourcelanguages}
1730 The encodings of the constants used
1731 \addtoindexx{language attribute, encoding}
1733 \addtoindexx{language name encoding}
1735 \livelink{chap:DWATlanguage}{DW\_AT\_language}
1736 attribute are given in
1737 Table \refersec{tab:languageencodings}.
1739 % If we don't force a following space it looks odd
1741 and their associated values are reserved, but the
1742 languages they represent are not well supported.
1743 Table \refersec{tab:languageencodings}
1745 \addtoindexx{lower bound attribute!default}
1746 default lower bound, if any, assumed for
1747 an omitted \livelink{chap:DWATlowerbound}{DW\_AT\_lower\_bound} attribute in the context of a
1748 \livelink{chap:DWTAGsubrangetype}{DW\_TAG\_subrange\_type} debugging information entry for each
1752 \setlength{\extrarowheight}{0.1cm}
1753 \begin{longtable}{l|c|c}
1754 \caption{Language encodings} \label{tab:languageencodings}\\
1755 \hline \bfseries Language name&\bfseries Value &\bfseries Default Lower Bound \\ \hline
1757 \bfseries Language name&\bfseries Value &\bfseries Default Lower Bound\\ \hline
1759 \hline \emph{Continued on next page}
1762 \dag \ \textit{See text}
1765 \livelink{chap:DWLANGC89}{DW\_LANG\_C89}&0x0001&0 \\
1766 \livelink{chap:DWLANGC}{DW\_LANG\_C}&0x0002&0 \\
1767 \livelink{chap:DWLANGAda83}{DW\_LANG\_Ada83} \dag &0x0003&1 \addtoindexx{Ada} \\
1768 \livelink{chap:DWLANGCplusplus}{DW\_LANG\_C\_plus\_plus} &0x0004&0 \\
1769 \livelink{chap:DWLANGCobol74}{DW\_LANG\_Cobol74} \dag &0x0005&1 \\
1770 \livelink{chap:DWLANGCobol85}{DW\_LANG\_Cobol85} \dag &0x0006&1 \\
1771 \livelink{chap:DWLANGFortran77}{DW\_LANG\_Fortran77}&0x0007&1 \\
1772 \livelink{chap:DWLANGFortran90}{DW\_LANG\_Fortran90}&0x0008&1 \\
1773 \livelink{chap:DWLANGPascal83}{DW\_LANG\_Pascal83}&0x0009&1 \\
1774 \livelink{chap:DWLANGModula2}{DW\_LANG\_Modula2}&0x000a&1 \\
1775 \livelink{chap:DWLANGJava}{DW\_LANG\_Java}&0x000b&0 \\
1776 \livelink{chap:DWLANGC99}{DW\_LANG\_C99}&0x000c&0 \\
1777 \livelink{chap:DWLANGAda95}{DW\_LANG\_Ada95} \dag &0x000d&1 \addtoindexx{Ada} \\
1778 \livelink{chap:DWLANGFortran95}{DW\_LANG\_Fortran95} &0x000e&1 \\
1779 \livelink{chap:DWLANGPLI}{DW\_LANG\_PLI} \dag &0x000f&1 \\
1780 \livelink{chap:DWLANGObjC}{DW\_LANG\_ObjC}&0x0010&0 \\
1781 \livelink{chap:DWLANGObjCplusplus}{DW\_LANG\_ObjC\_plus\_plus}&0x0011&0 \\
1782 \livelink{chap:DWLANGUPC}{DW\_LANG\_UPC}&0x0012&0 \\
1783 \livelink{chap:DWLANGD}{DW\_LANG\_D}&0x0013&0 \\
1784 \livelink{chap:DWLANGPython}{DW\_LANG\_Python} \dag &0x0014&0 \\
1785 \livelink{chap:DWXXXlohiuser}{DW\_LANG\_lo\_user}&0x8000 & \\
1786 \livelink{chap:DWXXXlohiuser}{DW\_LANG\_hi\_user}&\xffff & \\
1791 \section{Address Class Encodings}
1792 \label{datarep:addressclassencodings}
1794 The value of the common
1795 \addtoindexi{address}{address class!attribute encoding}
1797 \livelink{chap:DWADDRnone}{DW\_ADDR\_none} is 0.
1800 \section{Identifier Case}
1801 \label{datarep:identifiercase}
1803 The encodings of the constants used in the
1804 \livelink{chap:DWATidentifiercase}{DW\_AT\_identifier\_case} attribute are given in
1805 Table \refersec{tab:identifiercaseencodings}.
1808 \setlength{\extrarowheight}{0.1cm}
1809 \begin{longtable}{l|c}
1810 \caption{Identifier case encodings} \label{tab:identifiercaseencodings}\\
1811 \hline \bfseries Identifier case name&\bfseries Value \\ \hline
1813 \bfseries Identifier case name&\bfseries Value\\ \hline
1815 \hline \emph{Continued on next page}
1819 \livelink{chap:DWIDcasesensitive}{DW\_ID\_case\_sensitive}&0x00 \\
1820 \livelink{chap:DWIDupcase}{DW\_ID\_up\_case}&0x01 \\
1821 \livelink{chap:DWIDdowncase}{DW\_ID\_down\_case}&0x02 \\
1822 \livelink{chap:DWIDcaseinsensitive}{DW\_ID\_case\_insensitive}&0x03 \\
1826 \section{Calling Convention Encodings}
1827 \label{datarep:callingconventionencodings}
1828 The encodings of the constants used in the
1829 \livelink{chap:DWATcallingconvention}{DW\_AT\_calling\_convention} attribute are given in
1830 Table \refersec{tab:callingconventionencodings}.
1833 \setlength{\extrarowheight}{0.1cm}
1834 \begin{longtable}{l|c}
1835 \caption{Calling convention encodings} \label{tab:callingconventionencodings}\\
1836 \hline \bfseries Calling Convention name&\bfseries Value \\ \hline
1838 \bfseries Calling Convention name&\bfseries Value\\ \hline
1840 \hline \emph{Continued on next page}
1845 \livelink{chap:DWCCnormal}{DW\_CC\_normal}&0x01 \\
1846 \livelink{chap:DWCCprogram}{DW\_CC\_program}&0x02 \\
1847 \livelink{chap:DWCCnocall}{DW\_CC\_nocall}&0x03 \\
1848 \livelink{chap:DWXXXlohiuser}{DW\_CC\_lo\_user}&0x40 \\
1849 \livelink{chap:DWXXXlohiuser}{DW\_CC\_hi\_user}&\xff \\
1854 \section{Inline Codes}
1855 \label{datarep:inlinecodes}
1857 The encodings of the constants used in
1858 \addtoindexx{inline attribute!encoding}
1860 \livelink{chap:DWATinline}{DW\_AT\_inline} attribute are given in
1861 Table \refersec{tab:inlineencodings}.
1865 \setlength{\extrarowheight}{0.1cm}
1866 \begin{longtable}{l|c}
1867 \caption{Inline encodings} \label{tab:inlineencodings}\\
1868 \hline \bfseries Inline Code name&\bfseries Value \\ \hline
1870 \bfseries Inline Code name&\bfseries Value\\ \hline
1872 \hline \emph{Continued on next page}
1877 \livelink{chap:DWINLnotinlined}{DW\_INL\_not\_inlined}&0x00 \\
1878 \livelink{chap:DWINLinlined}{DW\_INL\_inlined}&0x01 \\
1879 \livelink{chap:DWINLdeclarednotinlined}{DW\_INL\_declared\_not\_inlined}&0x02 \\
1880 \livelink{chap:DWINLdeclaredinlined}{DW\_INL\_declared\_inlined}&0x03 \\
1885 % this clearpage is ugly, but the following table came
1886 % out oddly without it.
1888 \section{Array Ordering}
1889 \label{datarep:arrayordering}
1891 The encodings of the constants used in the
1892 \livelink{chap:DWATordering}{DW\_AT\_ordering} attribute are given in
1893 Table \refersec{tab:orderingencodings}.
1896 \setlength{\extrarowheight}{0.1cm}
1897 \begin{longtable}{l|c}
1898 \caption{Ordering encodings} \label{tab:orderingencodings}\\
1899 \hline \bfseries Ordering name&\bfseries Value \\ \hline
1901 \bfseries Ordering name&\bfseries Value\\ \hline
1903 \hline \emph{Continued on next page}
1908 \livelink{chap:DWORDrowmajor}{DW\_ORD\_row\_major}&0x00 \\
1909 \livelink{chap:DWORDcolmajor}{DW\_ORD\_col\_major}&0x01 \\
1915 \section{Discriminant Lists}
1916 \label{datarep:discriminantlists}
1918 The descriptors used in
1919 \addtoindexx{discriminant list attribute!encoding}
1921 \livelink{chap:DWATdiscrlist}{DW\_AT\_discr\_list} attribute are
1922 encoded as 1\dash byte constants. The
1923 defined values are given in
1924 Table \refersec{tab:discriminantdescriptorencodings}.
1926 % Odd that the 'Name' field capitalized here, it is not caps elsewhere.
1928 \setlength{\extrarowheight}{0.1cm}
1929 \begin{longtable}{l|c}
1930 \caption{Discriminant descriptor encodings} \label{tab:discriminantdescriptorencodings}\\
1931 \hline \bfseries Descriptor Name&\bfseries Value \\ \hline
1933 \bfseries Descriptor Name&\bfseries Value\\ \hline
1935 \hline \emph{Continued on next page}
1940 \livelink{chap:DWDSClabel}{DW\_DSC\_label}&0x00 \\
1941 \livelink{chap:DWDSCrange}{DW\_DSC\_range}&0x01 \\
1947 \section{Name Lookup Tables}
1948 \label{datarep:namelookuptables}
1950 Each set of entries in the table of global names contained
1951 in the \dotdebugpubnames{} and
1952 \dotdebugpubtypes{} sections begins
1953 with a header consisting of:
1954 \begin{enumerate}[1. ]
1956 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
1957 \addttindexx{unit\_length}
1958 A 4\dash byte or 12\dash byte unsigned integer
1959 \addtoindexx{initial length}
1960 representing the length
1961 of the \dotdebuginfo{}
1962 contribution for that compilation unit,
1963 not including the length field itself. In the
1964 \thirtytwobitdwarfformat, this is a 4\dash byte unsigned integer (which must be less
1965 than \xfffffffzero); in the \sixtyfourbitdwarfformat, this consists
1966 of the 4\dash byte value \wffffffff followed by an 8\dash byte unsigned
1967 integer that gives the actual length
1968 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1970 \item version (\addtoindex{uhalf}) \\
1971 A 2\dash byte unsigned integer representing the version of the
1972 DWARF information for the name lookup table
1973 \addtoindexx{version number!name lookup table}
1974 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
1975 The value in this field is 2.
1977 % Some say unsigned offset this just says offset: FIXME
1978 \item \addtoindex{debug\_info\_offset} (section offset) \\
1980 \addtoindexx{section offset!in name lookup table set of entries}
1981 4\dash byte or 8\dash byte
1984 section of the compilation unit header.
1985 In the \thirtytwobitdwarfformat, this is a 4\dash byte unsigned offset;
1986 in the \sixtyfourbitdwarfformat, this is an 8\dash byte unsigned offsets
1987 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1989 \item \addtoindex{debug\_info\_length} (\livelink{datarep:sectionoffsetlength}{section length}) \\
1990 \addtoindexx{section length!in .debug\_pubnames header}
1992 \addtoindexx{section length!in .debug\_pubtypes header}
1993 4\dash byte or 8\dash byte length containing the size in bytes of the
1994 contents of the \dotdebuginfo{}
1995 section generated to represent
1996 this compilation unit. In the \thirtytwobitdwarfformat, this is
1997 a 4\dash byte unsigned length; in the \sixtyfourbitdwarfformat, this
1998 is an 8-byte unsigned length
1999 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
2004 This header is followed by a series of tuples. Each tuple
2005 consists of a 4\dash byte or 8\dash byte offset followed by a string
2006 of non\dash null bytes terminated by one null byte.
2008 DWARF format, this is a 4\dash byte offset; in the 64\dash bit DWARF
2009 format, it is an 8\dash byte offset.
2010 Each set is terminated by an
2011 offset containing the value 0.
2015 \section{Address Range Table}
2016 \label{datarep:addrssrangetable}
2018 Each set of entries in the table of address ranges contained
2019 in the \dotdebugaranges{}
2020 section begins with a header containing:
2021 \begin{enumerate}[1. ]
2022 % FIXME The unit length text is not fully consistent across
2025 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
2026 \addttindexx{unit\_length}
2027 A 4-byte or 12-byte length containing the length of the
2028 \addtoindexx{initial length}
2029 set of entries for this compilation unit, not including the
2030 length field itself. In the \thirtytwobitdwarfformat, this is a
2031 4-byte unsigned integer (which must be less than \xfffffffzero);
2032 in the \sixtyfourbitdwarfformat, this consists of the 4-byte value
2033 \wffffffff followed by an 8-byte unsigned integer that gives
2035 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
2037 \item version (\addtoindex{uhalf}) \\
2038 A 2\dash byte version identifier representing the version of the
2039 DWARF information for the address range table
2040 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
2041 This value in this field \addtoindexx{version number!address range table} is 2.
2044 \item debug\_info\_offset (\livelink{datarep:sectionoffsetlength}{section offset}) \\
2046 \addtoindexx{section offset!in .debug\_aranges header}
2047 4\dash byte or 8\dash byte offset into the
2048 \dotdebuginfo{} section of
2049 the compilation unit header. In the \thirtytwobitdwarfformat,
2050 this is a 4\dash byte unsigned offset; in the \sixtyfourbitdwarfformat,
2051 this is an 8\dash byte unsigned offset
2052 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
2054 \item address\_size (ubyte) \\
2055 A 1\dash byte unsigned integer containing the size in bytes of an
2056 \addtoindexx{address\_size}
2058 \addtoindexx{size of an address}
2059 (or the offset portion of an address for segmented
2060 \addtoindexx{address space!segmented}
2061 addressing) on the target system.
2063 \item segment\_size (ubyte) \\
2065 \addtoindexx{segment\_size}
2066 1\dash byte unsigned integer containing the size in bytes of a
2067 segment selector on the target system.
2071 This header is followed by a series of tuples. Each tuple
2072 consists of a segment, an address and a length.
2074 size is given by the \addtoindex{segment\_size} field of the header; the
2075 address and length size are each given by the address\_size
2076 field of the header.
2077 The first tuple following the header in
2078 each set begins at an offset that is a multiple of the size
2079 of a single tuple (that is, the size of a segment selector
2080 plus twice the \addtoindex{size of an address}).
2081 The header is padded, if
2082 necessary, to that boundary. Each set of tuples is terminated
2083 by a 0 for the segment, a 0 for the address and 0 for the
2084 length. If the \addtoindex{segment\_size} field in the header is zero,
2085 the segment selectors are omitted from all tuples, including
2086 the terminating tuple.
2089 \section{Line Number Information}
2090 \label{datarep:linenumberinformation}
2092 The \addtoindexi{version number}{version number!line number information}
2093 in the line number program header is 4
2094 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
2096 The boolean values ``true'' and ``false''
2097 used by the line number information program are encoded
2098 as a single byte containing the value 0
2099 for ``false,'' and a non-zero value for ``true.''
2101 The encodings for the standard opcodes are given in
2102 \addtoindexx{line number opcodes!standard opcode encoding}
2103 Table \refersec{tab:linenumberstandardopcodeencodings}.
2105 % Odd that the 'Name' field capitalized here, it is not caps elsewhere.
2107 \setlength{\extrarowheight}{0.1cm}
2108 \begin{longtable}{l|c}
2109 \caption{Line Number Standard Opcode encodings} \label{tab:linenumberstandardopcodeencodings}\\
2110 \hline \bfseries Opcode Name&\bfseries Value \\ \hline
2112 \bfseries Opcode Name&\bfseries Value\\ \hline
2114 \hline \emph{Continued on next page}
2119 \livelink{chap:DWLNScopy}{DW\_LNS\_copy}&0x01 \\
2120 \livelink{chap:DWLNSadvancepc}{DW\_LNS\_advance\_pc}&0x02 \\
2121 \livelink{chap:DWLNSadvanceline}{DW\_LNS\_advance\_line}&0x03 \\
2122 \livelink{chap:DWLNSsetfile}{DW\_LNS\_set\_file}&0x04 \\
2123 \livelink{chap:DWLNSsetcolumn}{DW\_LNS\_set\_column}&0x05 \\
2124 \livelink{chap:DWLNSnegatestmt}{DW\_LNS\_negate\_stmt}&0x06 \\
2125 \livelink{chap:DWLNSsetbasicblock}{DW\_LNS\_set\_basic\_block}&0x07 \\
2126 \livelink{chap:DWLNSconstaddpc}{DW\_LNS\_const\_add\_pc}&0x08 \\
2127 \livelink{chap:DWLNSfixedadvancepc}{DW\_LNS\_fixed\_advance\_pc}&0x09 \\
2128 \livelink{chap:DWLNSsetprologueend}{DW\_LNS\_set\_prologue\_end}&0x0a \\
2129 \livelink{chap:DWLNSsetepiloguebegin}{DW\_LNS\_set\_epilogue\_begin}&0x0b \\
2130 \livelink{chap:DWLNSsetisa}{DW\_LNS\_set\_isa}&0x0c \\
2137 The encodings for the extended opcodes are given in
2138 \addtoindexx{line number opcodes!extended opcode encoding}
2139 Table \refersec{tab:linenumberextendedopcodeencodings}.
2142 \setlength{\extrarowheight}{0.1cm}
2143 \begin{longtable}{l|c}
2144 \caption{Line Number Extended Opcode encodings} \label{tab:linenumberextendedopcodeencodings}\\
2145 \hline \bfseries Opcode Name&\bfseries Value \\ \hline
2147 \bfseries Opcode Name&\bfseries Value\\ \hline
2149 \hline \emph{Continued on next page}
2152 \ddag \ \textit{New in \addtoindex{DWARF Version 4}}
2155 \livelink{chap:DWLNEendsequence}{DW\_LNE\_end\_sequence}&0x01 \\
2156 \livelink{chap:DWLNEsetaddress}{DW\_LNE\_set\_address}&0x02\\
2157 \livelink{chap:DWLNEdefinefile}{DW\_LNE\_define\_file}&0x03\\
2158 \livelink{chap:DWLNEsetdiscriminator}{DW\_LNE\_set\_discriminator} \ddag &0x04 \\
2159 \livelink{chap:DWXXXlohiuser}{DW\_LNE\_lo\_user}&0x80 \\
2160 \livelink{chap:DWXXXlohiuser}{DW\_LNE\_hi\_user}&\xff \\
2165 \section{Macro Information}
2166 \label{datarep:macroinformation}
2168 The source line numbers and source file indices encoded in the
2169 macro information section are represented as unsigned LEB128
2170 numbers as are the constants in a
2171 \livelink{chap:DWMACINFOvendorext}{DW\_MACINFO\_vendor\_ext} entry.
2173 The macinfo type is encoded as a single byte.
2175 \addtoindexx{macinfo types!encoding}
2177 Table \refersec{tab:macinfotypeencodings}.
2181 \setlength{\extrarowheight}{0.1cm}
2182 \begin{longtable}{l|c}
2183 \caption{Macinfo Type Encodings} \label{tab:macinfotypeencodings}\\
2184 \hline \bfseries Macinfo Type Name&\bfseries Value \\ \hline
2186 \bfseries Macinfo Type Name&\bfseries Value\\ \hline
2188 \hline \emph{Continued on next page}
2193 \livelink{chap:DWMACINFOdefine}{DW\_MACINFO\_define}&0x01 \\
2194 \livelink{chap:DWMACINFOundef}{DW\_MACINFO\_undef}&0x02 \\
2195 \livelink{chap:DWMACINFOstartfile}{DW\_MACINFO\_start\_file}&0x03 \\
2196 \livelink{chap:DWMACINFOendfile}{DW\_MACINFO\_end\_file}&0x04 \\
2197 \livelink{chap:DWMACINFOvendorext}{DW\_MACINFO\_vendor\_ext}&\xff \\
2203 \section{Call Frame Information}
2204 \label{datarep:callframeinformation}
2206 In the \thirtytwobitdwarfformat, the value of the CIE id in the
2207 CIE header is \xffffffff; in the \sixtyfourbitdwarfformat, the
2208 value is \xffffffffffffffff.
2210 The value of the CIE \addtoindexi{version number}{version number!call frame information}
2211 is 4 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
2213 Call frame instructions are encoded in one or more bytes. The
2214 primary opcode is encoded in the high order two bits of
2215 the first byte (that is, opcode = byte $\gg$ 6). An operand
2216 or extended opcode may be encoded in the low order 6
2217 bits. Additional operands are encoded in subsequent bytes.
2218 The instructions and their encodings are presented in
2219 Table \refersec{tab:callframeinstructionencodings}.
2222 \setlength{\extrarowheight}{0.1cm}
2223 \begin{longtable}{l|c|c|l|l}
2224 \caption{Call frame instruction encodings} \label{tab:callframeinstructionencodings} \\
2225 \hline &\bfseries High 2 &\bfseries Low 6 & & \\
2226 \bfseries Instruction&\bfseries Bits &\bfseries Bits &\bfseries Operand 1 &\bfseries Operand 2\\ \hline
2228 & \bfseries High 2 &\bfseries Low 6 & &\\
2229 \bfseries Instruction&\bfseries Bits &\bfseries Bits &\bfseries Operand 1 &\bfseries Operand 2\\ \hline
2231 \hline \emph{Continued on next page}
2236 \livelink{chap:DWCFAadvanceloc}{DW\_CFA\_advance\_loc}&0x1&delta & \\
2237 \livelink{chap:DWCFAoffset}{DW\_CFA\_offset}&0x2®ister&ULEB128 offset \\
2238 \livelink{chap:DWCFArestore}{DW\_CFA\_restore}&0x3®ister & & \\
2239 \livelink{chap:DWCFAnop}{DW\_CFA\_nop}&0&0 & & \\
2240 \livelink{chap:DWCFAsetloc}{DW\_CFA\_set\_loc}&0&0x01&address & \\
2241 \livelink{chap:DWCFAadvanceloc1}{DW\_CFA\_advance\_loc1}&0&0x02&1\dash byte delta & \\
2242 \livelink{chap:DWCFAadvanceloc2}{DW\_CFA\_advance\_loc2}&0&0x03&2\dash byte delta & \\
2243 \livelink{chap:DWCFAadvanceloc4}{DW\_CFA\_advance\_loc4}&0&0x04&4\dash byte delta & \\
2244 \livelink{chap:DWCFAoffsetextended}{DW\_CFA\_offset\_extended}&0&0x05&ULEB128 register&ULEB128 offset \\
2245 \livelink{chap:DWCFArestoreextended}{DW\_CFA\_restore\_extended}&0&0x06&ULEB128 register & \\
2246 \livelink{chap:DWCFAundefined}{DW\_CFA\_undefined}&0&0x07&ULEB128 register & \\
2247 \livelink{chap:DWCFAsamevalue}{DW\_CFA\_same\_value}&0&0x08 &ULEB128 register & \\
2248 \livelink{chap:DWCFAregister}{DW\_CFA\_register}&0&0x09&ULEB128 register &ULEB128 offset \\
2249 \livelink{chap:DWCFArememberstate}{DW\_CFA\_remember\_state}&0&0x0a & & \\
2250 \livelink{chap:DWCFArestorestate}{DW\_CFA\_restore\_state}&0&0x0b & & \\
2251 \livelink{chap:DWCFAdefcfa}{DW\_CFA\_def\_cfa}&0&0x0c &ULEB128 register&ULEB128 offset \\
2252 \livelink{chap:DWCFAdefcfaregister}{DW\_CFA\_def\_cfa\_register}&0&0x0d&ULEB128 register & \\
2253 \livelink{chap:DWCFAdefcfaoffset}{DW\_CFA\_def\_cfa\_offset}&0&0x0e &ULEB128 offset & \\
2254 \livelink{chap:DWCFAdefcfaexpression}{DW\_CFA\_def\_cfa\_expression}&0&0x0f &BLOCK \\
2255 \livelink{chap:DWCFAexpression}{DW\_CFA\_expression}&0&0x10&ULEB128 register & BLOCK \\
2257 \livelink{chap:DWCFAoffsetextendedsf}{DW\_CFA\_offset\_extended\_sf}&0&0x11&ULEB128 register&SLEB128 offset \\
2258 \livelink{chap:DWCFAdefcfasf}{DW\_CFA\_def\_cfa\_sf}&0&0x12&ULEB128 register&SLEB128 offset \\
2259 \livelink{chap:DWCFAdefcfaoffsetsf}{DW\_CFA\_def\_cfa\_offset\_sf}&0&0x13&SLEB128 offset & \\
2260 \livelink{chap:DWCFAvaloffset}{DW\_CFA\_val\_offset}&0&0x14&ULEB128&ULEB128 \\
2261 \livelink{chap:DWCFAvaloffsetsf}{DW\_CFA\_val\_offset\_sf}&0&0x15&ULEB128&SLEB128 \\
2262 \livelink{chap:DWCFAvalexpression}{DW\_CFA\_val\_expression}&0&0x16&ULEB128&BLOCK \\
2263 \livelink{chap:DWXXXlohiuser}{DW\_CFA\_lo\_user}&0&0x1c & & \\
2264 \livelink{chap:DWXXXlohiuser}{DW\_CFA\_hi\_user}&0&\xiiif & & \\
2268 \section{Non-contiguous Address Ranges}
2269 \label{datarep:noncontiguousaddressranges}
2271 Each entry in a \addtoindex{range list}
2272 (see Section \refersec{chap:noncontiguousaddressranges})
2274 \addtoindexx{base address selection entry!in range list}
2276 \addtoindexx{range list}
2277 a base address selection entry, or an end
2280 A \addtoindex{range list} entry consists of two relative addresses. The
2281 addresses are the same size as addresses on the target machine.
2283 A base address selection entry and an
2284 \addtoindexx{end of list entry!in range list}
2285 end of list entry each
2286 \addtoindexx{base address selection entry!in range list}
2287 consist of two (constant or relocated) addresses. The two
2288 addresses are the same size as addresses on the target machine.
2290 For a \addtoindex{range list} to be specified, the base address of the
2291 \addtoindexx{base address selection entry!in range list}
2292 corresponding compilation unit must be defined
2293 (see Section \refersec{chap:normalandpartialcompilationunitentries}).
2296 \section{Dependencies and Constraints}
2297 \label{datarep:dependenciesandconstraints}
2299 The debugging information in this format is intended to
2301 \addtoindexx{DWARF section names!list of}
2303 the \dotdebugabbrev{},
2310 \dotdebugpubnames{},
2311 \dotdebugpubtypes{},
2316 sections of an object file, or equivalent
2317 separate file or database. The information is not
2318 word\dash aligned. Consequently:
2321 \item For the \thirtytwobitdwarfformat{} and a target architecture with
2322 32\dash bit addresses, an assembler or compiler must provide a way
2323 to produce 2\dash byte and 4\dash byte quantities without alignment
2324 restrictions, and the linker must be able to relocate a
2325 4\dash byte address or
2326 \addtoindexx{section offset!alignment of}
2327 section offset that occurs at an arbitrary
2330 \item For the \thirtytwobitdwarfformat{} and a target architecture with
2331 64\dash bit addresses, an assembler or compiler must provide a
2332 way to produce 2\dash byte, 4\dash byte and 8\dash byte quantities without
2333 alignment restrictions, and the linker must be able to relocate
2334 an 8\dash byte address or 4\dash byte
2335 \addtoindexx{section offset!alignment of}
2336 section offset that occurs at an
2337 arbitrary alignment.
2339 \item For the \sixtyfourbitdwarfformat{} and a target architecture with
2340 32\dash bit addresses, an assembler or compiler must provide a
2341 way to produce 2\dash byte, 4\dash byte and 8\dash byte quantities without
2342 alignment restrictions, and the linker must be able to relocate
2343 a 4\dash byte address or 8\dash byte
2344 \addtoindexx{section offset!alignment of}
2345 section offset that occurs at an
2346 arbitrary alignment.
2348 \textit{It is expected that this will be required only for very large
2349 32\dash bit programs or by those architectures which support
2350 a mix of 32\dash bit and 64\dash bit code and data within the same
2353 \item For the \sixtyfourbitdwarfformat{} and a target architecture with
2354 64\dash bit addresses, an assembler or compiler must provide a
2355 way to produce 2\dash byte, 4\dash byte and 8\dash byte quantities without
2356 alignment restrictions, and the linker must be able to
2357 relocate an 8\dash byte address or
2358 \addtoindexx{section offset!alignment of}
2359 section offset that occurs at
2360 an arbitrary alignment.
2363 \section{Integer Representation Names}
2364 \label{datarep:integerrepresentationnames}
2366 The sizes of the integers used in the lookup by name, lookup
2367 by address, line number and call frame information sections
2369 Table 41 \refersec{tab:integerrepresentationnames}.
2372 \setlength{\extrarowheight}{0.1cm}
2373 \begin{longtable}{c|l}
2374 \caption{Integer Representation Names} \label{tab:integerrepresentationnames}\\
2375 \hline \bfseries Representation Name&\bfseries Representation \\ \hline
2377 \bfseries Representation Name&\bfseries Representation\\ \hline
2379 \hline \emph{Continued on next page}
2384 \addtoindex{sbyte}& signed, 1\dash byte integer \\
2385 \addtoindex{ubyte}&unsigned, 1\dash byte integer \\
2386 \addtoindex{uhalf}&unsigned, 2\dash byte integer \\
2387 \addtoindex{uword}&unsigned, 4\dash byte integer \\
2393 \section{Type Signature Computation}
2394 \label{datarep:typesignaturecomputation}
2396 A type signature is computed only by the DWARF producer;
2397 \addtoindexx{type signature computation}
2398 it is used by a DWARF consumer to resolve type references to
2399 the type definitions that are contained in
2400 \addtoindexx{type unit}
2403 The type signature for a type T0 is formed from the
2404 \addtoindex{MD5 hash}
2405 of a flattened description of the type. The flattened
2406 description of the type is a byte sequence derived from the
2407 DWARF encoding of the type as follows:
2408 \begin{enumerate}[1. ]
2410 \item Start with an empty sequence S and a list V of visited
2411 types, where V is initialized to a list containing the type
2412 T0 as its single element. Elements in V are indexed from 1,
2415 \item If the debugging information entry represents a type that
2416 is nested inside another type or a namespace, append to S
2417 the type\textquoteright s context as follows: For each surrounding type
2418 or namespace, beginning with the outermost such construct,
2419 append the letter 'C', the DWARF tag of the construct, and
2420 the name (taken from
2421 \addtoindexx{name attribute}
2422 the \livelink{chap:DWATname}{DW\_AT\_name} attribute) of the type
2423 \addtoindexx{name attribute}
2424 or namespace (including its trailing null byte).
2426 \item Append to S the letter 'D', followed by the DWARF tag of
2427 the debugging information entry.
2429 \item For each of the attributes in
2430 Table \refersec{tab:attributesusedintypesignaturecomputation}
2432 the debugging information entry, in the order listed,
2433 append to S a marker letter (see below), the DWARF attribute
2434 code, and the attribute value.
2437 \caption{Attributes used in type signature computation}
2438 \label{tab:attributesusedintypesignaturecomputation}
2439 \simplerule[\textwidth]
2441 \autocols[0pt]{c}{2}{l}{
2442 \livelink{chap:DWATname}{DW\_AT\_name},
2443 \livelink{chap:DWATaccessibility}{DW\_AT\_accessibility},
2444 \livelink{chap:DWATaddressclass}{DW\_AT\_address\_class},
2445 \livelink{chap:DWATallocated}{DW\_AT\_allocated},
2446 \livelink{chap:DWATartificial}{DW\_AT\_artificial},
2447 \livelink{chap:DWATassociated}{DW\_AT\_associated},
2448 \livelink{chap:DWATbinaryscale}{DW\_AT\_binary\_scale},
2449 \livelink{chap:DWATbitoffset}{DW\_AT\_bit\_offset},
2450 \livelink{chap:DWATbitsize}{DW\_AT\_bit\_size},
2451 \livelink{chap:DWATbitstride}{DW\_AT\_bit\_stride},
2452 \livelink{chap:DWATbytesize}{DW\_AT\_byte\_size},
2453 \livelink{chap:DWATbytestride}{DW\_AT\_byte\_stride},
2454 \livelink{chap:DWATconstexpr}{DW\_AT\_const\_expr},
2455 \livelink{chap:DWATconstvalue}{DW\_AT\_const\_value},
2456 \livelink{chap:DWATcontainingtype}{DW\_AT\_containing\_type},
2457 \livelink{chap:DWATcount}{DW\_AT\_count},
2458 \livelink{chap:DWATdatabitoffset}{DW\_AT\_data\_bit\_offset},
2459 \livelink{chap:DWATdatalocation}{DW\_AT\_data\_location},
2460 \livelink{chap:DWATdatamemberlocation}{DW\_AT\_data\_member\_location},
2461 \livelink{chap:DWATdecimalscale}{DW\_AT\_decimal\_scale},
2462 \livelink{chap:DWATdecimalsign}{DW\_AT\_decimal\_sign},
2463 \livelink{chap:DWATdefaultvalue}{DW\_AT\_default\_value},
2464 \livelink{chap:DWATdigitcount}{DW\_AT\_digit\_count},
2465 \livelink{chap:DWATdiscr}{DW\_AT\_discr},
2466 \livelink{chap:DWATdiscrlist}{DW\_AT\_discr\_list},
2467 \livelink{chap:DWATdiscrvalue}{DW\_AT\_discr\_value},
2468 \livelink{chap:DWATencoding}{DW\_AT\_encoding},
2469 \livelink{chap:DWATenumclass}{DW\_AT\_enum\_class},
2470 \livelink{chap:DWATendianity}{DW\_AT\_endianity},
2471 \livelink{chap:DWATexplicit}{DW\_AT\_explicit},
2472 \livelink{chap:DWATisoptional}{DW\_AT\_is\_optional},
2473 \livelink{chap:DWATlocation}{DW\_AT\_location},
2474 \livelink{chap:DWATlowerbound}{DW\_AT\_lower\_bound},
2475 \livelink{chap:DWATmutable}{DW\_AT\_mutable},
2476 \livelink{chap:DWATordering}{DW\_AT\_ordering},
2477 \livelink{chap:DWATpicturestring}{DW\_AT\_picture\_string},
2478 \livelink{chap:DWATprototyped}{DW\_AT\_prototyped},
2479 \livelink{chap:DWATsmall}{DW\_AT\_small},
2480 \livelink{chap:DWATsegment}{DW\_AT\_segment},
2481 \livelink{chap:DWATstringlength}{DW\_AT\_string\_length},
2482 \livelink{chap:DWATthreadsscaled}{DW\_AT\_threads\_scaled},
2483 \livelink{chap:DWATupperbound}{DW\_AT\_upper\_bound},
2484 \livelink{chap:DWATuselocation}{DW\_AT\_use\_location},
2485 \livelink{chap:DWATuseUTF8}{DW\_AT\_use\_UTF8},
2486 \livelink{chap:DWATvariableparameter}{DW\_AT\_variable\_parameter},
2487 \livelink{chap:DWATvirtuality}{DW\_AT\_virtuality},
2488 \livelink{chap:DWATvisibility}{DW\_AT\_visibility},
2489 \livelink{chap:DWATvtableelemlocation}{DW\_AT\_vtable\_elem\_location}
2492 \simplerule[\textwidth]
2495 Note that except for the initial
2496 \livelink{chap:DWATname}{DW\_AT\_name} attribute,
2497 \addtoindexx{name attribute}
2498 attributes are appended in order according to the alphabetical
2499 spelling of their identifier.
2501 If an implementation defines any vendor-specific attributes,
2502 any such attributes that are essential to the definition of
2503 the type should also be included at the end of the above list,
2504 in their own alphabetical suborder.
2506 An attribute that refers to another type entry T is processed
2507 as follows: (a) If T is in the list V at some V[x], use the
2508 letter 'R' as the marker and use the unsigned LEB128 encoding
2509 of x as the attribute value; otherwise, (b) use the letter 'T'
2510 as the marker, process the type T recursively by performing
2511 Steps 2 through 7, and use the result as the attribute value.
2513 Other attribute values use the letter 'A' as the marker, and
2514 the value consists of the form code (encoded as an unsigned
2515 LEB128 value) followed by the encoding of the value according
2516 to the form code. To ensure reproducibility of the signature,
2517 the set of forms used in the signature computation is limited
2518 to the following: \livelink{chap:DWFORMsdata}{DW\_FORM\_sdata},
2519 \livelink{chap:DWFORMflag}{DW\_FORM\_flag},
2520 \livelink{chap:DWFORMstring}{DW\_FORM\_string},
2521 and \livelink{chap:DWFORMblock}{DW\_FORM\_block}.
2523 \item If the tag in Step 3 is one of \livelink{chap:DWTAGpointertype}{DW\_TAG\_pointer\_type},
2524 \livelink{chap:DWTAGreferencetype}{DW\_TAG\_reference\_type},
2525 \livelink{chap:DWTAGrvaluereferencetype}{DW\_TAG\_rvalue\_reference\_type},
2526 \livelink{chap:DWTAGptrtomembertype}{DW\_TAG\_ptr\_to\_member\_type},
2527 or \livelink{chap:DWTAGfriend}{DW\_TAG\_friend}, and the referenced
2528 type (via the \livelink{chap:DWATtype}{DW\_AT\_type} or
2529 \livelink{chap:DWATfriend}{DW\_AT\_friend} attribute) has a
2530 \livelink{chap:DWATname}{DW\_AT\_name} attribute, append to S the letter 'N', the DWARF
2531 attribute code (\livelink{chap:DWATtype}{DW\_AT\_type} or
2532 \livelink{chap:DWATfriend}{DW\_AT\_friend}), the context of
2533 the type (according to the method in Step 2), the letter 'E',
2534 and the name of the type. For \livelink{chap:DWTAGfriend}{DW\_TAG\_friend}, if the referenced
2535 entry is a \livelink{chap:DWTAGsubprogram}{DW\_TAG\_subprogram}, the context is omitted and the
2536 name to be used is the ABI-specific name of the subprogram
2537 (e.g., the mangled linker name).
2540 \item If the tag in Step 3 is not one of \livelink{chap:DWTAGpointertype}{DW\_TAG\_pointer\_type},
2541 \livelink{chap:DWTAGreferencetype}{DW\_TAG\_reference\_type},
2542 \livelink{chap:DWTAGrvaluereferencetype}{DW\_TAG\_rvalue\_reference\_type},
2543 \livelink{chap:DWTAGptrtomembertype}{DW\_TAG\_ptr\_to\_member\_type}, or
2544 \livelink{chap:DWTAGfriend}{DW\_TAG\_friend}, but has
2545 a \livelink{chap:DWATtype}{DW\_AT\_type} attribute, or if the referenced type (via
2546 the \livelink{chap:DWATtype}{DW\_AT\_type} or
2547 \livelink{chap:DWATfriend}{DW\_AT\_friend} attribute) does not have a
2548 \livelink{chap:DWATname}{DW\_AT\_name} attribute, the attribute is processed according to
2549 the method in Step 4 for an attribute that refers to another
2553 \item Visit each child C of the debugging information
2554 entry as follows: If C is a nested type entry or a member
2555 function entry, and has
2556 a \livelink{chap:DWATname}{DW\_AT\_name} attribute, append to
2557 \addtoindexx{name attribute}
2558 S the letter 'S', the tag of C, and its name; otherwise,
2559 process C recursively by performing Steps 3 through 7,
2560 appending the result to S. Following the last child (or if
2561 there are no children), append a zero byte.
2566 For the purposes of this algorithm, if a debugging information
2568 \livelink{chap:DWATspecification}{DW\_AT\_specification}
2569 attribute that refers to
2570 another entry D (which has a
2571 \livelink{chap:DWATdeclaration}{DW\_AT\_declaration}
2573 then S inherits the attributes and children of D, and S is
2574 processed as if those attributes and children were present in
2575 the entry S. Exception: if a particular attribute is found in
2576 both S and D, the attribute in S is used and the corresponding
2577 one in D is ignored.
2579 DWARF tag and attribute codes are appended to the sequence
2580 as unsigned LEB128 values, using the values defined earlier
2583 \textit{A grammar describing this computation may be found in
2584 Appendix \refersec{app:typesignaturecomputationgrammar}.
2587 \textit{An attribute that refers to another type entry should
2588 be recursively processed or replaced with the name of the
2589 referent (in Step 4, 5 or 6). If neither treatment applies to
2590 an attribute that references another type entry, the entry
2591 that contains that attribute should not be considered for a
2592 separate \addtoindex{type unit}.}
2594 \textit{If a debugging information entry contains an attribute from
2595 the list above that would require an unsupported form, that
2596 entry should not be considered for a separate
2597 \addtoindex{type unit}.}
2599 \textit{A type should be considered for a separate
2600 \addtoindex{type unit} only
2601 if all of the type entries that it contains or refers to in
2602 Steps 6 and 7 can themselves each be considered for a separate
2603 \addtoindex{type unit}.}
2606 Where the DWARF producer may reasonably choose two or more
2607 different forms for a given attribute, it should choose
2608 the simplest possible form in computing the signature. (For
2609 example, a constant value should be preferred to a location
2610 expression when possible.)
2612 Once the string S has been formed from the DWARF encoding,
2613 an \addtoindex{MD5 hash} is computed for the string and the lower 64 bits
2614 are taken as the type signature.
2616 \textit{The string S is intended to be a flattened representation of
2617 the type that uniquely identifies that type (i.e., a different
2618 type is highly unlikely to produce the same string).}
2620 \textit{A debugging information entry should not be placed in a
2621 separate \addtoindex{type unit}
2622 if any of the following apply:}
2626 \item \textit{The entry has an attribute whose value is a location
2627 expression, and the location expression contains a reference to
2628 another debugging information entry (e.g., a \livelink{chap:DWOPcallref}{DW\_OP\_call\_ref}
2629 operator), as it is unlikely that the entry will remain
2630 identical across compilation units.}
2632 \item \textit{The entry has an attribute whose value refers
2633 to a code location or a \addtoindex{location list}.}
2635 \item \textit{The entry has an attribute whose value refers
2636 to another debugging information entry that does not represent
2642 \textit{Certain attributes are not included in the type signature:}
2645 \item \textit{The \livelink{chap:DWATdeclaration}{DW\_AT\_declaration} attribute is not included because it
2646 indicates that the debugging information entry represents an
2647 incomplete declaration, and incomplete declarations should
2649 \addtoindexx{type unit}
2650 separate type units.}
2652 \item \textit{The \livelink{chap:DWATdescription}{DW\_AT\_description} attribute is not included because
2653 it does not provide any information unique to the defining
2654 declaration of the type.}
2656 \item \textit{The \livelink{chap:DWATdeclfile}{DW\_AT\_decl\_file},
2657 \livelink{chap:DWATdeclline}{DW\_AT\_decl\_line}, and
2658 \livelink{chap:DWATdeclcolumn}{DW\_AT\_decl\_column} attributes are not included because they
2659 may vary from one source file to the next, and would prevent
2660 two otherwise identical type declarations from producing the
2661 \addtoindexx{MD5 hash}
2664 \item \textit{The \livelink{chap:DWATobjectpointer}{DW\_AT\_object\_pointer} attribute is not included
2665 because the information it provides is not necessary for the
2666 computation of a unique type signature.}
2670 \textit{Nested types and some types referred to by a debugging
2671 information entry are encoded by name rather than by recursively
2672 encoding the type to allow for cases where a complete definition
2673 of the type might not be available in all compilation units.}
2675 \textit{If a type definition contains the definition of a member function,
2676 it cannot be moved as is into a type unit, because the member function
2677 contains attributes that are unique to that compilation unit.
2678 Such a type definition can be moved to a type unit by rewriting the DIE tree,
2679 moving the member function declaration into a separate declaration tree,
2680 and replacing the function definition in the type with a non-defining
2681 declaration of the function (as if the function had been defined out of
2684 An example that illustrates the computation of an MD5 hash may be found in
2685 Appendix \refersec{app:usingtypeunits}.