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.
8 \section{Vendor Extensibility}
9 \label{datarep:vendorextensibility}
10 \addtoindexx{vendor extensibility}
11 \addtoindexx{vendor specific extensions|see{vendor extensibility}}
14 \addtoindexx{extensibility|see{vendor extensibility}}
15 reserve a portion of the DWARF name space and ranges of
16 enumeration values for use for vendor specific extensions,
17 special labels are reserved for tag names, attribute names,
18 base type encodings, location operations, language names,
19 calling conventions and call frame instructions.
21 The labels denoting the beginning and end of the
22 \hypertarget{chap:DWXXXlohiuser}{reserved value range}
23 for vendor specific extensions consist of the
25 (\DWATlouserMARK{}\DWAThiuserMARK{}DW\_AT,
26 \DWATElouserMARK{}\DWATEhiuserMARK{}DW\_ATE,
27 \DWCClouserMARK{}\DWCChiuserMARK{}DW\_CC,
28 \DWCFAlouserMARK{}\DWCFAhiuserMARK{}DW\_CFA,
29 \DWENDlouserMARK{}\DWENDhiuserMARK{}DW\_END,
31 \DWIDXlouserMARK{}\DWIDXhiuserMARK{}DW\_IDX,
33 \DWLANGlouserMARK{}\DWLANGhiuserMARK{}DW\_LANG,
35 \DWLNCTlouserMARK{}\DWLNCThiuserMARK{}DW\_LNCT,
37 \DWLNElouserMARK{}\DWLNEhiuserMARK{}DW\_LNE,
38 \DWMACROlouserMARK{}\DWMACROhiuserMARK{}DW\_MACRO,
39 \DWOPlouserMARK{}\DWOPhiuserMARK{}DW\_OP or
40 \DWTAGlouserMARK{}\DWTAGhiuserMARK{}DW\_TAG)
42 followed by \_lo\_user or \_hi\_user.
43 Values in the range between \textit{prefix}\_lo\_user
44 and \textit{prefix}\_hi\_user inclusive,
45 are reserved for vendor specific extensions. Vendors may
46 use values in this range without conflicting with current or
47 future system\dash defined values. All other values are reserved
48 for use by the system.
50 \textit{For example, for
52 debugging information entry
55 labels are \DWTAGlouserNAME{} and \DWTAGhiuserNAME.}
57 \textit{There may also be codes for vendor specific extensions
58 between the number of standard line number opcodes and
59 the first special line number opcode. However, since the
60 number of standard opcodes varies with the DWARF version,
61 the range for extensions is also version dependent. Thus,
62 \DWLNSlouserTARG{} and
63 \DWLNShiuserTARG{} symbols are not defined.
66 Vendor defined tags, attributes, base type encodings, location
67 atoms, language names, line number actions, calling conventions
68 and call frame instructions, conventionally use the form
69 \text{prefix\_vendor\_id\_name}, where
70 \textit{vendor\_id}\addtoindexx{vendor id} is some identifying
71 character sequence chosen so as to avoid conflicts with
74 To ensure that extensions added by one vendor may be safely
75 ignored by consumers that do not understand those extensions,
76 the following rules must be followed:
77 \begin{enumerate}[1. ]
79 \item New attributes are added in such a way that a
80 debugger may recognize the format of a new attribute value
81 without knowing the content of that attribute value.
83 \item The semantics of any new attributes do not alter
84 the semantics of previously existing attributes.
86 \item The semantics of any new tags do not conflict with
87 the semantics of previously existing tags.
89 \item New forms of attribute value are not added.
94 \section{Reserved Values}
95 \label{datarep:reservedvalues}
96 \subsection{Error Values}
97 \label{datarep:errorvalues}
98 \addtoindexx{reserved values!error}
101 \addtoindexx{error value}
102 a convenience for consumers of DWARF information, the value
103 0 is reserved in the encodings for attribute names, attribute
104 forms, base type encodings, location operations, languages,
105 line number program opcodes, macro information entries and tag
106 names to represent an error condition or unknown value. DWARF
107 does not specify names for these reserved values, because they
108 do not represent valid encodings for the given type and do
109 not appear in DWARF debugging information.
112 \subsection{Initial Length Values}
113 \label{datarep:initiallengthvalues}
114 \addtoindexx{reserved values!initial length}
116 An \livetarg{datarep:initiallengthvalues}{initial length} field
117 \addtoindexx{initial length field|see{initial length}}
118 is one of the fields that occur at the beginning
119 of those DWARF sections that have a header
123 \dotdebugnames{}) or the length field
124 that occurs at the beginning of the CIE and FDE structures
125 in the \dotdebugframe{} section.
128 In an \addtoindex{initial length} field, the values \wfffffffzero through
129 \wffffffff are reserved by DWARF to indicate some form of
130 extension relative to \DWARFVersionII; such values must not
131 be interpreted as a length field. The use of one such value,
132 \xffffffff, is defined in
133 Section \refersec{datarep:32bitand64bitdwarfformats});
135 the other values is reserved for possible future extensions.
138 \section{Relocatable, Split, Executable, Shared and Package Object Files}
139 \label{datarep:executableobjectsandsharedobjects}
141 \subsection{Relocatable Object Files}
142 \label{datarep:relocatableobjectfiles}
143 A DWARF producer (for example, a compiler) typically generates its
144 debugging information as part of a relocatable object file.
145 Relocatable object files are then combined by a linker to form an
146 executable file. During the linking process, the linker resolves
147 (binds) symbolic references between the various object files, and
148 relocates the contents of each object file into a combined virtual
151 The DWARF debugging information is placed in several sections (see
152 Appendix \refersec{app:debugsectionrelationshipsinformative}), and
153 requires an object file format capable of
154 representing these separate sections. There are symbolic references
155 between these sections, and also between the debugging information
156 sections and the other sections that contain the text and data of the
157 program itself. Many of these references require relocation, and the
158 producer must emit the relocation information appropriate to the
159 object file format and the target processor architecture. These
160 references include the following:
163 \item The compilation unit header (see Section
164 \refersec{datarep:unitheaders}) in the \dotdebuginfo{}
165 section contains a reference to the \dotdebugabbrev{} table. This
166 reference requires a relocation so that after linking, it refers to
167 that contribution to the combined \dotdebugabbrev{} section in the
170 \item Debugging information entries may have attributes with the form
171 \DWFORMaddr{} (see Section \refersec{datarep:attributeencodings}).
172 These attributes represent locations
173 within the virtual address space of the program, and require
176 \item A DWARF expression may contain a \DWOPaddr{} (see Section
177 \refersec{chap:literalencodings}) which contains a location within
178 the virtual address space of the program, and require relocation.
181 \item Debugging information entries may have attributes with the form
182 \DWFORMsecoffset{} (see Section \refersec{datarep:attributeencodings}).
183 These attributes refer to
184 debugging information in other debugging information sections within
185 the object file, and must be relocated during the linking process.
187 However, if a \DWATrangesbase{} attribute is present, the offset in
188 a \DWATranges{} attribute (which uses form \DWFORMsecoffset) is
189 relative to the given base offset--no relocation is involved.
191 \item Debugging information entries may have attributes with the form
192 \DWFORMrefaddr{} (see Section \refersec{datarep:attributeencodings}).
193 These attributes refer to
194 debugging information entries that may be outside the current
195 compilation unit. These values require both symbolic binding and
198 \item Debugging information entries may have attributes with the form
199 \DWFORMstrp{} (see Section \refersec{datarep:attributeencodings}).
200 These attributes refer to strings in
201 the \dotdebugstr{} section. These values require relocation.
203 \item Entries in the \dotdebugaddr, \dotdebugloc{}, \dotdebugranges{}
204 and \dotdebugaranges{}
205 sections contain references to locations within the virtual address
206 space of the program, and require relocation.
208 \item In the \dotdebugline{} section, the operand of the \DWLNEsetaddress{}
209 opcode is a reference to a location within the virtual address space
210 of the program, and requires relocation.
212 \item The \dotdebugstroffsets{} section contains a list of string offsets,
213 each of which is an offset of a string in the \dotdebugstr{} section. Each
214 of these offsets requires relocation. Depending on the implementation,
215 these relocations may be implicit (that is, the producer may not need to
216 emit any explicit relocation information for these offsets).
218 \item The \HFNdebuginfooffset{} field in the \dotdebugaranges{} header and
219 the list of compilation units following the \dotdebugnames{} header contain
220 references to the \dotdebuginfo{} section. These references require relocation
221 so that after linking they refer to the correct contribution in the combined
222 \dotdebuginfo{} section in the executable file.
224 \item Frame descriptor entries in the \dotdebugframe{} section
225 (see Section \refersec{chap:structureofcallframeinformation}) contain an
226 \HFNinitiallocation{} field value within the virtual address
227 space of the program and require relocation.
232 \textit{Note that operands of classes
235 \CLASSflag{} do not require relocation. Attribute operands that use
237 forms \DWFORMstring{},
239 \DWFORMrefone, \DWFORMreftwo, \DWFORMreffour, \DWFORMrefeight, or
240 \DWFORMrefudata{} also do not need relocation.}
242 \subsection{Split DWARF Object Files}
243 \label{datarep:splitdwarfobjectfiles}
244 \addtoindexx{split DWARF object file}
245 A DWARF producer may partition the debugging
246 information such that the majority of the debugging
247 information can remain in individual object files without
248 being processed by the linker.
251 \textit{This reduces link time by reducing the amount of information
252 the linker must process.}
256 \subsubsection{First Partition (with Skeleton Unit)}
257 The first partition contains
258 debugging information that must still be processed by the linker,
259 and includes the following:
262 The line number tables, range tables, frame tables, and
263 accelerated access tables, in the usual sections:
264 \dotdebugline, \dotdebuglinestr, \dotdebugranges, \dotdebugframe,
265 \dotdebugnames{} and \dotdebugaranges,
269 An address table, in the \dotdebugaddr{} section. This table
270 contains all addresses and constants that require
271 link-time relocation, and items in the table can be
272 referenced indirectly from the debugging information via
273 the \DWFORMaddrx{} form, and by the \DWOPaddrx{} and
274 \DWOPconstx{} operators.
276 A skeleton compilation unit, as described in Section
277 \refersec{chap:skeletoncompilationunitentries},
278 in the \dotdebuginfo{} section.
280 An abbreviations table for the skeleton compilation unit,
281 in the \dotdebugabbrev{} section.
283 A string table, in the \dotdebugstr{} section. The string
284 table is necessary only if the skeleton compilation unit
285 uses either indirect string form, \DWFORMstrp{} or
288 A string offsets table, in the \dotdebugstroffsets{}
289 section. The string offsets table is necessary only if
290 the skeleton compilation unit uses the \DWFORMstrx{} form.
292 The attributes contained in the skeleton compilation
293 unit can be used by a DWARF consumer to find the
295 DWARF object file that contains the second partition.
298 \subsubsection{Second Partition (Unlinked or in a \texttt{.dwo} File)}
300 The second partition contains the debugging information that
301 does not need to be processed by the linker. These sections
302 may be left in the object files and ignored by the linker
303 (that is, not combined and copied to the executable object file), or
304 they may be placed by the producer in a separate DWARF object
305 file. This partition includes the following:
308 The full compilation unit, in the \dotdebuginfodwo{} section.
311 The full compilation unit entry includes a \DWATdwoid{}
312 attribute whose form and value is the same as that of the \DWATdwoid{}
313 attribute of the associated skeleton unit.
316 Attributes contained in the full compilation unit
317 may refer to machine addresses indirectly using the \DWFORMaddrx{}
318 form, which accesses the table of addresses specified by the
319 \DWATaddrbase{} attribute in the associated skeleton unit.
320 Location expressions may similarly do so using the \DWOPaddrx{} and
321 \DWOPconstx{} operations.
323 \DWATranges{} attributes contained in the full compilation unit
324 may refer to range table entries with a \DWFORMsecoffset{} offset
325 relative to the base offset specified by the \DWATrangesbase{}
326 attribute in the associated skeleton unit.
328 \item Separate type units, in the \dotdebuginfodwo{} section.
331 Abbreviations table(s) for the compilation unit and type
332 units, in the \dotdebugabbrevdwo{} section.
334 \item Location lists, in the \dotdebuglocdwo{} section.
337 A \addtoindex{specialized line number table} (for the type units),
338 in the \dotdebuglinedwo{} section. This table
339 contains only the directory and filename lists needed to
340 interpret \DWATdeclfile{} attributes in the debugging
343 \item Macro information, in the \dotdebugmacrodwo{} section.
345 \item A string table, in the \dotdebugstrdwo{} section.
347 \item A string offsets table, in the \dotdebugstroffsetsdwo{}
351 Except where noted otherwise, all references in this document
352 to a debugging information section (for example, \dotdebuginfo),
356 also to the corresponding split DWARF section (for example,
360 Split DWARF object files do not get linked with any other files,
361 therefore references between sections must not make use of
362 normal object file relocation information. As a result, symbolic
363 references within or between sections are not possible.
365 \subsection{Executable Objects}
366 \label{chap:executableobjects}
367 The relocated addresses in the debugging information for an
368 executable object are virtual addresses.
371 The sections containing the debugging information are typically
372 not loaded as part of the memory image of the program (in ELF
373 terminology, the sections are not "allocatable" and are not part
374 of a loadable segment). Therefore, the debugging information
375 sections described in this document are typically linked as if
376 they were each to be loaded at virtual address 0, and references
377 within the debugging information always implicitly indicate which
378 section a particular offset refers to. (For example, a reference
379 of form \DWFORMsecoffset{} may refer to one of several sections,
380 depending on the class allowed by a particular attribute of a
381 debugging information entry, as shown in
382 Table \refersec{tab:attributeencodings}.)
387 \subsection{Shared Object Files}
388 \label{datarep:sharedobjectfiles}
390 addresses in the debugging information for a shared object file
391 are offsets relative to the start of the lowest region of
392 memory loaded from that shared object file.
395 \textit{This requirement makes the debugging information for
396 shared object files position independent. Virtual addresses in a
397 shared object file may be calculated by adding the offset to the
398 base address at which the object file was attached. This offset
399 is available in the run\dash time linker\textquoteright s data structures.}
402 As with executable objects, the sections containing debugging
403 information are typically not loaded as part of the memory image
404 of the shared object, and are typically linked as if they were
405 each to be loaded at virtual address 0.
408 \subsection{DWARF Package Files}
409 \label{datarep:dwarfpackagefiles}
410 \textit{Using \splitDWARFobjectfile{s} allows the developer to compile,
411 link, and debug an application quickly with less link-time overhead,
412 but a more convenient format is needed for saving the debug
413 information for later debugging of a deployed application. A
414 DWARF package file can be used to collect the debugging
415 information from the object (or separate DWARF object) files
416 produced during the compilation of an application.}
418 \textit{The package file is typically placed in the same directory as the
419 application, and is given the same name with a \doublequote{\texttt{.dwp}}
420 extension.\addtoindexx{\texttt{.dwp} file extension}}
422 A DWARF package file is itself an object file, using the
423 \addtoindexx{package files}
424 \addtoindexx{DWARF package files}
425 same object file format (including \byteorder) as the
426 corresponding application binary. It consists only of a file
427 header, a section table, a number of DWARF debug information
428 sections, and two index sections.
431 Each DWARF package file contains no more than one of each of the
432 following sections, copied from a set of object or DWARF object
433 files, and combined, section by section:
439 \dotdebugstroffsetsdwo
444 The string table section in \dotdebugstrdwo{} contains all the
445 strings referenced from DWARF attributes using the form
446 \DWFORMstrx. Any attribute in a compilation unit or a type
447 unit using this form refers to an entry in that unit's
448 contribution to the \dotdebugstroffsetsdwo{} section, which in turn
449 provides the offset of a string in the \dotdebugstrdwo{}
452 The DWARF package file also contains two index sections that
453 provide a fast way to locate debug information by compilation
454 unit ID (\DWATdwoid) for compilation units, or by type
455 signature for type units:
461 \subsubsection{The Compilation Unit (CU) Index Section}
462 The \dotdebugcuindex{} section is a hashed lookup table that maps a
463 compilation unit ID to a set of contributions in the
464 various debug information sections. Each contribution is stored
465 as an offset within its corresponding section and a size.
467 Each \compunitset{} may contain contributions from the
470 \dotdebuginfodwo{} (required)
471 \dotdebugabbrevdwo{} (required)
474 \dotdebugstroffsetsdwo
478 \textit{Note that a \compunitset{} is not able to represent \dotdebugmacinfo{}
479 information from \DWARFVersionIV{} or earlier formats.}
481 \subsubsection{The Type Unit (TU) Index Section}
482 The \dotdebugtuindex{} section is a hashed lookup table that maps a
483 type signature to a set of offsets into the various debug
484 information sections. Each contribution is stored as an offset
485 within its corresponding section and a size.
487 Each \typeunitset{} may contain contributions from the following
490 \dotdebuginfodwo{} (required)
491 \dotdebugabbrevdwo{} (required)
493 \dotdebugstroffsetsdwo
496 \subsubsection{Format of the CU and TU Index Sections}
497 Both index sections have the same format, and serve to map an
498 8-byte signature to a set of contributions to the debug sections.
499 Each index section begins with a header, followed by a hash table of
500 signatures, a parallel table of indexes, a table of offsets, and
501 a table of sizes. The index sections are aligned at 8-byte
502 boundaries in the DWARF package file.
505 The index section header contains the following fields:
506 \begin{enumerate}[1. ]
507 \item \texttt{version} (\HFTuhalf) \\
509 \addtoindexx{version number!CU index information}
510 \addtoindexx{version number!TU index information}
512 This number is specific to the CU and TU index information
513 and is independent of the DWARF version number.
515 The version number is \versiondotdebugcuindex.
517 \item \textit{padding} (\HFTuhalf) \\
518 Reserved to DWARF (must be zero).
520 \item \texttt{section\_count} (\HFTuword) \\
521 The number of entries in the table of section counts that follows.
522 For brevity, the contents of this field is referred to as $N$ below.
525 \item \texttt{unit\_count} (\HFTuword) \\
526 The number of compilation units or type units in the index.
527 For brevity, the contents of this field is referred to as $U$ below.
529 \item \texttt{slot\_count} (\HFTuword) \\
530 The number of slots in the hash table.
531 For brevity, the contents of this field is referred to as $S$ below.
535 \textit{We assume that $U$ and $S$ do not exceed $2^{32}$.}
537 The size of the hash table, $S$, must be $2^k$ such that:
538 \hspace{0.3cm}$2^k\ \ >\ \ 3*U/2$
540 The hash table begins at offset 16 in the section, and consists
541 of an array of $S$ 8-byte slots. Each slot contains a 64-bit
543 % (using the \byteorder{} of the application binary).
545 The parallel table of indices begins immediately after the hash table
546 (at offset \mbox{$16 + 8 * S$} from the beginning of the section), and
547 consists of an array of $S$ 4-byte slots,
548 % (using the byte order of the application binary),
549 corresponding 1-1 with slots in the hash
550 table. Each entry in the parallel table contains a row index into
551 the tables of offsets and sizes.
553 Unused slots in the hash table have 0 in both the hash table
554 entry and the parallel table entry. While 0 is a valid hash
555 value, the row index in a used slot will always be non-zero.
557 Given an 8-byte compilation unit ID or type signature $X$,
558 an entry in the hash table is located as follows:
559 \begin{enumerate}[1. ]
560 \item Define $REP(X)$ to be the value of $X$ interpreted as an
561 unsigned 64-bit integer in the target byte order.
562 \item Calculate a primary hash $H = REP(X)\ \&\ MASK(k)$, where
563 $MASK(k)$ is a mask with the low-order $k$ bits all set to 1.
564 \item Calculate a secondary hash $H' = (((REP(X)>>32)\ \&\ MASK(k))\ |\ 1)$.
565 \item If the hash table entry at index $H$ matches the signature, use
566 that entry. If the hash table entry at index $H$ is unused (all
567 zeroes), terminate the search: the signature is not present
569 \item Let $H = (H + H')\ modulo\ S$. Repeat at Step 4.
572 Because $S > U$, and $H'$ and $S$ are relatively prime, the search is
573 guaranteed to stop at an unused slot or find the match.
576 The table of offsets begins immediately following the parallel
577 table (at offset \mbox{$16 + 12 * S$} from the beginning of the section).
578 The table is a two-dimensional array of 4-byte words,
579 %(using the byte order of the application binary),
581 with $N$ sections and $U + 1$
583 rows, in row-major order. Each row in the array is indexed
584 starting from 0. The first row provides a key to the columns:
585 each column in this row provides a section identifier for a debug
586 section, and the offsets in the same column of subsequent rows
587 refer to that section. The section identifiers are shown in
588 Table \referfol{tab:dwarfpackagefilesectionidentifierencodings}.
591 \textit{Not all sections listed in the table need be included.}
596 \setlength{\extrarowheight}{0.1cm}
597 \begin{longtable}{l|c|l}
598 \caption{DWARF package file section identifier \mbox{encodings}}
599 \label{tab:dwarfpackagefilesectionidentifierencodings}
600 \addtoindexx{DWARF package files!section identifier encodings} \\
601 \hline \bfseries Section identifier &\bfseries Value &\bfseries Section \\ \hline
603 \bfseries Section identifier &\bfseries Value &\bfseries Section\\ \hline
605 \hline \emph{Continued on next page}
609 \DWSECTINFOTARG & 1 & \dotdebuginfodwo \\
610 \textit{Reserved} & 2 & \\
611 \DWSECTABBREVTARG & 3 & \dotdebugabbrevdwo \\
612 \DWSECTLINETARG & 4 & \dotdebuglinedwo \\
613 \DWSECTLOCTARG & 5 & \dotdebuglocdwo \\
614 \DWSECTSTROFFSETSTARG & 6 & \dotdebugstroffsetsdwo \\
615 %DWSECTMACINFO & & \dotdebugmacinfodwo \\
616 \DWSECTMACROTARG & 7 & \dotdebugmacrodwo \\
620 The offsets provided by the CU and TU index sections are the
621 base offsets for the contributions made by each CU or TU to the
622 corresponding section in the package file. Each CU and TU header
623 contains a \HFNdebugabbrevoffset{} field, used to find the abbreviations
624 table for that CU or TU within the contribution to the
625 \dotdebugabbrevdwo{} section for that CU or TU, and are
626 interpreted as relative to the base offset given in the index
627 section. Likewise, offsets into \dotdebuglinedwo{} from
628 \DWATstmtlist{} attributes are interpreted as relative to
629 the base offset for \dotdebuglinedwo{}, and offsets into other debug
630 sections obtained from DWARF attributes are also
631 interpreted as relative to the corresponding base offset.
633 The table of sizes begins immediately following the table of
634 offsets, and provides the sizes of the contributions made by each
635 CU or TU to the corresponding section in the package file. Like
636 the table of offsets, it is a two-dimensional array of 4-byte
641 entries and $U$ rows, in row-major order. Each row in
642 the array is indexed starting from 1 (row 0 of the table of
643 offsets also serves as the key for the table of sizes).
646 For an example, see Figure \refersec{fig:examplecuindexsection}.
649 \subsection{DWARF Supplementary Object Files}
650 \label{datarep:dwarfsupplemetaryobjectfiles}
651 In order to minimize the size of debugging information,
652 it is possible to move duplicate debug information entries,
653 strings and macro entries from several executables or shared
654 object files into a separate
655 \addtoindexi{\textit{supplementary object file}}{supplementary object file}
656 by some post-linking utility; the moved entries and strings can
661 from the debugging information of each of those executable or
665 This facilitates distribution of separate consolidated debug files in
670 A DWARF \addtoindex{supplementary object file} is itself an object file,
671 using the same object
672 file format, \byteorder{}, and size as the corresponding application executables
673 or shared libraries. It consists only of a file header, section table, and
674 a number of DWARF debug information sections. Both the
675 \addtoindex{supplementary object file}
676 and all the executable or shared object files that reference entries or strings in that
677 file must contain a \dotdebugsup{} section that establishes the relationship.
679 The \dotdebugsup{} section contains:
680 \begin{enumerate}[1. ]
681 \item \texttt{version} (\HFTuhalf) \\
682 \addttindexx{version}
683 A 2-byte unsigned integer representing the version of the DWARF
684 information for the compilation unit.
687 The value in this field is \versiondotdebugsup.
689 \item \texttt{is\_supplementary} (\HFTubyte) \\
690 \addttindexx{is\_supplementary}
691 A 1-byte unsigned integer, which contains the value 1 if it is
692 in the \addtoindex{supplementary object file} that other executable or
693 shared object files refer to, or 0 if it is an executable or shared object
694 referring to a \addtoindex{supplementary object file}.
697 \item \texttt{sup\_filename} (null terminated filename string) \\
698 \addttindexx{sup\_filename}
699 If \addttindex{is\_supplementary} is 0, this contains either an absolute
700 filename for the \addtoindex{supplementary object file}, or a filename
701 relative to the object file containing the \dotdebugsup{} section.
702 If \addttindex{is\_supplementary} is 1, then \addttindex{sup\_filename}
703 is not needed and must be an empty string (a single null byte).
706 \item \texttt{sup\_checksum\_len} (unsigned LEB128) \\
707 \addttindexx{sup\_checksum\_len}
708 Length of the following \addttindex{sup\_checksum} field;
709 this value can be 0 if no checksum is provided.
711 \item \texttt{sup\_checksum} (array of \HFTubyte) \\
712 \addttindexx{sup\_checksum}
714 An implementation-defined integer constant value that
715 provides unique identification of the supplementary file.
720 Debug information entries that refer to an executable's or shared
721 object's addresses must \emph{not} be moved to supplementary files (the
722 addesses will likely not be the same). Similarly,
723 entries referenced from within location expressions or using loclistptr
724 form attributes must not be moved to a \addtoindex{supplementary object file}.
726 Executable or shared object file compilation units can use
727 \DWTAGimportedunit{} with \DWFORMrefsup{} form \DWATimport{} attribute
728 to import entries from the \addtoindex{supplementary object file}, other \DWFORMrefsup{}
729 attributes to refer to them and \DWFORMstrpsup{} form attributes to
730 refer to strings that are used by debug information of multiple
731 executables or shared object files. Within the \addtoindex{supplementary object file}'s
732 debugging sections, form \DWFORMrefsup{} or \DWFORMstrpsup{} are
733 not used, and all reference forms referring to some other sections
734 refer to the local sections in the \addtoindex{supplementary object file}.
736 In macro information, \DWMACROdefinesup{} or
737 \DWMACROundefsup{} opcodes can refer to strings in the
738 \dotdebugstr{} section of the \addtoindex{supplementary object file},
739 or \DWMACROimportsup{}
740 can refer to \dotdebugmacro{} section entries. Within the
741 \dotdebugmacro{} section of a \addtoindex{supplementary object file},
742 \DWMACROdefinestrp{} and \DWMACROundefstrp{}
743 opcodes refer to the local \dotdebugstr{} section in that
744 supplementary file, not the one in
745 the executable or shared object file.
749 \section{32-Bit and 64-Bit DWARF Formats}
750 \label{datarep:32bitand64bitdwarfformats}
751 \hypertarget{datarep:xxbitdwffmt}{}
752 \addtoindexx{32-bit DWARF format}
753 \addtoindexx{64-bit DWARF format}
756 closely-related DWARF
758 formats. In the 32-bit DWARF
759 format, all values that represent lengths of DWARF sections
760 and offsets relative to the beginning of DWARF sections are
761 represented using four bytes. In the 64-bit DWARF format, all
762 values that represent lengths of DWARF sections and offsets
763 relative to the beginning of DWARF sections are represented
764 using eight bytes. A special convention applies to the initial
765 length field of certain DWARF sections, as well as the CIE and
766 FDE structures, so that the 32-bit and 64-bit DWARF formats
767 can coexist and be distinguished within a single linked object.
770 Except where noted otherwise, all references in this document
771 to a debugging information section (for example, \dotdebuginfo),
772 apply also to the corresponding split DWARF section (for example,
776 The differences between the 32- and 64-bit DWARF formats are
777 detailed in the following:
778 \begin{enumerate}[1. ]
780 \item In the 32-bit DWARF format, an
781 \addtoindex{initial length} field (see
782 \addtoindexx{initial length!encoding}
783 Section \ref{datarep:initiallengthvalues} on page \pageref{datarep:initiallengthvalues})
784 is an unsigned 4-byte integer (which
785 must be less than \xfffffffzero); in the 64-bit DWARF format,
786 an \addtoindex{initial length} field is 12 bytes in size,
789 \item The first four bytes have the value \xffffffff.
791 \item The following eight bytes contain the actual length
792 represented as an unsigned 8-byte integer.
795 \textit{This representation allows a DWARF consumer to dynamically
796 detect that a DWARF section contribution is using the 64-bit
797 format and to adapt its processing accordingly.}
800 \item \hypertarget{datarep:sectionoffsetlength}{}
801 Section offset and section length
802 \addtoindexx{section length!use in headers}
804 \addtoindexx{section offset!use in headers}
805 in the headers of DWARF sections (other than initial length
806 \addtoindexx{initial length}
807 fields) are listed following. In the 32-bit DWARF format these
808 are 4-byte unsigned integer values; in the 64-bit DWARF format,
809 they are 8-byte unsigned integer values.
813 Section &Name & Role \\ \hline
814 \dotdebugaranges{} & \addttindex{debug\_info\_offset} & offset in \dotdebuginfo{} \\
815 \dotdebugframe{}/CIE & \addttindex{CIE\_id} & CIE distinguished value \\
816 \dotdebugframe{}/FDE & \addttindex{CIE\_pointer} & offset in \dotdebugframe{} \\
817 \dotdebuginfo{} & \addttindex{debug\_abbrev\_offset} & offset in \dotdebugabbrev{} \\
818 \dotdebugline{} & \addttindex{header\_length} & length of header itself \\
819 \dotdebugnames{} & entry in array of CUs & offset in \dotdebuginfo{} \\
825 The \texttt{CIE\_id} field in a CIE structure must be 64 bits because
826 it overlays the \texttt{CIE\_pointer} in a FDE structure; this implicit
827 union must be accessed to distinguish whether a CIE or FDE is
828 present, consequently, these two fields must exactly overlay
829 each other (both offset and size).
831 \item Within the body of the \dotdebuginfo{}
832 section, certain forms of attribute value depend on the choice
833 of DWARF format as follows. For the 32-bit DWARF format,
834 the value is a 4-byte unsigned integer; for the 64-bit DWARF
835 format, the value is an 8-byte unsigned integer.
837 \begin{tabular}{lp{6cm}}
838 Form & Role \\ \hline
839 \DWFORMlinestrp & offset in \dotdebuglinestr \\
840 \DWFORMrefaddr & offset in \dotdebuginfo{} \\
841 \DWFORMrefsup & offset in \dotdebuginfo{} section of a \mbox{supplementary} object file \\
842 \addtoindexx{supplementary object file}
843 \DWFORMsecoffset & offset in a section other than \\
844 & \dotdebuginfo{} or \dotdebugstr{} \\
845 \DWFORMstrp & offset in \dotdebugstr{} \\
846 \DWFORMstrpsup & offset in \dotdebugstr{} section of a \mbox{supplementary} object file \\
847 \DWOPcallref & offset in \dotdebuginfo{} \\
852 \item Within the body of the \dotdebugline{} section, certain forms of content
853 description depend on the choice of DWARF format as follows: for the
854 32-bit DWARF format, the value is a 4-byte unsigned integer; for the
855 64-bit DWARF format, the value is a 8-byte unsigned integer.
857 \begin{tabular}{lp{6cm}}
858 Form & Role \\ \hline
859 \DWFORMlinestrp & offset in \dotdebuglinestr
863 \item Within the body of the \dotdebugnames{}
864 sections, the representation of each entry in the array of
865 compilation units (CUs) and the array of local type units
866 (TUs), which represents an offset in the
868 section, depends on the DWARF format as follows: in the
869 32-bit DWARF format, each entry is a 4-byte unsigned integer;
870 in the 64-bit DWARF format, it is a 8-byte unsigned integer.
873 \item In the body of the \dotdebugstroffsets{}
875 sections, the size of entries in the body depend on the DWARF
876 format as follows: in the 32-bit DWARF format, entries are 4-byte
877 unsigned integer values; in the 64-bit DWARF format, they are
878 8-byte unsigned integers.
880 \item In the body of the \dotdebugaddr{}, \dotdebugloc{} and \dotdebugranges{}
881 sections, the contents of the address size fields depends on the
882 DWARF format as follows: in the 32-bit DWARF format, these fields
883 contain 4; in the 64-bit DWARF format these fields contain 8.
887 The 32-bit and 64-bit DWARF format conventions must \emph{not} be
888 intermixed within a single compilation unit.
890 \textit{Attribute values and section header fields that represent
891 addresses in the target program are not affected by these
894 A DWARF consumer that supports the 64-bit DWARF format must
895 support executables in which some compilation units use the
896 32-bit format and others use the 64-bit format provided that
897 the combination links correctly (that is, provided that there
898 are no link\dash time errors due to truncation or overflow). (An
899 implementation is not required to guarantee detection and
900 reporting of all such errors.)
902 \textit{It is expected that DWARF producing compilers will \emph{not} use
903 the 64-bit format \emph{by default}. In most cases, the division of
904 even very large applications into a number of executable and
905 shared object files will suffice to assure that the DWARF sections
906 within each individual linked object are less than 4 GBytes
907 in size. However, for those cases where needed, the 64-bit
908 format allows the unusual case to be handled as well. Even
909 in this case, it is expected that only application supplied
910 objects will need to be compiled using the 64-bit format;
911 separate 32-bit format versions of system supplied shared
912 executable libraries can still be used.}
915 \section{Format of Debugging Information}
916 \label{datarep:formatofdebugginginformation}
918 For each compilation unit compiled with a DWARF producer,
919 a contribution is made to the \dotdebuginfo{} section of
920 the object file. Each such contribution consists of a
921 compilation unit header
922 (see Section \refersec{datarep:compilationunitheader})
924 single \DWTAGcompileunit{} or
925 \DWTAGpartialunit{} debugging
926 information entry, together with its children.
928 For each type defined in a compilation unit, a separate
929 contribution may also be made to the
931 section of the object file. Each
932 such contribution consists of a
933 \addtoindex{type unit} header
934 (see Section \refersec{datarep:typeunitheader})
935 followed by a \DWTAGtypeunit{} entry, together with
938 Each debugging information entry begins with a code that
939 represents an entry in a separate
940 \addtoindex{abbreviations table}. This
941 code is followed directly by a series of attribute values.
943 The appropriate entry in the
944 \addtoindex{abbreviations table} guides the
945 interpretation of the information contained directly in the
946 \dotdebuginfo{} section.
949 Multiple debugging information entries may share the same
950 abbreviation table entry. Each compilation unit is associated
951 with a particular abbreviation table, but multiple compilation
952 units may share the same table.
954 \subsection{Unit Headers}
955 \label{datarep:unitheaders}
956 Unit headers contain a field, \addttindex{unit\_type}, whose value indicates the kind of
957 compilation unit that follows. The encodings for the unit type
958 enumeration are shown in Table \refersec{tab:unitheaderunitkindencodings}.
962 \setlength{\extrarowheight}{0.1cm}
963 \begin{longtable}{l|c}
964 \caption{Unit header unit type encodings}
965 \label{tab:unitheaderunitkindencodings}
966 \addtoindexx{unit header unit type encodings} \\
967 \hline \bfseries Unit header unit type encodings&\bfseries Value \\ \hline
969 \bfseries Unit header unit type encodings&\bfseries Value \\ \hline
971 \hline \emph{Continued on next page}
973 \hline \ddag\ \textit{New in DWARF Version 5}
975 \DWUTcompileTARG~\ddag &0x01 \\
976 \DWUTtypeTARG~\ddag &0x02 \\
977 \DWUTpartialTARG~\ddag &0x03 \\ \hline
983 \subsubsection{Compilation and Partial Unit Headers}
985 \label{datarep:compilationunitheader}
986 \begin{enumerate}[1. ]
988 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
989 \addttindexx{unit\_length}
991 \addtoindexx{initial length}
992 unsigned integer representing the length
993 of the \dotdebuginfo{}
994 contribution for that compilation unit,
995 not including the length field itself. In the \thirtytwobitdwarfformat,
996 this is a 4-byte unsigned integer (which must be less
997 than \xfffffffzero); in the \sixtyfourbitdwarfformat, this consists
998 of the 4-byte value \wffffffff followed by an 8-byte unsigned
999 integer that gives the actual length
1000 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1002 \item \texttt{version} (\HFTuhalf) \\
1003 \addttindexx{version}
1004 \addtoindexx{version number!compilation unit}
1005 A 2-byte unsigned integer representing the version of the
1006 DWARF information for the compilation unit.
1009 The value in this field is \versiondotdebuginfo.
1012 \textit{See also Appendix \refersec{app:dwarfsectionversionnumbersinformative}
1013 for a summary of all version numbers that apply to DWARF sections.}
1017 \item \texttt{unit\_type} (\HFTubyte) \\
1018 \addttindexx{unit\_type}
1019 A 1-byte unsigned integer identifying this unit as a compilation unit.
1020 The value of this field is
1021 \DWUTcompile{} for a full compilation unit or
1022 \DWUTpartial{} for a partial compilation unit
1023 (see Section \refersec{chap:fullandpartialcompilationunitentries}).
1025 \textit{This field is new in \DWARFVersionV.}
1029 \item \texttt{address\_size} (\HFTubyte) \\
1030 \addttindexx{address\_size}
1031 A 1-byte unsigned integer representing the size in bytes of
1032 an address on the target architecture. If the system uses
1033 \addtoindexx{address space!segmented}
1034 segmented addressing, this value represents the size of the
1035 offset portion of an address.
1038 \item \HFNdebugabbrevoffset{} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
1040 \addtoindexx{section offset!in .debug\_info header}
1041 4-byte or 8-byte unsigned offset into the
1043 section. This offset associates the compilation unit with a
1044 particular set of debugging information entry abbreviations. In
1045 the \thirtytwobitdwarfformat, this is a 4-byte unsigned length;
1046 in the \sixtyfourbitdwarfformat, this is an 8-byte unsigned length
1047 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1053 \subsubsection{Type Unit Header}
1054 \label{datarep:typeunitheader}
1056 The header for the series of debugging information entries
1057 contributing to the description of a type that has been
1058 placed in its own \addtoindex{type unit}, within the
1059 \dotdebuginfo{} section,
1060 consists of the following information:
1061 \begin{enumerate}[1. ]
1064 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
1065 \addttindexx{unit\_length}
1066 A 4-byte or 12-byte unsigned integer
1067 \addtoindexx{initial length}
1068 representing the length
1069 of the \dotdebuginfo{} contribution for that type unit,
1070 not including the length field itself. In the \thirtytwobitdwarfformat,
1071 this is a 4-byte unsigned integer (which must be
1072 less than \xfffffffzero); in the \sixtyfourbitdwarfformat, this
1073 consists of the 4-byte value \wffffffff followed by an
1074 8-byte unsigned integer that gives the actual length
1075 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1078 \item \texttt{version} (\HFTuhalf) \\
1079 \addttindexx{version}
1080 \addtoindexx{version number!type unit}
1081 A 2-byte unsigned integer representing the version of the
1082 DWARF information for the type unit.
1085 The value in this field is \versiondotdebuginfo.
1087 \item \texttt{unit\_type} (\HFTubyte) \\
1088 \addttindexx{unit\_type}
1089 A 1-byte unsigned integer identifying this unit as a type unit.
1090 The value of this field is \DWUTtype{} for a type unit
1091 (see Section \refersec{chap:typeunitentries}).
1093 \textit{This field is new in \DWARFVersionV.}
1097 \item \texttt{address\_size} (\HFTubyte) \\
1098 \addttindexx{address\_size}
1099 A 1-byte unsigned integer representing the size
1100 \addtoindexx{size of an address}
1102 an address on the target architecture. If the system uses
1103 \addtoindexx{address space!segmented}
1104 segmented addressing, this value represents the size of the
1105 offset portion of an address.
1108 \item \HFNdebugabbrevoffset{} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
1110 \addtoindexx{section offset!in .debug\_info header}
1111 4-byte or 8-byte unsigned offset into the
1113 section. This offset associates the type unit with a
1114 particular set of debugging information entry abbreviations. In
1115 the \thirtytwobitdwarfformat, this is a 4-byte unsigned length;
1116 in the \sixtyfourbitdwarfformat, this is an 8-byte unsigned length
1117 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1121 \item \texttt{type\_signature} (8-byte unsigned integer) \\
1122 \addttindexx{type\_signature}
1123 \addtoindexx{type signature}
1124 A unique 8-byte signature (see Section
1125 \refersec{datarep:typesignaturecomputation})
1126 of the type described in this type
1129 \textit{An attribute that refers (using
1130 \DWFORMrefsigeight{}) to
1131 the primary type contained in this
1132 \addtoindex{type unit} uses this value.}
1134 \item \texttt{type\_offset} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
1135 \addttindexx{type\_offset}
1136 A 4-byte or 8-byte unsigned offset
1137 \addtoindexx{section offset!in .debug\_info header}
1138 relative to the beginning
1139 of the \addtoindex{type unit} header.
1140 This offset refers to the debugging
1141 information entry that describes the type. Because the type
1142 may be nested inside a namespace or other structures, and may
1143 contain references to other types that have not been placed in
1144 separate type units, it is not necessarily either the first or
1145 the only entry in the type unit. In the \thirtytwobitdwarfformat,
1146 this is a 4-byte unsigned length; in the \sixtyfourbitdwarfformat,
1147 this is an 8-byte unsigned length
1148 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1152 \subsection{Debugging Information Entry}
1153 \label{datarep:debugginginformationentry}
1155 Each debugging information entry begins with an
1156 unsigned LEB128\addtoindexx{LEB128!unsigned}
1157 number containing the abbreviation code for the entry. This
1158 code represents an entry within the abbreviations table
1159 associated with the compilation unit containing this entry. The
1160 abbreviation code is followed by a series of attribute values.
1162 On some architectures, there are alignment constraints on
1163 section boundaries. To make it easier to pad debugging
1164 information sections to satisfy such constraints, the
1165 abbreviation code 0 is reserved. Debugging information entries
1166 consisting of only the abbreviation code 0 are considered
1169 \subsection{Abbreviations Tables}
1170 \label{datarep:abbreviationstables}
1172 The abbreviations tables for all compilation units
1173 are contained in a separate object file section called
1175 As mentioned before, multiple compilation
1176 units may share the same abbreviations table.
1178 The abbreviations table for a single compilation unit consists
1179 of a series of abbreviation declarations. Each declaration
1180 specifies the tag and attributes for a particular form of
1181 debugging information entry. Each declaration begins with
1182 an unsigned LEB128\addtoindexx{LEB128!unsigned}
1183 number representing the abbreviation
1184 code itself. It is this code that appears at the beginning
1185 of a debugging information entry in the
1187 section. As described above, the abbreviation
1188 code 0 is reserved for null debugging information entries. The
1189 abbreviation code is followed by another unsigned LEB128\addtoindexx{LEB128!unsigned}
1190 number that encodes the entry\textquoteright s tag. The encodings for the
1191 tag names are given in
1192 Table \referfol{tab:tagencodings}.
1195 \setlength{\extrarowheight}{0.1cm}
1196 \begin{longtable}{l|c}
1197 \caption{Tag encodings} \label{tab:tagencodings} \\
1198 \hline \bfseries Tag name&\bfseries Value\\ \hline
1200 \bfseries Tag name&\bfseries Value \\ \hline
1202 \hline \emph{Continued on next page}
1204 \hline \ddag\ \textit{New in DWARF Version 5}
1206 \DWTAGarraytype{} &0x01 \\
1207 \DWTAGclasstype&0x02 \\
1208 \DWTAGentrypoint&0x03 \\
1209 \DWTAGenumerationtype&0x04 \\
1210 \DWTAGformalparameter&0x05 \\
1211 \DWTAGimporteddeclaration&0x08 \\
1213 \DWTAGlexicalblock&0x0b \\
1214 \DWTAGmember&0x0d \\
1215 \DWTAGpointertype&0x0f \\
1216 \DWTAGreferencetype&0x10 \\
1217 \DWTAGcompileunit&0x11 \\
1218 \DWTAGstringtype&0x12 \\
1219 \DWTAGstructuretype&0x13 \\
1220 \DWTAGsubroutinetype&0x15 \\
1221 \DWTAGtypedef&0x16 \\
1222 \DWTAGuniontype&0x17 \\
1223 \DWTAGunspecifiedparameters&0x18 \\
1224 \DWTAGvariant&0x19 \\
1225 \DWTAGcommonblock&0x1a \\
1226 \DWTAGcommoninclusion&0x1b \\
1227 \DWTAGinheritance&0x1c \\
1228 \DWTAGinlinedsubroutine&0x1d \\
1229 \DWTAGmodule&0x1e \\
1230 \DWTAGptrtomembertype&0x1f \\
1231 \DWTAGsettype&0x20 \\
1232 \DWTAGsubrangetype&0x21 \\
1233 \DWTAGwithstmt&0x22 \\
1234 \DWTAGaccessdeclaration&0x23 \\
1235 \DWTAGbasetype&0x24 \\
1236 \DWTAGcatchblock&0x25 \\
1237 \DWTAGconsttype&0x26 \\
1238 \DWTAGconstant&0x27 \\
1239 \DWTAGenumerator&0x28 \\
1240 \DWTAGfiletype&0x29 \\
1241 \DWTAGfriend&0x2a \\
1242 \DWTAGnamelist&0x2b \\
1243 \DWTAGnamelistitem&0x2c \\
1244 \DWTAGpackedtype&0x2d \\
1245 \DWTAGsubprogram&0x2e \\
1246 \DWTAGtemplatetypeparameter&0x2f \\
1247 \DWTAGtemplatevalueparameter&0x30 \\
1248 \DWTAGthrowntype&0x31 \\
1249 \DWTAGtryblock&0x32 \\
1250 \DWTAGvariantpart&0x33 \\
1251 \DWTAGvariable&0x34 \\
1252 \DWTAGvolatiletype&0x35 \\
1253 \DWTAGdwarfprocedure&0x36 \\
1254 \DWTAGrestricttype&0x37 \\
1255 \DWTAGinterfacetype&0x38 \\
1256 \DWTAGnamespace&0x39 \\
1257 \DWTAGimportedmodule&0x3a \\
1258 \DWTAGunspecifiedtype&0x3b \\
1259 \DWTAGpartialunit&0x3c \\
1260 \DWTAGimportedunit&0x3d \\
1261 \DWTAGcondition&\xiiif \\
1262 \DWTAGsharedtype&0x40 \\
1263 \DWTAGtypeunit & 0x41 \\
1264 \DWTAGrvaluereferencetype & 0x42 \\
1265 \DWTAGtemplatealias & 0x43 \\
1266 \DWTAGcoarraytype~\ddag & 0x44 \\
1267 \DWTAGgenericsubrange~\ddag & 0x45 \\
1268 \DWTAGdynamictype~\ddag & 0x46 \\
1269 \DWTAGatomictype~\ddag & 0x47 \\
1270 \DWTAGcallsite~\ddag & 0x48 \\
1271 \DWTAGcallsiteparameter~\ddag & 0x49 \\
1272 \DWTAGlouser&0x4080 \\
1273 \DWTAGhiuser&\xffff \\
1278 Following the tag encoding is a 1-byte value that determines
1279 whether a debugging information entry using this abbreviation
1280 has child entries or not. If the value is
1282 the next physically succeeding entry of any debugging
1283 information entry using this abbreviation is the first
1284 child of that entry. If the 1-byte value following the
1285 abbreviation\textquoteright s tag encoding is
1286 \DWCHILDRENnoTARG, the next
1287 physically succeeding entry of any debugging information entry
1288 using this abbreviation is a sibling of that entry. (Either
1289 the first child or sibling entries may be null entries). The
1290 encodings for the child determination byte are given in
1291 Table \refersec{tab:childdeterminationencodings}
1293 Section \refersec{chap:relationshipofdebugginginformationentries},
1294 each chain of sibling entries is terminated by a null entry.)
1298 \setlength{\extrarowheight}{0.1cm}
1299 \begin{longtable}{l|c}
1300 \caption{Child determination encodings}
1301 \label{tab:childdeterminationencodings}
1302 \addtoindexx{Child determination encodings} \\
1303 \hline \bfseries Children determination name&\bfseries Value \\ \hline
1305 \bfseries Children determination name&\bfseries Value \\ \hline
1307 \hline \emph{Continued on next page}
1311 \DWCHILDRENno&0x00 \\
1312 \DWCHILDRENyes&0x01 \\ \hline
1317 Finally, the child encoding is followed by a series of
1318 attribute specifications. Each attribute specification
1319 consists of two parts. The first part is an
1320 unsigned LEB128\addtoindexx{LEB128!unsigned}
1321 number representing the attribute\textquoteright s name.
1322 The second part is an
1323 unsigned LEB128\addtoindexx{LEB128!unsigned}
1324 number representing the attribute\textquoteright s form.
1325 The series of attribute specifications ends with an
1326 entry containing 0 for the name and 0 for the form.
1329 \DWFORMindirectTARG{} is a special case. For
1330 attributes with this form, the attribute value itself in the
1332 section begins with an unsigned
1333 LEB128 number that represents its form. This allows producers
1334 to choose forms for particular attributes
1335 \addtoindexx{abbreviations table!dynamic forms in}
1337 without having to add a new entry to the abbreviations table.
1339 The attribute form \DWFORMimplicitconstTARG{} is another special case.
1340 For attributes with this form, the attribute specification contains
1341 a third part, which is a signed LEB128\addtoindexx{LEB128!signed}
1342 number. The value of this number is used as the value of the
1343 attribute, and no value is stored in the \dotdebuginfo{} section.
1345 The abbreviations for a given compilation unit end with an
1346 entry consisting of a 0 byte for the abbreviation code.
1349 Appendix \refersec{app:compilationunitsandabbreviationstableexample}
1350 for a depiction of the organization of the
1351 debugging information.}
1354 \subsection{Attribute Encodings}
1355 \label{datarep:attributeencodings}
1357 The encodings for the attribute names are given in
1358 Table \referfol{tab:attributeencodings}.
1361 \setlength{\extrarowheight}{0.1cm}
1362 \begin{longtable}{l|c|l}
1363 \caption{Attribute encodings}
1364 \label{tab:attributeencodings}
1365 \addtoindexx{attribute encodings} \\
1366 \hline \bfseries Attribute name&\bfseries Value &\bfseries Classes \\ \hline
1368 \bfseries Attribute name&\bfseries Value &\bfseries Classes\\ \hline
1370 \hline \emph{Continued on next page}
1372 \hline \ddag\ \textit{New in DWARF Version 5}
1374 \DWATsibling&0x01&\livelink{chap:classreference}{reference}
1375 \addtoindexx{sibling attribute} \\
1376 \DWATlocation&0x02&\livelink{chap:classexprloc}{exprloc},
1377 \livelink{chap:classloclistptr}{loclistptr}
1378 \addtoindexx{location attribute} \\
1379 \DWATname&0x03&\livelink{chap:classstring}{string}
1380 \addtoindexx{name attribute} \\
1381 \DWATordering&0x09&\livelink{chap:classconstant}{constant}
1382 \addtoindexx{ordering attribute} \\
1383 \DWATbytesize&0x0b&\livelink{chap:classconstant}{constant},
1384 \livelink{chap:classexprloc}{exprloc},
1385 \livelink{chap:classreference}{reference}
1386 \addtoindexx{byte size attribute} \\
1387 \textit{Reserved}&0x0c\footnote{Code 0x0c is reserved to allow backward compatible support of the
1388 DW\_AT\_bit\_offset \mbox{attribute} which was
1389 defined in \DWARFVersionIII{} and earlier.}
1390 &\livelink{chap:classconstant}{constant},
1391 \livelink{chap:classexprloc}{exprloc},
1392 \livelink{chap:classreference}{reference}
1393 \addtoindexx{bit offset attribute (Version 3)}
1394 \addtoindexx{DW\_AT\_bit\_offset (deprecated)} \\
1395 \DWATbitsize&0x0d&\livelink{chap:classconstant}{constant},
1396 \livelink{chap:classexprloc}{exprloc},
1397 \livelink{chap:classreference}{reference}
1398 \addtoindexx{bit size attribute} \\
1399 \DWATstmtlist&0x10&\livelink{chap:classlineptr}{lineptr}
1400 \addtoindexx{statement list attribute} \\
1401 \DWATlowpc&0x11&\livelink{chap:classaddress}{address}
1402 \addtoindexx{low PC attribute} \\
1403 \DWAThighpc&0x12&\livelink{chap:classaddress}{address},
1404 \livelink{chap:classconstant}{constant}
1405 \addtoindexx{high PC attribute} \\
1406 \DWATlanguage&0x13&\livelink{chap:classconstant}{constant}
1407 \addtoindexx{language attribute} \\
1408 \DWATdiscr&0x15&\livelink{chap:classreference}{reference}
1409 \addtoindexx{discriminant attribute} \\
1410 \DWATdiscrvalue&0x16&\livelink{chap:classconstant}{constant}
1411 \addtoindexx{discriminant value attribute} \\
1412 \DWATvisibility&0x17&\livelink{chap:classconstant}{constant}
1413 \addtoindexx{visibility attribute} \\
1414 \DWATimport&0x18&\livelink{chap:classreference}{reference}
1415 \addtoindexx{import attribute} \\
1416 \DWATstringlength&0x19&\livelink{chap:classexprloc}{exprloc},
1417 \livelink{chap:classloclistptr}{loclistptr}
1418 \addtoindexx{string length attribute} \\
1419 \DWATcommonreference&0x1a&\livelink{chap:classreference}{reference}
1420 \addtoindexx{common reference attribute} \\
1421 \DWATcompdir&0x1b&\livelink{chap:classstring}{string}
1422 \addtoindexx{compilation directory attribute} \\
1423 \DWATconstvalue&0x1c&\livelink{chap:classblock}{block},
1424 \livelink{chap:classconstant}{constant},
1425 \livelink{chap:classstring}{string}
1426 \addtoindexx{constant value attribute} \\
1427 \DWATcontainingtype&0x1d&\livelink{chap:classreference}{reference}
1428 \addtoindexx{containing type attribute} \\
1429 \DWATdefaultvalue&0x1e&\livelink{chap:classconstant}{constant},
1430 \livelink{chap:classreference}{reference},
1431 \livelink{chap:classflag}{flag}
1432 \addtoindexx{default value attribute} \\
1433 \DWATinline&0x20&\livelink{chap:classconstant}{constant}
1434 \addtoindexx{inline attribute} \\
1435 \DWATisoptional&0x21&\livelink{chap:classflag}{flag}
1436 \addtoindexx{is optional attribute} \\
1437 \DWATlowerbound&0x22&\livelink{chap:classconstant}{constant},
1438 \livelink{chap:classexprloc}{exprloc},
1439 \livelink{chap:classreference}{reference}
1440 \addtoindexx{lower bound attribute} \\
1441 \DWATproducer&0x25&\livelink{chap:classstring}{string}
1442 \addtoindexx{producer attribute} \\
1443 \DWATprototyped&0x27&\livelink{chap:classflag}{flag}
1444 \addtoindexx{prototyped attribute} \\
1445 \DWATreturnaddr&0x2a&\livelink{chap:classexprloc}{exprloc},
1446 \livelink{chap:classloclistptr}{loclistptr}
1447 \addtoindexx{return address attribute} \\
1448 \DWATstartscope&0x2c&\livelink{chap:classconstant}{constant},
1449 \livelink{chap:classrangelistptr}{rangelistptr}
1450 \addtoindexx{start scope attribute} \\
1451 \DWATbitstride&0x2e&\livelink{chap:classconstant}{constant},
1452 \livelink{chap:classexprloc}{exprloc},
1453 \livelink{chap:classreference}{reference}
1454 \addtoindexx{bit stride attribute} \\
1455 \DWATupperbound&0x2f&\livelink{chap:classconstant}{constant},
1456 \livelink{chap:classexprloc}{exprloc},
1457 \livelink{chap:classreference}{reference}
1458 \addtoindexx{upper bound attribute} \\
1459 \DWATabstractorigin&0x31&\livelink{chap:classreference}{reference}
1460 \addtoindexx{abstract origin attribute} \\
1461 \DWATaccessibility&0x32&\livelink{chap:classconstant}{constant}
1462 \addtoindexx{accessibility attribute} \\
1463 \DWATaddressclass&0x33&\livelink{chap:classconstant}{constant}
1464 \addtoindexx{address class attribute} \\
1465 \DWATartificial&0x34&\livelink{chap:classflag}{flag}
1466 \addtoindexx{artificial attribute} \\
1467 \DWATbasetypes&0x35&\livelink{chap:classreference}{reference}
1468 \addtoindexx{base types attribute} \\
1469 \DWATcallingconvention&0x36&\livelink{chap:classconstant}{constant}
1470 \addtoindexx{calling convention attribute} \\
1471 \DWATcount&0x37&\livelink{chap:classconstant}{constant},
1472 \livelink{chap:classexprloc}{exprloc},
1473 \livelink{chap:classreference}{reference}
1474 \addtoindexx{count attribute} \\
1475 \DWATdatamemberlocation&0x38&\livelink{chap:classconstant}{constant},
1476 \livelink{chap:classexprloc}{exprloc},
1477 \livelink{chap:classloclistptr}{loclistptr}
1478 \addtoindexx{data member attribute} \\
1479 \DWATdeclcolumn&0x39&\livelink{chap:classconstant}{constant}
1480 \addtoindexx{declaration column attribute} \\
1481 \DWATdeclfile&0x3a&\livelink{chap:classconstant}{constant}
1482 \addtoindexx{declaration file attribute} \\
1483 \DWATdeclline&0x3b&\livelink{chap:classconstant}{constant}
1484 \addtoindexx{declaration line attribute} \\
1485 \DWATdeclaration&0x3c&\livelink{chap:classflag}{flag}
1486 \addtoindexx{declaration attribute} \\
1487 \DWATdiscrlist&0x3d&\livelink{chap:classblock}{block}
1488 \addtoindexx{discriminant list attribute} \\
1489 \DWATencoding&0x3e&\livelink{chap:classconstant}{constant}
1490 \addtoindexx{encoding attribute} \\
1491 \DWATexternal&\xiiif&\livelink{chap:classflag}{flag}
1492 \addtoindexx{external attribute} \\
1493 \DWATframebase&0x40&\livelink{chap:classexprloc}{exprloc},
1494 \livelink{chap:classloclistptr}{loclistptr}
1495 \addtoindexx{frame base attribute} \\
1496 \DWATfriend&0x41&\livelink{chap:classreference}{reference}
1497 \addtoindexx{friend attribute} \\
1498 \DWATidentifiercase&0x42&\livelink{chap:classconstant}{constant}
1499 \addtoindexx{identifier case attribute} \\
1501 \textit{Reserved}&0x43\footnote{Code 0x43 is reserved to allow backward compatible support of the
1502 DW\_AT\_macro\_info \mbox{attribute} which was
1503 defined in \DWARFVersionIV{} and earlier.}
1505 &\livelink{chap:classmacptr}{macptr}
1506 \addtoindexx{macro information attribute (legacy)!encoding} \\
1507 \DWATnamelistitem&0x44&\livelink{chap:classreference}{reference}
1508 \addtoindexx{name list item attribute} \\
1509 \DWATpriority&0x45&\livelink{chap:classreference}{reference}
1510 \addtoindexx{priority attribute} \\
1511 \DWATsegment&0x46&\livelink{chap:classexprloc}{exprloc},
1512 \livelink{chap:classloclistptr}{loclistptr}
1513 \addtoindexx{segment attribute} \\
1514 \DWATspecification&0x47&\livelink{chap:classreference}{reference}
1515 \addtoindexx{specification attribute} \\
1516 \DWATstaticlink&0x48&\livelink{chap:classexprloc}{exprloc},
1517 \livelink{chap:classloclistptr}{loclistptr}
1518 \addtoindexx{static link attribute} \\
1519 \DWATtype&0x49&\livelink{chap:classreference}{reference}
1520 \addtoindexx{type attribute} \\
1521 \DWATuselocation&0x4a&\livelink{chap:classexprloc}{exprloc},
1522 \livelink{chap:classloclistptr}{loclistptr}
1523 \addtoindexx{location list attribute} \\
1524 \DWATvariableparameter&0x4b&\livelink{chap:classflag}{flag}
1525 \addtoindexx{variable parameter attribute} \\
1526 \DWATvirtuality&0x4c&\livelink{chap:classconstant}{constant}
1527 \addtoindexx{virtuality attribute} \\
1528 \DWATvtableelemlocation&0x4d&\livelink{chap:classexprloc}{exprloc},
1529 \livelink{chap:classloclistptr}{loclistptr}
1530 \addtoindexx{vtable element location attribute} \\
1531 \DWATallocated&0x4e&\livelink{chap:classconstant}{constant},
1532 \livelink{chap:classexprloc}{exprloc},
1533 \livelink{chap:classreference}{reference}
1534 \addtoindexx{allocated attribute} \\
1535 \DWATassociated&0x4f&\livelink{chap:classconstant}{constant},
1536 \livelink{chap:classexprloc}{exprloc},
1537 \livelink{chap:classreference}{reference}
1538 \addtoindexx{associated attribute} \\
1539 \DWATdatalocation&0x50&\livelink{chap:classexprloc}{exprloc}
1540 \addtoindexx{data location attribute} \\
1541 \DWATbytestride&0x51&\livelink{chap:classconstant}{constant},
1542 \livelink{chap:classexprloc}{exprloc},
1543 \livelink{chap:classreference}{reference}
1544 \addtoindexx{byte stride attribute} \\
1545 \DWATentrypc&0x52&\livelink{chap:classaddress}{address},
1546 \livelink{chap:classconstant}{constant}
1547 \addtoindexx{entry PC attribute} \\
1548 \DWATuseUTFeight&0x53&\livelink{chap:classflag}{flag}
1549 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8} \\
1550 \DWATextension&0x54&\livelink{chap:classreference}{reference}
1551 \addtoindexx{extension attribute} \\
1552 \DWATranges&0x55&\livelink{chap:classrangelistptr}{rangelistptr}
1553 \addtoindexx{ranges attribute} \\
1554 \DWATtrampoline&0x56&\livelink{chap:classaddress}{address},
1555 \livelink{chap:classflag}{flag},
1556 \livelink{chap:classreference}{reference},
1557 \livelink{chap:classstring}{string}
1558 \addtoindexx{trampoline attribute} \\
1559 \DWATcallcolumn&0x57&\livelink{chap:classconstant}{constant}
1560 \addtoindexx{call column attribute} \\
1561 \DWATcallfile&0x58&\livelink{chap:classconstant}{constant}
1562 \addtoindexx{call file attribute} \\
1563 \DWATcallline&0x59&\livelink{chap:classconstant}{constant}
1564 \addtoindexx{call line attribute} \\
1565 \DWATdescription&0x5a&\livelink{chap:classstring}{string}
1566 \addtoindexx{description attribute} \\
1567 \DWATbinaryscale&0x5b&\livelink{chap:classconstant}{constant}
1568 \addtoindexx{binary scale attribute} \\
1569 \DWATdecimalscale&0x5c&\livelink{chap:classconstant}{constant}
1570 \addtoindexx{decimal scale attribute} \\
1571 \DWATsmall{} &0x5d&\livelink{chap:classreference}{reference}
1572 \addtoindexx{small attribute} \\
1573 \DWATdecimalsign&0x5e&\livelink{chap:classconstant}{constant}
1574 \addtoindexx{decimal scale attribute} \\
1575 \DWATdigitcount&0x5f&\livelink{chap:classconstant}{constant}
1576 \addtoindexx{digit count attribute} \\
1577 \DWATpicturestring&0x60&\livelink{chap:classstring}{string}
1578 \addtoindexx{picture string attribute} \\
1579 \DWATmutable&0x61&\livelink{chap:classflag}{flag}
1580 \addtoindexx{mutable attribute} \\
1581 \DWATthreadsscaled&0x62&\livelink{chap:classflag}{flag}
1582 \addtoindexx{thread scaled attribute} \\
1583 \DWATexplicit&0x63&\livelink{chap:classflag}{flag}
1584 \addtoindexx{explicit attribute} \\
1585 \DWATobjectpointer&0x64&\livelink{chap:classreference}{reference}
1586 \addtoindexx{object pointer attribute} \\
1587 \DWATendianity&0x65&\livelink{chap:classconstant}{constant}
1588 \addtoindexx{endianity attribute} \\
1589 \DWATelemental&0x66&\livelink{chap:classflag}{flag}
1590 \addtoindexx{elemental attribute} \\
1591 \DWATpure&0x67&\livelink{chap:classflag}{flag}
1592 \addtoindexx{pure attribute} \\
1593 \DWATrecursive&0x68&\livelink{chap:classflag}{flag}
1594 \addtoindexx{recursive attribute} \\
1595 \DWATsignature{} &0x69&\livelink{chap:classreference}{reference}
1596 \addtoindexx{signature attribute} \\
1597 \DWATmainsubprogram{} &0x6a&\livelink{chap:classflag}{flag}
1598 \addtoindexx{main subprogram attribute} \\
1599 \DWATdatabitoffset{} &0x6b&\livelink{chap:classconstant}{constant}
1600 \addtoindexx{data bit offset attribute} \\
1601 \DWATconstexpr{} &0x6c&\livelink{chap:classflag}{flag}
1602 \addtoindexx{constant expression attribute} \\
1603 \DWATenumclass{} &0x6d&\livelink{chap:classflag}{flag}
1604 \addtoindexx{enumeration class attribute} \\
1605 \DWATlinkagename{} &0x6e&\livelink{chap:classstring}{string}
1606 \addtoindexx{linkage name attribute} \\
1607 \DWATstringlengthbitsize{}~\ddag&0x6f&
1608 \livelink{chap:classconstant}{constant}
1609 \addtoindexx{string length attribute!size of length} \\
1610 \DWATstringlengthbytesize{}~\ddag&0x70&
1611 \livelink{chap:classconstant}{constant}
1612 \addtoindexx{string length attribute!size of length} \\
1613 \DWATrank~\ddag&0x71&
1614 \livelink{chap:classconstant}{constant},
1615 \livelink{chap:classexprloc}{exprloc}
1616 \addtoindexx{rank attribute} \\
1617 \DWATstroffsetsbase~\ddag&0x72&
1618 \livelinki{chap:classstroffsetsptr}{stroffsetsptr}{stroffsetsptr class}
1619 \addtoindexx{string offsets base!encoding} \\
1620 \DWATaddrbase~\ddag &0x73&
1621 \livelinki{chap:classaddrptr}{addrptr}{addrptr class}
1622 \addtoindexx{address table base!encoding} \\
1623 \DWATrangesbase~\ddag&0x74&
1624 \livelinki{chap:classrangelistptr}{rangelistptr}{rangelistptr class}
1625 \addtoindexx{ranges base!encoding} \\
1626 \DWATdwoid~\ddag &0x75&
1627 \livelink{chap:classconstant}{constant}
1628 \addtoindexx{split DWARF object file id!encoding} \\
1629 \DWATdwoname~\ddag &0x76&
1630 \livelink{chap:classstring}{string}
1631 \addtoindexx{split DWARF object file name!encoding} \\
1632 \DWATreference~\ddag &0x77&
1633 \livelink{chap:classflag}{flag} \\
1634 \DWATrvaluereference~\ddag &0x78&
1635 \livelink{chap:classflag}{flag} \\
1636 \DWATmacros~\ddag &0x79&\livelink{chap:classmacptr}{macptr}
1637 \addtoindexx{macro information attribute} \\
1638 \DWATcallallcalls~\ddag &0x7a&\CLASSflag
1639 \addtoindexx{all calls summary attribute} \\
1640 \DWATcallallsourcecalls~\ddag &0x7b &\CLASSflag
1641 \addtoindexx{all source calls summary attribute} \\
1642 \DWATcallalltailcalls~\ddag &0x7c&\CLASSflag
1643 \addtoindexx{all tail calls summary attribute} \\
1644 \DWATcallreturnpc~\ddag &0x7d &\CLASSaddress
1645 \addtoindexx{call return PC attribute} \\
1646 \DWATcallvalue~\ddag &0x7e &\CLASSexprloc
1647 \addtoindexx{call value attribute} \\
1648 \DWATcallorigin~\ddag &0x7f &\CLASSexprloc
1649 \addtoindexx{call origin attribute} \\
1650 \DWATcallparameter~\ddag &0x80 &\CLASSreference
1651 \addtoindexx{call parameter attribute} \\
1652 \DWATcallpc~\ddag &0x81 &\CLASSaddress
1653 \addtoindexx{call PC attribute} \\
1654 \DWATcalltailcall~\ddag &0x82 &\CLASSflag
1655 \addtoindexx{call tail call attribute} \\
1656 \DWATcalltarget~\ddag &0x83 &\CLASSexprloc
1657 \addtoindexx{call target attribute} \\
1658 \DWATcalltargetclobbered~\ddag &0x84 &\CLASSexprloc
1659 \addtoindexx{call target clobbered attribute} \\
1660 \DWATcalldatalocation~\ddag &0x85 &\CLASSexprloc
1661 \addtoindexx{call data location attribute} \\
1662 \DWATcalldatavalue~\ddag &0x86 &\CLASSexprloc
1663 \addtoindexx{call data value attribute} \\
1664 \DWATnoreturn~\ddag &0x87 &\CLASSflag
1665 \addtoindexx{noreturn attribute} \\
1666 \DWATalignment~\ddag &0x88 &\CLASSconstant
1667 \addtoindexx{alignment attribute} \\
1668 \DWATexportsymbols~\ddag &0x89 &\CLASSflag
1669 \addtoindexx{export symbols attribute} \\
1670 \DWATdeleted~\ddag &0x8a &\CLASSflag \addtoindexx{deleted attribute} \\
1671 \DWATdefaulted~\ddag &0x8b &\CLASSconstant \addtoindexx{defaulted attribute} \\
1672 \DWATlouser&0x2000 & --- \addtoindexx{low user attribute encoding} \\
1673 \DWAThiuser&\xiiifff& --- \addtoindexx{high user attribute encoding} \\
1678 The attribute form governs how the value of the attribute is
1679 encoded. There are nine classes of form, listed below. Each
1680 class is a set of forms which have related representations
1681 and which are given a common interpretation according to the
1682 attribute in which the form is used.
1684 Form \DWFORMsecoffsetTARG{}
1686 \addtoindexx{rangelistptr class}
1688 \addtoindexx{macptr class}
1690 \addtoindexx{loclistptr class}
1692 \addtoindexx{lineptr class}
1698 \CLASSrangelistptr{} or
1699 \CLASSstroffsetsptr;
1700 the list of classes allowed by the applicable attribute in
1701 Table \refersec{tab:attributeencodings}
1702 determines the class of the form.
1705 In the form descriptions that follow, some forms are said
1706 to depend in part on the value of an attribute of the
1707 \definition{\associatedcompilationunit}:
1710 In the case of a \splitDWARFobjectfile{}, the associated
1711 compilation unit is the skeleton compilation unit corresponding
1712 to the containing unit.
1713 \item Otherwise, the associated compilation unit
1714 is the containing unit.
1718 Each possible form belongs to one or more of the following classes
1719 (see Table \refersec{tab:classesofattributevalue} for a summary of
1720 the purpose and general usage of each class):
1723 \item \livelinki{chap:classaddress}{address}{address class} \\
1724 \livetarg{datarep:classaddress}{}
1725 Represented as either:
1727 \item An object of appropriate size to hold an
1728 address on the target machine
1730 The size is encoded in the compilation unit header
1731 (see Section \refersec{datarep:compilationunitheader}).
1732 This address is relocatable in a relocatable object file and
1733 is relocated in an executable file or shared object file.
1735 \item An indirect index into a table of addresses (as
1736 described in the previous bullet) in the
1737 \dotdebugaddr{} section (\DWFORMaddrxTARG).
1738 The representation of a \DWFORMaddrxNAME{} value is an unsigned
1739 \addtoindex{LEB128} value, which is interpreted as a zero-based
1740 index into an array of addresses in the \dotdebugaddr{} section.
1741 The index is relative to the value of the \DWATaddrbase{} attribute
1742 of the associated compilation unit.
1747 \item \livelink{chap:classaddrptr}{addrptr} \\
1748 \livetarg{datarep:classaddrptr}{}
1749 This is an offset into the \dotdebugaddr{} section (\DWFORMsecoffset). It
1750 consists of an offset from the beginning of the \dotdebugaddr{} section to the
1751 beginning of the list of machine addresses information for the
1752 referencing entity. It is relocatable in
1753 a relocatable object file, and relocated in an executable or
1754 shared object file. In the \thirtytwobitdwarfformat, this offset
1755 is a 4-byte unsigned value; in the 64-bit DWARF
1756 format, it is an 8-byte unsigned value (see Section
1757 \refersec{datarep:32bitand64bitdwarfformats}).
1759 \textit{This class is new in \DWARFVersionV.}
1762 \item \livelink{chap:classblock}{block} \\
1763 \livetarg{datarep:classblock}{}
1764 Blocks come in four forms:
1767 A 1-byte length followed by 0 to 255 contiguous information
1768 bytes (\DWFORMblockoneTARG).
1771 A 2-byte length followed by 0 to 65,535 contiguous information
1772 bytes (\DWFORMblocktwoTARG).
1775 A 4-byte length followed by 0 to 4,294,967,295 contiguous
1776 information bytes (\DWFORMblockfourTARG).
1779 An unsigned LEB128\addtoindexx{LEB128!unsigned}
1780 length followed by the number of bytes
1781 specified by the length (\DWFORMblockTARG).
1784 In all forms, the length is the number of information bytes
1785 that follow. The information bytes may contain any mixture
1786 of relocated (or relocatable) addresses, references to other
1787 debugging information entries or data bytes.
1789 \item \livelinki{chap:classconstant}{constant}{constant class} \\
1790 \livetarg{datarep:classconstant}{}
1791 There are eight forms of constants. There are fixed length
1792 constant data forms for one-, two-, four-, eight- and sixteen-byte values
1796 \DWFORMdatafourTARG,
1797 \DWFORMdataeightTARG{} and
1798 \DWFORMdatasixteenTARG).
1799 There are variable length constant
1800 data forms encoded using
1801 signed LEB128 numbers (\DWFORMsdataTARG) and unsigned
1802 LEB128 numbers (\DWFORMudataTARG).
1803 There is also an implicit constant (\DWFORMimplicitconst),
1804 whose value is provided as part of the abbreviation
1808 The data in \DWFORMdataone,
1811 \DWFORMdataeight{} and
1812 \DWFORMdatasixteen{}
1813 can be anything. Depending on context, it may
1814 be a signed integer, an unsigned integer, a floating\dash point
1815 constant, or anything else. A consumer must use context to
1816 know how to interpret the bits, which if they are target
1817 machine data (such as an integer or floating-point constant)
1818 will be in target machine \byteorder.
1820 \textit{If one of the \DWFORMdataTARG\textless n\textgreater
1821 forms is used to represent a
1822 signed or unsigned integer, it can be hard for a consumer
1823 to discover the context necessary to determine which
1824 interpretation is intended. Producers are therefore strongly
1825 encouraged to use \DWFORMsdata{} or
1826 \DWFORMudata{} for signed and
1827 unsigned integers respectively, rather than
1828 \DWFORMdata\textless n\textgreater.}
1831 \item \livelinki{chap:classexprloc}{exprloc}{exprloc class} \\
1832 \livetarg{datarep:classexprloc}{}
1833 This is an unsigned LEB128\addtoindexx{LEB128!unsigned} length followed by the
1834 number of information bytes specified by the length
1835 (\DWFORMexprlocTARG).
1836 The information bytes contain a DWARF expression
1837 (see Section \refersec{chap:dwarfexpressions})
1838 or location description
1839 (see Section \refersec{chap:locationdescriptions}).
1842 \item \livelinki{chap:classflag}{flag}{flag class} \\
1843 \livetarg{datarep:classflag}{}
1844 A flag \addtoindexx{flag class}
1845 is represented explicitly as a single byte of data
1846 (\DWFORMflagTARG) or
1847 implicitly (\DWFORMflagpresentTARG).
1849 first case, if the \nolink{flag} has value zero, it indicates the
1850 absence of the attribute; if the \nolink{flag} has a non-zero value,
1851 it indicates the presence of the attribute. In the second
1852 case, the attribute is implicitly indicated as present, and
1853 no value is encoded in the debugging information entry itself.
1855 \item \livelinki{chap:classlineptr}{lineptr}{lineptr class} \\
1856 \livetarg{datarep:classlineptr}{}
1857 This is an offset into
1858 \addtoindexx{section offset!in class lineptr value}
1860 \dotdebugline{} or \dotdebuglinedwo{} section
1862 It consists of an offset from the beginning of the
1864 section to the first byte of
1865 the data making up the line number list for the compilation
1867 It is relocatable in a relocatable object file, and
1868 relocated in an executable or shared object file. In the
1869 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
1870 in the \sixtyfourbitdwarfformat, it is an 8-byte unsigned value
1871 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1874 \item \livelinki{chap:classloclistptr}{loclistptr}{loclistptr class} \\
1875 \livetarg{datarep:classloclistptr}{}
1876 This is an offset into the
1880 It consists of an offset from the
1881 \addtoindexx{section offset!in class loclistptr value}
1884 section to the first byte of
1885 the data making up the
1886 \addtoindex{location list} for the compilation unit.
1887 It is relocatable in a relocatable object file, and
1888 relocated in an executable or shared object file. In the
1889 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
1890 in the \sixtyfourbitdwarfformat, it is an 8-byte unsigned value
1891 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1894 \item \livelinki{chap:classmacptr}{macptr}{macptr class} \\
1895 \livetarg{datarep:classmacptr}{}
1897 \addtoindexx{section offset!in class macptr value}
1899 \dotdebugmacro{} or \dotdebugmacrodwo{} section
1901 It consists of an offset from the beginning of the
1902 \dotdebugmacro{} or \dotdebugmacrodwo{}
1903 section to the the header making up the
1904 macro information list for the compilation unit.
1905 It is relocatable in a relocatable object file, and
1906 relocated in an executable or shared object file. In the
1907 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
1908 in the \sixtyfourbitdwarfformat, it is an 8-byte unsigned value
1909 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1912 \item \livelinki{chap:classrangelistptr}{rangelistptr}{rangelistptr class} \\
1913 \livetarg{datarep:classrangelistptr}{}
1915 \addtoindexx{section offset!in class rangelistptr value}
1916 offset into the \dotdebugranges{} section
1919 offset from the beginning of the
1920 \dotdebugranges{} section
1921 to the beginning of the non-contiguous address ranges
1922 information for the referencing entity.
1923 It is relocatable in
1924 a relocatable object file, and relocated in an executable or
1926 However, if a \DWATrangesbase{} attribute applies, the offset
1927 is relative to the base offset given by \DWATrangesbase.
1928 In the \thirtytwobitdwarfformat, this offset
1929 is a 4-byte unsigned value; in the 64-bit DWARF
1930 format, it is an 8-byte unsigned value (see Section
1931 \refersec{datarep:32bitand64bitdwarfformats}).
1934 \textit{Because classes
1939 \CLASSrangelistptr{} and
1940 \CLASSstroffsetsptr{}
1941 share a common representation, it is not possible for an
1942 attribute to allow more than one of these classes}
1946 \item \livelinki{chap:classreference}{reference}{reference class} \\
1947 \livetarg{datarep:classreference}{}
1948 There are four types of reference.
1951 \addtoindexx{reference class}
1952 first type of reference can identify any debugging
1953 information entry within the containing unit.
1956 \addtoindexx{section offset!in class reference value}
1957 offset from the first byte of the compilation
1958 header for the compilation unit containing the reference. There
1959 are five forms for this type of reference. There are fixed
1960 length forms for one, two, four and eight byte offsets
1966 and \DWFORMrefeightTARG).
1967 There is also an unsigned variable
1968 length offset encoded form that uses
1969 unsigned LEB128\addtoindexx{LEB128!unsigned} numbers
1970 (\DWFORMrefudataTARG).
1971 Because this type of reference is within
1972 the containing compilation unit no relocation of the value
1975 The second type of reference can identify any debugging
1976 information entry within a
1977 \dotdebuginfo{} section; in particular,
1978 it may refer to an entry in a different compilation unit
1979 from the unit containing the reference, and may refer to an
1980 entry in a different shared object file. This type of reference
1981 (\DWFORMrefaddrTARG)
1982 is an offset from the beginning of the
1984 section of the target executable or shared object file, or, for
1985 references within a \addtoindex{supplementary object file},
1986 an offset from the beginning of the local \dotdebuginfo{} section;
1987 it is relocatable in a relocatable object file and frequently
1988 relocated in an executable or shared object file. For
1989 references from one shared object or static executable file
1990 to another, the relocation and identification of the target
1991 object must be performed by the consumer. In the
1992 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
1993 in the \sixtyfourbitdwarfformat, it is an 8-byte
1995 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1997 \textit{A debugging information entry that may be referenced by
1998 another compilation unit using
1999 \DWFORMrefaddr{} must have a global symbolic name.}
2001 \textit{For a reference from one executable or shared object file to
2002 another, the reference is resolved by the debugger to identify
2003 the executable or shared object file and the offset into that
2004 file\textquoteright s \dotdebuginfo{}
2005 section in the same fashion as the run
2006 time loader, either when the debug information is first read,
2007 or when the reference is used.}
2009 The third type of reference can identify any debugging
2010 information type entry that has been placed in its own
2011 \addtoindex{type unit}. This type of
2012 reference (\DWFORMrefsigeightTARG) is the
2013 \addtoindexx{type signature}
2014 8-byte type signature
2015 (see Section \refersec{datarep:typesignaturecomputation})
2016 that was computed for the type.
2018 The fourth type of reference is a reference from within the
2019 \dotdebuginfo{} section of the executable or shared object file to
2020 a debugging information entry in the \dotdebuginfo{} section of
2021 a \addtoindex{supplementary object file}.
2022 This type of reference (\DWFORMrefsupTARG) is an offset from the
2023 beginning of the \dotdebuginfo{} section in the
2024 \addtoindex{supplementary object file}.
2026 \textit{The use of compilation unit relative references will reduce the
2027 number of link\dash time relocations and so speed up linking. The
2028 use of the second, third and fourth type of reference allows for the
2029 sharing of information, such as types, across compilation
2030 units, while the fourth type further allows for sharing of information
2031 across compilation units from different executables or shared object files.}
2033 \textit{A reference to any kind of compilation unit identifies the
2034 debugging information entry for that unit, not the preceding
2038 \item \livelinki{chap:classstring}{string}{string class} \\
2039 \livetarg{datarep:classstring}{}
2040 A string is a sequence of contiguous non\dash null bytes followed by
2042 \addtoindexx{string class}
2043 A string may be represented:
2045 \setlength{\itemsep}{0em}
2046 \item immediately in the debugging information entry itself
2047 (\DWFORMstringTARG),
2050 \addtoindexx{section offset!in class string value}
2051 offset into a string table contained in
2052 the \dotdebugstr{} section of the object file (\DWFORMstrpTARG),
2053 the \dotdebuglinestr{} section of the object file (\DWFORMlinestrpTARG),
2054 or as an offset into a string table contained in the
2055 \dotdebugstr{} section of a \addtoindex{supplementary object file}
2056 (\DWFORMstrpsupTARG). \DWFORMstrpsupNAME{} offsets from the \dotdebuginfo{}
2057 section of a \addtoindex{supplementary object file}
2058 refer to the local \dotdebugstr{} section of that same file.
2059 In the \thirtytwobitdwarfformat, the representation of a
2060 \DWFORMstrpNAME{}, \DWFORMstrpNAME{} or \DWFORMstrpsupNAME{}
2061 value is a 4-byte unsigned offset; in the \sixtyfourbitdwarfformat,
2062 it is an 8-byte unsigned offset
2063 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
2066 \item as an indirect offset into the string table using an
2067 index into a table of offsets contained in the
2068 \dotdebugstroffsets{} section of the object file (\DWFORMstrxTARG).
2069 The representation of a \DWFORMstrxNAME{} value is an unsigned
2070 \addtoindex{LEB128} value, which is interpreted as a zero-based
2071 index into an array of offsets in the \dotdebugstroffsets{} section.
2072 The offset entries in the \dotdebugstroffsets{} section have the
2073 same representation as \DWFORMstrp{} values.
2075 Any combination of these three forms may be used within a single compilation.
2077 If the \DWATuseUTFeight{}
2078 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8} attribute is specified for the
2079 compilation, partial, skeleton or type unit entry, string values are encoded using the
2080 UTF\dash 8 (\addtoindex{Unicode} Transformation Format\dash 8) from the Universal
2081 Character Set standard (ISO/IEC 10646\dash 1:1993).
2082 \addtoindexx{ISO 10646 character set standard}
2083 Otherwise, the string representation is unspecified.
2085 \textit{The \addtoindex{Unicode} Standard Version 3 is fully compatible with
2086 ISO/IEC 10646\dash 1:1993.
2087 \addtoindexx{ISO 10646 character set standard}
2088 It contains all the same characters
2089 and encoding points as ISO/IEC 10646, as well as additional
2090 information about the characters and their use.}
2092 \textit{Earlier versions of DWARF did not specify the representation
2093 of strings; for compatibility, this version also does
2094 not. However, the UTF\dash 8 representation is strongly recommended.}
2097 \item \livelinki{chap:classstroffsetsptr}{stroffsetsptr}{stroffsetsptr class} \\
2098 \livetarg{datarep:classstroffsetsptr}{}
2099 This is an offset into the \dotdebugstroffsets{} section
2100 (\DWFORMsecoffset). It consists of an offset from the beginning of the
2101 \dotdebugstroffsets{} section to the
2102 beginning of the string offsets information for the
2103 referencing entity. It is relocatable in
2104 a relocatable object file, and relocated in an executable or
2105 shared object file. In the \thirtytwobitdwarfformat, this offset
2106 is a 4-byte unsigned value; in the \sixtyfourbitdwarfformat,
2107 it is an 8-byte unsigned value (see Section
2108 \refersec{datarep:32bitand64bitdwarfformats}).
2110 \textit{This class is new in \DWARFVersionV.}
2114 In no case does an attribute use one of the classes
2119 \CLASSrangelistptr{} or
2120 \CLASSstroffsetsptr{}
2121 to point into either the
2122 \dotdebuginfo{} or \dotdebugstr{} section.
2124 The form encodings are listed in
2125 Table \referfol{tab:attributeformencodings}.
2129 \setlength{\extrarowheight}{0.1cm}
2130 \begin{longtable}{l|c|l}
2131 \caption{Attribute form encodings} \label{tab:attributeformencodings} \\
2132 \hline \bfseries Form name&\bfseries Value &\bfseries Classes \\ \hline
2134 \bfseries Form name&\bfseries Value &\bfseries Classes\\ \hline
2136 \hline \emph{Continued on next page}
2138 \hline \ddag\ \textit{New in DWARF Version 5}
2141 \DWFORMaddr &0x01&\livelink{chap:classaddress}{address} \\
2142 \textit{Reserved} &0x02& \\
2143 \DWFORMblocktwo &0x03&\livelink{chap:classblock}{block} \\
2144 \DWFORMblockfour &0x04&\livelink{chap:classblock}{block} \\
2145 \DWFORMdatatwo &0x05&\livelink{chap:classconstant}{constant} \\
2146 \DWFORMdatafour &0x06&\livelink{chap:classconstant}{constant} \\
2147 \DWFORMdataeight &0x07&\livelink{chap:classconstant}{constant} \\
2148 \DWFORMstring&0x08&\livelink{chap:classstring}{string} \\
2149 \DWFORMblock&0x09&\livelink{chap:classblock}{block} \\
2150 \DWFORMblockone &0x0a&\livelink{chap:classblock}{block} \\
2151 \DWFORMdataone &0x0b&\livelink{chap:classconstant}{constant} \\
2152 \DWFORMflag&0x0c&\livelink{chap:classflag}{flag} \\
2153 \DWFORMsdata&0x0d&\livelink{chap:classconstant}{constant} \\
2154 \DWFORMstrp&0x0e&\livelink{chap:classstring}{string} \\
2155 \DWFORMudata&0x0f&\livelink{chap:classconstant}{constant} \\
2156 \DWFORMrefaddr&0x10&\livelink{chap:classreference}{reference} \\
2157 \DWFORMrefone&0x11&\livelink{chap:classreference}{reference} \\
2158 \DWFORMreftwo&0x12&\livelink{chap:classreference}{reference} \\
2159 \DWFORMreffour&0x13&\livelink{chap:classreference}{reference} \\
2160 \DWFORMrefeight&0x14&\livelink{chap:classreference}{reference} \\
2161 \DWFORMrefudata&0x15&\livelink{chap:classreference}{reference} \\
2162 \DWFORMindirect&0x16&(see Section \refersec{datarep:abbreviationstables}) \\
2163 \DWFORMsecoffset{} &0x17& \CLASSaddrptr, \CLASSlineptr, \CLASSloclistptr, \\
2164 & & \CLASSmacptr, \CLASSrangelistptr, \CLASSstroffsetsptr \\
2165 \DWFORMexprloc{} &0x18&\livelink{chap:classexprloc}{exprloc} \\
2166 \DWFORMflagpresent{} &0x19&\livelink{chap:classflag}{flag} \\
2167 \DWFORMstrx{} \ddag &0x1a&\livelink{chap:classstring}{string} \\
2168 \DWFORMaddrx{} \ddag &0x1b&\livelink{chap:classaddress}{address} \\
2169 \DWFORMrefsup{}~\ddag &0x1c &\livelink{chap:classreference}{reference} \\
2170 \DWFORMstrpsup{}~\ddag &0x1d &\livelink{chap:classstring}{string} \\
2171 \DWFORMdatasixteen~\ddag &0x1e &\CLASSconstant \\
2172 \DWFORMlinestrp~\ddag &0x1f &\CLASSstring \\
2173 \DWFORMrefsigeight &0x20 &\livelink{chap:classreference}{reference} \\
2174 \DWFORMimplicitconst~\ddag &0x21 &\CLASSconstant \\
2180 \section{Variable Length Data}
2181 \label{datarep:variablelengthdata}
2182 \addtoindexx{variable length data|see {LEB128}}
2184 \addtoindexx{Little-Endian Base 128|see{LEB128}}
2185 encoded using \doublequote{Little-Endian Base 128}
2186 \addtoindexx{little-endian encoding|see{endian attribute}}
2188 \addtoindexx{LEB128}
2189 LEB128 is a scheme for encoding integers
2190 densely that exploits the assumption that most integers are
2193 \textit{This encoding is equally suitable whether the target machine
2194 architecture represents data in big-endian or little-endian
2195 \byteorder. It is \doublequote{little-endian} only in the sense that it
2196 avoids using space to represent the \doublequote{big} end of an
2197 unsigned integer, when the big end is all zeroes or sign
2200 Unsigned LEB128\addtoindexx{LEB128!unsigned} (\addtoindex{ULEB128})
2201 numbers are encoded as follows:
2202 \addtoindexx{LEB128!unsigned, encoding as}
2203 start at the low order end of an unsigned integer and chop
2204 it into 7-bit chunks. Place each chunk into the low order 7
2205 bits of a byte. Typically, several of the high order bytes
2206 will be zero; discard them. Emit the remaining bytes in a
2207 stream, starting with the low order byte; set the high order
2208 bit on each byte except the last emitted byte. The high bit
2209 of zero on the last byte indicates to the decoder that it
2210 has encountered the last byte.
2212 The integer zero is a special case, consisting of a single
2215 Table \refersec{tab:examplesofunsignedleb128encodings}
2216 gives some examples of unsigned LEB128\addtoindexx{LEB128!unsigned}
2218 0x80 in each case is the high order bit of the byte, indicating
2219 that an additional byte follows.
2222 The encoding for signed, two\textquoteright{s} complement LEB128
2223 (\addtoindex{SLEB128}) \addtoindexx{LEB128!signed, encoding as}
2224 numbers is similar, except that the criterion for discarding
2225 high order bytes is not whether they are zero, but whether
2226 they consist entirely of sign extension bits. Consider the
2227 4-byte integer -2. The three high level bytes of the number
2228 are sign extension, thus LEB128 would represent it as a single
2229 byte containing the low order 7 bits, with the high order
2230 bit cleared to indicate the end of the byte stream. Note
2231 that there is nothing within the LEB128 representation that
2232 indicates whether an encoded number is signed or unsigned. The
2233 decoder must know what type of number to expect.
2234 Table \refersec{tab:examplesofunsignedleb128encodings}
2235 gives some examples of unsigned LEB128\addtoindexx{LEB128!unsigned}
2236 numbers and Table \refersec{tab:examplesofsignedleb128encodings}
2237 gives some examples of signed LEB128\addtoindexx{LEB128!signed}
2240 \textit{Appendix \refersec{app:variablelengthdataencodingdecodinginformative}
2241 \addtoindexx{LEB128!examples}
2242 gives algorithms for encoding and decoding these forms.}
2246 \setlength{\extrarowheight}{0.1cm}
2247 \begin{longtable}{c|c|c}
2248 \caption{Examples of unsigned LEB128 encodings}
2249 \label{tab:examplesofunsignedleb128encodings}
2250 \addtoindexx{LEB128 encoding!examples}\addtoindexx{LEB128!unsigned} \\
2251 \hline \bfseries Number&\bfseries First byte &\bfseries Second byte \\ \hline
2253 \bfseries Number&\bfseries First Byte &\bfseries Second byte\\ \hline
2255 \hline \emph{Continued on next page}
2261 128& 0 + 0x80 & 1 \\
2262 129& 1 + 0x80 & 1 \\
2263 %130& 2 + 0x80 & 1 \\
2264 12857& 57 + 0x80 & 100 \\
2271 \setlength{\extrarowheight}{0.1cm}
2272 \begin{longtable}{c|c|c}
2273 \caption{Examples of signed LEB128 encodings}
2274 \label{tab:examplesofsignedleb128encodings}
2275 \addtoindexx{LEB128!signed} \\
2276 \hline \bfseries Number&\bfseries First byte &\bfseries Second byte \\ \hline
2278 \bfseries Number&\bfseries First Byte &\bfseries Second byte\\ \hline
2280 \hline \emph{Continued on next page}
2286 127& 127 + 0x80 & 0 \\
2287 -127& 1 + 0x80 & 0x7f \\
2288 128& 0 + 0x80 & 1 \\
2289 -128& 0 + 0x80 & 0x7f \\
2290 129& 1 + 0x80 & 1 \\
2291 -129& 0x7f + 0x80 & 0x7e \\
2298 \section{DWARF Expressions and Location Descriptions}
2299 \label{datarep:dwarfexpressionsandlocationdescriptions}
2300 \subsection{DWARF Expressions}
2301 \label{datarep:dwarfexpressions}
2304 \addtoindexx{DWARF expression!operator encoding}
2305 DWARF expression is stored in a \nolink{block} of contiguous
2306 bytes. The bytes form a sequence of operations. Each operation
2307 is a 1-byte code that identifies that operation, followed by
2308 zero or more bytes of additional data. The encodings for the
2309 operations are described in
2310 Table \refersec{tab:dwarfoperationencodings}.
2313 \setlength{\extrarowheight}{0.1cm}
2314 \begin{longtable}{l|c|c|l}
2315 \caption{DWARF operation encodings} \label{tab:dwarfoperationencodings} \\
2316 \hline & &\bfseries No. of &\\
2317 \bfseries Operation&\bfseries Code &\bfseries Operands &\bfseries Notes\\ \hline
2319 & &\bfseries No. of &\\
2320 \bfseries Operation&\bfseries Code &\bfseries Operands &\bfseries Notes\\ \hline
2322 \hline \emph{Continued on next page}
2324 \hline \ddag\ \textit{New in DWARF Version 5}
2327 \DWOPaddr&0x03&1 & constant address \\
2328 & & &(size is target specific) \\
2330 \DWOPderef&0x06&0 & \\
2332 \DWOPconstoneu&0x08&1&1-byte constant \\
2333 \DWOPconstones&0x09&1&1-byte constant \\
2334 \DWOPconsttwou&0x0a&1&2-byte constant \\
2335 \DWOPconsttwos&0x0b&1&2-byte constant \\
2336 \DWOPconstfouru&0x0c&1&4-byte constant \\
2337 \DWOPconstfours&0x0d&1&4-byte constant \\
2338 \DWOPconsteightu&0x0e&1&8-byte constant \\
2339 \DWOPconsteights&0x0f&1&8-byte constant \\
2340 \DWOPconstu&0x10&1&ULEB128 constant \\
2341 \DWOPconsts&0x11&1&SLEB128 constant \\
2342 \DWOPdup&0x12&0 & \\
2343 \DWOPdrop&0x13&0 & \\
2344 \DWOPover&0x14&0 & \\
2345 \DWOPpick&0x15&1&1-byte stack index \\
2346 \DWOPswap&0x16&0 & \\
2347 \DWOProt&0x17&0 & \\
2348 \DWOPxderef&0x18&0 & \\
2349 \DWOPabs&0x19&0 & \\
2350 \DWOPand&0x1a&0 & \\
2351 \DWOPdiv&0x1b&0 & \\
2352 \DWOPminus&0x1c&0 & \\
2353 \DWOPmod&0x1d&0 & \\
2354 \DWOPmul&0x1e&0 & \\
2355 \DWOPneg&0x1f&0 & \\
2356 \DWOPnot&0x20&0 & \\
2358 \DWOPplus&0x22&0 & \\
2359 \DWOPplusuconst&0x23&1&ULEB128 addend \\
2360 \DWOPshl&0x24&0 & \\
2361 \DWOPshr&0x25&0 & \\
2362 \DWOPshra&0x26&0 & \\
2363 \DWOPxor&0x27&0 & \\
2365 \DWOPbra&0x28&1 & signed 2-byte constant \\
2372 \DWOPskip&0x2f&1&signed 2-byte constant \\ \hline
2374 \DWOPlitzero & 0x30 & 0 & \\
2375 \DWOPlitone & 0x31 & 0& literals 0 .. 31 = \\
2376 \ldots & & &\hspace{0.3cm}(\DWOPlitzero{} + literal) \\
2377 \DWOPlitthirtyone & 0x4f & 0 & \\ \hline
2379 \DWOPregzero & 0x50 & 0 & \\*
2380 \DWOPregone & 0x51 & 0® 0 .. 31 = \\*
2381 \ldots & & &\hspace{0.3cm}(\DWOPregzero{} + regnum) \\*
2382 \DWOPregthirtyone & 0x6f & 0 & \\ \hline
2384 \DWOPbregzero & 0x70 &1 & SLEB128 offset \\*
2385 \DWOPbregone & 0x71 & 1 &base register 0 .. 31 = \\*
2386 ... & & &\hspace{0.3cm}(\DWOPbregzero{} + regnum) \\*
2387 \DWOPbregthirtyone & 0x8f & 1 & \\ \hline
2389 \DWOPregx{} & 0x90 &1&ULEB128 register \\
2390 \DWOPfbreg{} & 0x91&1&SLEB128 offset \\
2391 \DWOPbregx{} & 0x92&2 &ULEB128 register, \\*
2392 & & &SLEB128 offset \\
2393 \DWOPpiece{} & 0x93 &1& ULEB128 size of piece \\
2394 \DWOPderefsize{} & 0x94 &1& 1-byte size of data retrieved \\
2395 \DWOPxderefsize{} & 0x95&1&1-byte size of data retrieved \\
2396 \DWOPnop{} & 0x96 &0& \\
2398 \DWOPpushobjectaddress&0x97&0 & \\
2399 \DWOPcalltwo&0x98&1& 2-byte offset of DIE \\
2400 \DWOPcallfour&0x99&1& 4-byte offset of DIE \\
2401 \DWOPcallref&0x9a&1& 4\dash\ or 8-byte offset of DIE \\
2402 \DWOPformtlsaddress&0x9b &0& \\
2403 \DWOPcallframecfa{} &0x9c &0& \\
2404 \DWOPbitpiece&0x9d &2&ULEB128 size, \\*
2406 \DWOPimplicitvalue{} &0x9e &2&ULEB128 size, \\*
2407 &&&\nolink{block} of that size\\
2408 \DWOPstackvalue{} &0x9f &0& \\
2409 \DWOPimplicitpointer{}~\ddag &0xa0& 2 &4- or 8-byte offset of DIE, \\*
2410 &&&SLEB128 constant offset \\
2411 \DWOPaddrx~\ddag&0xa1&1&ULEB128 indirect address \\
2412 \DWOPconstx~\ddag&0xa2&1&ULEB128 indirect constant \\
2413 \DWOPentryvalue~\ddag&0xa3&2&ULEB128 size, \\*
2414 &&&\nolink{block} of that size\\
2415 \DWOPconsttype~\ddag & 0xa4 & 3 & ULEB128 type entry offset,\\*
2416 & & & 1-byte size, \\*
2417 & & & constant value \\
2418 \DWOPregvaltype~\ddag & 0xa5 & 2 & ULEB128 register number, \\*
2419 &&& ULEB128 constant offset \\
2420 \DWOPdereftype~\ddag & 0xa6 & 2 & 1-byte size, \\*
2421 &&& ULEB128 type entry offset \\
2422 \DWOPxdereftype~\ddag & 0xa7 & 2 & 1-byte size, \\*
2423 &&& ULEB128 type entry offset \\
2424 \DWOPconvert~\ddag & 0xa8 & 1 & ULEB128 type entry offset \\
2425 \DWOPreinterpret~\ddag & 0xa9 & 1 & ULEB128 type entry offset \\
2426 \DWOPlouser{} &0xe0 && \\
2427 \DWOPhiuser{} &\xff && \\
2433 \subsection{Location Descriptions}
2434 \label{datarep:locationdescriptions}
2436 A location description is used to compute the
2437 location of a variable or other entity.
2439 \subsection{Location Lists}
2440 \label{datarep:locationlists}
2442 Each entry in a \addtoindex{location list} is either a location list entry,
2443 a base address selection entry, or an
2444 \addtoindexx{end-of-list entry!in location list}
2448 \subsubsection{Location List Entries in Non-Split Objects}
2449 A \addtoindex{location list} entry consists of two address offsets followed
2450 by an unsigned 2-byte length, followed by a block of contiguous bytes
2451 that contains a DWARF location description. The length
2452 specifies the number of bytes in that block. The two offsets
2453 are the same size as an address on the target machine.
2456 A base address selection entry and an
2457 \addtoindexx{end-of-list entry!in location list}
2458 end-of-list entry each
2459 consist of two (constant or relocated) address offsets. The two
2460 offsets are the same size as an address on the target machine.
2462 For a \addtoindex{location list} to be specified, the base address of
2463 \addtoindexx{base address selection entry!in location list}
2464 the corresponding compilation unit must be defined
2465 (see Section \refersec{chap:fullandpartialcompilationunitentries}).
2467 \subsubsection{Location List Entries in Split Objects}
2468 \label{datarep:locationlistentriesinsplitobjects}
2469 An alternate form for location list entries is used in split objects.
2470 Each entry begins with an unsigned 1-byte code that indicates the kind of entry
2471 that follows. The encodings for these constants are given in
2472 Table \refersec{tab:locationlistentryencodingvalues}.
2476 \setlength{\extrarowheight}{0.1cm}
2477 \begin{longtable}{l|c}
2478 \caption{Location list entry encoding values} \label{tab:locationlistentryencodingvalues} \\
2479 \hline \bfseries Location list entry encoding name&\bfseries Value \\ \hline
2481 \bfseries Location list entry encoding name&\bfseries Value\\ \hline
2483 \hline \emph{Continued on next page}
2487 \DWLLEendoflistentry & 0x0 \\
2488 \DWLLEbaseaddressselectionentry & 0x01 \\
2489 \DWLLEstartendentry & 0x02 \\
2490 \DWLLEstartlengthentry & 0x03 \\
2491 \DWLLEoffsetpairentry & 0x04 \\
2495 \section{Base Type Attribute Encodings}
2496 \label{datarep:basetypeattributeencodings}
2498 The\hypertarget{chap:DWATencodingencodingofbasetype}{}
2499 encodings of the constants used in the
2500 \DWATencodingDEFN{} attribute\addtoindexx{encoding attribute}
2502 Table \refersec{tab:basetypeencodingvalues}
2505 \setlength{\extrarowheight}{0.1cm}
2506 \begin{longtable}{l|c}
2507 \caption{Base type encoding values} \label{tab:basetypeencodingvalues} \\
2508 \hline \bfseries Base type encoding name&\bfseries Value \\ \hline
2510 \bfseries Base type encoding name&\bfseries Value\\ \hline
2512 \hline \emph{Continued on next page}
2515 \ddag \ \textit{New in \DWARFVersionV}
2517 \DWATEaddress&0x01 \\
2518 \DWATEboolean&0x02 \\
2519 \DWATEcomplexfloat&0x03 \\
2521 \DWATEsigned&0x05 \\
2522 \DWATEsignedchar&0x06 \\
2523 \DWATEunsigned&0x07 \\
2524 \DWATEunsignedchar&0x08 \\
2525 \DWATEimaginaryfloat&0x09 \\
2526 \DWATEpackeddecimal&0x0a \\
2527 \DWATEnumericstring&0x0b \\
2528 \DWATEedited&0x0c \\
2529 \DWATEsignedfixed&0x0d \\
2530 \DWATEunsignedfixed&0x0e \\
2531 \DWATEdecimalfloat & 0x0f \\
2532 \DWATEUTF{} & 0x10 \\
2533 \DWATEUCS~\ddag & 0x11 \\
2534 \DWATEASCII~\ddag & 0x12 \\
2535 \DWATElouser{} & 0x80 \\
2536 \DWATEhiuser{} & \xff \\
2541 The encodings of the constants used in the
2542 \DWATdecimalsign{} attribute
2544 Table \refersec{tab:decimalsignencodings}.
2547 \setlength{\extrarowheight}{0.1cm}
2548 \begin{longtable}{l|c}
2549 \caption{Decimal sign encodings} \label{tab:decimalsignencodings} \\
2550 \hline \bfseries Decimal sign code name&\bfseries Value \\ \hline
2552 \bfseries Decimal sign code name&\bfseries Value\\ \hline
2554 % \hline \emph{Continued on next page}
2558 \DWDSunsigned{} & 0x01 \\
2559 \DWDSleadingoverpunch{} & 0x02 \\
2560 \DWDStrailingoverpunch{} & 0x03 \\
2561 \DWDSleadingseparate{} & 0x04 \\
2562 \DWDStrailingseparate{} & 0x05 \\
2567 The encodings of the constants used in the
2568 \DWATendianity{} attribute are given in
2569 Table \refersec{tab:endianityencodings}.
2572 \setlength{\extrarowheight}{0.1cm}
2573 \begin{longtable}{l|c}
2574 \caption{Endianity encodings} \label{tab:endianityencodings}\\
2575 \hline \bfseries Endian code name&\bfseries Value \\ \hline
2577 \bfseries Endian code name&\bfseries Value\\ \hline
2579 \hline \emph{Continued on next page}
2584 \DWENDdefault{} & 0x00 \\
2585 \DWENDbig{} & 0x01 \\
2586 \DWENDlittle{} & 0x02 \\
2587 \DWENDlouser{} & 0x40 \\
2588 \DWENDhiuser{} & \xff \\
2594 \section{Accessibility Codes}
2595 \label{datarep:accessibilitycodes}
2596 The encodings of the constants used in the
2597 \DWATaccessibility{}
2599 \addtoindexx{accessibility attribute}
2601 Table \refersec{tab:accessibilityencodings}.
2604 \setlength{\extrarowheight}{0.1cm}
2605 \begin{longtable}{l|c}
2606 \caption{Accessibility encodings} \label{tab:accessibilityencodings}\\
2607 \hline \bfseries Accessibility code name&\bfseries Value \\ \hline
2609 \bfseries Accessibility code name&\bfseries Value\\ \hline
2611 \hline \emph{Continued on next page}
2616 \DWACCESSpublic&0x01 \\
2617 \DWACCESSprotected&0x02 \\
2618 \DWACCESSprivate&0x03 \\
2624 \section{Visibility Codes}
2625 \label{datarep:visibilitycodes}
2626 The encodings of the constants used in the
2627 \DWATvisibility{} attribute are given in
2628 Table \refersec{tab:visibilityencodings}.
2631 \setlength{\extrarowheight}{0.1cm}
2632 \begin{longtable}{l|c}
2633 \caption{Visibility encodings} \label{tab:visibilityencodings}\\
2634 \hline \bfseries Visibility code name&\bfseries Value \\ \hline
2636 \bfseries Visibility code name&\bfseries Value\\ \hline
2638 \hline \emph{Continued on next page}
2644 \DWVISexported&0x02 \\
2645 \DWVISqualified&0x03 \\
2650 \section{Virtuality Codes}
2651 \label{datarep:vitualitycodes}
2653 The encodings of the constants used in the
2654 \DWATvirtuality{} attribute are given in
2655 Table \refersec{tab:virtualityencodings}.
2658 \setlength{\extrarowheight}{0.1cm}
2659 \begin{longtable}{l|c}
2660 \caption{Virtuality encodings} \label{tab:virtualityencodings}\\
2661 \hline \bfseries Virtuality code name&\bfseries Value \\ \hline
2663 \bfseries Virtuality code name&\bfseries Value\\ \hline
2665 \hline \emph{Continued on next page}
2670 \DWVIRTUALITYnone&0x00 \\
2671 \DWVIRTUALITYvirtual&0x01 \\
2672 \DWVIRTUALITYpurevirtual&0x02 \\
2679 \DWVIRTUALITYnone{} is equivalent to the absence of the
2683 \section{Source Languages}
2684 \label{datarep:sourcelanguages}
2686 The encodings of the constants used
2687 \addtoindexx{language attribute, encoding}
2689 \addtoindexx{language name encoding}
2692 attribute are given in
2693 Table \refersec{tab:languageencodings}.
2695 % If we don't force a following space it looks odd
2697 and their associated values are reserved, but the
2698 languages they represent are not well supported.
2699 Table \refersec{tab:languageencodings}
2701 \addtoindexx{lower bound attribute!default}
2702 default lower bound, if any, assumed for
2703 an omitted \DWATlowerbound{} attribute in the context of a
2704 \DWTAGsubrangetype{} debugging information entry for each
2708 \setlength{\extrarowheight}{0.1cm}
2709 \begin{longtable}{l|c|c}
2710 \caption{Language encodings} \label{tab:languageencodings}\\
2711 \hline \bfseries Language name&\bfseries Value &\bfseries Default Lower Bound \\ \hline
2713 \bfseries Language name&\bfseries Value &\bfseries Default Lower Bound\\ \hline
2715 \hline \emph{Continued on next page}
2718 \dag \ \textit{See text} \\ \ddag \ \textit{New in \DWARFVersionV}
2720 \addtoindexx{ISO-defined language names}
2722 \DWLANGCeightynine &0x0001 &0 \addtoindexx{C:1989 (ISO)} \\
2723 \DWLANGC{} &0x0002 &0 \addtoindexx{C!non-standard} \\
2724 \DWLANGAdaeightythree{} \dag &0x0003 &1 \addtoindexx{Ada:1983 (ISO)} \\
2725 \DWLANGCplusplus{} &0x0004 &0 \addtoindexx{C++98 (ISO)} \\
2726 \DWLANGCobolseventyfour{} \dag &0x0005 &1 \addtoindexx{COBOL:1974 (ISO)} \\
2727 \DWLANGCoboleightyfive{} \dag &0x0006 &1 \addtoindexx{COBOL:1985 (ISO)} \\
2728 \DWLANGFortranseventyseven &0x0007 &1 \addtoindexx{FORTRAN:1977 (ISO)} \\
2729 \DWLANGFortranninety &0x0008 &1 \addtoindexx{Fortran:1990 (ISO)} \\
2730 \DWLANGPascaleightythree &0x0009 &1 \addtoindexx{Pascal:1983 (ISO)} \\
2731 \DWLANGModulatwo &0x000a &1 \addtoindexx{Modula-2:1996 (ISO)} \\
2732 \DWLANGJava &0x000b &0 \addtoindexx{Java} \\
2733 \DWLANGCninetynine &0x000c &0 \addtoindexx{C:1999 (ISO)} \\
2734 \DWLANGAdaninetyfive{} \dag &0x000d &1 \addtoindexx{Ada:1995 (ISO)} \\
2735 \DWLANGFortranninetyfive &0x000e &1 \addtoindexx{Fortran:1995 (ISO)} \\
2736 \DWLANGPLI{} \dag &0x000f &1 \addtoindexx{PL/I:1976 (ANSI)}\\
2737 \DWLANGObjC{} &0x0010 &0 \addtoindexx{Objective C}\\
2738 \DWLANGObjCplusplus{} &0x0011 &0 \addtoindexx{Objective C++}\\
2739 \DWLANGUPC{} &0x0012 &0 \addtoindexx{UPC}\\
2740 \DWLANGD{} &0x0013 &0 \addtoindexx{D language}\\
2741 \DWLANGPython{} \dag &0x0014 &0 \addtoindexx{Python}\\
2742 \DWLANGOpenCL{} \dag \ddag &0x0015 &0 \addtoindexx{OpenCL}\\
2743 \DWLANGGo{} \dag \ddag &0x0016 &0 \addtoindexx{Go}\\
2744 \DWLANGModulathree{} \dag \ddag &0x0017 &1 \addtoindexx{Modula-3}\\
2745 \DWLANGHaskell{} \dag \ddag &0x0018 &0 \addtoindexx{Haskell}\\
2746 \DWLANGCpluspluszerothree{} \ddag &0x0019 &0 \addtoindexx{C++03 (ISO)}\\
2747 \DWLANGCpluspluseleven{} \ddag &0x001a &0 \addtoindexx{C++11 (ISO)} \\
2748 \DWLANGOCaml{} \ddag &0x001b &0 \addtoindexx{OCaml}\\
2749 \DWLANGRust{} \ddag &0x001c &0 \addtoindexx{Rust}\\
2750 \DWLANGCeleven{} \ddag &0x001d &0 \addtoindexx{C:2011 (ISO)}\\
2751 \DWLANGSwift{} \ddag &0x001e &0 \addtoindexx{Swift} \\
2752 \DWLANGJulia{} \ddag &0x001f &1 \addtoindexx{Julia} \\
2753 \DWLANGDylan{} \ddag &0x0020 &0 \addtoindexx{Dylan} \\
2754 \DWLANGCplusplusfourteen{}~\ddag &0x0021 &0 \addtoindexx{C++14 (ISO)} \\
2755 \DWLANGFortranzerothree{}~\ddag &0x0022 &1 \addtoindexx{Fortran:2004 (ISO)} \\
2756 \DWLANGFortranzeroeight{}~\ddag &0x0023 &1 \addtoindexx{Fortran:2010 (ISO)} \\
2757 \DWLANGlouser{} &0x8000 & \\
2758 \DWLANGhiuser{} &\xffff & \\
2763 \section{Address Class Encodings}
2764 \label{datarep:addressclassencodings}
2766 The value of the common
2767 \addtoindex{address class} encoding
2771 \section{Identifier Case}
2772 \label{datarep:identifiercase}
2774 The encodings of the constants used in the
2775 \DWATidentifiercase{} attribute are given in
2776 Table \refersec{tab:identifiercaseencodings}.
2780 \setlength{\extrarowheight}{0.1cm}
2781 \begin{longtable}{l|c}
2782 \caption{Identifier case encodings} \label{tab:identifiercaseencodings}\\
2783 \hline \bfseries Identifier case name&\bfseries Value \\ \hline
2785 \bfseries Identifier case name&\bfseries Value\\ \hline
2787 \hline \emph{Continued on next page}
2791 \DWIDcasesensitive&0x00 \\
2793 \DWIDdowncase&0x02 \\
2794 \DWIDcaseinsensitive&0x03 \\
2798 \section{Calling Convention Encodings}
2799 \label{datarep:callingconventionencodings}
2800 The encodings of the constants used in the
2801 \DWATcallingconvention{} attribute are given in
2802 Table \refersec{tab:callingconventionencodings}.
2805 \setlength{\extrarowheight}{0.1cm}
2806 \begin{longtable}{l|c}
2807 \caption{Calling convention encodings} \label{tab:callingconventionencodings}\\
2808 \hline \bfseries Calling convention name&\bfseries Value \\ \hline
2810 \bfseries Calling convention name&\bfseries Value\\ \hline
2812 \hline \emph{Continued on next page}
2814 \hline \ddag\ \textit{New in DWARF Version 5}
2817 \DWCCnormal &0x01 \\
2818 \DWCCprogram&0x02 \\
2819 \DWCCnocall &0x03 \\
2820 \DWCCpassbyreference~\ddag &0x04 \\
2821 \DWCCpassbyvalue~\ddag &0x05 \\
2822 \DWCClouser &0x40 \\
2829 \section{Inline Codes}
2830 \label{datarep:inlinecodes}
2832 The encodings of the constants used in
2833 \addtoindexx{inline attribute}
2835 \DWATinline{} attribute are given in
2836 Table \refersec{tab:inlineencodings}.
2840 \setlength{\extrarowheight}{0.1cm}
2841 \begin{longtable}{l|c}
2842 \caption{Inline encodings} \label{tab:inlineencodings}\\
2843 \hline \bfseries Inline code name&\bfseries Value \\ \hline
2845 \bfseries Inline Code name&\bfseries Value\\ \hline
2847 \hline \emph{Continued on next page}
2852 \DWINLnotinlined&0x00 \\
2853 \DWINLinlined&0x01 \\
2854 \DWINLdeclarednotinlined&0x02 \\
2855 \DWINLdeclaredinlined&0x03 \\
2860 % this clearpage is ugly, but the following table came
2861 % out oddly without it.
2863 \section{Array Ordering}
2864 \label{datarep:arrayordering}
2866 The encodings of the constants used in the
2867 \DWATordering{} attribute are given in
2868 Table \refersec{tab:orderingencodings}.
2872 \setlength{\extrarowheight}{0.1cm}
2873 \begin{longtable}{l|c}
2874 \caption{Ordering encodings} \label{tab:orderingencodings}\\
2875 \hline \bfseries Ordering name&\bfseries Value \\ \hline
2877 \bfseries Ordering name&\bfseries Value\\ \hline
2879 \hline \emph{Continued on next page}
2884 \DWORDrowmajor&0x00 \\
2885 \DWORDcolmajor&0x01 \\
2891 \section{Discriminant Lists}
2892 \label{datarep:discriminantlists}
2894 The descriptors used in
2895 \addtoindexx{discriminant list attribute}
2897 \DWATdiscrlist{} attribute are
2898 encoded as 1-byte constants. The
2899 defined values are given in
2900 Table \refersec{tab:discriminantdescriptorencodings}.
2902 % Odd that the 'Name' field capitalized here, it is not caps elsewhere.
2904 \setlength{\extrarowheight}{0.1cm}
2905 \begin{longtable}{l|c}
2906 \caption{Discriminant descriptor encodings} \label{tab:discriminantdescriptorencodings}\\
2907 \hline \bfseries Descriptor name&\bfseries Value \\ \hline
2909 \bfseries Descriptor name&\bfseries Value\\ \hline
2911 \hline \emph{Continued on next page}
2923 \section{Name Index Table}
2924 \label{datarep:nameindextable}
2925 The \addtoindexi{version number}{version number!name index table}
2926 in the name index table header is \versiondotdebugnames{}.
2929 The name index attributes and their encodings are listed in Table \referfol{datarep:indexattributeencodings}.
2932 \setlength{\extrarowheight}{0.1cm}
2933 \begin{longtable}{l|c|l}
2934 \caption{Name index attribute encodings} \label{datarep:indexattributeencodings}\\
2935 \hline \bfseries Attribute name &\bfseries Value &\bfseries Form/Class \\ \hline
2937 \bfseries Attribute name &\bfseries Value &\bfseries Form/Class \\ \hline
2939 \hline \emph{Continued on next page}
2942 \ddag~\textit{New in \DWARFVersionV}
2944 \DWIDXcompileunit~\ddag & 1 & \CLASSconstant \\
2945 \DWIDXtypeunit~\ddag & 2 & \CLASSconstant \\
2946 \DWIDXdieoffset~\ddag & 3 & \CLASSreference \\
2947 \DWIDXparent~\ddag & 4 & \CLASSconstant \\
2948 \DWIDXtypehash~\ddag & 5 & \DWFORMdataeight \\
2949 \DWIDXlouser~\ddag & 0x2000 & \\
2950 \DWIDXhiuser~\ddag & \xiiifff & \\
2954 The abbreviations table ends with an entry consisting of a single 0
2955 byte for the abbreviation code. The size of the table given by
2956 \texttt{abbrev\_table\_size} may include optional padding following the
2959 \section{Defaulted Member Encodings}
2960 \hypertarget{datarep:defaultedmemberencodings}{}
2962 The encodings of the constants used in the \DWATdefaulted{} attribute
2963 are given in Table \referfol{datarep:defaultedattributeencodings}.
2966 \setlength{\extrarowheight}{0.1cm}
2967 \begin{longtable}{l|c}
2968 \caption{Defaulted attribute encodings} \label{datarep:defaultedattributeencodings} \\
2969 \hline \bfseries Defaulted name &\bfseries Value \\ \hline
2971 \bfseries Defaulted name &\bfseries Value \\ \hline
2973 \hline \emph{Continued on next page}
2976 \ddag~\textit{New in \DWARFVersionV}
2978 \DWDEFAULTEDno~\ddag & 0x00 \\
2979 \DWDEFAULTEDinclass~\ddag & 0x01 \\
2980 \DWDEFAULTEDoutofclass~\ddag & 0x02 \\
2985 \section{Address Range Table}
2986 \label{datarep:addrssrangetable}
2988 Each set of entries in the table of address ranges contained
2989 in the \dotdebugaranges{}
2990 section begins with a header containing:
2991 \begin{enumerate}[1. ]
2992 % FIXME The unit length text is not fully consistent across
2995 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
2996 \addttindexx{unit\_length}
2997 A 4-byte or 12-byte length containing the length of the
2998 \addtoindexx{initial length}
2999 set of entries for this compilation unit, not including the
3000 length field itself. In the \thirtytwobitdwarfformat, this is a
3001 4-byte unsigned integer (which must be less than \xfffffffzero);
3002 in the \sixtyfourbitdwarfformat, this consists of the 4-byte value
3003 \wffffffff followed by an 8-byte unsigned integer that gives
3005 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
3007 \item version (\HFTuhalf) \\
3008 A 2-byte version identifier representing the version of the
3009 DWARF information for the address range table.
3012 This value in this field \addtoindexx{version number!address range table} is 2.
3014 \item debug\_info\_offset (\livelink{datarep:sectionoffsetlength}{section offset}) \\
3016 \addtoindexx{section offset!in .debug\_aranges header}
3017 4-byte or 8-byte offset into the
3018 \dotdebuginfo{} section of
3019 the compilation unit header. In the \thirtytwobitdwarfformat,
3020 this is a 4-byte unsigned offset; in the \sixtyfourbitdwarfformat,
3021 this is an 8-byte unsigned offset
3022 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
3024 \item \texttt{address\_size} (\HFTubyte) \\
3025 A 1-byte unsigned integer containing the size in bytes of an
3026 \addttindexx{address\_size}
3028 \addtoindexx{size of an address}
3029 (or the offset portion of an address for segmented
3030 \addtoindexx{address space!segmented}
3031 addressing) on the target system.
3033 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
3034 A 1-byte unsigned integer containing the size in bytes of a
3035 segment selector on the target system.
3039 This header is followed by a series of tuples. Each tuple
3040 consists of a segment, an address and a length.
3041 The segment selector
3042 size is given by the \HFNsegmentselectorsize{} field of the header; the
3043 address and length size are each given by the \addttindex{address\_size}
3044 field of the header.
3045 The first tuple following the header in
3046 each set begins at an offset that is a multiple of the size
3047 of a single tuple (that is, the size of a segment selector
3048 plus twice the \addtoindex{size of an address}).
3049 The header is padded, if
3050 necessary, to that boundary. Each set of tuples is terminated
3051 by a 0 for the segment, a 0 for the address and 0 for the
3052 length. If the \HFNsegmentselectorsize{} field in the header is zero,
3053 the segment selectors are omitted from all tuples, including
3054 the terminating tuple.
3057 \section{Line Number Information}
3058 \label{datarep:linenumberinformation}
3060 The \addtoindexi{version number}{version number!line number information}
3061 in the line number program header is \versiondotdebugline{}.
3064 The boolean values \doublequote{true} and \doublequote{false}
3065 used by the line number information program are encoded
3066 as a single byte containing the value 0
3067 for \doublequote{false,} and a non-zero value for \doublequote{true.}
3070 The encodings for the standard opcodes are given in
3071 \addtoindexx{line number opcodes!standard opcode encoding}
3072 Table \refersec{tab:linenumberstandardopcodeencodings}.
3075 \setlength{\extrarowheight}{0.1cm}
3076 \begin{longtable}{l|c}
3077 \caption{Line number standard opcode encodings} \label{tab:linenumberstandardopcodeencodings}\\
3078 \hline \bfseries Opcode name&\bfseries Value \\ \hline
3080 \bfseries Opcode name&\bfseries Value\\ \hline
3082 \hline \emph{Continued on next page}
3088 \DWLNSadvancepc&0x02 \\
3089 \DWLNSadvanceline&0x03 \\
3090 \DWLNSsetfile&0x04 \\
3091 \DWLNSsetcolumn&0x05 \\
3092 \DWLNSnegatestmt&0x06 \\
3093 \DWLNSsetbasicblock&0x07 \\
3094 \DWLNSconstaddpc&0x08 \\
3095 \DWLNSfixedadvancepc&0x09 \\
3096 \DWLNSsetprologueend&0x0a \\*
3097 \DWLNSsetepiloguebegin&0x0b \\*
3098 \DWLNSsetisa&0x0c \\*
3104 The encodings for the extended opcodes are given in
3105 \addtoindexx{line number opcodes!extended opcode encoding}
3106 Table \refersec{tab:linenumberextendedopcodeencodings}.
3109 \setlength{\extrarowheight}{0.1cm}
3110 \begin{longtable}{l|c}
3111 \caption{Line number extended opcode encodings} \label{tab:linenumberextendedopcodeencodings}\\
3112 \hline \bfseries Opcode name&\bfseries Value \\ \hline
3114 \bfseries Opcode name&\bfseries Value\\ \hline
3116 \hline \emph{Continued on next page}
3118 \hline %\ddag~\textit{New in DWARF Version 5}
3121 \DWLNEendsequence &0x01 \\
3122 \DWLNEsetaddress &0x02 \\
3123 \textit{Reserved} &0x03\footnote{Code 0x03 is reserved to allow backward compatible support of the
3124 DW\_LNE\_define\_file operation which was defined in \DWARFVersionIV{}
3126 \DWLNEsetdiscriminator &0x04 \\
3127 \DWLNElouser &0x80 \\
3128 \DWLNEhiuser &\xff \\
3134 The encodings for the line number header entry formats are given in
3135 \addtoindexx{line number opcodes!file entry format encoding}
3136 Table \refersec{tab:linenumberheaderentryformatencodings}.
3139 \setlength{\extrarowheight}{0.1cm}
3140 \begin{longtable}{l|c}
3141 \caption{Line number header entry format \mbox{encodings}} \label{tab:linenumberheaderentryformatencodings}\\
3142 \hline \bfseries Line number header entry format name&\bfseries Value \\ \hline
3144 \bfseries Line number header entry format name&\bfseries Value\\ \hline
3146 \hline \emph{Continued on next page}
3148 \hline \ddag~\textit{New in DWARF Version 5}
3150 \DWLNCTpath~\ddag & 0x1 \\
3151 \DWLNCTdirectoryindex~\ddag & 0x2 \\
3152 \DWLNCTtimestamp~\ddag & 0x3 \\
3153 \DWLNCTsize~\ddag & 0x4 \\
3154 \DWLNCTMDfive~\ddag & 0x5 \\
3155 \DWLNCTlouser~\ddag & 0x2000 \\
3156 \DWLNCThiuser~\ddag & \xiiifff \\
3161 \section{Macro Information}
3162 \label{datarep:macroinformation}
3163 The \addtoindexi{version number}{version number!macro information}
3164 in the macro information header is \versiondotdebugmacro{}.
3167 The source line numbers and source file indices encoded in the
3168 macro information section are represented as
3169 unsigned LEB128\addtoindexx{LEB128!unsigned} numbers.
3172 The macro information entry type is encoded as a single unsigned byte.
3174 \addtoindexx{macro information entry types!encoding}
3176 Table \refersec{tab:macroinfoentrytypeencodings}.
3180 \setlength{\extrarowheight}{0.1cm}
3181 \begin{longtable}{l|c}
3182 \caption{Macro information entry type encodings} \label{tab:macroinfoentrytypeencodings}\\
3183 \hline \bfseries Macro information entry type name&\bfseries Value \\ \hline
3185 \bfseries Macro information entry type name&\bfseries Value\\ \hline
3187 \hline \emph{Continued on next page}
3189 \hline \ddag~\textit{New in DWARF Version 5}
3192 \DWMACROdefine~\ddag &0x01 \\
3193 \DWMACROundef~\ddag &0x02 \\
3194 \DWMACROstartfile~\ddag &0x03 \\
3195 \DWMACROendfile~\ddag &0x04 \\
3196 \DWMACROdefinestrp~\ddag &0x05 \\
3197 \DWMACROundefstrp~\ddag &0x06 \\
3198 \DWMACROimport~\ddag &0x07 \\
3199 \DWMACROdefinesup~\ddag &0x08 \\
3200 \DWMACROundefsup~\ddag &0x09 \\
3201 \DWMACROimportsup~\ddag &0x0a \\
3202 \DWMACROdefinestrx~\ddag &0x0b \\
3203 \DWMACROundefstrx~\ddag &0x0c \\
3204 \DWMACROlouser~\ddag &0xe0 \\
3205 \DWMACROhiuser~\ddag &\xff \\
3211 \section{Call Frame Information}
3212 \label{datarep:callframeinformation}
3214 In the \thirtytwobitdwarfformat, the value of the CIE id in the
3215 CIE header is \xffffffff; in the \sixtyfourbitdwarfformat, the
3216 value is \xffffffffffffffff.
3218 The value of the CIE \addtoindexi{version number}{version number!call frame information}
3219 is \versiondotdebugframe.
3222 Call frame instructions are encoded in one or more bytes. The
3223 primary opcode is encoded in the high order two bits of
3224 the first byte (that is, opcode = byte $\gg$ 6). An operand
3225 or extended opcode may be encoded in the low order 6
3226 bits. Additional operands are encoded in subsequent bytes.
3227 The instructions and their encodings are presented in
3228 Table \refersec{tab:callframeinstructionencodings}.
3231 \setlength{\extrarowheight}{0.1cm}
3232 \begin{longtable}{l|c|c|l|l}
3233 \caption{Call frame instruction encodings} \label{tab:callframeinstructionencodings} \\
3234 \hline &\bfseries High 2 &\bfseries Low 6 & & \\
3235 \bfseries Instruction&\bfseries Bits &\bfseries Bits &\bfseries Operand 1 &\bfseries Operand 2\\ \hline
3237 & \bfseries High 2 &\bfseries Low 6 & &\\
3238 \bfseries Instruction&\bfseries Bits &\bfseries Bits &\bfseries Operand 1 &\bfseries Operand 2\\ \hline
3240 \hline \emph{Continued on next page}
3245 \DWCFAadvanceloc&0x1&delta & \\
3246 \DWCFAoffset&0x2®ister&ULEB128 offset \\
3247 \DWCFArestore&0x3®ister & & \\
3248 \DWCFAnop&0&0 & & \\
3249 \DWCFAsetloc&0&0x01&address & \\
3250 \DWCFAadvancelocone&0&0x02&1-byte delta & \\
3251 \DWCFAadvanceloctwo&0&0x03&2-byte delta & \\
3252 \DWCFAadvancelocfour&0&0x04&4-byte delta & \\
3253 \DWCFAoffsetextended&0&0x05&ULEB128 register&ULEB128 offset \\
3254 \DWCFArestoreextended&0&0x06&ULEB128 register & \\
3255 \DWCFAundefined&0&0x07&ULEB128 register & \\
3256 \DWCFAsamevalue&0&0x08 &ULEB128 register & \\
3257 \DWCFAregister&0&0x09&ULEB128 register &ULEB128 offset \\
3258 \DWCFArememberstate&0&0x0a & & \\
3259 \DWCFArestorestate&0&0x0b & & \\
3260 \DWCFAdefcfa&0&0x0c &ULEB128 register&ULEB128 offset \\
3261 \DWCFAdefcfaregister&0&0x0d&ULEB128 register & \\
3262 \DWCFAdefcfaoffset&0&0x0e &ULEB128 offset & \\
3263 \DWCFAdefcfaexpression&0&0x0f &BLOCK \\
3264 \DWCFAexpression&0&0x10&ULEB128 register & BLOCK \\
3266 \DWCFAoffsetextendedsf&0&0x11&ULEB128 register&SLEB128 offset \\
3267 \DWCFAdefcfasf&0&0x12&ULEB128 register&SLEB128 offset \\
3268 \DWCFAdefcfaoffsetsf&0&0x13&SLEB128 offset & \\
3269 \DWCFAvaloffset&0&0x14&ULEB128&ULEB128 \\
3270 \DWCFAvaloffsetsf&0&0x15&ULEB128&SLEB128 \\
3271 \DWCFAvalexpression&0&0x16&ULEB128&BLOCK \\
3272 \DWCFAlouser&0&0x1c & & \\
3273 \DWCFAhiuser&0&\xiiif & & \\
3277 \section{Non-contiguous Address Ranges}
3278 \label{datarep:noncontiguousaddressranges}
3280 Each entry in a \addtoindex{range list}
3281 (see Section \refersec{chap:noncontiguousaddressranges})
3283 \addtoindexx{base address selection entry!in range list}
3285 \addtoindexx{range list}
3286 a base address selection entry, or an end-of-list entry.
3288 A \addtoindex{range list} entry consists of two relative addresses. The
3289 addresses are the same size as addresses on the target machine.
3292 A base address selection entry and an
3293 \addtoindexx{end-of-list entry!in range list}
3294 end-of-list entry each
3295 \addtoindexx{base address selection entry!in range list}
3296 consist of two (constant or relocated) addresses. The two
3297 addresses are the same size as addresses on the target machine.
3299 For a \addtoindex{range list} to be specified, the base address of the
3300 \addtoindexx{base address selection entry!in range list}
3301 corresponding compilation unit must be defined
3302 (see Section \refersec{chap:fullandpartialcompilationunitentries}).
3305 \section{String Offsets Table}
3306 \label{chap:stringoffsetstable}
3307 Each set of entries in the string offsets table contained in the
3308 \dotdebugstroffsets{} or \dotdebugstroffsetsdwo{}
3309 section begins with a header containing:
3310 \begin{enumerate}[1. ]
3311 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3312 \addttindexx{unit\_length}
3313 A 4-byte or 12-byte length containing the length of
3314 the set of entries for this compilation unit, not
3315 including the length field itself. In the 32-bit
3316 DWARF format, this is a 4-byte unsigned integer
3317 (which must be less than \xfffffffzero); in the 64-bit
3318 DWARF format, this consists of the 4-byte value
3319 \wffffffff followed by an 8-byte unsigned integer
3320 that gives the actual length (see
3321 Section \refersec{datarep:32bitand64bitdwarfformats}).
3324 \item \texttt{version} (\HFTuhalf) \\
3325 \addtoindexx{version number!string offsets table}
3326 A 2-byte version identifier containing the value
3327 \versiondotdebugstroffsets{}.
3330 \item \textit{padding} (\HFTuhalf) \\
3332 Reserved to DWARF (must be zero).
3336 This header is followed by a series of string table offsets
3337 that have the same representation as \DWFORMstrp.
3338 For the 32-bit DWARF format, each offset is 4 bytes long; for
3339 the 64-bit DWARF format, each offset is 8 bytes long.
3341 The \DWATstroffsetsbase{} attribute points to the first
3342 entry following the header. The entries are indexed
3343 sequentially from this base entry, starting from 0.
3345 \section{Address Table}
3346 \label{chap:addresstable}
3347 Each set of entries in the address table contained in the
3348 \dotdebugaddr{} section begins with a header containing:
3349 \begin{enumerate}[1. ]
3350 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3351 \addttindexx{unit\_length}
3352 A 4-byte or 12-byte length containing the length of
3353 the set of entries for this compilation unit, not
3354 including the length field itself. In the 32-bit
3355 DWARF format, this is a 4-byte unsigned integer
3356 (which must be less than \xfffffffzero); in the 64-bit
3357 DWARF format, this consists of the 4-byte value
3358 \wffffffff followed by an 8-byte unsigned integer
3359 that gives the actual length (see
3360 Section \refersec{datarep:32bitand64bitdwarfformats}).
3363 \item \texttt{version} (\HFTuhalf) \\
3364 \addtoindexx{version number!address table}
3365 A 2-byte version identifier containing the value
3366 \versiondotdebugaddr{}.
3370 \item \texttt{address\_size} (\HFTubyte) \\
3371 A 1-byte unsigned integer containing the size in
3372 bytes of an address (or the offset portion of an
3373 address for segmented addressing) on the target
3377 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
3378 A 1-byte unsigned integer containing the size in
3379 bytes of a segment selector on the target system.
3382 This header is followed by a series of segment/address pairs.
3383 The segment size is given by the \HFNsegmentselectorsize{} field of the
3384 header, and the address size is given by the \addttindex{address\_size}
3385 field of the header. If the \HFNsegmentselectorsize{} field in the header
3386 is zero, the entries consist only of an addresses.
3388 The \DWATaddrbase{} attribute points to the first entry
3389 following the header. The entries are indexed sequentially
3390 from this base entry, starting from 0.
3393 \section{Range List Table}
3394 \label{app:rangelisttable}
3395 Each set of entries in the range list table contained in the
3396 \dotdebugranges{} section begins with a header containing:
3397 \begin{enumerate}[1. ]
3398 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3399 \addttindexx{unit\_length}
3400 A 4-byte or 12-byte length containing the length of
3401 the set of entries for this compilation unit, not
3402 including the length field itself. In the 32-bit
3403 DWARF format, this is a 4-byte unsigned integer
3404 (which must be less than \xfffffffzero); in the 64-bit
3405 DWARF format, this consists of the 4-byte value
3406 \wffffffff followed by an 8-byte unsigned integer
3407 that gives the actual length (see
3408 Section \refersec{datarep:32bitand64bitdwarfformats}).
3411 \item \texttt{version} (\HFTuhalf) \\
3412 \addtoindexx{version number!range list table}
3413 A 2-byte version identifier containing the value
3414 \versiondotdebugranges{}.
3418 \item \texttt{address\_size} (\HFTubyte) \\
3419 A 1-byte unsigned integer containing the size in
3420 bytes of an address (or the offset portion of an
3421 address for segmented addressing) on the target
3425 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
3426 A 1-byte unsigned integer containing the size in
3427 bytes of a segment selector on the target system.
3430 This header is followed by a series of range list entries as
3431 described in Section \refersec{chap:noncontiguousaddressranges}.
3432 The segment size is given by the
3433 \HFNsegmentselectorsize{} field of the header, and the address size is
3434 given by the \addttindex{address\_size} field of the header. If the
3435 \HFNsegmentselectorsize{} field in the header is zero, the segment
3436 selector is omitted from the range list entries.
3438 The \DWATrangesbase{} attribute points to the first entry
3439 following the header. The entries are referenced by a byte
3440 offset relative to this base address.
3443 \section{Location List Table}
3444 \label{datarep:locationlisttable}
3445 Each set of entries in the location list table contained in the
3446 \dotdebugloc{} or \dotdebuglocdwo{} sections begins with a header containing:
3447 \begin{enumerate}[1. ]
3448 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3449 \addttindexx{unit\_length}
3450 A 4-byte or 12-byte length containing the length of
3451 the set of entries for this compilation unit, not
3452 including the length field itself. In the 32-bit
3453 DWARF format, this is a 4-byte unsigned integer
3454 (which must be less than \xfffffffzero); in the 64-bit
3455 DWARF format, this consists of the 4-byte value
3456 \wffffffff followed by an 8-byte unsigned integer
3457 that gives the actual length (see
3458 Section \refersec{datarep:32bitand64bitdwarfformats}).
3461 \item \texttt{version} (\HFTuhalf) \\
3462 \addtoindexx{version number!location list table}
3463 A 2-byte version identifier containing the value
3464 \versiondotdebugloc{}.
3468 \item \texttt{address\_size} (\HFTubyte) \\
3469 A 1-byte unsigned integer containing the size in
3470 bytes of an address (or the offset portion of an
3471 address for segmented addressing) on the target
3475 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
3476 A 1-byte unsigned integer containing the size in
3477 bytes of a segment selector on the target system.
3480 This header is followed by a series of location list entries as
3481 described in Section \refersec{chap:locationlists}.
3482 The segment size is given by the
3483 \HFNsegmentselectorsize{} field of the header, and the address size is
3484 given by the \HFNaddresssize{} field of the header. If the
3485 \HFNsegmentselectorsize{} field in the header is zero, the segment
3486 selector is omitted from range list entries.
3488 The entries are referenced by a byte offset relative to the first
3489 location list following this header.
3492 \section{Dependencies and Constraints}
3493 \label{datarep:dependenciesandconstraints}
3494 The debugging information in this format is intended to
3495 exist in sections of an object file, or an equivalent
3496 separate file or database, having names beginning with
3497 the prefix ".debug\_" (see Appendix
3498 \refersec{app:dwarfsectionversionnumbersinformative}
3499 for a complete list of such names).
3500 Except as specifically specified, this information is not
3501 aligned on 2-, 4- or 8-byte boundaries. Consequently:
3504 \item For the \thirtytwobitdwarfformat{} and a target architecture with
3505 32-bit addresses, an assembler or compiler must provide a way
3506 to produce 2-byte and 4-byte quantities without alignment
3507 restrictions, and the linker must be able to relocate a
3509 \addtoindexx{section offset!alignment of}
3510 section offset that occurs at an arbitrary
3513 \item For the \thirtytwobitdwarfformat{} and a target architecture with
3514 64-bit addresses, an assembler or compiler must provide a
3515 way to produce 2-byte, 4-byte and 8-byte quantities without
3516 alignment restrictions, and the linker must be able to relocate
3517 an 8-byte address or 4-byte
3518 \addtoindexx{section offset!alignment of}
3519 section offset that occurs at an
3520 arbitrary alignment.
3522 \item For the \sixtyfourbitdwarfformat{} and a target architecture with
3523 32-bit addresses, an assembler or compiler must provide a
3524 way to produce 2-byte, 4-byte and 8-byte quantities without
3525 alignment restrictions, and the linker must be able to relocate
3526 a 4-byte address or 8-byte
3527 \addtoindexx{section offset!alignment of}
3528 section offset that occurs at an
3529 arbitrary alignment.
3531 \textit{It is expected that this will be required only for very large
3532 32-bit programs or by those architectures which support
3533 a mix of 32-bit and 64-bit code and data within the same
3536 \item For the \sixtyfourbitdwarfformat{} and a target architecture with
3537 64-bit addresses, an assembler or compiler must provide a
3538 way to produce 2-byte, 4-byte and 8-byte quantities without
3539 alignment restrictions, and the linker must be able to
3540 relocate an 8-byte address or
3541 \addtoindexx{section offset!alignment of}
3542 section offset that occurs at
3543 an arbitrary alignment.
3547 \section{Integer Representation Names}
3548 \label{datarep:integerrepresentationnames}
3549 The sizes of the integers used in the lookup by name, lookup
3550 by address, line number, call frame information and other sections
3552 Table \ref{tab:integerrepresentationnames}.
3556 \setlength{\extrarowheight}{0.1cm}
3557 \begin{longtable}{c|l}
3558 \caption{Integer representation names} \label{tab:integerrepresentationnames}\\
3559 \hline \bfseries Representation name&\bfseries Representation \\ \hline
3561 \bfseries Representation name&\bfseries Representation\\ \hline
3563 \hline \emph{Continued on next page}
3568 \HFTsbyte& signed, 1-byte integer \\
3569 \HFTubyte&unsigned, 1-byte integer \\
3570 \HFTuhalf&unsigned, 2-byte integer \\
3571 \HFTuword&unsigned, 4-byte integer \\
3577 \section{Type Signature Computation}
3578 \label{datarep:typesignaturecomputation}
3580 A \addtoindex{type signature} is used by a DWARF consumer
3581 to resolve type references to the type definitions that
3582 are contained in \addtoindex{type unit}s (see Section
3583 \refersec{chap:typeunitentries}).
3585 \textit{A type signature is computed only by a DWARF producer;
3586 \addtoindexx{type signature!computation} a consumer need
3587 compare two type signatures to check for equality.}
3590 The type signature for a type T0 is formed from the
3591 \MDfive{}\footnote{\livetarg{def:MDfive}{MD5} Message Digest Algorithm,
3592 R.L. Rivest, RFC 1321, April 1992}
3593 digest of a flattened description of the type. The flattened
3594 description of the type is a byte sequence derived from the
3595 DWARF encoding of the type as follows:
3596 \begin{enumerate}[1. ]
3598 \item Start with an empty sequence S and a list V of visited
3599 types, where V is initialized to a list containing the type
3600 T0 as its single element. Elements in V are indexed from 1,
3603 \item If the debugging information entry represents a type that
3604 is nested inside another type or a namespace, append to S
3605 the type\textquoteright s context as follows: For each surrounding type
3606 or namespace, beginning with the outermost such construct,
3607 append the letter 'C', the DWARF tag of the construct, and
3608 the name (taken from
3609 \addtoindexx{name attribute}
3610 the \DWATname{} attribute) of the type
3611 \addtoindexx{name attribute}
3612 or namespace (including its trailing null byte).
3614 \item Append to S the letter 'D', followed by the DWARF tag of
3615 the debugging information entry.
3617 \item For each of the attributes in
3618 Table \refersec{tab:attributesusedintypesignaturecomputation}
3620 the debugging information entry, in the order listed,
3621 append to S a marker letter (see below), the DWARF attribute
3622 code, and the attribute value.
3625 \caption{Attributes used in type signature computation}
3626 \label{tab:attributesusedintypesignaturecomputation}
3627 \simplerule[\textwidth]
3629 \autocols[0pt]{c}{2}{l}{
3645 \DWATcontainingtype,
3649 \DWATdatamemberlocation,
3670 \DWATrvaluereference,
3674 \DWATstringlengthbitsize,
3675 \DWATstringlengthbytesize,
3680 \DWATvariableparameter,
3683 \DWATvtableelemlocation
3686 \simplerule[\textwidth]
3689 Note that except for the initial
3690 \DWATname{} attribute,
3691 \addtoindexx{name attribute}
3692 attributes are appended in order according to the alphabetical
3693 spelling of their identifier.
3695 If an implementation defines any vendor-specific attributes,
3696 any such attributes that are essential to the definition of
3697 the type are also included at the end of the above list,
3698 in their own alphabetical suborder.
3700 An attribute that refers to another type entry T is processed
3701 as follows: (a) If T is in the list V at some V[x], use the
3702 letter 'R' as the marker and use the unsigned LEB128\addtoindexx{LEB128!unsigned}
3703 encoding of x as the attribute value; otherwise, (b) use the letter 'T'
3704 as the marker, process the type T recursively by performing
3705 Steps 2 through 7, and use the result as the attribute value.
3708 Other attribute values use the letter 'A' as the marker, and
3709 the value consists of the form code (encoded as an unsigned
3710 LEB128 value) followed by the encoding of the value according
3711 to the form code. To ensure reproducibility of the signature,
3712 the set of forms used in the signature computation is limited
3721 \item If the tag in Step 3 is one of \DWTAGpointertype,
3722 \DWTAGreferencetype,
3723 \DWTAGrvaluereferencetype,
3724 \DWTAGptrtomembertype,
3725 or \DWTAGfriend, and the referenced
3726 type (via the \DWATtype{} or
3727 \DWATfriend{} attribute) has a
3728 \DWATname{} attribute, append to S the letter 'N', the DWARF
3729 attribute code (\DWATtype{} or
3730 \DWATfriend), the context of
3731 the type (according to the method in Step 2), the letter 'E',
3732 and the name of the type. For \DWTAGfriend, if the referenced
3733 entry is a \DWTAGsubprogram, the context is omitted and the
3734 name to be used is the ABI-specific name of the subprogram
3735 (for example, the mangled linker name).
3738 \item If the tag in Step 3 is not one of \DWTAGpointertype,
3739 \DWTAGreferencetype,
3740 \DWTAGrvaluereferencetype,
3741 \DWTAGptrtomembertype, or
3742 \DWTAGfriend, but has
3743 a \DWATtype{} attribute, or if the referenced type (via
3745 \DWATfriend{} attribute) does not have a
3746 \DWATname{} attribute, the attribute is processed according to
3747 the method in Step 4 for an attribute that refers to another
3751 \item Visit each child C of the debugging information
3752 entry as follows: If C is a nested type entry or a member
3753 function entry, and has
3754 a \DWATname{} attribute, append to
3755 \addtoindexx{name attribute}
3756 S the letter 'S', the tag of C, and its name; otherwise,
3757 process C recursively by performing Steps 3 through 7,
3758 appending the result to S. Following the last child (or if
3759 there are no children), append a zero byte.
3764 For the purposes of this algorithm, if a debugging information
3766 \DWATspecification{}
3767 attribute that refers to
3768 another entry D (which has a
3771 then S inherits the attributes and children of D, and S is
3772 processed as if those attributes and children were present in
3773 the entry S. Exception: if a particular attribute is found in
3774 both S and D, the attribute in S is used and the corresponding
3775 one in D is ignored.
3778 DWARF tag and attribute codes are appended to the sequence
3779 as unsigned LEB128\addtoindexx{LEB128!unsigned} values,
3780 using the values defined earlier in this chapter.
3782 \textit{A grammar describing this computation may be found in
3783 Appendix \refersec{app:typesignaturecomputationgrammar}.
3786 \textit{An attribute that refers to another type entry is
3787 recursively processed or replaced with the name of the
3788 referent (in Step 4, 5 or 6). If neither treatment applies to
3789 an attribute that references another type entry, the entry
3790 that contains that attribute is not suitable for a
3791 separate \addtoindex{type unit}.}
3793 \textit{If a debugging information entry contains an attribute from
3794 the list above that would require an unsupported form, that
3795 entry is not suitable for a separate
3796 \addtoindex{type unit}.}
3798 \textit{A type is suitable for a separate
3799 \addtoindex{type unit} only
3800 if all of the type entries that it contains or refers to in
3801 Steps 6 and 7 are themselves suitable for a separate
3802 \addtoindex{type unit}.}
3805 Where the DWARF producer may reasonably choose two or more
3806 different forms for a given attribute, it should choose
3807 the simplest possible form in computing the signature. (For
3808 example, a constant value should be preferred to a location
3809 expression when possible.)
3811 Once the string S has been formed from the DWARF encoding,
3812 an 16-byte \MDfive{} digest is computed for the string and the
3813 last eight bytes are taken as the type signature.
3815 \textit{The string S is intended to be a flattened representation of
3816 the type that uniquely identifies that type (that is, a different
3817 type is highly unlikely to produce the same string).}
3820 \textit{A debugging information entry is not be placed in a
3821 separate \addtoindex{type unit}
3822 if any of the following apply:}
3826 \item \textit{The entry has an attribute whose value is a location
3827 expression, and the location expression contains a reference to
3828 another debugging information entry (for example, a \DWOPcallref{}
3829 operator), as it is unlikely that the entry will remain
3830 identical across compilation units.}
3832 \item \textit{The entry has an attribute whose value refers
3833 to a code location or a \addtoindex{location list}.}
3835 \item \textit{The entry has an attribute whose value refers
3836 to another debugging information entry that does not represent
3842 \textit{Certain attributes are not included in the type signature:}
3845 \item \textit{The \DWATdeclaration{} attribute is not included because it
3846 indicates that the debugging information entry represents an
3847 incomplete declaration, and incomplete declarations should
3849 \addtoindexx{type unit}
3850 separate type units.}
3852 \item \textit{The \DWATdescription{} attribute is not included because
3853 it does not provide any information unique to the defining
3854 declaration of the type.}
3856 \item \textit{The \DWATdeclfile,
3858 \DWATdeclcolumn{} attributes are not included because they
3859 may vary from one source file to the next, and would prevent
3860 two otherwise identical type declarations from producing the
3861 same \MDfive{} digest.}
3863 \item \textit{The \DWATobjectpointer{} attribute is not included
3864 because the information it provides is not necessary for the
3865 computation of a unique type signature.}
3869 \textit{Nested types and some types referred to by a debugging
3870 information entry are encoded by name rather than by recursively
3871 encoding the type to allow for cases where a complete definition
3872 of the type might not be available in all compilation units.}
3875 \textit{If a type definition contains the definition of a member function,
3876 it cannot be moved as is into a type unit, because the member function
3877 contains attributes that are unique to that compilation unit.
3878 Such a type definition can be moved to a type unit by rewriting the
3880 debugging information entry
3883 moving the member function declaration into a separate declaration tree,
3884 and replacing the function definition in the type with a non-defining
3885 declaration of the function (as if the function had been defined out of
3888 An example that illustrates the computation of an \MDfive{} digest may be found in
3889 Appendix \refersec{app:usingtypeunits}.
3891 \section{Name Table Hash Function}
3892 \label{datarep:nametablehashfunction}
3893 The hash function used for hashing name strings in the accelerated
3894 access name index table (see Section \refersec{chap:acceleratedaccess})
3895 is defined in \addtoindex{C} as shown in
3896 Figure \referfol{fig:nametablehashfunctiondefinition}.\footnoteRR{
3897 This hash function is sometimes known as the
3899 "\addtoindex{Bernstein hash function}" or the
3901 "\addtoindex{DJB hash function}"
3903 \hrefself{http://en.wikipedia.org/wiki/List\_of\_hash\_functions} or
3904 \hrefself{http://stackoverflow.com/questions/10696223/reason-for-5381-number-in-djb-hash-function)}.}
3910 uint32_t /* must be a 32-bit integer type */
3911 hash(unsigned char *str)
3913 uint32_t hash = 5381;
3917 hash = hash * 33 + c;
3924 \caption{Name Table Hash Function Definition}
3925 \label{fig:nametablehashfunctiondefinition}