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 \hypertarget{chap:DWXXXlohiuser}{}
24 value range for vendor specific extensions consist of the
26 (\DWATlouserMARK{}\DWAThiuserMARK{} DW\_AT,
27 \DWATElouserMARK{}\DWATEhiuserMARK{} DW\_ATE,
28 \DWCClouserMARK{}\DWCChiuserMARK{} DW\_CC,
29 \DWCFAlouserMARK{}\DWCFAhiuserMARK{} DW\_CFA
30 \DWENDlouserMARK{}\DWENDhiuserMARK{} DW\_END,
31 \DWLANGlouserMARK{}\DWLANGhiuserMARK{} DW\_LANG,
32 \DWLNElouserMARK{}\DWLNEhiuserMARK{} DW\_LNE,
33 \DWMACROlouserMARK{}\DWMACROhiuserMARK{}DW\_MACRO,
34 \DWOPlouserMARK{}\DWOPhiuserMARK{} DW\_OP or
35 \DWTAGlouserMARK{}\DWTAGhiuserMARK{} DW\_TAG,
36 respectively) followed by
37 \_lo\_user or \_hi\_user.
38 Values in the range between \textit{prefix}\_lo\_user
39 and \textit{prefix}\_hi\_user inclusive,
40 are reserved for vendor specific extensions. Vendors may
41 use values in this range without conflicting with current or
42 future system\dash defined values. All other values are reserved
43 for use by the system.
45 \textit{For example, for DIE tags, the special
46 labels are \DWTAGlouserNAME{} and \DWTAGhiuserNAME.}
48 \textit{There may also be codes for vendor specific extensions
49 between the number of standard line number opcodes and
50 the first special line number opcode. However, since the
51 number of standard opcodes varies with the DWARF version,
52 the range for extensions is also version dependent. Thus,
53 \DWLNSlouserTARG{} and
54 \DWLNShiuserTARG{} symbols are not defined.
57 Vendor defined tags, attributes, base type encodings, location
58 atoms, language names, line number actions, calling conventions
59 and call frame instructions, conventionally use the form
60 \text{prefix\_vendor\_id\_name}, where
61 \textit{vendor\_id}\addtoindexx{vendor id} is some identifying
62 character sequence chosen so as to avoid conflicts with
65 To ensure that extensions added by one vendor may be safely
66 ignored by consumers that do not understand those extensions,
67 the following rules should be followed:
68 \begin{enumerate}[1. ]
70 \item New attributes should be added in such a way that a
71 debugger may recognize the format of a new attribute value
72 without knowing the content of that attribute value.
74 \item The semantics of any new attributes should not alter
75 the semantics of previously existing attributes.
77 \item The semantics of any new tags should not conflict with
78 the semantics of previously existing tags.
80 \item Do not add any new forms of attribute value.
85 \section{Reserved Values}
86 \label{datarep:reservedvalues}
87 \subsection{Error Values}
88 \label{datarep:errorvalues}
89 \addtoindexx{reserved values!error}
92 \addtoindexx{error value}
93 a convenience for consumers of DWARF information, the value
94 0 is reserved in the encodings for attribute names, attribute
95 forms, base type encodings, location operations, languages,
96 line number program opcodes, macro information entries and tag
97 names to represent an error condition or unknown value. DWARF
98 does not specify names for these reserved values, since they
99 do not represent valid encodings for the given type and should
100 not appear in DWARF debugging information.
103 \subsection{Initial Length Values}
104 \label{datarep:initiallengthvalues}
105 \addtoindexx{reserved values!initial length}
107 An \livetarg{datarep:initiallengthvalues}{initial length field} is one of the length fields that occur
109 of those DWARF sections that
114 \dotdebugpubnames{}, and
115 \dotdebugpubtypes{}) or the length field
116 that occurs at the beginning of the CIE and FDE structures
117 in the \dotdebugframe{} section.
119 In an \addtoindex{initial length field}, the values \wfffffffzero through
120 \wffffffff are reserved by DWARF to indicate some form of
121 extension relative to \addtoindex{DWARF Version 2}; such values must not
122 be interpreted as a length field. The use of one such value,
123 \xffffffff, is defined below
124 (see Section \refersec{datarep:32bitand64bitdwarfformats});
126 the other values is reserved for possible future extensions.
130 \section{Relocatable, Split, Executable and Shared Objects}
131 \label{datarep:executableobjectsandsharedobjects}
133 \subsection{Relocatable Objects}
135 \subsection{Split DWARF Objects}
136 \label{datarep:splitdwarfobjects}
137 A DWARF producer may partition the debugging
138 information such that the majority of the debugging
139 information can remain in individual object files without
140 being processed by the linker. The first partition contains
141 debugging information that must still be processed by the linker,
142 and includes the following:
145 The line number tables, range tables, frame tables, and
146 accelerated access tables, in the usual sections:
147 \dotdebugline, \dotdebugranges, \dotdebugframe,
148 \dotdebugpubnames, \dotdebugpubtypes{} and \dotdebugaranges,
151 An address table, in the \dotdebugaddr{} section. This table
152 contains all addresses and constants that require
153 link-time relocation, and items in the table can be
154 referenced indirectly from the debugging information via
155 the \DWFORMaddrx{} form, and by the \DWOPaddrx{} and
156 \DWOPconstx{} operators.
158 A skeleton compilation unit, as described in Section
159 \refersec{chap:skeletoncompilationunitentries},
160 in the \dotdebuginfo{} section.
162 An abbreviations table for the skeleton compilation unit,
163 in the \dotdebugabbrev{} section.
165 A string table, in the \dotdebugstr{} section. The string
166 table is necessary only if the skeleton compilation unit
167 uses either indirect string form, \DWFORMstrp{} or
170 A string offsets table, in the \dotdebugstroffsets{}
171 section. The string offsets table is necessary only if
172 the skeleton compilation unit uses the \DWFORMstrx{} form.
174 The attributes contained in the skeleton compilation
175 unit can be used by a DWARF consumer to find the object file
176 or DWARF object file that contains the second partition.
178 The second partition contains the debugging information that
179 does not need to be processed by the linker. These sections
180 may be left in the object files and ignored by the linker
181 (that is, not combined and copied to the executable object), or
182 they may be placed by the producer in a separate DWARF object
183 file. This partition includes the following:
186 The full compilation unit, in the \dotdebuginfodwo{} section.
187 Attributes in debugging information entries may refer to
188 machine addresses indirectly using the \DWFORMaddrx{} form,
189 and location expressions may do so using the \DWOPaddrx{} and
190 \DWOPconstx{} forms. Attributes may refer to range table
191 entries with an offset relative to a base offset in the
192 range table for the compilation unit.
194 \item Separate type units, in the \dotdebuginfodwo{} section.
197 Abbreviations table(s) for the compilation unit and type
198 units, in the \dotdebugabbrevdwo{} section.
200 \item Location lists, in the \dotdebuglocdwo{} section.
203 A skeleton line table (for the type units), in the
204 \dotdebuglinedwo{} section (see
205 Section \refersec{chap:skeletoncompilationunitentries}).
207 \item Macro information, in the \dotdebugmacrodwo{} section.
209 \item A string table, in the \dotdebugstrdwo{} section.
211 \item A string offsets table, in the \dotdebugstroffsetsdwo{}
215 Except where noted otherwise, all references in this document
216 to a debugging information section (for example, \dotdebuginfo),
217 applies also to the corresponding split DWARF section (for example,
220 \subsection{Executable Objects}
221 \label{chap:executableobjects}
222 The relocated addresses in the debugging information for an
223 executable object are virtual addresses.
225 \subsection{Shared Objects}
226 \label{datarep:sharedobjects}
228 addresses in the debugging information for a shared object
229 are offsets relative to the start of the lowest region of
230 memory loaded from that shared object.
232 \textit{This requirement makes the debugging information for
233 shared objects position independent. Virtual addresses in a
234 shared object may be calculated by adding the offset to the
235 base address at which the object was attached. This offset
236 is available in the run\dash time linker\textquoteright s data structures.}
240 \section{32-Bit and 64-Bit DWARF Formats}
241 \label{datarep:32bitand64bitdwarfformats}
242 \hypertarget{datarep:xxbitdwffmt}{}
243 \addtoindexx{32-bit DWARF format}
244 \addtoindexx{64-bit DWARF format}
245 There are two closely related file formats. In the 32\dash bit DWARF
246 format, all values that represent lengths of DWARF sections
247 and offsets relative to the beginning of DWARF sections are
248 represented using 32\dash bits. In the 64\dash bit DWARF format, all
249 values that represent lengths of DWARF sections and offsets
250 relative to the beginning of DWARF sections are represented
251 using 64\dash bits. A special convention applies to the initial
252 length field of certain DWARF sections, as well as the CIE and
253 FDE structures, so that the 32\dash bit and 64\dash bit DWARF formats
254 can coexist and be distinguished within a single linked object.
256 The differences between the 32\dash\ and 64\dash bit
258 detailed in the following:
259 \begin{enumerate}[1. ]
261 \item In the 32\dash bit DWARF format, an
262 \addtoindex{initial length field}
264 \addtoindexx{initial length field!encoding}
265 Section \refersec{datarep:initiallengthvalues})
266 is an unsigned 32\dash bit integer (which
267 must be less than \xfffffffzero); in the 64\dash bit DWARF format,
268 an \addtoindex{initial length field} is 96 bits in size,
271 \item The first 32\dash bits have the value \xffffffff.
273 \item The following 64\dash bits contain the actual length
274 represented as an unsigned 64\dash bit integer.
277 \textit{This representation allows a DWARF consumer to dynamically
278 detect that a DWARF section contribution is using the 64\dash bit
279 format and to adapt its processing accordingly.}
281 \item Section offset and section length
282 \hypertarget{datarep:sectionoffsetlength}{}
283 \addtoindexx{section length!use in headers}
285 \addtoindexx{section offset!use in headers}
286 in the headers of DWARF sections (other
287 \addtoindexx{initial length field}
289 \addtoindex{initial length}
290 fields) are listed following. In the 32\dash bit DWARF format these
291 are 32\dash bit unsigned integer values; in the 64\dash bit DWARF format,
293 \addtoindexx{section length!in .debug\_aranges header}
295 \addtoindexx{section length!in .debug\_pubnames header}
297 \addtoindexx{section length!in .debug\_pubtypes header}
298 unsigned integer values.
302 Section &Name & Role \\ \hline
303 \dotdebugaranges{} & \addtoindex{debug\_info\_offset} & offset in \dotdebuginfo{} \\
304 \dotdebugframe{}/CIE & \addtoindex{CIE\_id} & CIE distinguished value \\
305 \dotdebugframe{}/FDE & \addtoindex{CIE\_pointer} & offset in \dotdebugframe{} \\
306 \dotdebuginfo{} & \addtoindex{debug\_abbrev\_offset} & offset in \dotdebugabbrev{} \\
307 \dotdebugline{} & \addtoindex{header\_length} & length of header itself \\
308 \dotdebugpubnames{} & \addtoindex{debug\_info\_offset} & offset in \dotdebuginfo{} \\
309 & \addtoindex{debug\_info\_length} & length of \dotdebuginfo{} \\
311 \dotdebugpubtypes{} & \addtoindex{debug\_info\_offset} & offset in \dotdebuginfo{} \\
312 & \addtoindex{debug\_info\_length} & length of \dotdebuginfo{} \\
317 The \texttt{CIE\_id} field in a CIE structure must be 64 bits because
318 it overlays the \texttt{CIE\_pointer} in a FDE structure; this implicit
319 union must be accessed to distinguish whether a CIE or FDE is
320 present, consequently, these two fields must exactly overlay
321 each other (both offset and size).
323 \item Within the body of the \dotdebuginfo{}
324 section, certain forms of attribute value depend on the choice
325 of DWARF format as follows. For the 32\dash bit DWARF format,
326 the value is a 32\dash bit unsigned integer; for the 64\dash bit DWARF
327 format, the value is a 64\dash bit unsigned integer.
330 Form & Role \\ \hline
331 \DWFORMrefaddr& offset in \dotdebuginfo{} \\
332 \DWFORMsecoffset& offset in a section other than \\
333 &\dotdebuginfo{} or \dotdebugstr{} \\
334 \DWFORMstrp&offset in \dotdebugstr{} \\
335 \DWOPcallref&offset in \dotdebuginfo{} \\
339 \item Within the body of the \dotdebugpubnames{} and
341 sections, the representation of the first field
342 of each tuple (which represents an offset in the
344 section) depends on the DWARF format as follows: in the
345 32\dash bit DWARF format, this field is a 32\dash bit unsigned integer;
346 in the 64\dash bit DWARF format, it is a 64\dash bit unsigned integer.
349 \item In the body of the \dotdebugstroffsets{} and \dotdebugstroffsetsdwo{}
350 sections, the size of entries in the body depend on the DWARF
351 format as follows: in the 32-bit DWARF format, entries are 32-bit
352 unsigned integer values; in the 64-bit DWARF format, they are
353 64-bit unsigned integers.
355 \item In the body of the \dotdebugaddr{}, \dotdebugloc{} and \dotdebugranges{}
356 sections, the contents of the address size fields depends on the
357 DWARF format as follows: in the 32-bit DWARF format, these fields
358 contain 4; in the 64-bit DWARF format these fields contain 8.
362 The 32\dash bit and 64\dash bit DWARF format conventions must \emph{not} be
363 intermixed within a single compilation unit.
365 \textit{Attribute values and section header fields that represent
366 addresses in the target program are not affected by these
369 A DWARF consumer that supports the 64\dash bit DWARF format must
370 support executables in which some compilation units use the
371 32\dash bit format and others use the 64\dash bit format provided that
372 the combination links correctly (that is, provided that there
373 are no link\dash time errors due to truncation or overflow). (An
374 implementation is not required to guarantee detection and
375 reporting of all such errors.)
377 \textit{It is expected that DWARF producing compilers will \emph{not} use
378 the 64\dash bit format \emph{by default}. In most cases, the division of
379 even very large applications into a number of executable and
380 shared objects will suffice to assure that the DWARF sections
381 within each individual linked object are less than 4 GBytes
382 in size. However, for those cases where needed, the 64\dash bit
383 format allows the unusual case to be handled as well. Even
384 in this case, it is expected that only application supplied
385 objects will need to be compiled using the 64\dash bit format;
386 separate 32\dash bit format versions of system supplied shared
387 executable libraries can still be used.}
391 \section{Format of Debugging Information}
392 \label{datarep:formatofdebugginginformation}
394 For each compilation unit compiled with a DWARF producer,
395 a contribution is made to the \dotdebuginfo{} section of
396 the object file. Each such contribution consists of a
397 compilation unit header
398 (see Section \refersec{datarep:compilationunitheader})
400 single \DWTAGcompileunit{} or
401 \DWTAGpartialunit{} debugging
402 information entry, together with its children.
404 For each type defined in a compilation unit, a separate
405 contribution may also be made to the
407 section of the object file. Each
408 such contribution consists of a
409 \addtoindex{type unit} header
410 (see Section \refersec{datarep:typeunitheader})
411 followed by a \DWTAGtypeunit{} entry, together with
414 Each debugging information entry begins with a code that
415 represents an entry in a separate
416 \addtoindex{abbreviations table}. This
417 code is followed directly by a series of attribute values.
419 The appropriate entry in the
420 \addtoindex{abbreviations table} guides the
421 interpretation of the information contained directly in the
422 \dotdebuginfo{} section.
425 Multiple debugging information entries may share the same
426 abbreviation table entry. Each compilation unit is associated
427 with a particular abbreviation table, but multiple compilation
428 units may share the same table.
430 \subsection{Unit Headers}
431 \label{datarep:unitheaders}
432 Unit headers contain a field, \texttt{unit\_type}, whose value indicates the kind of
433 compilation unit that follows. The encodings for the unit type
434 enumeration are shown in Table \refersec{tab:unitheaderunitkindencodings}.
438 \setlength{\extrarowheight}{0.1cm}
439 \begin{longtable}{l|l}
440 \caption{Unit header unit kind encodings}
441 \label{tab:unitheaderunitkindencodings}
442 \addtoindexx{Unit header unit kind encodings} \\
443 \hline \bfseries Unit header unit kind encodings&\bfseries Value \\ \hline
445 \bfseries Unit header unit kind encodings&\bfseries Value \\ \hline
447 \hline \emph{Continued on next page}
451 \DWUTcompileTARG &0x01 \\
452 \DWUTtypeTARG &0x02 \\
453 \DWUTpartialTARG &0x03 \\ \hline
457 \subsubsection{Compilation Unit Header}
458 \label{datarep:compilationunitheader}
459 \begin{enumerate}[1. ]
461 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
462 \addttindexx{unit\_length}
463 A 4\dash byte or 12\dash byte
464 \addtoindexx{initial length}
465 unsigned integer representing the length
466 of the \dotdebuginfo{}
467 contribution for that compilation unit,
468 not including the length field itself. In the \thirtytwobitdwarfformat,
469 this is a 4\dash byte unsigned integer (which must be less
470 than \xfffffffzero); in the \sixtyfourbitdwarfformat, this consists
471 of the 4\dash byte value \wffffffff followed by an 8\dash byte unsigned
472 integer that gives the actual length
473 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
475 \item \texttt{version} (\addtoindex{uhalf}) \\
476 A 2\dash byte unsigned integer representing the version of the
477 DWARF information for the compilation unit \addtoindexx{version number!compilation unit}
478 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
479 The value in this field is \versiondotdebuginfo.
482 \item \texttt{unit\_type} (\addtoindex{ubyte}) \\
483 A 1-byte unsigned integer identifying this unit as a compilation unit.
484 The value of this field is
485 \DWUTcompile{} for a {normal compilation} unit or
486 \DWUTpartial{} for a {partial compilation} unit
487 (see Section \refersec{chap:normalandpartialcompilationunitentries}).
489 \textit{This field is new in \DWARFVersionV.}
492 \item \addttindex{debug\_abbrev\_offset} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
494 \addtoindexx{section offset!in .debug\_info header}
495 4\dash byte or 8\dash byte unsigned offset into the
497 section. This offset associates the compilation unit with a
498 particular set of debugging information entry abbreviations. In
499 the \thirtytwobitdwarfformat, this is a 4\dash byte unsigned length;
500 in the \sixtyfourbitdwarfformat, this is an 8\dash byte unsigned length
501 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
503 \item \texttt{address\_size} (\addtoindex{ubyte}) \\
504 A 1\dash byte unsigned integer representing the size in bytes of
505 \addttindexx{address\_size}
506 an address on the target architecture. If the system uses
507 \addtoindexx{address space!segmented}
508 segmented addressing, this value represents the size of the
509 offset portion of an address.
514 \subsubsection{Type Unit Header}
515 \label{datarep:typeunitheader}
517 The header for the series of debugging information entries
518 contributing to the description of a type that has been
519 placed in its own \addtoindex{type unit}, within the
520 \dotdebuginfo{} section,
521 consists of the following information:
522 \begin{enumerate}[1. ]
524 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
525 \addttindexx{unit\_length}
526 A 4\dash byte or 12\dash byte unsigned integer
527 \addtoindexx{initial length}
528 representing the length
529 of the \dotdebuginfo{} contribution for that type unit,
530 not including the length field itself. In the \thirtytwobitdwarfformat,
531 this is a 4\dash byte unsigned integer (which must be
532 less than \xfffffffzero); in the \sixtyfourbitdwarfformat, this
533 consists of the 4\dash byte value \wffffffff followed by an
534 8\dash byte unsigned integer that gives the actual length
535 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
538 \item \texttt{version} (\addtoindex{uhalf}) \\
539 A 2\dash byte unsigned integer representing the version of the
540 DWARF information for the
541 type unit\addtoindexx{version number!type unit}
542 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
543 The value in this field is \versiondotdebuginfo.
545 \item \texttt{unit\_type} (\addtoindex{ubyte}) \\
546 A 1-byte unsigned integer identifying this unit as a type unit.
547 The value of this field is \DWUTtype{} for a type unit
548 (see Section \refersec{chap:separatetypeunitentries}).
550 \textit{This field is new in \DWARFVersionV.}
553 \item \addttindex{debug\_abbrev\_offset} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
555 \addtoindexx{section offset!in .debug\_types header}
556 4\dash byte or 8\dash byte unsigned offset into the
558 section. This offset associates the type unit with a
559 particular set of debugging information entry abbreviations. In
560 the \thirtytwobitdwarfformat, this is a 4\dash byte unsigned length;
561 in the \sixtyfourbitdwarfformat, this is an 8\dash byte unsigned length
562 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
565 \item \texttt{address\_size} (ubyte) \\
566 A 1\dash byte unsigned integer representing the size
567 \addtoindexx{size of an address}
569 \addttindexx{address\_size}
570 an address on the target architecture. If the system uses
571 \addtoindexx{address space!segmented}
572 segmented addressing, this value represents the size of the
573 offset portion of an address.
575 \item \texttt{type\_signature} (8\dash byte unsigned integer) \\
576 \addtoindexx{type signature}
578 \addttindexx{type\_signature}
579 64\dash bit unique signature (see Section
580 \refersec{datarep:typesignaturecomputation})
581 of the type described in this type
584 \textit{An attribute that refers (using
585 \DWFORMrefsigeight{}) to
586 the primary type contained in this
587 \addtoindex{type unit} uses this value.}
589 \item \texttt{type\_offset} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
590 \addttindexx{type\_offset}
591 A 4\dash byte or 8\dash byte unsigned offset
592 \addtoindexx{section offset!in .debug\_types header}
593 relative to the beginning
594 of the \addtoindex{type unit} header.
595 This offset refers to the debugging
596 information entry that describes the type. Because the type
597 may be nested inside a namespace or other structures, and may
598 contain references to other types that have not been placed in
599 separate type units, it is not necessarily either the first or
600 the only entry in the type unit. In the \thirtytwobitdwarfformat,
601 this is a 4\dash byte unsigned length; in the \sixtyfourbitdwarfformat,
602 this is an 8\dash byte unsigned length
603 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
607 \subsection{Debugging Information Entry}
608 \label{datarep:debugginginformationentry}
610 Each debugging information entry begins with an
611 unsigned LEB128\addtoindexx{LEB128!unsigned}
612 number containing the abbreviation code for the entry. This
613 code represents an entry within the abbreviations table
614 associated with the compilation unit containing this entry. The
615 abbreviation code is followed by a series of attribute values.
617 On some architectures, there are alignment constraints on
618 section boundaries. To make it easier to pad debugging
619 information sections to satisfy such constraints, the
620 abbreviation code 0 is reserved. Debugging information entries
621 consisting of only the abbreviation code 0 are considered
624 \subsection{Abbreviations Tables}
625 \label{datarep:abbreviationstables}
627 The abbreviations tables for all compilation units
628 are contained in a separate object file section called
630 As mentioned before, multiple compilation
631 units may share the same abbreviations table.
633 The abbreviations table for a single compilation unit consists
634 of a series of abbreviation declarations. Each declaration
635 specifies the tag and attributes for a particular form of
636 debugging information entry. Each declaration begins with
637 an unsigned LEB128\addtoindexx{LEB128!unsigned}
638 number representing the abbreviation
639 code itself. It is this code that appears at the beginning
640 of a debugging information entry in the
642 section. As described above, the abbreviation
643 code 0 is reserved for null debugging information entries. The
644 abbreviation code is followed by another unsigned LEB128\addtoindexx{LEB128!unsigned}
645 number that encodes the entry\textquoteright s tag. The encodings for the
646 tag names are given in
647 Table \refersec{tab:tagencodings}.
650 \setlength{\extrarowheight}{0.1cm}
651 \begin{longtable}{l|l}
653 \caption{Tag encodings} \label{tab:tagencodings} \\
654 \hline \bfseries Tag name&\bfseries Value\\ \hline
656 \bfseries Tag name&\bfseries Value \\ \hline
658 \hline \emph{Continued on next page}
660 \hline \ddag\ \textit{New in DWARF Version 5}
662 \DWTAGarraytype{} &0x01 \\
663 \DWTAGclasstype&0x02 \\
664 \DWTAGentrypoint&0x03 \\
665 \DWTAGenumerationtype&0x04 \\
666 \DWTAGformalparameter&0x05 \\
667 \DWTAGimporteddeclaration&0x08 \\
669 \DWTAGlexicalblock&0x0b \\
671 \DWTAGpointertype&0x0f \\
672 \DWTAGreferencetype&0x10 \\
673 \DWTAGcompileunit&0x11 \\
674 \DWTAGstringtype&0x12 \\
675 \DWTAGstructuretype&0x13 \\
676 \DWTAGsubroutinetype&0x15 \\
677 \DWTAGtypedef&0x16 \\
678 \DWTAGuniontype&0x17 \\
679 \DWTAGunspecifiedparameters&0x18 \\
680 \DWTAGvariant&0x19 \\
681 \DWTAGcommonblock&0x1a \\
682 \DWTAGcommoninclusion&0x1b \\
683 \DWTAGinheritance&0x1c \\
684 \DWTAGinlinedsubroutine&0x1d \\
686 \DWTAGptrtomembertype&0x1f \\
687 \DWTAGsettype&0x20 \\
688 \DWTAGsubrangetype&0x21 \\
689 \DWTAGwithstmt&0x22 \\
690 \DWTAGaccessdeclaration&0x23 \\
691 \DWTAGbasetype&0x24 \\
692 \DWTAGcatchblock&0x25 \\
693 \DWTAGconsttype&0x26 \\
694 \DWTAGconstant&0x27 \\
695 \DWTAGenumerator&0x28 \\
696 \DWTAGfiletype&0x29 \\
698 \DWTAGnamelist&0x2b \\
699 \DWTAGnamelistitem&0x2c \\
700 \DWTAGpackedtype&0x2d \\
701 \DWTAGsubprogram&0x2e \\
702 \DWTAGtemplatetypeparameter&0x2f \\
703 \DWTAGtemplatevalueparameter&0x30 \\
704 \DWTAGthrowntype&0x31 \\
705 \DWTAGtryblock&0x32 \\
706 \DWTAGvariantpart&0x33 \\
707 \DWTAGvariable&0x34 \\
708 \DWTAGvolatiletype&0x35 \\
709 \DWTAGdwarfprocedure&0x36 \\
710 \DWTAGrestricttype&0x37 \\
711 \DWTAGinterfacetype&0x38 \\
712 \DWTAGnamespace&0x39 \\
713 \DWTAGimportedmodule&0x3a \\
714 \DWTAGunspecifiedtype&0x3b \\
715 \DWTAGpartialunit&0x3c \\
716 \DWTAGimportedunit&0x3d \\
717 \DWTAGcondition&\xiiif \\
718 \DWTAGsharedtype&0x40 \\
719 \DWTAGtypeunit & 0x41 \\
720 \DWTAGrvaluereferencetype & 0x42 \\
721 \DWTAGtemplatealias & 0x43 \\
722 \DWTAGcoarraytype~\ddag & 0x44 \\
723 \DWTAGgenericsubrange~\ddag & 0x45 \\
724 \DWTAGdynamictype~\ddag & 0x46 \\
725 \DWTAGatomictype~\ddag & 0x47 \\
726 \DWTAGcallsite~\ddag & 0x48 \\
727 \DWTAGcallsiteparameter~\ddag & 0x49 \\
728 \DWTAGlouser&0x4080 \\
729 \DWTAGhiuser&\xffff \\
733 Following the tag encoding is a 1\dash byte value that determines
734 whether a debugging information entry using this abbreviation
735 has child entries or not. If the value is
737 the next physically succeeding entry of any debugging
738 information entry using this abbreviation is the first
739 child of that entry. If the 1\dash byte value following the
740 abbreviation\textquoteright s tag encoding is
741 \DWCHILDRENnoTARG, the next
742 physically succeeding entry of any debugging information entry
743 using this abbreviation is a sibling of that entry. (Either
744 the first child or sibling entries may be null entries). The
745 encodings for the child determination byte are given in
746 Table \refersec{tab:childdeterminationencodings}
748 Section \refersec{chap:relationshipofdebugginginformationentries},
749 each chain of sibling entries is terminated by a null entry.)
753 \setlength{\extrarowheight}{0.1cm}
754 \begin{longtable}{l|l}
755 \caption{Child determination encodings}
756 \label{tab:childdeterminationencodings}
757 \addtoindexx{Child determination encodings} \\
758 \hline \bfseries Children determination name&\bfseries Value \\ \hline
760 \bfseries Children determination name&\bfseries Value \\ \hline
762 \hline \emph{Continued on next page}
766 \DWCHILDRENno&0x00 \\
767 \DWCHILDRENyes&0x01 \\ \hline
772 Finally, the child encoding is followed by a series of
773 attribute specifications. Each attribute specification
774 consists of two parts. The first part is an
775 unsigned LEB128\addtoindexx{LEB128!unsigned}
776 number representing the attribute\textquoteright s name.
777 The second part is an
778 unsigned LEB128\addtoindexx{LEB128!unsigned}
779 number representing the attribute\textquoteright s form.
780 The series of attribute specifications ends with an
781 entry containing 0 for the name and 0 for the form.
784 \DWFORMindirectTARG{} is a special case. For
785 attributes with this form, the attribute value itself in the
787 section begins with an unsigned
788 LEB128 number that represents its form. This allows producers
789 to choose forms for particular attributes
790 \addtoindexx{abbreviations table!dynamic forms in}
792 without having to add a new entry to the abbreviations table.
794 The abbreviations for a given compilation unit end with an
795 entry consisting of a 0 byte for the abbreviation code.
798 Appendix \refersec{app:compilationunitsandabbreviationstableexample}
799 for a depiction of the organization of the
800 debugging information.}
803 \subsection{Attribute Encodings}
804 \label{datarep:attributeencodings}
806 The encodings for the attribute names are given in
807 Table \refersec{tab:attributeencodings}.
809 The attribute form governs how the value of the attribute is
810 encoded. There are nine classes of form, listed below. Each
811 class is a set of forms which have related representations
812 and which are given a common interpretation according to the
813 attribute in which the form is used.
815 Form \DWFORMsecoffsetTARG{}
817 \addtoindexx{rangelistptr class}
819 \addtoindexx{macptr class}
821 \addtoindexx{loclistptr class}
823 \addtoindexx{lineptr class}
824 namely \livelink{chap:classlineptr}{lineptr},
825 \livelink{chap:classloclistptr}{loclistptr},
826 \livelink{chap:classmacptr}{macptr} or
827 \livelink{chap:classrangelistptr}{rangelistptr}; the list
828 of classes allowed by the applicable attribute in
829 Table \refersec{tab:attributeencodings}
830 determines the class of the form.
832 \textit{In DWARF V3 the forms \DWFORMdatafour{} and
833 \DWFORMdataeight{} were
834 \addtoindexx{lineptr class}
836 \addtoindexx{rangelistptr class}
838 \addtoindexx{macptr class}
840 \addtoindexx{loclistptr class}
841 class constant \addtoindexx{constant class}
842 or one of the classes
843 \livelink{chap:classlineptr}{lineptr},
844 \livelink{chap:classloclistptr}{loclistptr},
845 \livelink{chap:classmacptr}{macptr} or
846 \livelink{chap:classrangelistptr}{rangelistptr}, depending on context. In
848 \DWFORMdatafour{} and
849 \DWFORMdataeight{} are members of class
850 constant in all cases.
852 \DWFORMsecoffset{} replaces
853 their usage for the other classes.}
856 Each possible form belongs to one or more of the following classes:
859 \item \livelinki{chap:classaddress}{address}{address class} \\
860 \livetarg{datarep:classaddress}{}
861 Represented as either:
863 \item An object of appropriate size to hold an
864 address on the target machine
866 The size is encoded in the compilation unit header
867 (see Section \refersec{datarep:compilationunitheader}).
868 This address is relocatable in a relocatable object file and
869 is relocated in an executable file or shared object.
871 \item An indirect index into a table of addresses (as
872 described in the previous bullet) in the
873 \dotdebugaddr{} section (\DWFORMaddrxTARG).
874 The representation of a \DWFORMaddrxNAME{} value is an unsigned
875 \addtoindex{LEB128} value, which is interpreted as a zero-based
876 index into an array of addresses in the \dotdebugaddr{} section.
877 The index is relative to the value of the \DWATaddrbase{} attribute
878 of the associated compilation unit.
882 \item \livelink{chap:classaddrptr}{addrptr} \\
883 \livetarg{datarep:classaddrptr}{}
884 This is an offset into the \dotdebugaddr{} section (\DWFORMsecoffset). It
885 consists of an offset from the beginning of the \dotdebugaddr{} section to the
886 beginning of the list of machine addresses information for the
887 referencing entity. It is relocatable in
888 a relocatable object file, and relocated in an executable or
889 shared object. In the \thirtytwobitdwarfformat, this offset
890 is a 4\dash byte unsigned value; in the 64\dash bit DWARF
891 format, it is an 8\dash byte unsigned value (see Section
892 \refersec{datarep:32bitand64bitdwarfformats}).
894 \textit{This class is new in \DWARFVersionV.}
897 \item \livelink{chap:classblock}{block} \\
898 \livetarg{datarep:classblock}{}
899 Blocks come in four forms:
901 \begin{myindentpara}{1cm}
902 A 1\dash byte length followed by 0 to 255 contiguous information
903 bytes (\DWFORMblockoneTARG).
906 \begin{myindentpara}{1cm}
907 A 2\dash byte length followed by 0 to 65,535 contiguous information
908 bytes (\DWFORMblocktwoTARG).
911 \begin{myindentpara}{1cm}
912 A 4\dash byte length followed by 0 to 4,294,967,295 contiguous
913 information bytes (\DWFORMblockfourTARG).
916 \begin{myindentpara}{1cm}
917 An unsigned LEB128\addtoindexx{LEB128!unsigned}
918 length followed by the number of bytes
919 specified by the length (\DWFORMblockTARG).
922 In all forms, the length is the number of information bytes
923 that follow. The information bytes may contain any mixture
924 of relocated (or relocatable) addresses, references to other
925 debugging information entries or data bytes.
927 \item \livelinki{chap:classconstant}{constant}{constant class} \\
928 \livetarg{datarep:classconstant}{}
929 There are six forms of constants. There are fixed length
930 constant data forms for one, two, four and eight byte values
935 and \DWFORMdataeightTARG).
936 There are also variable length constant
937 data forms encoded using LEB128 numbers (see below). Both
938 signed (\DWFORMsdataTARG) and unsigned
939 (\DWFORMudataTARG) variable
940 length constants are available
943 The data in \DWFORMdataone,
945 \DWFORMdatafour{} and
947 can be anything. Depending on context, it may
948 be a signed integer, an unsigned integer, a floating\dash point
949 constant, or anything else. A consumer must use context to
950 know how to interpret the bits, which if they are target
951 machine data (such as an integer or floating point constant)
952 will be in target machine byte\dash order.
954 \textit{If one of the \DWFORMdataTARG\textless n\textgreater
955 forms is used to represent a
956 signed or unsigned integer, it can be hard for a consumer
957 to discover the context necessary to determine which
958 interpretation is intended. Producers are therefore strongly
959 encouraged to use \DWFORMsdata{} or
960 \DWFORMudata{} for signed and
961 unsigned integers respectively, rather than
962 \DWFORMdata\textless n\textgreater.}
965 \item \livelinki{chap:classexprloc}{exprloc}{exprloc class} \\
966 \livetarg{datarep:classexprloc}{}
967 This is an unsigned LEB128\addtoindexx{LEB128!unsigned} length followed by the
968 number of information bytes specified by the length
969 (\DWFORMexprlocTARG).
970 The information bytes contain a DWARF expression
971 (see Section \refersec{chap:dwarfexpressions})
972 or location description
973 (see Section \refersec{chap:locationdescriptions}).
975 \item \livelinki{chap:classflag}{flag}{flag class} \\
976 \livetarg{datarep:classflag}{}
977 A flag \addtoindexx{flag class}
978 is represented explicitly as a single byte of data
980 implicitly (\DWFORMflagpresentTARG).
982 first case, if the \nolink{flag} has value zero, it indicates the
983 absence of the attribute; if the \nolink{flag} has a non\dash zero value,
984 it indicates the presence of the attribute. In the second
985 case, the attribute is implicitly indicated as present, and
986 no value is encoded in the debugging information entry itself.
988 \item \livelinki{chap:classlineptr}{lineptr}{lineptr class} \\
989 \livetarg{datarep:classlineptr}{}
990 This is an offset into
991 \addtoindexx{section offset!in class lineptr value}
993 \dotdebugline{} or \dotdebuglinedwo{} section
995 It consists of an offset from the beginning of the
997 section to the first byte of
998 the data making up the line number list for the compilation
1000 It is relocatable in a relocatable object file, and
1001 relocated in an executable or shared object. In the
1002 \thirtytwobitdwarfformat, this offset is a 4\dash byte unsigned value;
1003 in the \sixtyfourbitdwarfformat, it is an 8\dash byte unsigned value
1004 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1007 \item \livelinki{chap:classloclistptr}{loclistptr}{loclistptr class} \\
1008 \livetarg{datarep:classloclistptr}{}
1009 This is an offset into the
1013 It consists of an offset from the
1014 \addtoindexx{section offset!in class loclistptr value}
1017 section to the first byte of
1018 the data making up the
1019 \addtoindex{location list} for the compilation unit.
1020 It is relocatable in a relocatable object file, and
1021 relocated in an executable or shared object. In the
1022 \thirtytwobitdwarfformat, this offset is a 4\dash byte unsigned value;
1023 in the \sixtyfourbitdwarfformat, it is an 8\dash byte unsigned value
1024 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1027 \item \livelinki{chap:classmacptr}{macptr}{macptr class} \\
1028 \livetarg{datarep:classmacptr}{}
1030 \addtoindexx{section offset!in class macptr value}
1032 \dotdebugmacro{} or \dotdebugmacrodwo{} section
1034 It consists of an offset from the beginning of the
1035 \dotdebugmacro{} or \dotdebugmacrodwo{}
1036 section to the the header making up the
1037 macro information list for the compilation unit.
1038 It is relocatable in a relocatable object file, and
1039 relocated in an executable or shared object. In the
1040 \thirtytwobitdwarfformat, this offset is a 4\dash byte unsigned value;
1041 in the \sixtyfourbitdwarfformat, it is an 8\dash byte unsigned value
1042 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1045 \item \livelinki{chap:classrangelistptr}{rangelistptr}{rangelistptr class} \\
1046 \livetarg{datarep:classrangelistptr}{}
1048 \addtoindexx{section offset!in class rangelistptr value}
1049 offset into the \dotdebugranges{} section
1052 offset from the beginning of the
1053 \dotdebugranges{} section
1054 to the beginning of the non\dash contiguous address ranges
1055 information for the referencing entity.
1056 It is relocatable in
1057 a relocatable object file, and relocated in an executable or
1058 shared object. In the \thirtytwobitdwarfformat, this offset
1059 is a 4\dash byte unsigned value; in the 64\dash bit DWARF
1060 format, it is an 8\dash byte unsigned value (see Section
1061 \refersec{datarep:32bitand64bitdwarfformats}).
1064 \textit{Because classes \livelink{chap:classlineptr}{lineptr},
1065 \livelink{chap:classloclistptr}{loclistptr},
1066 \livelink{chap:classmacptr}{macptr} and
1067 \livelink{chap:classrangelistptr}{rangelistptr}
1068 share a common representation, it is not possible for an
1069 attribute to allow more than one of these classes}
1073 \item \livelinki{chap:classreference}{reference}{reference class} \\
1074 \livetarg{datarep:classreference}{}
1075 There are three types of reference.
1078 \addtoindexx{reference class}
1079 first type of reference can identify any debugging
1080 information entry within the containing unit.
1083 \addtoindexx{section offset!in class reference value}
1084 offset from the first byte of the compilation
1085 header for the compilation unit containing the reference. There
1086 are five forms for this type of reference. There are fixed
1087 length forms for one, two, four and eight byte offsets
1093 and \DWFORMrefeightTARG).
1094 There is also an unsigned variable
1095 length offset encoded form that uses
1096 unsigned LEB128\addtoindexx{LEB128!unsigned} numbers
1097 (\DWFORMrefudataTARG).
1098 Because this type of reference is within
1099 the containing compilation unit no relocation of the value
1102 The second type of reference can identify any debugging
1103 information entry within a
1104 \dotdebuginfo{} section; in particular,
1105 it may refer to an entry in a different compilation unit
1106 from the unit containing the reference, and may refer to an
1107 entry in a different shared object. This type of reference
1108 (\DWFORMrefaddrTARG)
1109 is an offset from the beginning of the
1111 section of the target executable or shared object;
1112 it is relocatable in a relocatable object file and frequently
1113 relocated in an executable file or shared object. For
1114 references from one shared object or static executable file
1115 to another, the relocation and identification of the target
1116 object must be performed by the consumer. In the
1117 \thirtytwobitdwarfformat, this offset is a 4\dash byte unsigned value;
1118 in the \sixtyfourbitdwarfformat, it is an 8\dash byte
1120 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1122 \textit{A debugging information entry that may be referenced by
1123 another compilation unit using
1124 \DWFORMrefaddr{} must have a
1125 global symbolic name.}
1127 \textit{For a reference from one executable or shared object to
1128 another, the reference is resolved by the debugger to identify
1129 the shared object or executable and the offset into that
1130 object\textquoteright s \dotdebuginfo{}
1131 section in the same fashion as the run
1132 time loader, either when the debug information is first read,
1133 or when the reference is used.}
1135 The third type of reference can identify any debugging
1136 information type entry that has been placed in its own
1137 \addtoindex{type unit}. This type of
1138 reference (\DWFORMrefsigeightTARG) is the
1139 \addtoindexx{type signature}
1140 64\dash bit type signature
1141 (see Section \refersec{datarep:typesignaturecomputation})
1145 \textit{The use of compilation unit relative references will reduce the
1146 number of link\dash time relocations and so speed up linking. The
1147 use of the second and third type of reference allows for the
1148 sharing of information, such as types, across compilation
1151 \textit{A reference to any kind of compilation unit identifies the
1152 debugging information entry for that unit, not the preceding
1155 \item \livelinki{chap:classstring}{string}{string class} \\
1156 \livetarg{datarep:classstring}{}
1157 A string is a sequence of contiguous non\dash null bytes followed by
1159 \addtoindexx{string class}
1160 A string may be represented:
1162 \item immediately in the debugging information entry itself
1163 (\DWFORMstringTARG),
1165 \addtoindexx{section offset!in class string value}
1166 offset into a string table contained in
1167 the \dotdebugstr{} section of the object file
1169 In the \thirtytwobitdwarfformat, the representation of a
1171 value is a 4\dash byte unsigned offset; in the \sixtyfourbitdwarfformat,
1172 it is an 8\dash byte unsigned offset
1173 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1174 \item as an indirect offset into the string table using an
1175 index into a table of offsets contained in the
1176 \dotdebugstroffsets{} section of the object file (\DWFORMstrxTARG).
1177 The representation of a \DWFORMstrxNAME{} value is an unsigned
1178 \addtoindex{LEB128} value, which is interpreted as a zero-based
1179 index into an array of offsets in the \dotdebugstroffsets{} section.
1180 The offset entries in the \dotdebugstroffsets{} section have the
1181 same representation as \DWFORMstrp{} values.
1183 Any combination of these three forms may be used within a single compilation.
1185 If the \DWATuseUTFeight{}
1186 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8} attribute is specified for the
1187 compilation, partial, skeleton or type unit entry, string values are encoded using the
1188 UTF\dash 8 (\addtoindex{Unicode} Transformation Format\dash 8) from the Universal
1189 Character Set standard (ISO/IEC 10646\dash 1:1993). Otherwise,
1190 the string representation is unspecified.
1192 \textit{The \addtoindex{Unicode} Standard Version 3 is fully compatible with
1193 ISO/IEC 10646\dash 1:1993. It contains all the same characters
1194 and encoding points as ISO/IEC 10646, as well as additional
1195 information about the characters and their use.}
1197 \textit{Earlier versions of DWARF did not specify the representation
1198 of strings; for compatibility, this version also does
1199 not. However, the UTF\dash 8 representation is strongly recommended.}
1201 \item \livelinki{chap:classstroffsetsptr}{stroffsetsptr}{stroffsetsptr class} \\
1202 \livetarg{datarep:classstroffsetsptr}{}
1203 This is an offset into the \dotdebugstroffsets{} section
1204 (\DWFORMsecoffset). It consists of an offset from the beginning of the
1205 \dotdebugstroffsets{} section to the
1206 beginning of the string offsets information for the
1207 referencing entity. It is relocatable in
1208 a relocatable object file, and relocated in an executable or
1209 shared object. In the \thirtytwobitdwarfformat, this offset
1210 is a 4\dash byte unsigned value; in the 64\dash bit DWARF
1211 format, it is an 8\dash byte unsigned value (see Section
1212 \refersec{datarep:32bitand64bitdwarfformats}).
1214 \textit{This class is new in \DWARFVersionV.}
1218 In no case does an attribute use
1219 \addtoindexx{rangelistptr class}
1221 \addtoindexx{loclistptr class}
1223 \addtoindexx{lineptr class}
1225 \addtoindexx{macptr class}
1226 classes \livelink{chap:classlineptr}{lineptr},
1227 \livelink{chap:classloclistptr}{loclistptr}, \livelink{chap:classmacptr}{macptr} or
1228 \livelink{chap:classrangelistptr}{rangelistptr} to point into either the
1229 \dotdebuginfo{} or \dotdebugstr{} section.
1231 The form encodings are listed in
1232 Table \refersec{tab:attributeformencodings}.
1236 \setlength{\extrarowheight}{0.1cm}
1237 \begin{longtable}{l|l|l}
1238 \caption{Attribute encodings}
1239 \label{tab:attributeencodings}
1240 \addtoindexx{attribute encodings} \\
1241 \hline \bfseries Attribute name&\bfseries Value &\bfseries Classes \\ \hline
1243 \bfseries Attribute name&\bfseries Value &\bfseries Classes\\ \hline
1245 \hline \emph{Continued on next page}
1247 \hline \ddag\ \textit{New in DWARF Version 5}
1249 \DWATsibling&0x01&\livelink{chap:classreference}{reference}
1250 \addtoindexx{sibling attribute!encoding} \\
1251 \DWATlocation&0x02&\livelink{chap:classexprloc}{exprloc},
1252 \livelink{chap:classloclistptr}{loclistptr}
1253 \addtoindexx{location attribute!encoding} \\
1254 \DWATname&0x03&\livelink{chap:classstring}{string}
1255 \addtoindexx{name attribute!encoding} \\
1256 \DWATordering&0x09&\livelink{chap:classconstant}{constant}
1257 \addtoindexx{ordering attribute!encoding} \\
1258 \DWATbytesize&0x0b&\livelink{chap:classconstant}{constant},
1259 \livelink{chap:classexprloc}{exprloc},
1260 \livelink{chap:classreference}{reference}
1261 \addtoindexx{byte size attribute!encoding} \\
1262 \DWATbitoffset&0x0c&\livelink{chap:classconstant}{constant},
1263 \livelink{chap:classexprloc}{exprloc},
1264 \livelink{chap:classreference}{reference}
1265 \addtoindexx{bit offset attribute!encoding} \\
1266 \DWATbitsize&0x0d&\livelink{chap:classconstant}{constant},
1267 \livelink{chap:classexprloc}{exprloc},
1268 \livelink{chap:classreference}{reference}
1269 \addtoindexx{bit size attribute!encoding} \\
1270 \DWATstmtlist&0x10&\livelink{chap:classlineptr}{lineptr}
1271 \addtoindexx{statement list attribute!encoding} \\
1272 \DWATlowpc&0x11&\livelink{chap:classaddress}{address}
1273 \addtoindexx{low PC attribute!encoding} \\
1274 \DWAThighpc&0x12&\livelink{chap:classaddress}{address},
1275 \livelink{chap:classconstant}{constant}
1276 \addtoindexx{high PC attribute!encoding} \\
1277 \DWATlanguage&0x13&\livelink{chap:classconstant}{constant}
1278 \addtoindexx{language attribute!encoding} \\
1279 \DWATdiscr&0x15&\livelink{chap:classreference}{reference}
1280 \addtoindexx{discriminant attribute!encoding} \\
1281 \DWATdiscrvalue&0x16&\livelink{chap:classconstant}{constant}
1282 \addtoindexx{discriminant value attribute!encoding} \\
1283 \DWATvisibility&0x17&\livelink{chap:classconstant}{constant}
1284 \addtoindexx{visibility attribute!encoding} \\
1285 \DWATimport&0x18&\livelink{chap:classreference}{reference}
1286 \addtoindexx{import attribute!encoding} \\
1287 \DWATstringlength&0x19&\livelink{chap:classexprloc}{exprloc},
1288 \livelink{chap:classloclistptr}{loclistptr}
1289 \addtoindexx{string length attribute!encoding} \\
1290 \DWATcommonreference&0x1a&\livelink{chap:classreference}{reference}
1291 \addtoindexx{common reference attribute!encoding} \\
1292 \DWATcompdir&0x1b&\livelink{chap:classstring}{string}
1293 \addtoindexx{compilation directory attribute!encoding} \\
1294 \DWATconstvalue&0x1c&\livelink{chap:classblock}{block},
1295 \livelink{chap:classconstant}{constant},
1296 \livelink{chap:classstring}{string}
1297 \addtoindexx{constant value attribute!encoding} \\
1298 \DWATcontainingtype&0x1d&\livelink{chap:classreference}{reference}
1299 \addtoindexx{containing type attribute!encoding} \\
1300 \DWATdefaultvalue&0x1e&\livelink{chap:classconstant}{constant},
1301 \livelink{chap:classreference}{reference},
1302 \livelink{chap:classflag}{flag}
1303 \addtoindexx{default value attribute!encoding} \\
1304 \DWATinline&0x20&\livelink{chap:classconstant}{constant}
1305 \addtoindexx{inline attribute!encoding} \\
1306 \DWATisoptional&0x21&\livelink{chap:classflag}{flag}
1307 \addtoindexx{is optional attribute!encoding} \\
1308 \DWATlowerbound&0x22&\livelink{chap:classconstant}{constant},
1309 \livelink{chap:classexprloc}{exprloc},
1310 \livelink{chap:classreference}{reference}
1311 \addtoindexx{lower bound attribute!encoding} \\
1312 \DWATproducer&0x25&\livelink{chap:classstring}{string}
1313 \addtoindexx{producer attribute!encoding} \\
1314 \DWATprototyped&0x27&\livelink{chap:classflag}{flag}
1315 \addtoindexx{prototyped attribute!encoding} \\
1316 \DWATreturnaddr&0x2a&\livelink{chap:classexprloc}{exprloc},
1317 \livelink{chap:classloclistptr}{loclistptr}
1318 \addtoindexx{return address attribute!encoding} \\
1319 \DWATstartscope&0x2c&\livelink{chap:classconstant}{constant},
1320 \livelink{chap:classrangelistptr}{rangelistptr}
1321 \addtoindexx{start scope attribute!encoding} \\
1322 \DWATbitstride&0x2e&\livelink{chap:classconstant}{constant},
1323 \livelink{chap:classexprloc}{exprloc},
1324 \livelink{chap:classreference}{reference}
1325 \addtoindexx{bit stride attribute!encoding} \\
1326 \DWATupperbound&0x2f&\livelink{chap:classconstant}{constant},
1327 \livelink{chap:classexprloc}{exprloc},
1328 \livelink{chap:classreference}{reference}
1329 \addtoindexx{upper bound attribute!encoding} \\
1330 \DWATabstractorigin&0x31&\livelink{chap:classreference}{reference}
1331 \addtoindexx{abstract origin attribute!encoding} \\
1332 \DWATaccessibility&0x32&\livelink{chap:classconstant}{constant}
1333 \addtoindexx{accessibility attribute!encoding} \\
1334 \DWATaddressclass&0x33&\livelink{chap:classconstant}{constant}
1335 \addtoindexx{address class attribute!encoding} \\
1336 \DWATartificial&0x34&\livelink{chap:classflag}{flag}
1337 \addtoindexx{artificial attribute!encoding} \\
1338 \DWATbasetypes&0x35&\livelink{chap:classreference}{reference}
1339 \addtoindexx{base types attribute!encoding} \\
1340 \DWATcallingconvention&0x36&\livelink{chap:classconstant}{constant}
1341 \addtoindexx{calling convention attribute!encoding} \\
1342 \DWATcount&0x37&\livelink{chap:classconstant}{constant},
1343 \livelink{chap:classexprloc}{exprloc},
1344 \livelink{chap:classreference}{reference}
1345 \addtoindexx{count attribute!encoding} \\
1346 \DWATdatamemberlocation&0x38&\livelink{chap:classconstant}{constant},
1347 \livelink{chap:classexprloc}{exprloc},
1348 \livelink{chap:classloclistptr}{loclistptr}
1349 \addtoindexx{data member attribute!encoding} \\
1350 \DWATdeclcolumn&0x39&\livelink{chap:classconstant}{constant}
1351 \addtoindexx{declaration column attribute!encoding} \\
1352 \DWATdeclfile&0x3a&\livelink{chap:classconstant}{constant}
1353 \addtoindexx{declaration file attribute!encoding} \\
1354 \DWATdeclline&0x3b&\livelink{chap:classconstant}{constant}
1355 \addtoindexx{declaration line attribute!encoding} \\
1356 \DWATdeclaration&0x3c&\livelink{chap:classflag}{flag}
1357 \addtoindexx{declaration attribute!encoding} \\
1358 \DWATdiscrlist&0x3d&\livelink{chap:classblock}{block}
1359 \addtoindexx{discriminant list attribute!encoding} \\
1360 \DWATencoding&0x3e&\livelink{chap:classconstant}{constant}
1361 \addtoindexx{encoding attribute!encoding} \\
1362 \DWATexternal&\xiiif&\livelink{chap:classflag}{flag}
1363 \addtoindexx{external attribute!encoding} \\
1364 \DWATframebase&0x40&\livelink{chap:classexprloc}{exprloc},
1365 \livelink{chap:classloclistptr}{loclistptr}
1366 \addtoindexx{frame base attribute!encoding} \\
1367 \DWATfriend&0x41&\livelink{chap:classreference}{reference}
1368 \addtoindexx{friend attribute!encoding} \\
1369 \DWATidentifiercase&0x42&\livelink{chap:classconstant}{constant}
1370 \addtoindexx{identifier case attribute!encoding} \\
1371 \DWATmacroinfo\footnote{\raggedright Not used in \DWARFVersionV.
1372 Reserved for compatibility and coexistence
1373 with prior DWARF versions.}
1374 &0x43&\livelink{chap:classmacptr}{macptr}
1375 \addtoindexx{macro information attribute (legacy)!encoding} \\
1376 \DWATnamelistitem&0x44&\livelink{chap:classreference}{reference}
1377 \addtoindexx{name list item attribute!encoding} \\
1378 \DWATpriority&0x45&\livelink{chap:classreference}{reference}
1379 \addtoindexx{priority attribute!encoding} \\
1380 \DWATsegment&0x46&\livelink{chap:classexprloc}{exprloc},
1381 \livelink{chap:classloclistptr}{loclistptr}
1382 \addtoindexx{segment attribute!encoding} \\
1383 \DWATspecification&0x47&\livelink{chap:classreference}{reference}
1384 \addtoindexx{specification attribute!encoding} \\
1385 \DWATstaticlink&0x48&\livelink{chap:classexprloc}{exprloc},
1386 \livelink{chap:classloclistptr}{loclistptr}
1387 \addtoindexx{static link attribute!encoding} \\
1388 \DWATtype&0x49&\livelink{chap:classreference}{reference}
1389 \addtoindexx{type attribute!encoding} \\
1390 \DWATuselocation&0x4a&\livelink{chap:classexprloc}{exprloc},
1391 \livelink{chap:classloclistptr}{loclistptr}
1392 \addtoindexx{location list attribute!encoding} \\
1393 \DWATvariableparameter&0x4b&\livelink{chap:classflag}{flag}
1394 \addtoindexx{variable parameter attribute!encoding} \\
1395 \DWATvirtuality&0x4c&\livelink{chap:classconstant}{constant}
1396 \addtoindexx{virtuality attribute!encoding} \\
1397 \DWATvtableelemlocation&0x4d&\livelink{chap:classexprloc}{exprloc},
1398 \livelink{chap:classloclistptr}{loclistptr}
1399 \addtoindexx{vtable element location attribute!encoding} \\
1400 \DWATallocated&0x4e&\livelink{chap:classconstant}{constant},
1401 \livelink{chap:classexprloc}{exprloc},
1402 \livelink{chap:classreference}{reference}
1403 \addtoindexx{allocated attribute!encoding} \\
1404 \DWATassociated&0x4f&\livelink{chap:classconstant}{constant},
1405 \livelink{chap:classexprloc}{exprloc},
1406 \livelink{chap:classreference}{reference}
1407 \addtoindexx{associated attribute!encoding} \\
1408 \DWATdatalocation&0x50&\livelink{chap:classexprloc}{exprloc}
1409 \addtoindexx{data location attribute!encoding} \\
1410 \DWATbytestride&0x51&\livelink{chap:classconstant}{constant},
1411 \livelink{chap:classexprloc}{exprloc},
1412 \livelink{chap:classreference}{reference}
1413 \addtoindexx{byte stride attribute!encoding} \\
1414 \DWATentrypc&0x52&\livelink{chap:classaddress}{address},
1415 \livelink{chap:classconstant}{constant}
1416 \addtoindexx{entry pc attribute!encoding} \\
1417 \DWATuseUTFeight&0x53&\livelink{chap:classflag}{flag}
1418 \addtoindexx{use UTF8 attribute!encoding}\addtoindexx{UTF-8} \\
1419 \DWATextension&0x54&\livelink{chap:classreference}{reference}
1420 \addtoindexx{extension attribute!encoding} \\
1421 \DWATranges&0x55&\livelink{chap:classrangelistptr}{rangelistptr}
1422 \addtoindexx{ranges attribute!encoding} \\
1423 \DWATtrampoline&0x56&\livelink{chap:classaddress}{address},
1424 \livelink{chap:classflag}{flag},
1425 \livelink{chap:classreference}{reference},
1426 \livelink{chap:classstring}{string}
1427 \addtoindexx{trampoline attribute!encoding} \\
1428 \DWATcallcolumn&0x57&\livelink{chap:classconstant}{constant}
1429 \addtoindexx{call column attribute!encoding} \\
1430 \DWATcallfile&0x58&\livelink{chap:classconstant}{constant}
1431 \addtoindexx{call file attribute!encoding} \\
1432 \DWATcallline&0x59&\livelink{chap:classconstant}{constant}
1433 \addtoindexx{call line attribute!encoding} \\
1434 \DWATdescription&0x5a&\livelink{chap:classstring}{string}
1435 \addtoindexx{description attribute!encoding} \\
1436 \DWATbinaryscale&0x5b&\livelink{chap:classconstant}{constant}
1437 \addtoindexx{binary scale attribute!encoding} \\
1438 \DWATdecimalscale&0x5c&\livelink{chap:classconstant}{constant}
1439 \addtoindexx{decimal scale attribute!encoding} \\
1440 \DWATsmall{} &0x5d&\livelink{chap:classreference}{reference}
1441 \addtoindexx{small attribute!encoding} \\
1442 \DWATdecimalsign&0x5e&\livelink{chap:classconstant}{constant}
1443 \addtoindexx{decimal scale attribute!encoding} \\
1444 \DWATdigitcount&0x5f&\livelink{chap:classconstant}{constant}
1445 \addtoindexx{digit count attribute!encoding} \\
1446 \DWATpicturestring&0x60&\livelink{chap:classstring}{string}
1447 \addtoindexx{picture string attribute!encoding} \\
1448 \DWATmutable&0x61&\livelink{chap:classflag}{flag}
1449 \addtoindexx{mutable attribute!encoding} \\
1450 \DWATthreadsscaled&0x62&\livelink{chap:classflag}{flag}
1451 \addtoindexx{thread scaled attribute!encoding} \\
1452 \DWATexplicit&0x63&\livelink{chap:classflag}{flag}
1453 \addtoindexx{explicit attribute!encoding} \\
1454 \DWATobjectpointer&0x64&\livelink{chap:classreference}{reference}
1455 \addtoindexx{object pointer attribute!encoding} \\
1456 \DWATendianity&0x65&\livelink{chap:classconstant}{constant}
1457 \addtoindexx{endianity attribute!encoding} \\
1458 \DWATelemental&0x66&\livelink{chap:classflag}{flag}
1459 \addtoindexx{elemental attribute!encoding} \\
1460 \DWATpure&0x67&\livelink{chap:classflag}{flag}
1461 \addtoindexx{pure attribute!encoding} \\
1462 \DWATrecursive&0x68&\livelink{chap:classflag}{flag}
1463 \addtoindexx{recursive attribute!encoding} \\
1464 \DWATsignature{} &0x69&\livelink{chap:classreference}{reference}
1465 \addtoindexx{signature attribute!encoding} \\
1466 \DWATmainsubprogram{} &0x6a&\livelink{chap:classflag}{flag}
1467 \addtoindexx{main subprogram attribute!encoding} \\
1468 \DWATdatabitoffset{} &0x6b&\livelink{chap:classconstant}{constant}
1469 \addtoindexx{data bit offset attribute!encoding} \\
1470 \DWATconstexpr{} &0x6c&\livelink{chap:classflag}{flag}
1471 \addtoindexx{constant expression attribute!encoding} \\
1472 \DWATenumclass{} &0x6d&\livelink{chap:classflag}{flag}
1473 \addtoindexx{enumeration class attribute!encoding} \\
1474 \DWATlinkagename{} &0x6e&\livelink{chap:classstring}{string}
1475 \addtoindexx{linkage name attribute!encoding} \\
1476 \DWATstringlengthbitsize{}~\ddag&0x6f&
1477 \livelink{chap:classconstant}{constant}
1478 \addtoindexx{string length attribute!size of length} \\
1479 \DWATstringlengthbytesize{}~\ddag&0x70&
1480 \livelink{chap:classconstant}{constant}
1481 \addtoindexx{string length attribute!size of length} \\
1482 \DWATrank~\ddag&0x71&
1483 \livelink{chap:classconstant}{constant},
1484 \livelink{chap:classexprloc}{exprloc}
1485 \addtoindexx{rank attribute!encoding} \\
1486 \DWATstroffsetsbase~\ddag&0x72&
1487 \livelinki{chap:classstring}{stroffsetsptr}{stroffsetsptr class}
1488 \addtoindexx{string offsets base!encoding} \\
1489 \DWATaddrbase~\ddag &0x73&
1490 \livelinki{chap:DWATaddrbase}{addrptr}{addrptr class}
1491 \addtoindexx{address table base!encoding} \\
1492 \DWATrangesbase~\ddag&0x74&
1493 \livelinki{chap:DWATrangesbase}{rangelistptr}{rangelistptr class}
1494 \addtoindexx{ranges base!encoding} \\
1495 \DWATdwoid~\ddag &0x75&
1496 \livelink{chap:DWATdwoid}{constant}
1497 \addtoindexx{split DWARF object id!encoding} \\
1498 \DWATdwoname~\ddag &0x76&
1499 \livelink{chap:DWATdwoname}{string}
1500 \addtoindexx{split DWARF object file name!encoding} \\
1501 \DWATreference~\ddag &0x77&
1502 \livelink{chap:DWATreference}{flag} \\
1503 \DWATrvaluereference~\ddag &0x78&
1504 \livelink{chap:DWATrvaluereference}{flag} \\
1505 \DWATmacros~\ddag &0x79&\livelink{chap:classmacptr}{macptr}
1506 \addtoindexx{macro information attribute!encoding} \\
1507 \DWATcallallcalls~\ddag &0x7a&\CLASSflag
1508 \addtoindexx{all calls summary attribute!encoding}\\
1509 \DWATcallallsourcecalls~\ddag &0x7b &\CLASSflag
1510 \addtoindexx{all source calls summary attribute!encoding} \\
1511 \DWATcallalltailcalls~\ddag &0x7c&\CLASSflag
1512 \addtoindexx{all tail calls summary attribute!encoding} \\
1513 \DWATcalldatalocation~\ddag &0x7d&\CLASSexprloc
1514 \addtoindexx{call data location attribute!encoding} \\
1515 \DWATcalldatavalue~\ddag &0x7e&\CLASSexprloc
1516 \addtoindexx{call data value attribute!encoding} \\
1517 \DWATcallorigin~\ddag &0x7f &\CLASSexprloc
1518 \addtoindexx{call origin attribute!encoding} \\
1519 \DWATcallparameter~\ddag &0x80 &\CLASSreference
1520 \addtoindexx{call parameter attribute!encoding} \\
1521 \DWATcallpc~\ddag &0x81 &\CLASSaddress
1522 \addtoindexx{call pc attribute!encoding} \\
1523 \DWATcallreturnpc~\ddag &0x82 &\CLASSaddress
1524 \addtoindexx{call return pc attribute!encoding} \\
1525 \DWATcalltailcall~\ddag &0x83 &\CLASSflag
1526 \addtoindexx{call tail call attribute!encoding} \\
1527 \DWATcalltarget~\ddag &0x84 &\CLASSexprloc
1528 \addtoindexx{call target attribute!encoding} \\
1529 \DWATcalltargetclobbered!\ddag &0x85 &\CLASSexprloc
1530 \addtoindexx{call target clobbered attribute!encoding} \\
1531 \DWATcallvalue~\ddag &0x86 &\CLASSexprloc
1532 \addtoindexx{call value attribute!encoding} \\
1534 \DWATlouser&0x2000 & --- \addtoindexx{low user attribute encoding} \\
1535 \DWAThiuser&\xiiifff& --- \addtoindexx{high user attribute encoding} \\
1542 \setlength{\extrarowheight}{0.1cm}
1543 \begin{longtable}{l|l|l}
1544 \caption{Attribute form encodings} \label{tab:attributeformencodings} \\
1545 \hline \bfseries Form name&\bfseries Value &\bfseries Classes \\ \hline
1547 \bfseries Form name&\bfseries Value &\bfseries Classes\\ \hline
1549 \hline \emph{Continued on next page}
1551 \hline \ddag\ \textit{New in DWARF Version 5}
1554 \DWFORMaddr &0x01&\livelink{chap:classaddress}{address} \\
1555 \textit{Reserved} &0x02& \\
1556 \DWFORMblocktwo &0x03&\livelink{chap:classblock}{block} \\
1557 \DWFORMblockfour &0x04&\livelink{chap:classblock}{block} \\
1558 \DWFORMdatatwo &0x05&\livelink{chap:classconstant}{constant} \\
1559 \DWFORMdatafour &0x06&\livelink{chap:classconstant}{constant} \\
1560 \DWFORMdataeight &0x07&\livelink{chap:classconstant}{constant} \\
1561 \DWFORMstring&0x08&\livelink{chap:classstring}{string} \\
1562 \DWFORMblock&0x09&\livelink{chap:classblock}{block} \\
1563 \DWFORMblockone &0x0a&\livelink{chap:classblock}{block} \\
1564 \DWFORMdataone &0x0b&\livelink{chap:classconstant}{constant} \\
1565 \DWFORMflag&0x0c&\livelink{chap:classflag}{flag} \\
1566 \DWFORMsdata&0x0d&\livelink{chap:classconstant}{constant} \\
1567 \DWFORMstrp&0x0e&\livelink{chap:classstring}{string} \\
1568 \DWFORMudata&0x0f&\livelink{chap:classconstant}{constant} \\
1569 \DWFORMrefaddr&0x10&\livelink{chap:classreference}{reference} \\
1570 \DWFORMrefone&0x11&\livelink{chap:classreference}{reference} \\
1571 \DWFORMreftwo&0x12&\livelink{chap:classreference}{reference} \\
1572 \DWFORMreffour&0x13&\livelink{chap:classreference}{reference} \\
1573 \DWFORMrefeight&0x14&\livelink{chap:classreference}{reference} \\
1574 \DWFORMrefudata&0x15&\livelink{chap:classreference}{reference} \\
1575 \DWFORMindirect&0x16&(see Section \refersec{datarep:abbreviationstables}) \\
1576 \DWFORMsecoffset{} &0x17&\livelink{chap:classlineptr}{lineptr}, \livelink{chap:classloclistptr}{loclistptr}, \livelink{chap:classmacptr}{macptr}, \livelink{chap:classrangelistptr}{rangelistptr} \\
1577 \DWFORMexprloc{} &0x18&\livelink{chap:classexprloc}{exprloc} \\
1578 \DWFORMflagpresent{} &0x19&\livelink{chap:classflag}{flag} \\
1579 \DWFORMstrx{} \ddag &0x1a&\livelink{chap:classstring}{string} \\
1580 \DWFORMaddrx{} \ddag &0x1b&\livelink{chap:classaddress}{address} \\
1581 \DWFORMrefsigeight &0x20&\livelink{chap:classreference}{reference} \\
1588 \section{Variable Length Data}
1589 \label{datarep:variablelengthdata}
1590 \addtoindexx{variable length data|see {LEB128}}
1592 \addtoindexx{Little Endian Base 128|see{LEB128}}
1593 encoded using \doublequote{Little Endian Base 128}
1594 \addtoindexx{little-endian encoding|see{endian attribute}}
1596 \addtoindexx{LEB128}
1597 LEB128 is a scheme for encoding integers
1598 densely that exploits the assumption that most integers are
1601 \textit{This encoding is equally suitable whether the target machine
1602 architecture represents data in big\dash\ endian or little\dash endian
1603 order. It is \doublequote{little\dash endian} only in the sense that it
1604 avoids using space to represent the \doublequote{big} end of an
1605 unsigned integer, when the big end is all zeroes or sign
1608 Unsigned LEB128\addtoindexx{LEB128!unsigned} (ULEB128) numbers are encoded as follows:
1609 \addtoindexx{LEB128!unsigned, encoding as}
1610 start at the low order end of an unsigned integer and chop
1611 it into 7\dash bit chunks. Place each chunk into the low order 7
1612 bits of a byte. Typically, several of the high order bytes
1613 will be zero; discard them. Emit the remaining bytes in a
1614 stream, starting with the low order byte; set the high order
1615 bit on each byte except the last emitted byte. The high bit
1616 of zero on the last byte indicates to the decoder that it
1617 has encountered the last byte.
1619 The integer zero is a special case, consisting of a single
1622 Table \refersec{tab:examplesofunsignedleb128encodings}
1623 gives some examples of unsigned LEB128\addtoindexx{LEB128!unsigned}
1625 0x80 in each case is the high order bit of the byte, indicating
1626 that an additional byte follows.
1629 The encoding for signed, two\textquoteright s complement LEB128 (SLEB128)
1630 \addtoindexx{LEB128!signed, encoding as}
1631 numbers is similar, except that the criterion for discarding
1632 high order bytes is not whether they are zero, but whether
1633 they consist entirely of sign extension bits. Consider the
1634 32\dash bit integer -2. The three high level bytes of the number
1635 are sign extension, thus LEB128 would represent it as a single
1636 byte containing the low order 7 bits, with the high order
1637 bit cleared to indicate the end of the byte stream. Note
1638 that there is nothing within the LEB128 representation that
1639 indicates whether an encoded number is signed or unsigned. The
1640 decoder must know what type of number to expect.
1641 Table \refersec{tab:examplesofunsignedleb128encodings}
1642 gives some examples of unsigned LEB128\addtoindexx{LEB128!unsigned}
1643 numbers and Table \refersec{tab:examplesofsignedleb128encodings}
1644 gives some examples of signed LEB128\addtoindexx{LEB128!signed}
1647 \textit{Appendix \refersec{app:variablelengthdataencodingdecodinginformative}
1648 \addtoindexx{LEB128!examples}
1649 gives algorithms for encoding and decoding these forms.}
1653 \setlength{\extrarowheight}{0.1cm}
1654 \begin{longtable}{l|l|l}
1655 \caption{Examples of unsigned LEB128 encodings}
1656 \label{tab:examplesofunsignedleb128encodings}
1657 \addtoindexx{LEB128 encoding!examples}\addtoindexx{LEB128!unsigned} \\
1658 \hline \bfseries Number&\bfseries First byte &\bfseries Second byte \\ \hline
1660 \bfseries Number&\bfseries First Byte &\bfseries Second byte\\ \hline
1662 \hline \emph{Continued on next page}
1668 128& 0 + 0x80 & 1 \\
1669 129& 1 + 0x80 & 1 \\
1670 130& 2 + 0x80 & 1 \\
1671 12857& 57 + 0x80 & 100 \\
1678 \setlength{\extrarowheight}{0.1cm}
1679 \begin{longtable}{l|l|l}
1680 \caption{Examples of signed LEB128 encodings}
1681 \label{tab:examplesofsignedleb128encodings}
1682 \addtoindexx{LEB128!signed} \\
1683 \hline \bfseries Number&\bfseries First byte &\bfseries Second byte \\ \hline
1685 \bfseries Number&\bfseries First Byte &\bfseries Second byte\\ \hline
1687 \hline \emph{Continued on next page}
1693 127& 127 + 0x80 & 0 \\
1694 -127& 1 + 0x80 & 0x7f \\
1695 128& 0 + 0x80 & 1 \\
1696 -128& 0 + 0x80 & 0x7f \\
1697 129& 1 + 0x80 & 1 \\
1698 -129& 0x7f + 0x80 & 0x7e \\
1705 \section{DWARF Expressions and Location Descriptions}
1706 \label{datarep:dwarfexpressionsandlocationdescriptions}
1707 \subsection{DWARF Expressions}
1708 \label{datarep:dwarfexpressions}
1711 \addtoindexx{DWARF Expression!operator encoding}
1712 DWARF expression is stored in a \nolink{block} of contiguous
1713 bytes. The bytes form a sequence of operations. Each operation
1714 is a 1\dash byte code that identifies that operation, followed by
1715 zero or more bytes of additional data. The encodings for the
1716 operations are described in
1717 Table \refersec{tab:dwarfoperationencodings}.
1720 \setlength{\extrarowheight}{0.1cm}
1721 \begin{longtable}{l|c|c|l}
1722 \caption{DWARF operation encodings} \label{tab:dwarfoperationencodings} \\
1723 \hline & &\bfseries No. of &\\
1724 \bfseries Operation&\bfseries Code &\bfseries Operands &\bfseries Notes\\ \hline
1726 & &\bfseries No. of &\\
1727 \bfseries Operation&\bfseries Code &\bfseries Operands &\bfseries Notes\\ \hline
1729 \hline \emph{Continued on next page}
1731 \hline \ddag\ \textit{New in DWARF Version 5}
1734 \DWOPaddr&0x03&1 & constant address \\
1735 & & &(size is target specific) \\
1737 \DWOPderef&0x06&0 & \\
1739 \DWOPconstoneu&0x08&1&1\dash byte constant \\
1740 \DWOPconstones&0x09&1&1\dash byte constant \\
1741 \DWOPconsttwou&0x0a&1&2\dash byte constant \\
1742 \DWOPconsttwos&0x0b&1&2\dash byte constant \\
1743 \DWOPconstfouru&0x0c&1&4\dash byte constant \\
1744 \DWOPconstfours&0x0d&1&4\dash byte constant \\
1745 \DWOPconsteightu&0x0e&1&8\dash byte constant \\
1746 \DWOPconsteights&0x0f&1&8\dash byte constant \\
1747 \DWOPconstu&0x10&1&ULEB128 constant \\
1748 \DWOPconsts&0x11&1&SLEB128 constant \\
1749 \DWOPdup&0x12&0 & \\
1750 \DWOPdrop&0x13&0 & \\
1751 \DWOPover&0x14&0 & \\
1752 \DWOPpick&0x15&1&1\dash byte stack index \\
1753 \DWOPswap&0x16&0 & \\
1754 \DWOProt&0x17&0 & \\
1755 \DWOPxderef&0x18&0 & \\
1756 \DWOPabs&0x19&0 & \\
1757 \DWOPand&0x1a&0 & \\
1758 \DWOPdiv&0x1b&0 & \\
1759 \DWOPminus&0x1c&0 & \\
1760 \DWOPmod&0x1d&0 & \\
1761 \DWOPmul&0x1e&0 & \\
1762 \DWOPneg&0x1f&0 & \\
1763 \DWOPnot&0x20&0 & \\
1765 \DWOPplus&0x22&0 & \\
1766 \DWOPplusuconst&0x23&1&ULEB128 addend \\
1767 \DWOPshl&0x24&0 & \\
1768 \DWOPshr&0x25&0 & \\
1769 \DWOPshra&0x26&0 & \\
1770 \DWOPxor&0x27&0 & \\
1772 \DWOPbra&0x28&1 & signed 2\dash byte constant \\
1779 \DWOPskip&0x2f&1&signed 2\dash byte constant \\ \hline
1781 \DWOPlitzero & 0x30 & 0 & \\
1782 \DWOPlitone & 0x31 & 0& literals 0 .. 31 = \\
1783 \ldots & & &\hspace{0.3cm}(\DWOPlitzero{} + literal) \\
1784 \DWOPlitthirtyone & 0x4f & 0 & \\ \hline
1786 \DWOPregzero & 0x50 & 0 & \\*
1787 \DWOPregone & 0x51 & 0® 0 .. 31 = \\*
1788 \ldots & & &\hspace{0.3cm}(\DWOPregzero{} + regnum) \\*
1789 \DWOPregthirtyone & 0x6f & 0 & \\ \hline
1791 \DWOPbregzero & 0x70 &1 & SLEB128 offset \\*
1792 \DWOPbregone & 0x71 & 1 &base register 0 .. 31 = \\*
1793 ... & & &\hspace{0.3cm}(\DWOPbregzero{} + regnum) \\*
1794 \DWOPbregthirtyone & 0x8f & 1 & \\ \hline
1796 \DWOPregx{} & 0x90 &1&ULEB128 register \\
1797 \DWOPfbreg{} & 0x91&1&SLEB128 offset \\
1798 \DWOPbregx{} & 0x92&2 &ULEB128 register, \\*
1799 & & &SLEB128 offset \\
1800 \DWOPpiece{} & 0x93 &1& ULEB128 size of piece \\
1801 \DWOPderefsize{} & 0x94 &1& 1-byte size of data retrieved \\
1802 \DWOPxderefsize{} & 0x95&1&1-byte size of data retrieved \\
1803 \DWOPnop{} & 0x96 &0& \\
1805 \DWOPpushobjectaddress&0x97&0 & \\
1806 \DWOPcalltwo&0x98&1& 2\dash byte offset of DIE \\
1807 \DWOPcallfour&0x99&1& 4\dash byte offset of DIE \\
1808 \DWOPcallref&0x9a&1& 4\dash\ or 8\dash byte offset of DIE \\
1809 \DWOPformtlsaddress&0x9b &0& \\
1810 \DWOPcallframecfa{} &0x9c &0& \\
1811 \DWOPbitpiece&0x9d &2&ULEB128 size, \\*
1813 \DWOPimplicitvalue{} &0x9e &2&ULEB128 size, \\*
1814 &&&\nolink{block} of that size\\
1815 \DWOPstackvalue{} &0x9f &0& \\
1816 \DWOPimplicitpointer{}~\ddag &0xa0& 2 &4- or 8-byte offset of DIE, \\*
1817 &&&SLEB128 constant offset \\
1818 \DWOPaddrx~\ddag&0xa1&1&ULEB128 indirect address \\
1819 \DWOPconstx~\ddag&0xa2&1&ULEB128 indirect constant \\
1820 \DWOPentryvalue~\ddag&0xa3&2&ULEV128 size, \\*
1821 &&&\nolink{block} of that size\\
1822 \DWOPlouser{} &0xe0 && \\
1823 \DWOPhiuser{} &\xff && \\
1829 \subsection{Location Descriptions}
1830 \label{datarep:locationdescriptions}
1832 A location description is used to compute the
1833 location of a variable or other entity.
1835 \subsection{Location Lists}
1836 \label{datarep:locationlists}
1838 Each entry in a \addtoindex{location list} is either a location list entry,
1839 a base address selection entry, or an
1840 \addtoindexx{end of list entry!in location list}
1844 \subsubsection{Location List Entries in Non-Split Objects}
1845 A \addtoindex{location list} entry consists of two address offsets followed
1846 by a 2\dash byte length, followed by a block of contiguous bytes
1847 that contains a DWARF location description. The length
1848 specifies the number of bytes in that block. The two offsets
1849 are the same size as an address on the target machine.
1852 A base address selection entry and an
1853 \addtoindexx{end of list entry!in location list}
1854 end of list entry each
1855 consist of two (constant or relocated) address offsets. The two
1856 offsets are the same size as an address on the target machine.
1858 For a \addtoindex{location list} to be specified, the base address of
1859 \addtoindexx{base address selection entry!in location list}
1860 the corresponding compilation unit must be defined
1861 (see Section \refersec{chap:normalandpartialcompilationunitentries}).
1863 \subsubsection{Location List Entries in Split Objects}
1864 An alternate form for location list entries is used in split objects.
1865 Each entry begins with a one-byte code that indicates the kind of entry
1866 that follows. The encodings for these constants are given in
1867 Table \refersec{tab:locationlistentryencodingvalues}.
1870 \setlength{\extrarowheight}{0.1cm}
1871 \begin{longtable}{l|c}
1872 \caption{Location list entry encoding values} \label{tab:locationlistentryencodingvalues} \\
1873 \hline \bfseries Location list entry encoding name&\bfseries Value \\ \hline
1875 \bfseries Location list entry encoding name&\bfseries Value\\ \hline
1877 \hline \emph{Continued on next page}
1881 \DWLLEendoflistentry & 0x0 \\
1882 \DWLLEbaseaddressselectionentry & 0x01 \\
1883 \DWLLEstartendentry & 0x02 \\
1884 \DWLLEstartlengthentry & 0x03 \\
1885 \DWLLEoffsetpairentry & 0x04 \\
1889 \section{Base Type Attribute Encodings}
1890 \label{datarep:basetypeattributeencodings}
1892 The encodings of the
1893 \hypertarget{chap:DWATencodingencodingofbasetype}{}
1895 \addtoindexx{encoding attribute!encoding}
1898 attribute are given in
1899 Table \refersec{tab:basetypeencodingvalues}
1902 \setlength{\extrarowheight}{0.1cm}
1903 \begin{longtable}{l|c}
1904 \caption{Base type encoding values} \label{tab:basetypeencodingvalues} \\
1905 \hline \bfseries Base type encoding name&\bfseries Value \\ \hline
1907 \bfseries Base type encoding name&\bfseries Value\\ \hline
1909 \hline \emph{Continued on next page}
1913 \DWATEaddress&0x01 \\
1914 \DWATEboolean&0x02 \\
1915 \DWATEcomplexfloat&0x03 \\
1917 \DWATEsigned&0x05 \\
1918 \DWATEsignedchar&0x06 \\
1919 \DWATEunsigned&0x07 \\
1920 \DWATEunsignedchar&0x08 \\
1921 \DWATEimaginaryfloat&0x09 \\
1922 \DWATEpackeddecimal&0x0a \\
1923 \DWATEnumericstring&0x0b \\
1924 \DWATEedited&0x0c \\
1925 \DWATEsignedfixed&0x0d \\
1926 \DWATEunsignedfixed&0x0e \\
1927 \DWATEdecimalfloat{} & 0x0f \\
1928 \DWATEUTF{} & 0x10 \\
1929 \DWATElouser{} & 0x80 \\
1930 \DWATEhiuser{} & \xff \\
1935 The encodings of the constants used in the
1936 \DWATdecimalsign{} attribute
1938 Table \refersec{tab:decimalsignencodings}.
1941 \setlength{\extrarowheight}{0.1cm}
1942 \begin{longtable}{l|c}
1943 \caption{Decimal sign encodings} \label{tab:decimalsignencodings} \\
1944 \hline \bfseries Decimal sign code name&\bfseries Value \\ \hline
1946 \bfseries Decimal sign code name&\bfseries Value\\ \hline
1948 \hline \emph{Continued on next page}
1953 \DWDSunsigned{} & 0x01 \\
1954 \DWDSleadingoverpunch{} & 0x02 \\
1955 \DWDStrailingoverpunch{} & 0x03 \\
1956 \DWDSleadingseparate{} & 0x04 \\
1957 \DWDStrailingseparate{} & 0x05 \\
1963 The encodings of the constants used in the
1964 \DWATendianity{} attribute are given in
1965 Table \refersec{tab:endianityencodings}.
1968 \setlength{\extrarowheight}{0.1cm}
1969 \begin{longtable}{l|c}
1970 \caption{Endianity encodings} \label{tab:endianityencodings}\\
1971 \hline \bfseries Endian code name&\bfseries Value \\ \hline
1973 \bfseries Endian code name&\bfseries Value\\ \hline
1975 \hline \emph{Continued on next page}
1980 \DWENDdefault{} & 0x00 \\
1981 \DWENDbig{} & 0x01 \\
1982 \DWENDlittle{} & 0x02 \\
1983 \DWENDlouser{} & 0x40 \\
1984 \DWENDhiuser{} & \xff \\
1989 \section{Accessibility Codes}
1990 \label{datarep:accessibilitycodes}
1991 The encodings of the constants used in the
1992 \DWATaccessibility{}
1994 \addtoindexx{accessibility attribute!encoding}
1996 Table \refersec{tab:accessibilityencodings}.
1999 \setlength{\extrarowheight}{0.1cm}
2000 \begin{longtable}{l|c}
2001 \caption{Accessibility encodings} \label{tab:accessibilityencodings}\\
2002 \hline \bfseries Accessibility code name&\bfseries Value \\ \hline
2004 \bfseries Accessibility code name&\bfseries Value\\ \hline
2006 \hline \emph{Continued on next page}
2011 \DWACCESSpublic&0x01 \\
2012 \DWACCESSprotected&0x02 \\
2013 \DWACCESSprivate&0x03 \\
2019 \section{Visibility Codes}
2020 \label{datarep:visibilitycodes}
2021 The encodings of the constants used in the
2022 \DWATvisibility{} attribute are given in
2023 Table \refersec{tab:visibilityencodings}.
2026 \setlength{\extrarowheight}{0.1cm}
2027 \begin{longtable}{l|c}
2028 \caption{Visibility encodings} \label{tab:visibilityencodings}\\
2029 \hline \bfseries Visibility code name&\bfseries Value \\ \hline
2031 \bfseries Visibility code name&\bfseries Value\\ \hline
2033 \hline \emph{Continued on next page}
2039 \DWVISexported&0x02 \\
2040 \DWVISqualified&0x03 \\
2045 \section{Virtuality Codes}
2046 \label{datarep:vitualitycodes}
2048 The encodings of the constants used in the
2049 \DWATvirtuality{} attribute are given in
2050 Table \refersec{tab:virtualityencodings}.
2053 \setlength{\extrarowheight}{0.1cm}
2054 \begin{longtable}{l|c}
2055 \caption{Virtuality encodings} \label{tab:virtualityencodings}\\
2056 \hline \bfseries Virtuality code name&\bfseries Value \\ \hline
2058 \bfseries Virtuality code name&\bfseries Value\\ \hline
2060 \hline \emph{Continued on next page}
2065 \DWVIRTUALITYnone&0x00 \\
2066 \DWVIRTUALITYvirtual&0x01 \\
2067 \DWVIRTUALITYpurevirtual&0x02 \\
2075 \DWVIRTUALITYnone{} is equivalent to the absence of the
2079 \section{Source Languages}
2080 \label{datarep:sourcelanguages}
2082 The encodings of the constants used
2083 \addtoindexx{language attribute, encoding}
2085 \addtoindexx{language name encoding}
2088 attribute are given in
2089 Table \refersec{tab:languageencodings}.
2091 % If we don't force a following space it looks odd
2093 and their associated values are reserved, but the
2094 languages they represent are not well supported.
2095 Table \refersec{tab:languageencodings}
2097 \addtoindexx{lower bound attribute!default}
2098 default lower bound, if any, assumed for
2099 an omitted \DWATlowerbound{} attribute in the context of a
2100 \DWTAGsubrangetype{} debugging information entry for each
2104 \setlength{\extrarowheight}{0.1cm}
2105 \begin{longtable}{l|c|c}
2106 \caption{Language encodings} \label{tab:languageencodings}\\
2107 \hline \bfseries Language name&\bfseries Value &\bfseries Default Lower Bound \\ \hline
2109 \bfseries Language name&\bfseries Value &\bfseries Default Lower Bound\\ \hline
2111 \hline \emph{Continued on next page}
2114 \dag \ \textit{See text} \\ \ddag \ \textit{New in \addtoindex{DWARF Version 5}}
2116 \addtoindexx{ISO-defined language names}
2118 \DWLANGCeightynine &0x0001 &0 \addtoindexx{C:1989 (ISO)} \\
2119 \DWLANGC{} &0x0002 &0 \addtoindexx{C!non-standard} \\
2120 \DWLANGAdaeightythree{} \dag &0x0003 &1 \addtoindexx{Ada:1983 (ISO)} \\
2121 \DWLANGCplusplus{} &0x0004 &0 \addtoindexx{C++:1998 (ISO)} \\
2122 \DWLANGCobolseventyfour{} \dag &0x0005 &1 \addtoindexx{COBOL:1974 (ISO)} \\
2123 \DWLANGCoboleightyfive{} \dag &0x0006 &1 \addtoindexx{COBOL:1985 (ISO)} \\
2124 \DWLANGFortranseventyseven &0x0007 &1 \addtoindexx{FORTRAN:1977 (ISO)} \\
2125 \DWLANGFortranninety &0x0008 &1 \addtoindexx{Fortran:1990 (ISO)} \\
2126 \DWLANGPascaleightythree &0x0009 &1 \addtoindexx{Pascal:1983 (ISO)} \\
2127 \DWLANGModulatwo &0x000a &1 \addtoindexx{Modula-2:1996 (ISO)} \\
2128 \DWLANGJava &0x000b &0 \addtoindexx{Java} \\
2129 \DWLANGCninetynine &0x000c &0 \addtoindexx{C:1999 (ISO)} \\
2130 \DWLANGAdaninetyfive{} \dag &0x000d &1 \addtoindexx{Ada:1995 (ISO)} \\
2131 \DWLANGFortranninetyfive &0x000e &1 \addtoindexx{Fortran:1995 (ISO)} \\
2132 \DWLANGPLI{} \dag &0x000f &1 \addtoindexx{PL/I:1976 (ANSI)}\\
2133 \DWLANGObjC{} &0x0010 &0 \addtoindexx{Objective C}\\
2134 \DWLANGObjCplusplus{} &0x0011 &0 \addtoindexx{Objective C++}\\
2135 \DWLANGUPC{} &0x0012 &0 \addtoindexx{UPC}\\
2136 \DWLANGD{} &0x0013 &0 \addtoindexx{D language}\\
2137 \DWLANGPython{} \dag &0x0014 &0 \addtoindexx{Python}\\
2138 \DWLANGOpenCL{} \dag \ddag &0x0015 &0 \addtoindexx{OpenCL}\\
2139 \DWLANGGo{} \dag \ddag &0x0016 &0 \addtoindexx{Go}\\
2140 \DWLANGModulathree{} \dag \ddag &0x0017 &1 \addtoindexx{Modula-3}\\
2141 \DWLANGHaskell{} \dag \ddag &0x0018 &0 \addtoindexx{Haskell}\\
2142 \DWLANGCpluspluszerothree{} \ddag &0x0019 &0 \addtoindexx{C++:2003 (ISO)}\\
2143 \DWLANGCpluspluseleven{} \ddag &0x001a &0 \addtoindexx{C++:2011 (ISO)}\\
2144 \DWLANGOCaml{} \ddag &0x001b &0 \addtoindexx{OCaml}\\
2145 \DWLANGRust{} \ddag &0x001c &0 \addtoindexx{Rust}\\
2146 \DWLANGCeleven{} \ddag &0x001d &0 \addtoindexx{C:2011 (ISO)}\\
2147 \DWLANGlouser{} &0x8000 & \\
2148 \DWLANGhiuser{} &\xffff & \\
2153 \section{Address Class Encodings}
2154 \label{datarep:addressclassencodings}
2156 The value of the common
2157 \addtoindexi{address}{address class!attribute encoding}
2162 \section{Identifier Case}
2163 \label{datarep:identifiercase}
2165 The encodings of the constants used in the
2166 \DWATidentifiercase{} attribute are given in
2167 Table \refersec{tab:identifiercaseencodings}.
2170 \setlength{\extrarowheight}{0.1cm}
2171 \begin{longtable}{l|c}
2172 \caption{Identifier case encodings} \label{tab:identifiercaseencodings}\\
2173 \hline \bfseries Identifier case name&\bfseries Value \\ \hline
2175 \bfseries Identifier case name&\bfseries Value\\ \hline
2177 \hline \emph{Continued on next page}
2181 \DWIDcasesensitive&0x00 \\
2183 \DWIDdowncase&0x02 \\
2184 \DWIDcaseinsensitive&0x03 \\
2188 \section{Calling Convention Encodings}
2189 \label{datarep:callingconventionencodings}
2190 The encodings of the constants used in the
2191 \DWATcallingconvention{} attribute are given in
2192 Table \refersec{tab:callingconventionencodings}.
2195 \setlength{\extrarowheight}{0.1cm}
2196 \begin{longtable}{l|c}
2197 \caption{Calling convention encodings} \label{tab:callingconventionencodings}\\
2198 \hline \bfseries Calling convention name&\bfseries Value \\ \hline
2200 \bfseries Calling convention name&\bfseries Value\\ \hline
2202 \hline \emph{Continued on next page}
2208 \DWCCprogram&0x02 \\
2216 \section{Inline Codes}
2217 \label{datarep:inlinecodes}
2219 The encodings of the constants used in
2220 \addtoindexx{inline attribute!encoding}
2222 \DWATinline{} attribute are given in
2223 Table \refersec{tab:inlineencodings}.
2227 \setlength{\extrarowheight}{0.1cm}
2228 \begin{longtable}{l|c}
2229 \caption{Inline encodings} \label{tab:inlineencodings}\\
2230 \hline \bfseries Inline code name&\bfseries Value \\ \hline
2232 \bfseries Inline Code name&\bfseries Value\\ \hline
2234 \hline \emph{Continued on next page}
2239 \DWINLnotinlined&0x00 \\
2240 \DWINLinlined&0x01 \\
2241 \DWINLdeclarednotinlined&0x02 \\
2242 \DWINLdeclaredinlined&0x03 \\
2247 % this clearpage is ugly, but the following table came
2248 % out oddly without it.
2250 \section{Array Ordering}
2251 \label{datarep:arrayordering}
2253 The encodings of the constants used in the
2254 \DWATordering{} attribute are given in
2255 Table \refersec{tab:orderingencodings}.
2259 \setlength{\extrarowheight}{0.1cm}
2260 \begin{longtable}{l|c}
2261 \caption{Ordering encodings} \label{tab:orderingencodings}\\
2262 \hline \bfseries Ordering name&\bfseries Value \\ \hline
2264 \bfseries Ordering name&\bfseries Value\\ \hline
2266 \hline \emph{Continued on next page}
2271 \DWORDrowmajor&0x00 \\
2272 \DWORDcolmajor&0x01 \\
2278 \section{Discriminant Lists}
2279 \label{datarep:discriminantlists}
2281 The descriptors used in
2282 \addtoindexx{discriminant list attribute!encoding}
2284 \DWATdiscrlist{} attribute are
2285 encoded as 1\dash byte constants. The
2286 defined values are given in
2287 Table \refersec{tab:discriminantdescriptorencodings}.
2289 % Odd that the 'Name' field capitalized here, it is not caps elsewhere.
2291 \setlength{\extrarowheight}{0.1cm}
2292 \begin{longtable}{l|c}
2293 \caption{Discriminant descriptor encodings} \label{tab:discriminantdescriptorencodings}\\
2294 \hline \bfseries Descriptor name&\bfseries Value \\ \hline
2296 \bfseries Descriptor name&\bfseries Value\\ \hline
2298 \hline \emph{Continued on next page}
2310 \section{Name Lookup Tables}
2311 \label{datarep:namelookuptables}
2313 Each set of entries in the table of global names contained
2314 in the \dotdebugpubnames{} and
2315 \dotdebugpubtypes{} sections begins
2316 with a header consisting of:
2317 \begin{enumerate}[1. ]
2319 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
2320 \addttindexx{unit\_length}
2321 A 4\dash byte or 12\dash byte unsigned integer
2322 \addtoindexx{initial length}
2323 representing the length
2324 of the \dotdebuginfo{}
2325 contribution for that compilation unit,
2326 not including the length field itself. In the
2327 \thirtytwobitdwarfformat, this is a 4\dash byte unsigned integer (which must be less
2328 than \xfffffffzero); in the \sixtyfourbitdwarfformat, this consists
2329 of the 4\dash byte value \wffffffff followed by an 8\dash byte unsigned
2330 integer that gives the actual length
2331 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
2333 \item version (\addtoindex{uhalf}) \\
2334 A 2\dash byte unsigned integer representing the version of the
2335 DWARF information for the name lookup table
2336 \addtoindexx{version number!name lookup table}
2337 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
2338 The value in this field is 2.
2341 \item \addtoindex{debug\_info\_offset} (section offset) \\
2343 \addtoindexx{section offset!in name lookup table set of entries}
2344 4\dash byte or 8\dash byte
2346 \dotdebuginfo{} or \dotdebuginfodwo{}
2347 section of the compilation unit header.
2348 In the \thirtytwobitdwarfformat, this is a 4\dash byte unsigned offset;
2349 in the \sixtyfourbitdwarfformat, this is an 8\dash byte unsigned offsets
2350 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
2352 \item \addtoindex{debug\_info\_length} (\livelink{datarep:sectionoffsetlength}{section length}) \\
2353 \addtoindexx{section length!in .debug\_pubnames header}
2355 \addtoindexx{section length!in .debug\_pubtypes header}
2356 4\dash byte or 8\dash byte length containing the size in bytes of the
2357 contents of the \dotdebuginfo{}
2358 section generated to represent
2359 this compilation unit. In the \thirtytwobitdwarfformat, this is
2360 a 4\dash byte unsigned length; in the \sixtyfourbitdwarfformat, this
2361 is an 8-byte unsigned length
2362 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
2367 This header is followed by a series of tuples. Each tuple
2368 consists of a 4\dash byte or 8\dash byte offset followed by a string
2369 of non\dash null bytes terminated by one null byte.
2371 DWARF format, this is a 4\dash byte offset; in the 64\dash bit DWARF
2372 format, it is an 8\dash byte offset.
2373 Each set is terminated by an
2374 offset containing the value 0.
2378 \section{Address Range Table}
2379 \label{datarep:addrssrangetable}
2381 Each set of entries in the table of address ranges contained
2382 in the \dotdebugaranges{}
2383 section begins with a header containing:
2384 \begin{enumerate}[1. ]
2385 % FIXME The unit length text is not fully consistent across
2388 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
2389 \addttindexx{unit\_length}
2390 A 4-byte or 12-byte length containing the length of the
2391 \addtoindexx{initial length}
2392 set of entries for this compilation unit, not including the
2393 length field itself. In the \thirtytwobitdwarfformat, this is a
2394 4-byte unsigned integer (which must be less than \xfffffffzero);
2395 in the \sixtyfourbitdwarfformat, this consists of the 4-byte value
2396 \wffffffff followed by an 8-byte unsigned integer that gives
2398 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
2400 \item version (\addtoindex{uhalf}) \\
2401 A 2\dash byte version identifier representing the version of the
2402 DWARF information for the address range table
2403 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
2404 This value in this field \addtoindexx{version number!address range table} is 2.
2407 \item debug\_info\_offset (\livelink{datarep:sectionoffsetlength}{section offset}) \\
2409 \addtoindexx{section offset!in .debug\_aranges header}
2410 4\dash byte or 8\dash byte offset into the
2411 \dotdebuginfo{} section of
2412 the compilation unit header. In the \thirtytwobitdwarfformat,
2413 this is a 4\dash byte unsigned offset; in the \sixtyfourbitdwarfformat,
2414 this is an 8\dash byte unsigned offset
2415 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
2417 \item address\_size (ubyte) \\
2418 A 1\dash byte unsigned integer containing the size in bytes of an
2419 \addtoindexx{address\_size}
2421 \addtoindexx{size of an address}
2422 (or the offset portion of an address for segmented
2423 \addtoindexx{address space!segmented}
2424 addressing) on the target system.
2426 \item segment\_size (ubyte) \\
2428 \addtoindexx{segment\_size}
2429 1\dash byte unsigned integer containing the size in bytes of a
2430 segment selector on the target system.
2434 This header is followed by a series of tuples. Each tuple
2435 consists of a segment, an address and a length.
2437 size is given by the \addtoindex{segment\_size} field of the header; the
2438 address and length size are each given by the address\_size
2439 field of the header.
2440 The first tuple following the header in
2441 each set begins at an offset that is a multiple of the size
2442 of a single tuple (that is, the size of a segment selector
2443 plus twice the \addtoindex{size of an address}).
2444 The header is padded, if
2445 necessary, to that boundary. Each set of tuples is terminated
2446 by a 0 for the segment, a 0 for the address and 0 for the
2447 length. If the \addtoindex{segment\_size} field in the header is zero,
2448 the segment selectors are omitted from all tuples, including
2449 the terminating tuple.
2452 \section{Line Number Information}
2453 \label{datarep:linenumberinformation}
2455 The \addtoindexi{version number}{version number!line number information}
2456 in the line number program header is \versiondotdebugline{}
2457 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
2459 The boolean values \doublequote{true} and \doublequote{false}
2460 used by the line number information program are encoded
2461 as a single byte containing the value 0
2462 for \doublequote{false,} and a non-zero value for \doublequote{true.}
2464 The encodings for the standard opcodes are given in
2465 \addtoindexx{line number opcodes!standard opcode encoding}
2466 Table \refersec{tab:linenumberstandardopcodeencodings}.
2468 % Odd that the 'Name' field capitalized here, it is not caps elsewhere.
2470 \setlength{\extrarowheight}{0.1cm}
2471 \begin{longtable}{l|c}
2472 \caption{Line number standard opcode encodings} \label{tab:linenumberstandardopcodeencodings}\\
2473 \hline \bfseries Opcode name&\bfseries Value \\ \hline
2475 \bfseries Opcode name&\bfseries Value\\ \hline
2477 \hline \emph{Continued on next page}
2483 \DWLNSadvancepc&0x02 \\
2484 \DWLNSadvanceline&0x03 \\
2485 \DWLNSsetfile&0x04 \\
2486 \DWLNSsetcolumn&0x05 \\
2487 \DWLNSnegatestmt&0x06 \\
2488 \DWLNSsetbasicblock&0x07 \\
2489 \DWLNSconstaddpc&0x08 \\
2490 \DWLNSfixedadvancepc&0x09 \\
2491 \DWLNSsetprologueend&0x0a \\*
2492 \DWLNSsetepiloguebegin&0x0b \\*
2493 \DWLNSsetisa&0x0c \\*
2500 The encodings for the extended opcodes are given in
2501 \addtoindexx{line number opcodes!extended opcode encoding}
2502 Table \refersec{tab:linenumberextendedopcodeencodings}.
2505 \setlength{\extrarowheight}{0.1cm}
2506 \begin{longtable}{l|c}
2507 \caption{Line number extended opcode encodings} \label{tab:linenumberextendedopcodeencodings}\\
2508 \hline \bfseries Opcode name&\bfseries Value \\ \hline
2510 \bfseries Opcode name&\bfseries Value\\ \hline
2512 \hline \emph{Continued on next page}
2514 \hline \ddag~\textit{New in DWARF Version 5}
2517 \DWLNEendsequence &0x01 \\
2518 \DWLNEsetaddress &0x02 \\
2519 \DWLNEdefinefile &0x03 \\
2520 \DWLNEsetdiscriminator &0x04 \\
2521 \DWLNEdefinefileMDfive~\ddag &0x05 \\
2522 \DWLNElouser &0x80 \\
2523 \DWLNEhiuser &\xff \\
2529 The encodings for the file entry format are given in
2530 \addtoindexx{line number opcodes!file entry format encoding}
2531 Table \refersec{tab:linenumberfileentryformatencodings}.
2534 \setlength{\extrarowheight}{0.1cm}
2535 \begin{longtable}{l|c}
2536 \caption{Line number file entry format \mbox{encodings}} \label{tab:linenumberfileentryformatencodings}\\
2537 \hline \bfseries File entry format name&\bfseries Value \\ \hline
2539 \bfseries File entry format name&\bfseries Value\\ \hline
2541 \hline \emph{Continued on next page}
2546 \DWLNFtimestampsize & 0x01 \\
2547 \DWLNFMDfive & 0x02 \\
2552 \section{Macro Information}
2553 \label{datarep:macroinformation}
2555 The source line numbers and source file indices encoded in the
2556 macro information section are represented as
2557 unsigned LEB128\addtoindexx{LEB128!unsigned} numbers.
2559 The macro information entry type is encoded as a single byte.
2561 \addtoindexx{macro information entry types!encoding}
2563 Table \refersec{tab:macroinfoentrytypeencodings}.
2567 \setlength{\extrarowheight}{0.1cm}
2568 \begin{longtable}{l|c}
2569 \caption{Macro information entry type encodings} \label{tab:macroinfoentrytypeencodings}\\
2570 \hline \bfseries Macro information entry type name&\bfseries Value \\ \hline
2572 \bfseries Macro information entry type name&\bfseries Value\\ \hline
2574 \hline \emph{Continued on next page}
2579 \DWMACROdefine &0x01 \\
2580 \DWMACROundef &0x02 \\
2581 \DWMACROstartfile &0x03 \\
2582 \DWMACROendfile &0x04 \\
2583 \DWMACROdefineindirect &0x05 \\
2584 \DWMACROundefindirect &0x06 \\
2585 \DWMACROtransparentinclude &0x07 \\
2586 % what about 0x08 thru 0x0a??
2587 \DWMACROdefineindirectx &0x0b \\
2588 \DWMACROundefindirectx &0x0c \\
2589 \DWMACROlouser &0xe0 \\
2590 \DWMACROhiuser &\xff \\
2596 \section{Call Frame Information}
2597 \label{datarep:callframeinformation}
2599 In the \thirtytwobitdwarfformat, the value of the CIE id in the
2600 CIE header is \xffffffff; in the \sixtyfourbitdwarfformat, the
2601 value is \xffffffffffffffff.
2603 The value of the CIE \addtoindexi{version number}{version number!call frame information}
2604 is 4 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
2606 Call frame instructions are encoded in one or more bytes. The
2607 primary opcode is encoded in the high order two bits of
2608 the first byte (that is, opcode = byte $\gg$ 6). An operand
2609 or extended opcode may be encoded in the low order 6
2610 bits. Additional operands are encoded in subsequent bytes.
2611 The instructions and their encodings are presented in
2612 Table \refersec{tab:callframeinstructionencodings}.
2615 \setlength{\extrarowheight}{0.1cm}
2616 \begin{longtable}{l|c|c|l|l}
2617 \caption{Call frame instruction encodings} \label{tab:callframeinstructionencodings} \\
2618 \hline &\bfseries High 2 &\bfseries Low 6 & & \\
2619 \bfseries Instruction&\bfseries Bits &\bfseries Bits &\bfseries Operand 1 &\bfseries Operand 2\\ \hline
2621 & \bfseries High 2 &\bfseries Low 6 & &\\
2622 \bfseries Instruction&\bfseries Bits &\bfseries Bits &\bfseries Operand 1 &\bfseries Operand 2\\ \hline
2624 \hline \emph{Continued on next page}
2629 \DWCFAadvanceloc&0x1&delta & \\
2630 \DWCFAoffset&0x2®ister&ULEB128 offset \\
2631 \DWCFArestore&0x3®ister & & \\
2632 \DWCFAnop&0&0 & & \\
2633 \DWCFAsetloc&0&0x01&address & \\
2634 \DWCFAadvancelocone&0&0x02&1\dash byte delta & \\
2635 \DWCFAadvanceloctwo&0&0x03&2\dash byte delta & \\
2636 \DWCFAadvancelocfour&0&0x04&4\dash byte delta & \\
2637 \DWCFAoffsetextended&0&0x05&ULEB128 register&ULEB128 offset \\
2638 \DWCFArestoreextended&0&0x06&ULEB128 register & \\
2639 \DWCFAundefined&0&0x07&ULEB128 register & \\
2640 \DWCFAsamevalue&0&0x08 &ULEB128 register & \\
2641 \DWCFAregister&0&0x09&ULEB128 register &ULEB128 offset \\
2642 \DWCFArememberstate&0&0x0a & & \\
2643 \DWCFArestorestate&0&0x0b & & \\
2644 \DWCFAdefcfa&0&0x0c &ULEB128 register&ULEB128 offset \\
2645 \DWCFAdefcfaregister&0&0x0d&ULEB128 register & \\
2646 \DWCFAdefcfaoffset&0&0x0e &ULEB128 offset & \\
2647 \DWCFAdefcfaexpression&0&0x0f &BLOCK \\
2648 \DWCFAexpression&0&0x10&ULEB128 register & BLOCK \\
2650 \DWCFAoffsetextendedsf&0&0x11&ULEB128 register&SLEB128 offset \\
2651 \DWCFAdefcfasf&0&0x12&ULEB128 register&SLEB128 offset \\
2652 \DWCFAdefcfaoffsetsf&0&0x13&SLEB128 offset & \\
2653 \DWCFAvaloffset&0&0x14&ULEB128&ULEB128 \\
2654 \DWCFAvaloffsetsf&0&0x15&ULEB128&SLEB128 \\
2655 \DWCFAvalexpression&0&0x16&ULEB128&BLOCK \\
2656 \DWCFAlouser&0&0x1c & & \\
2657 \DWCFAhiuser&0&\xiiif & & \\
2661 \section{Non-contiguous Address Ranges}
2662 \label{datarep:noncontiguousaddressranges}
2664 Each entry in a \addtoindex{range list}
2665 (see Section \refersec{chap:noncontiguousaddressranges})
2667 \addtoindexx{base address selection entry!in range list}
2669 \addtoindexx{range list}
2670 a base address selection entry, or an end
2673 A \addtoindex{range list} entry consists of two relative addresses. The
2674 addresses are the same size as addresses on the target machine.
2676 A base address selection entry and an
2677 \addtoindexx{end of list entry!in range list}
2678 end of list entry each
2679 \addtoindexx{base address selection entry!in range list}
2680 consist of two (constant or relocated) addresses. The two
2681 addresses are the same size as addresses on the target machine.
2683 For a \addtoindex{range list} to be specified, the base address of the
2684 \addtoindexx{base address selection entry!in range list}
2685 corresponding compilation unit must be defined
2686 (see Section \refersec{chap:normalandpartialcompilationunitentries}).
2688 \section{String Offsets Table}
2689 \label{chap:stringoffsetstable}
2690 Each set of entries in the string offsets table contained in the
2691 \dotdebugstroffsets{} or \dotdebugstroffsetsdwo{}
2692 section begins with a header containing:
2693 \begin{enumerate}[1. ]
2694 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
2695 A 4-byte or 12-byte length containing the length of
2696 the set of entries for this compilation unit, not
2697 including the length field itself. In the 32-bit
2698 DWARF format, this is a 4-byte unsigned integer
2699 (which must be less than \xfffffffzero); in the 64-bit
2700 DWARF format, this consists of the 4-byte value
2701 \wffffffff followed by an 8-byte unsigned integer
2702 that gives the actual length (see
2703 Section \refersec{datarep:32bitand64bitdwarfformats}).
2705 \item \texttt{version} (\addtoindex{uhalf}) \\
2706 A 2-byte version identifier containing the value
2707 \versiondotdebugstroffsets{}
2708 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
2709 \item \texttt{padding} (\addtoindex{uhalf}) \\
2712 This header is followed by a series of string table offsets
2713 that have the same representation as \DWFORMstrp.
2714 For the 32-bit DWARF format, each offset is 4 bytes long; for
2715 the 64-bit DWARF format, each offset is 8 bytes long.
2717 The \DWATstroffsetsbase{} attribute points to the first
2718 entry following the header. The entries are indexed
2719 sequentially from this base entry, starting from 0.
2721 \section{Address Table}
2722 \label{chap:addresstable}
2723 Each set of entries in the address table contained in the
2724 \dotdebugaddr{} section begins with a header containing:
2725 \begin{enumerate}[1. ]
2726 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
2727 A 4-byte or 12-byte length containing the length of
2728 the set of entries for this compilation unit, not
2729 including the length field itself. In the 32-bit
2730 DWARF format, this is a 4-byte unsigned integer
2731 (which must be less than \xfffffffzero); in the 64-bit
2732 DWARF format, this consists of the 4-byte value
2733 \wffffffff followed by an 8-byte unsigned integer
2734 that gives the actual length (see
2735 Section \refersec{datarep:32bitand64bitdwarfformats}).
2738 \item \texttt{version} (\addtoindex{uhalf}) \\
2739 A 2-byte version identifier containing the value
2740 \versiondotdebugaddr{}
2741 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
2744 \item \texttt{address\_size} (\addtoindex{ubyte}) \\
2745 A 1-byte unsigned integer containing the size in
2746 bytes of an address (or the offset portion of an
2747 address for segmented addressing) on the target
2751 \item \texttt{segment\_size} (\addtoindex{ubyte}) \\
2752 A 1-byte unsigned integer containing the size in
2753 bytes of a segment selector on the target system.
2756 This header is followed by a series of segment/address pairs.
2757 The segment size is given by the \texttt{segment\_size} field of the
2758 header, and the address size is given by the \texttt{address\_size}
2759 field of the header. If the \texttt{segment\_size} field in the header
2760 is zero, the entries consist only of an addresses.
2762 The \DWATaddrbase{} attribute points to the first entry
2763 following the header. The entries are indexed sequentially
2764 from this base entry, starting from 0.
2766 \section{Range List Table}
2767 \label{app:rangelisttable}
2768 Each set of entries in the range list table contained in the
2769 \dotdebugranges{} section begins with a header containing:
2770 \begin{enumerate}[1. ]
2771 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
2772 A 4-byte or 12-byte length containing the length of
2773 the set of entries for this compilation unit, not
2774 including the length field itself. In the 32-bit
2775 DWARF format, this is a 4-byte unsigned integer
2776 (which must be less than \xfffffffzero); in the 64-bit
2777 DWARF format, this consists of the 4-byte value
2778 \wffffffff followed by an 8-byte unsigned integer
2779 that gives the actual length (see
2780 Section \refersec{datarep:32bitand64bitdwarfformats}).
2783 \item \texttt{version} (\addtoindex{uhalf}) \\
2784 A 2-byte version identifier containing the value
2785 \versiondotdebugranges{}
2786 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
2789 \item \texttt{address\_size} (\addtoindex{ubyte}) \\
2790 A 1-byte unsigned integer containing the size in
2791 bytes of an address (or the offset portion of an
2792 address for segmented addressing) on the target
2796 \item \texttt{segment\_size} (\addtoindex{ubyte}) \\
2797 A 1-byte unsigned integer containing the size in
2798 bytes of a segment selector on the target system.
2801 This header is followed by a series of range list entries as
2802 described in Section \refersec{chap:locationlists}.
2803 The segment size is given by the
2804 \texttt{segment\_size} field of the header, and the address size is
2805 given by the \texttt{address\_size} field of the header. If the
2806 \texttt{segment\_size} field in the header is zero, the segment
2807 selector is omitted from the range list entries.
2809 The \DWATrangesbase{} attribute points to the first entry
2810 following the header. The entries are referenced by a byte
2811 offset relative to this base address.
2814 \section{Location List Table}
2815 \label{datarep:locationlisttable}
2816 Each set of entries in the location list table contained in the
2817 \dotdebugloc{} or \dotdebuglocdwo{} sections begins with a header containing:
2818 \begin{enumerate}[1. ]
2819 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
2820 A 4-byte or 12-byte length containing the length of
2821 the set of entries for this compilation unit, not
2822 including the length field itself. In the 32-bit
2823 DWARF format, this is a 4-byte unsigned integer
2824 (which must be less than \xfffffffzero); in the 64-bit
2825 DWARF format, this consists of the 4-byte value
2826 \wffffffff followed by an 8-byte unsigned integer
2827 that gives the actual length (see
2828 Section \refersec{datarep:32bitand64bitdwarfformats}).
2831 \item \texttt{version} (\addtoindex{uhalf}) \\
2832 A 2-byte version identifier containing the value
2833 \versiondotdebugloc{}
2834 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
2837 \item \texttt{address\_size} (\addtoindex{ubyte}) \\
2838 A 1-byte unsigned integer containing the size in
2839 bytes of an address (or the offset portion of an
2840 address for segmented addressing) on the target
2844 \item \texttt{segment\_size} (\addtoindex{ubyte}) \\
2845 A 1-byte unsigned integer containing the size in
2846 bytes of a segment selector on the target system.
2849 This header is followed by a series of location list entries as
2850 described in Section \refersec{chap:locationlists}.
2851 The segment size is given by the
2852 \texttt{segment\_size} field of the header, and the address size is
2853 given by the \texttt{address\_size} field of the header. If the
2854 \texttt{segment\_size} field in the header is zero, the segment
2855 selector is omitted from the range list entries.
2857 The entries are referenced by a byte offset relative to the first
2858 location list following this header.
2861 \section{Dependencies and Constraints}
2862 \label{datarep:dependenciesandconstraints}
2864 The debugging information in this format is intended to
2866 \addtoindexx{DWARF section names!list of}
2876 \dotdebugpubnames{},
2877 \dotdebugpubtypes{},
2881 \dotdebugstroffsets{}
2882 sections of an object file, or equivalent
2883 separate file or database. The information is not
2884 word\dash aligned. Consequently:
2887 \item For the \thirtytwobitdwarfformat{} and a target architecture with
2888 32\dash bit addresses, an assembler or compiler must provide a way
2889 to produce 2\dash byte and 4\dash byte quantities without alignment
2890 restrictions, and the linker must be able to relocate a
2891 4\dash byte address or
2892 \addtoindexx{section offset!alignment of}
2893 section offset that occurs at an arbitrary
2896 \item For the \thirtytwobitdwarfformat{} and a target architecture with
2897 64\dash bit addresses, an assembler or compiler must provide a
2898 way to produce 2\dash byte, 4\dash byte and 8\dash byte quantities without
2899 alignment restrictions, and the linker must be able to relocate
2900 an 8\dash byte address or 4\dash byte
2901 \addtoindexx{section offset!alignment of}
2902 section offset that occurs at an
2903 arbitrary alignment.
2905 \item For the \sixtyfourbitdwarfformat{} and a target architecture with
2906 32\dash bit addresses, an assembler or compiler must provide a
2907 way to produce 2\dash byte, 4\dash byte and 8\dash byte quantities without
2908 alignment restrictions, and the linker must be able to relocate
2909 a 4\dash byte address or 8\dash byte
2910 \addtoindexx{section offset!alignment of}
2911 section offset that occurs at an
2912 arbitrary alignment.
2914 \textit{It is expected that this will be required only for very large
2915 32\dash bit programs or by those architectures which support
2916 a mix of 32\dash bit and 64\dash bit code and data within the same
2919 \item For the \sixtyfourbitdwarfformat{} and a target architecture with
2920 64\dash bit addresses, an assembler or compiler must provide a
2921 way to produce 2\dash byte, 4\dash byte and 8\dash byte quantities without
2922 alignment restrictions, and the linker must be able to
2923 relocate an 8\dash byte address or
2924 \addtoindexx{section offset!alignment of}
2925 section offset that occurs at
2926 an arbitrary alignment.
2929 \section{Integer Representation Names}
2930 \label{datarep:integerrepresentationnames}
2932 The sizes of the integers used in the lookup by name, lookup
2933 by address, line number and call frame information sections
2935 Table \ref{tab:integerrepresentationnames}.
2939 \setlength{\extrarowheight}{0.1cm}
2940 \begin{longtable}{c|l}
2941 \caption{Integer representation names} \label{tab:integerrepresentationnames}\\
2942 \hline \bfseries Representation name&\bfseries Representation \\ \hline
2944 \bfseries Representation name&\bfseries Representation\\ \hline
2946 \hline \emph{Continued on next page}
2951 \addtoindex{sbyte}& signed, 1\dash byte integer \\
2952 \addtoindex{ubyte}&unsigned, 1\dash byte integer \\
2953 \addtoindex{uhalf}&unsigned, 2\dash byte integer \\
2954 \addtoindex{uword}&unsigned, 4\dash byte integer \\
2960 \section{Type Signature Computation}
2961 \label{datarep:typesignaturecomputation}
2963 A type signature is computed only by the DWARF producer;
2964 \addtoindexx{type signature!computation}
2965 it is used by a DWARF consumer to resolve type references to
2966 the type definitions that are contained in
2967 \addtoindexx{type unit}
2970 The type signature for a type T0 is formed from the
2971 \MDfive{}\footnote{\livetarg{def:MDfive}{MD5} Message Digest Algorithm,
2972 R.L. Rivest, RFC 1321, April 1992}
2973 hash of a flattened description of the type. The flattened
2974 description of the type is a byte sequence derived from the
2975 DWARF encoding of the type as follows:
2976 \begin{enumerate}[1. ]
2978 \item Start with an empty sequence S and a list V of visited
2979 types, where V is initialized to a list containing the type
2980 T0 as its single element. Elements in V are indexed from 1,
2983 \item If the debugging information entry represents a type that
2984 is nested inside another type or a namespace, append to S
2985 the type\textquoteright s context as follows: For each surrounding type
2986 or namespace, beginning with the outermost such construct,
2987 append the letter 'C', the DWARF tag of the construct, and
2988 the name (taken from
2989 \addtoindexx{name attribute}
2990 the \DWATname{} attribute) of the type
2991 \addtoindexx{name attribute}
2992 or namespace (including its trailing null byte).
2994 \item Append to S the letter 'D', followed by the DWARF tag of
2995 the debugging information entry.
2997 \item For each of the attributes in
2998 Table \refersec{tab:attributesusedintypesignaturecomputation}
3000 the debugging information entry, in the order listed,
3001 append to S a marker letter (see below), the DWARF attribute
3002 code, and the attribute value.
3005 \caption{Attributes used in type signature computation}
3006 \label{tab:attributesusedintypesignaturecomputation}
3007 \simplerule[\textwidth]
3009 \autocols[0pt]{c}{2}{l}{
3024 \DWATcontainingtype,
3028 \DWATdatamemberlocation,
3049 \DWATrvaluereference,
3053 \DWATstringlengthbitsize,
3054 \DWATstringlengthbytesize,
3059 \DWATvariableparameter,
3062 \DWATvtableelemlocation
3065 \simplerule[\textwidth]
3068 Note that except for the initial
3069 \DWATname{} attribute,
3070 \addtoindexx{name attribute}
3071 attributes are appended in order according to the alphabetical
3072 spelling of their identifier.
3074 If an implementation defines any vendor-specific attributes,
3075 any such attributes that are essential to the definition of
3076 the type should also be included at the end of the above list,
3077 in their own alphabetical suborder.
3079 An attribute that refers to another type entry T is processed
3080 as follows: (a) If T is in the list V at some V[x], use the
3081 letter 'R' as the marker and use the unsigned LEB128\addtoindexx{LEB128!unsigned}
3082 encoding of x as the attribute value; otherwise, (b) use the letter 'T'
3083 as the marker, process the type T recursively by performing
3084 Steps 2 through 7, and use the result as the attribute value.
3086 Other attribute values use the letter 'A' as the marker, and
3087 the value consists of the form code (encoded as an unsigned
3088 LEB128 value) followed by the encoding of the value according
3089 to the form code. To ensure reproducibility of the signature,
3090 the set of forms used in the signature computation is limited
3098 \item If the tag in Step 3 is one of \DWTAGpointertype,
3099 \DWTAGreferencetype,
3100 \DWTAGrvaluereferencetype,
3101 \DWTAGptrtomembertype,
3102 or \DWTAGfriend, and the referenced
3103 type (via the \DWATtype{} or
3104 \DWATfriend{} attribute) has a
3105 \DWATname{} attribute, append to S the letter 'N', the DWARF
3106 attribute code (\DWATtype{} or
3107 \DWATfriend), the context of
3108 the type (according to the method in Step 2), the letter 'E',
3109 and the name of the type. For \DWTAGfriend, if the referenced
3110 entry is a \DWTAGsubprogram, the context is omitted and the
3111 name to be used is the ABI-specific name of the subprogram
3112 (for example, the mangled linker name).
3115 \item If the tag in Step 3 is not one of \DWTAGpointertype,
3116 \DWTAGreferencetype,
3117 \DWTAGrvaluereferencetype,
3118 \DWTAGptrtomembertype, or
3119 \DWTAGfriend, but has
3120 a \DWATtype{} attribute, or if the referenced type (via
3122 \DWATfriend{} attribute) does not have a
3123 \DWATname{} attribute, the attribute is processed according to
3124 the method in Step 4 for an attribute that refers to another
3128 \item Visit each child C of the debugging information
3129 entry as follows: If C is a nested type entry or a member
3130 function entry, and has
3131 a \DWATname{} attribute, append to
3132 \addtoindexx{name attribute}
3133 S the letter 'S', the tag of C, and its name; otherwise,
3134 process C recursively by performing Steps 3 through 7,
3135 appending the result to S. Following the last child (or if
3136 there are no children), append a zero byte.
3141 For the purposes of this algorithm, if a debugging information
3143 \DWATspecification{}
3144 attribute that refers to
3145 another entry D (which has a
3148 then S inherits the attributes and children of D, and S is
3149 processed as if those attributes and children were present in
3150 the entry S. Exception: if a particular attribute is found in
3151 both S and D, the attribute in S is used and the corresponding
3152 one in D is ignored.
3154 DWARF tag and attribute codes are appended to the sequence
3155 as unsigned LEB128\addtoindexx{LEB128!unsigned} values,
3156 using the values defined earlier in this chapter.
3158 \textit{A grammar describing this computation may be found in
3159 Appendix \refersec{app:typesignaturecomputationgrammar}.
3162 \textit{An attribute that refers to another type entry should
3163 be recursively processed or replaced with the name of the
3164 referent (in Step 4, 5 or 6). If neither treatment applies to
3165 an attribute that references another type entry, the entry
3166 that contains that attribute should not be considered for a
3167 separate \addtoindex{type unit}.}
3169 \textit{If a debugging information entry contains an attribute from
3170 the list above that would require an unsupported form, that
3171 entry should not be considered for a separate
3172 \addtoindex{type unit}.}
3174 \textit{A type should be considered for a separate
3175 \addtoindex{type unit} only
3176 if all of the type entries that it contains or refers to in
3177 Steps 6 and 7 can themselves each be considered for a separate
3178 \addtoindex{type unit}.}
3181 Where the DWARF producer may reasonably choose two or more
3182 different forms for a given attribute, it should choose
3183 the simplest possible form in computing the signature. (For
3184 example, a constant value should be preferred to a location
3185 expression when possible.)
3187 Once the string S has been formed from the DWARF encoding,
3188 an \MDfive{} hash is computed for the string and the
3189 least significant 64 bits are taken as the type signature.
3191 \textit{The string S is intended to be a flattened representation of
3192 the type that uniquely identifies that type (that is, a different
3193 type is highly unlikely to produce the same string).}
3195 \textit{A debugging information entry should not be placed in a
3196 separate \addtoindex{type unit}
3197 if any of the following apply:}
3201 \item \textit{The entry has an attribute whose value is a location
3202 expression, and the location expression contains a reference to
3203 another debugging information entry (for example, a \DWOPcallref{}
3204 operator), as it is unlikely that the entry will remain
3205 identical across compilation units.}
3207 \item \textit{The entry has an attribute whose value refers
3208 to a code location or a \addtoindex{location list}.}
3210 \item \textit{The entry has an attribute whose value refers
3211 to another debugging information entry that does not represent
3217 \textit{Certain attributes are not included in the type signature:}
3220 \item \textit{The \DWATdeclaration{} attribute is not included because it
3221 indicates that the debugging information entry represents an
3222 incomplete declaration, and incomplete declarations should
3224 \addtoindexx{type unit}
3225 separate type units.}
3227 \item \textit{The \DWATdescription{} attribute is not included because
3228 it does not provide any information unique to the defining
3229 declaration of the type.}
3231 \item \textit{The \DWATdeclfile,
3233 \DWATdeclcolumn{} attributes are not included because they
3234 may vary from one source file to the next, and would prevent
3235 two otherwise identical type declarations from producing the
3236 same \MDfive{} hash.}
3238 \item \textit{The \DWATobjectpointer{} attribute is not included
3239 because the information it provides is not necessary for the
3240 computation of a unique type signature.}
3244 \textit{Nested types and some types referred to by a debugging
3245 information entry are encoded by name rather than by recursively
3246 encoding the type to allow for cases where a complete definition
3247 of the type might not be available in all compilation units.}
3249 \textit{If a type definition contains the definition of a member function,
3250 it cannot be moved as is into a type unit, because the member function
3251 contains attributes that are unique to that compilation unit.
3252 Such a type definition can be moved to a type unit by rewriting the DIE tree,
3253 moving the member function declaration into a separate declaration tree,
3254 and replacing the function definition in the type with a non-defining
3255 declaration of the function (as if the function had been defined out of
3258 An example that illustrates the computation of an \MDfive{} hash may be found in
3259 Appendix \refersec{app:usingtypeunits}.