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.
324 may similarly do so using the \DWOPaddrx{} and
325 \DWOPconstx{} operations.
327 \DWATranges{} attributes contained in the full compilation unit
328 may refer to range table entries with a \DWFORMsecoffset{} offset
329 relative to the base offset specified by the \DWATrangesbase{}
330 attribute in the associated skeleton unit.
332 \item Separate type units, in the \dotdebuginfodwo{} section.
335 Abbreviations table(s) for the compilation unit and type
336 units, in the \dotdebugabbrevdwo{} section.
338 \item Location lists, in the \dotdebuglocdwo{} section.
341 A \addtoindex{specialized line number table} (for the type units),
342 in the \dotdebuglinedwo{} section. This table
343 contains only the directory and filename lists needed to
344 interpret \DWATdeclfile{} attributes in the debugging
347 \item Macro information, in the \dotdebugmacrodwo{} section.
349 \item A string table, in the \dotdebugstrdwo{} section.
351 \item A string offsets table, in the \dotdebugstroffsetsdwo{}
355 Except where noted otherwise, all references in this document
356 to a debugging information section (for example, \dotdebuginfo),
360 also to the corresponding split DWARF section (for example,
364 Split DWARF object files do not get linked with any other files,
365 therefore references between sections must not make use of
366 normal object file relocation information. As a result, symbolic
367 references within or between sections are not possible.
369 \subsection{Executable Objects}
370 \label{chap:executableobjects}
371 The relocated addresses in the debugging information for an
372 executable object are virtual addresses.
375 The sections containing the debugging information are typically
376 not loaded as part of the memory image of the program (in ELF
377 terminology, the sections are not "allocatable" and are not part
378 of a loadable segment). Therefore, the debugging information
379 sections described in this document are typically linked as if
380 they were each to be loaded at virtual address 0, and references
381 within the debugging information always implicitly indicate which
382 section a particular offset refers to. (For example, a reference
383 of form \DWFORMsecoffset{} may refer to one of several sections,
384 depending on the class allowed by a particular attribute of a
385 debugging information entry, as shown in
386 Table \refersec{tab:attributeencodings}.)
391 \subsection{Shared Object Files}
392 \label{datarep:sharedobjectfiles}
394 addresses in the debugging information for a shared object file
395 are offsets relative to the start of the lowest region of
396 memory loaded from that shared object file.
399 \textit{This requirement makes the debugging information for
400 shared object files position independent. Virtual addresses in a
401 shared object file may be calculated by adding the offset to the
402 base address at which the object file was attached. This offset
403 is available in the run\dash time linker\textquoteright s data structures.}
406 As with executable objects, the sections containing debugging
407 information are typically not loaded as part of the memory image
408 of the shared object, and are typically linked as if they were
409 each to be loaded at virtual address 0.
412 \subsection{DWARF Package Files}
413 \label{datarep:dwarfpackagefiles}
414 \textit{Using \splitDWARFobjectfile{s} allows the developer to compile,
415 link, and debug an application quickly with less link-time overhead,
416 but a more convenient format is needed for saving the debug
417 information for later debugging of a deployed application. A
418 DWARF package file can be used to collect the debugging
419 information from the object (or separate DWARF object) files
420 produced during the compilation of an application.}
422 \textit{The package file is typically placed in the same directory as the
423 application, and is given the same name with a \doublequote{\texttt{.dwp}}
424 extension.\addtoindexx{\texttt{.dwp} file extension}}
426 A DWARF package file is itself an object file, using the
427 \addtoindexx{package files}
428 \addtoindexx{DWARF package files}
429 same object file format (including \byteorder) as the
430 corresponding application binary. It consists only of a file
431 header, a section table, a number of DWARF debug information
432 sections, and two index sections.
435 Each DWARF package file contains no more than one of each of the
436 following sections, copied from a set of object or DWARF object
437 files, and combined, section by section:
443 \dotdebugstroffsetsdwo
448 The string table section in \dotdebugstrdwo{} contains all the
449 strings referenced from DWARF attributes using the form
450 \DWFORMstrx. Any attribute in a compilation unit or a type
451 unit using this form refers to an entry in that unit's
452 contribution to the \dotdebugstroffsetsdwo{} section, which in turn
453 provides the offset of a string in the \dotdebugstrdwo{}
456 The DWARF package file also contains two index sections that
457 provide a fast way to locate debug information by compilation
458 unit ID (\DWATdwoid) for compilation units, or by type
459 signature for type units:
465 \subsubsection{The Compilation Unit (CU) Index Section}
466 The \dotdebugcuindex{} section is a hashed lookup table that maps a
467 compilation unit ID to a set of contributions in the
468 various debug information sections. Each contribution is stored
469 as an offset within its corresponding section and a size.
471 Each \compunitset{} may contain contributions from the
474 \dotdebuginfodwo{} (required)
475 \dotdebugabbrevdwo{} (required)
478 \dotdebugstroffsetsdwo
482 \textit{Note that a \compunitset{} is not able to represent \dotdebugmacinfo{}
483 information from \DWARFVersionIV{} or earlier formats.}
485 \subsubsection{The Type Unit (TU) Index Section}
486 The \dotdebugtuindex{} section is a hashed lookup table that maps a
487 type signature to a set of offsets into the various debug
488 information sections. Each contribution is stored as an offset
489 within its corresponding section and a size.
491 Each \typeunitset{} may contain contributions from the following
494 \dotdebuginfodwo{} (required)
495 \dotdebugabbrevdwo{} (required)
497 \dotdebugstroffsetsdwo
500 \subsubsection{Format of the CU and TU Index Sections}
501 Both index sections have the same format, and serve to map an
502 8-byte signature to a set of contributions to the debug sections.
503 Each index section begins with a header, followed by a hash table of
504 signatures, a parallel table of indexes, a table of offsets, and
505 a table of sizes. The index sections are aligned at 8-byte
506 boundaries in the DWARF package file.
509 The index section header contains the following fields:
510 \begin{enumerate}[1. ]
511 \item \texttt{version} (\HFTuhalf) \\
513 \addtoindexx{version number!CU index information}
514 \addtoindexx{version number!TU index information}
516 This number is specific to the CU and TU index information
517 and is independent of the DWARF version number.
519 The version number is \versiondotdebugcuindex.
521 \item \textit{padding} (\HFTuhalf) \\
522 Reserved to DWARF (must be zero).
524 \item \texttt{section\_count} (\HFTuword) \\
525 The number of entries in the table of section counts that follows.
526 For brevity, the contents of this field is referred to as $N$ below.
529 \item \texttt{unit\_count} (\HFTuword) \\
530 The number of compilation units or type units in the index.
531 For brevity, the contents of this field is referred to as $U$ below.
533 \item \texttt{slot\_count} (\HFTuword) \\
534 The number of slots in the hash table.
535 For brevity, the contents of this field is referred to as $S$ below.
539 \textit{We assume that $U$ and $S$ do not exceed $2^{32}$.}
541 The size of the hash table, $S$, must be $2^k$ such that:
542 \hspace{0.3cm}$2^k\ \ >\ \ 3*U/2$
544 The hash table begins at offset 16 in the section, and consists
545 of an array of $S$ 8-byte slots. Each slot contains a 64-bit
547 % (using the \byteorder{} of the application binary).
549 The parallel table of indices begins immediately after the hash table
550 (at offset \mbox{$16 + 8 * S$} from the beginning of the section), and
551 consists of an array of $S$ 4-byte slots,
552 % (using the byte order of the application binary),
553 corresponding 1-1 with slots in the hash
554 table. Each entry in the parallel table contains a row index into
555 the tables of offsets and sizes.
557 Unused slots in the hash table have 0 in both the hash table
558 entry and the parallel table entry. While 0 is a valid hash
559 value, the row index in a used slot will always be non-zero.
561 Given an 8-byte compilation unit ID or type signature $X$,
562 an entry in the hash table is located as follows:
563 \begin{enumerate}[1. ]
564 \item Define $REP(X)$ to be the value of $X$ interpreted as an
565 unsigned 64-bit integer in the target byte order.
566 \item Calculate a primary hash $H = REP(X)\ \&\ MASK(k)$, where
567 $MASK(k)$ is a mask with the low-order $k$ bits all set to 1.
568 \item Calculate a secondary hash $H' = (((REP(X)>>32)\ \&\ MASK(k))\ |\ 1)$.
569 \item If the hash table entry at index $H$ matches the signature, use
570 that entry. If the hash table entry at index $H$ is unused (all
571 zeroes), terminate the search: the signature is not present
573 \item Let $H = (H + H')\ modulo\ S$. Repeat at Step 4.
576 Because $S > U$, and $H'$ and $S$ are relatively prime, the search is
577 guaranteed to stop at an unused slot or find the match.
580 The table of offsets begins immediately following the parallel
581 table (at offset \mbox{$16 + 12 * S$} from the beginning of the section).
582 The table is a two-dimensional array of 4-byte words,
583 %(using the byte order of the application binary),
585 with $N$ sections and $U + 1$
587 rows, in row-major order. Each row in the array is indexed
588 starting from 0. The first row provides a key to the columns:
589 each column in this row provides a section identifier for a debug
590 section, and the offsets in the same column of subsequent rows
591 refer to that section. The section identifiers are shown in
592 Table \referfol{tab:dwarfpackagefilesectionidentifierencodings}.
595 \textit{Not all sections listed in the table need be included.}
600 \setlength{\extrarowheight}{0.1cm}
601 \begin{longtable}{l|c|l}
602 \caption{DWARF package file section identifier \mbox{encodings}}
603 \label{tab:dwarfpackagefilesectionidentifierencodings}
604 \addtoindexx{DWARF package files!section identifier encodings} \\
605 \hline \bfseries Section identifier &\bfseries Value &\bfseries Section \\ \hline
607 \bfseries Section identifier &\bfseries Value &\bfseries Section\\ \hline
609 \hline \emph{Continued on next page}
613 \DWSECTINFOTARG & 1 & \dotdebuginfodwo \\
614 \textit{Reserved} & 2 & \\
615 \DWSECTABBREVTARG & 3 & \dotdebugabbrevdwo \\
616 \DWSECTLINETARG & 4 & \dotdebuglinedwo \\
617 \DWSECTLOCTARG & 5 & \dotdebuglocdwo \\
618 \DWSECTSTROFFSETSTARG & 6 & \dotdebugstroffsetsdwo \\
619 %DWSECTMACINFO & & \dotdebugmacinfodwo \\
620 \DWSECTMACROTARG & 7 & \dotdebugmacrodwo \\
624 The offsets provided by the CU and TU index sections are the
625 base offsets for the contributions made by each CU or TU to the
626 corresponding section in the package file. Each CU and TU header
627 contains a \HFNdebugabbrevoffset{} field, used to find the abbreviations
628 table for that CU or TU within the contribution to the
629 \dotdebugabbrevdwo{} section for that CU or TU, and are
630 interpreted as relative to the base offset given in the index
631 section. Likewise, offsets into \dotdebuglinedwo{} from
632 \DWATstmtlist{} attributes are interpreted as relative to
633 the base offset for \dotdebuglinedwo{}, and offsets into other debug
634 sections obtained from DWARF attributes are also
635 interpreted as relative to the corresponding base offset.
637 The table of sizes begins immediately following the table of
638 offsets, and provides the sizes of the contributions made by each
639 CU or TU to the corresponding section in the package file. Like
640 the table of offsets, it is a two-dimensional array of 4-byte
645 entries and $U$ rows, in row-major order. Each row in
646 the array is indexed starting from 1 (row 0 of the table of
647 offsets also serves as the key for the table of sizes).
650 For an example, see Figure \refersec{fig:examplecuindexsection}.
653 \subsection{DWARF Supplementary Object Files}
654 \label{datarep:dwarfsupplemetaryobjectfiles}
655 In order to minimize the size of debugging information,
656 it is possible to move duplicate debug information entries,
657 strings and macro entries from several executables or shared
658 object files into a separate
659 \addtoindexi{\textit{supplementary object file}}{supplementary object file}
660 by some post-linking utility; the moved entries and strings can
665 from the debugging information of each of those executable or
669 This facilitates distribution of separate consolidated debug files in
674 A DWARF \addtoindex{supplementary object file} is itself an object file,
675 using the same object
676 file format, \byteorder{}, and size as the corresponding application executables
677 or shared libraries. It consists only of a file header, section table, and
678 a number of DWARF debug information sections. Both the
679 \addtoindex{supplementary object file}
680 and all the executable or shared object files that reference entries or strings in that
681 file must contain a \dotdebugsup{} section that establishes the relationship.
683 The \dotdebugsup{} section contains:
684 \begin{enumerate}[1. ]
685 \item \texttt{version} (\HFTuhalf) \\
686 \addttindexx{version}
687 A 2-byte unsigned integer representing the version of the DWARF
688 information for the compilation unit.
691 The value in this field is \versiondotdebugsup.
693 \item \texttt{is\_supplementary} (\HFTubyte) \\
694 \addttindexx{is\_supplementary}
695 A 1-byte unsigned integer, which contains the value 1 if it is
696 in the \addtoindex{supplementary object file} that other executable or
697 shared object files refer to, or 0 if it is an executable or shared object
698 referring to a \addtoindex{supplementary object file}.
701 \item \texttt{sup\_filename} (null terminated filename string) \\
702 \addttindexx{sup\_filename}
703 If \addttindex{is\_supplementary} is 0, this contains either an absolute
704 filename for the \addtoindex{supplementary object file}, or a filename
705 relative to the object file containing the \dotdebugsup{} section.
706 If \addttindex{is\_supplementary} is 1, then \addttindex{sup\_filename}
707 is not needed and must be an empty string (a single null byte).
710 \item \texttt{sup\_checksum\_len} (unsigned LEB128) \\
711 \addttindexx{sup\_checksum\_len}
712 Length of the following \addttindex{sup\_checksum} field;
713 this value can be 0 if no checksum is provided.
715 \item \texttt{sup\_checksum} (array of \HFTubyte) \\
716 \addttindexx{sup\_checksum}
718 An implementation-defined integer constant value that
719 provides unique identification of the supplementary file.
724 Debug information entries that refer to an executable's or shared
725 object's addresses must \emph{not} be moved to supplementary files (the
726 addesses will likely not be the same). Similarly,
727 entries referenced from within location
732 form attributes must not be moved to a \addtoindex{supplementary object file}.
734 Executable or shared object file compilation units can use
735 \DWTAGimportedunit{} with \DWFORMrefsup{} form \DWATimport{} attribute
736 to import entries from the \addtoindex{supplementary object file}, other \DWFORMrefsup{}
737 attributes to refer to them and \DWFORMstrpsup{} form attributes to
738 refer to strings that are used by debug information of multiple
739 executables or shared object files. Within the \addtoindex{supplementary object file}'s
740 debugging sections, form \DWFORMrefsup{} or \DWFORMstrpsup{} are
741 not used, and all reference forms referring to some other sections
742 refer to the local sections in the \addtoindex{supplementary object file}.
744 In macro information, \DWMACROdefinesup{} or
745 \DWMACROundefsup{} opcodes can refer to strings in the
746 \dotdebugstr{} section of the \addtoindex{supplementary object file},
747 or \DWMACROimportsup{}
748 can refer to \dotdebugmacro{} section entries. Within the
749 \dotdebugmacro{} section of a \addtoindex{supplementary object file},
750 \DWMACROdefinestrp{} and \DWMACROundefstrp{}
751 opcodes refer to the local \dotdebugstr{} section in that
752 supplementary file, not the one in
753 the executable or shared object file.
757 \section{32-Bit and 64-Bit DWARF Formats}
758 \label{datarep:32bitand64bitdwarfformats}
759 \hypertarget{datarep:xxbitdwffmt}{}
760 \addtoindexx{32-bit DWARF format}
761 \addtoindexx{64-bit DWARF format}
764 closely-related DWARF
766 formats. In the 32-bit DWARF
767 format, all values that represent lengths of DWARF sections
768 and offsets relative to the beginning of DWARF sections are
769 represented using four bytes. In the 64-bit DWARF format, all
770 values that represent lengths of DWARF sections and offsets
771 relative to the beginning of DWARF sections are represented
772 using eight bytes. A special convention applies to the initial
773 length field of certain DWARF sections, as well as the CIE and
774 FDE structures, so that the 32-bit and 64-bit DWARF formats
775 can coexist and be distinguished within a single linked object.
778 Except where noted otherwise, all references in this document
779 to a debugging information section (for example, \dotdebuginfo),
780 apply also to the corresponding split DWARF section (for example,
784 The differences between the 32- and 64-bit DWARF formats are
785 detailed in the following:
786 \begin{enumerate}[1. ]
788 \item In the 32-bit DWARF format, an
789 \addtoindex{initial length} field (see
790 \addtoindexx{initial length!encoding}
791 Section \ref{datarep:initiallengthvalues} on page \pageref{datarep:initiallengthvalues})
792 is an unsigned 4-byte integer (which
793 must be less than \xfffffffzero); in the 64-bit DWARF format,
794 an \addtoindex{initial length} field is 12 bytes in size,
797 \item The first four bytes have the value \xffffffff.
799 \item The following eight bytes contain the actual length
800 represented as an unsigned 8-byte integer.
803 \textit{This representation allows a DWARF consumer to dynamically
804 detect that a DWARF section contribution is using the 64-bit
805 format and to adapt its processing accordingly.}
808 \item \hypertarget{datarep:sectionoffsetlength}{}
809 Section offset and section length
810 \addtoindexx{section length!use in headers}
812 \addtoindexx{section offset!use in headers}
813 in the headers of DWARF sections (other than initial length
814 \addtoindexx{initial length}
815 fields) are listed following. In the 32-bit DWARF format these
816 are 4-byte unsigned integer values; in the 64-bit DWARF format,
817 they are 8-byte unsigned integer values.
821 Section &Name & Role \\ \hline
822 \dotdebugaranges{} & \addttindex{debug\_info\_offset} & offset in \dotdebuginfo{} \\
823 \dotdebugframe{}/CIE & \addttindex{CIE\_id} & CIE distinguished value \\
824 \dotdebugframe{}/FDE & \addttindex{CIE\_pointer} & offset in \dotdebugframe{} \\
825 \dotdebuginfo{} & \addttindex{debug\_abbrev\_offset} & offset in \dotdebugabbrev{} \\
826 \dotdebugline{} & \addttindex{header\_length} & length of header itself \\
827 \dotdebugnames{} & entry in array of CUs & offset in \dotdebuginfo{} \\
833 The \texttt{CIE\_id} field in a CIE structure must be 64 bits because
834 it overlays the \texttt{CIE\_pointer} in a FDE structure; this implicit
835 union must be accessed to distinguish whether a CIE or FDE is
836 present, consequently, these two fields must exactly overlay
837 each other (both offset and size).
839 \item Within the body of the \dotdebuginfo{}
840 section, certain forms of attribute value depend on the choice
841 of DWARF format as follows. For the 32-bit DWARF format,
842 the value is a 4-byte unsigned integer; for the 64-bit DWARF
843 format, the value is an 8-byte unsigned integer.
845 \begin{tabular}{lp{6cm}}
846 Form & Role \\ \hline
847 \DWFORMlinestrp & offset in \dotdebuglinestr \\
848 \DWFORMrefaddr & offset in \dotdebuginfo{} \\
849 \DWFORMrefsup & offset in \dotdebuginfo{} section of a \mbox{supplementary} object file \\
850 \addtoindexx{supplementary object file}
851 \DWFORMsecoffset & offset in a section other than \\
852 & \dotdebuginfo{} or \dotdebugstr{} \\
853 \DWFORMstrp & offset in \dotdebugstr{} \\
854 \DWFORMstrpsup & offset in \dotdebugstr{} section of a \mbox{supplementary} object file \\
855 \DWOPcallref & offset in \dotdebuginfo{} \\
860 \item Within the body of the \dotdebugline{} section, certain forms of content
861 description depend on the choice of DWARF format as follows: for the
862 32-bit DWARF format, the value is a 4-byte unsigned integer; for the
863 64-bit DWARF format, the value is a 8-byte unsigned integer.
865 \begin{tabular}{lp{6cm}}
866 Form & Role \\ \hline
867 \DWFORMlinestrp & offset in \dotdebuglinestr
871 \item Within the body of the \dotdebugnames{}
872 sections, the representation of each entry in the array of
873 compilation units (CUs) and the array of local type units
874 (TUs), which represents an offset in the
876 section, depends on the DWARF format as follows: in the
877 32-bit DWARF format, each entry is a 4-byte unsigned integer;
878 in the 64-bit DWARF format, it is a 8-byte unsigned integer.
881 \item In the body of the \dotdebugstroffsets{}
883 sections, the size of entries in the body depend on the DWARF
884 format as follows: in the 32-bit DWARF format, entries are 4-byte
885 unsigned integer values; in the 64-bit DWARF format, they are
886 8-byte unsigned integers.
888 \item In the body of the \dotdebugaddr{}, \dotdebugloc{} and \dotdebugranges{}
889 sections, the contents of the address size fields depends on the
890 DWARF format as follows: in the 32-bit DWARF format, these fields
891 contain 4; in the 64-bit DWARF format these fields contain 8.
895 The 32-bit and 64-bit DWARF format conventions must \emph{not} be
896 intermixed within a single compilation unit.
898 \textit{Attribute values and section header fields that represent
899 addresses in the target program are not affected by these
902 A DWARF consumer that supports the 64-bit DWARF format must
903 support executables in which some compilation units use the
904 32-bit format and others use the 64-bit format provided that
905 the combination links correctly (that is, provided that there
906 are no link\dash time errors due to truncation or overflow). (An
907 implementation is not required to guarantee detection and
908 reporting of all such errors.)
910 \textit{It is expected that DWARF producing compilers will \emph{not} use
911 the 64-bit format \emph{by default}. In most cases, the division of
912 even very large applications into a number of executable and
913 shared object files will suffice to assure that the DWARF sections
914 within each individual linked object are less than 4 GBytes
915 in size. However, for those cases where needed, the 64-bit
916 format allows the unusual case to be handled as well. Even
917 in this case, it is expected that only application supplied
918 objects will need to be compiled using the 64-bit format;
919 separate 32-bit format versions of system supplied shared
920 executable libraries can still be used.}
923 \section{Format of Debugging Information}
924 \label{datarep:formatofdebugginginformation}
926 For each compilation unit compiled with a DWARF producer,
927 a contribution is made to the \dotdebuginfo{} section of
928 the object file. Each such contribution consists of a
929 compilation unit header
930 (see Section \refersec{datarep:compilationunitheader})
932 single \DWTAGcompileunit{} or
933 \DWTAGpartialunit{} debugging
934 information entry, together with its children.
936 For each type defined in a compilation unit, a separate
937 contribution may also be made to the
939 section of the object file. Each
940 such contribution consists of a
941 \addtoindex{type unit} header
942 (see Section \refersec{datarep:typeunitheader})
943 followed by a \DWTAGtypeunit{} entry, together with
946 Each debugging information entry begins with a code that
947 represents an entry in a separate
948 \addtoindex{abbreviations table}. This
949 code is followed directly by a series of attribute values.
951 The appropriate entry in the
952 \addtoindex{abbreviations table} guides the
953 interpretation of the information contained directly in the
954 \dotdebuginfo{} section.
957 Multiple debugging information entries may share the same
958 abbreviation table entry. Each compilation unit is associated
959 with a particular abbreviation table, but multiple compilation
960 units may share the same table.
962 \subsection{Unit Headers}
963 \label{datarep:unitheaders}
964 Unit headers contain a field, \addttindex{unit\_type}, whose value indicates the kind of
965 compilation unit that follows. The encodings for the unit type
966 enumeration are shown in Table \refersec{tab:unitheaderunitkindencodings}.
970 \setlength{\extrarowheight}{0.1cm}
971 \begin{longtable}{l|c}
972 \caption{Unit header unit type encodings}
973 \label{tab:unitheaderunitkindencodings}
974 \addtoindexx{unit header unit type encodings} \\
975 \hline \bfseries Unit header unit type encodings&\bfseries Value \\ \hline
977 \bfseries Unit header unit type encodings&\bfseries Value \\ \hline
979 \hline \emph{Continued on next page}
981 \hline \ddag\ \textit{New in DWARF Version 5}
983 \DWUTcompileTARG~\ddag &0x01 \\
984 \DWUTtypeTARG~\ddag &0x02 \\
985 \DWUTpartialTARG~\ddag &0x03 \\ \hline
991 \subsubsection{Compilation and Partial Unit Headers}
993 \label{datarep:compilationunitheader}
994 \begin{enumerate}[1. ]
996 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
997 \addttindexx{unit\_length}
999 \addtoindexx{initial length}
1000 unsigned integer representing the length
1001 of the \dotdebuginfo{}
1002 contribution for that compilation unit,
1003 not including the length field itself. In the \thirtytwobitdwarfformat,
1004 this is a 4-byte unsigned integer (which must be less
1005 than \xfffffffzero); in the \sixtyfourbitdwarfformat, this consists
1006 of the 4-byte value \wffffffff followed by an 8-byte unsigned
1007 integer that gives the actual length
1008 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1010 \item \texttt{version} (\HFTuhalf) \\
1011 \addttindexx{version}
1012 \addtoindexx{version number!compilation unit}
1013 A 2-byte unsigned integer representing the version of the
1014 DWARF information for the compilation unit.
1017 The value in this field is \versiondotdebuginfo.
1020 \textit{See also Appendix \refersec{app:dwarfsectionversionnumbersinformative}
1021 for a summary of all version numbers that apply to DWARF sections.}
1025 \item \texttt{unit\_type} (\HFTubyte) \\
1026 \addttindexx{unit\_type}
1027 A 1-byte unsigned integer identifying this unit as a compilation unit.
1028 The value of this field is
1029 \DWUTcompile{} for a full compilation unit or
1030 \DWUTpartial{} for a partial compilation unit
1031 (see Section \refersec{chap:fullandpartialcompilationunitentries}).
1033 \textit{This field is new in \DWARFVersionV.}
1037 \item \texttt{address\_size} (\HFTubyte) \\
1038 \addttindexx{address\_size}
1039 A 1-byte unsigned integer representing the size in bytes of
1040 an address on the target architecture. If the system uses
1041 \addtoindexx{address space!segmented}
1042 segmented addressing, this value represents the size of the
1043 offset portion of an address.
1046 \item \HFNdebugabbrevoffset{} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
1048 \addtoindexx{section offset!in .debug\_info header}
1049 4-byte or 8-byte unsigned offset into the
1051 section. This offset associates the compilation unit with a
1052 particular set of debugging information entry abbreviations. In
1053 the \thirtytwobitdwarfformat, this is a 4-byte unsigned length;
1054 in the \sixtyfourbitdwarfformat, this is an 8-byte unsigned length
1055 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1061 \subsubsection{Type Unit Header}
1062 \label{datarep:typeunitheader}
1064 The header for the series of debugging information entries
1065 contributing to the description of a type that has been
1066 placed in its own \addtoindex{type unit}, within the
1067 \dotdebuginfo{} section,
1068 consists of the following information:
1069 \begin{enumerate}[1. ]
1072 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
1073 \addttindexx{unit\_length}
1074 A 4-byte or 12-byte unsigned integer
1075 \addtoindexx{initial length}
1076 representing the length
1077 of the \dotdebuginfo{} contribution for that type unit,
1078 not including the length field itself. In the \thirtytwobitdwarfformat,
1079 this is a 4-byte unsigned integer (which must be
1080 less than \xfffffffzero); in the \sixtyfourbitdwarfformat, this
1081 consists of the 4-byte value \wffffffff followed by an
1082 8-byte unsigned integer that gives the actual length
1083 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1086 \item \texttt{version} (\HFTuhalf) \\
1087 \addttindexx{version}
1088 \addtoindexx{version number!type unit}
1089 A 2-byte unsigned integer representing the version of the
1090 DWARF information for the type unit.
1093 The value in this field is \versiondotdebuginfo.
1095 \item \texttt{unit\_type} (\HFTubyte) \\
1096 \addttindexx{unit\_type}
1097 A 1-byte unsigned integer identifying this unit as a type unit.
1098 The value of this field is \DWUTtype{} for a type unit
1099 (see Section \refersec{chap:typeunitentries}).
1101 \textit{This field is new in \DWARFVersionV.}
1105 \item \texttt{address\_size} (\HFTubyte) \\
1106 \addttindexx{address\_size}
1107 A 1-byte unsigned integer representing the size
1108 \addtoindexx{size of an address}
1110 an address on the target architecture. If the system uses
1111 \addtoindexx{address space!segmented}
1112 segmented addressing, this value represents the size of the
1113 offset portion of an address.
1116 \item \HFNdebugabbrevoffset{} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
1118 \addtoindexx{section offset!in .debug\_info header}
1119 4-byte or 8-byte unsigned offset into the
1121 section. This offset associates the type unit with a
1122 particular set of debugging information entry abbreviations. In
1123 the \thirtytwobitdwarfformat, this is a 4-byte unsigned length;
1124 in the \sixtyfourbitdwarfformat, this is an 8-byte unsigned length
1125 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1129 \item \texttt{type\_signature} (8-byte unsigned integer) \\
1130 \addttindexx{type\_signature}
1131 \addtoindexx{type signature}
1132 A unique 8-byte signature (see Section
1133 \refersec{datarep:typesignaturecomputation})
1134 of the type described in this type
1137 \textit{An attribute that refers (using
1138 \DWFORMrefsigeight{}) to
1139 the primary type contained in this
1140 \addtoindex{type unit} uses this value.}
1142 \item \texttt{type\_offset} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
1143 \addttindexx{type\_offset}
1144 A 4-byte or 8-byte unsigned offset
1145 \addtoindexx{section offset!in .debug\_info header}
1146 relative to the beginning
1147 of the \addtoindex{type unit} header.
1148 This offset refers to the debugging
1149 information entry that describes the type. Because the type
1150 may be nested inside a namespace or other structures, and may
1151 contain references to other types that have not been placed in
1152 separate type units, it is not necessarily either the first or
1153 the only entry in the type unit. In the \thirtytwobitdwarfformat,
1154 this is a 4-byte unsigned length; in the \sixtyfourbitdwarfformat,
1155 this is an 8-byte unsigned length
1156 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1160 \subsection{Debugging Information Entry}
1161 \label{datarep:debugginginformationentry}
1163 Each debugging information entry begins with an
1164 unsigned LEB128\addtoindexx{LEB128!unsigned}
1165 number containing the abbreviation code for the entry. This
1166 code represents an entry within the abbreviations table
1167 associated with the compilation unit containing this entry. The
1168 abbreviation code is followed by a series of attribute values.
1170 On some architectures, there are alignment constraints on
1171 section boundaries. To make it easier to pad debugging
1172 information sections to satisfy such constraints, the
1173 abbreviation code 0 is reserved. Debugging information entries
1174 consisting of only the abbreviation code 0 are considered
1177 \subsection{Abbreviations Tables}
1178 \label{datarep:abbreviationstables}
1180 The abbreviations tables for all compilation units
1181 are contained in a separate object file section called
1183 As mentioned before, multiple compilation
1184 units may share the same abbreviations table.
1186 The abbreviations table for a single compilation unit consists
1187 of a series of abbreviation declarations. Each declaration
1188 specifies the tag and attributes for a particular form of
1189 debugging information entry. Each declaration begins with
1190 an unsigned LEB128\addtoindexx{LEB128!unsigned}
1191 number representing the abbreviation
1192 code itself. It is this code that appears at the beginning
1193 of a debugging information entry in the
1195 section. As described above, the abbreviation
1196 code 0 is reserved for null debugging information entries. The
1197 abbreviation code is followed by another unsigned LEB128\addtoindexx{LEB128!unsigned}
1198 number that encodes the entry\textquoteright s tag. The encodings for the
1199 tag names are given in
1200 Table \referfol{tab:tagencodings}.
1203 \setlength{\extrarowheight}{0.1cm}
1204 \begin{longtable}{l|c}
1205 \caption{Tag encodings} \label{tab:tagencodings} \\
1206 \hline \bfseries Tag name&\bfseries Value\\ \hline
1208 \bfseries Tag name&\bfseries Value \\ \hline
1210 \hline \emph{Continued on next page}
1212 \hline \ddag\ \textit{New in DWARF Version 5}
1214 \DWTAGarraytype{} &0x01 \\
1215 \DWTAGclasstype&0x02 \\
1216 \DWTAGentrypoint&0x03 \\
1217 \DWTAGenumerationtype&0x04 \\
1218 \DWTAGformalparameter&0x05 \\
1219 \DWTAGimporteddeclaration&0x08 \\
1221 \DWTAGlexicalblock&0x0b \\
1222 \DWTAGmember&0x0d \\
1223 \DWTAGpointertype&0x0f \\
1224 \DWTAGreferencetype&0x10 \\
1225 \DWTAGcompileunit&0x11 \\
1226 \DWTAGstringtype&0x12 \\
1227 \DWTAGstructuretype&0x13 \\
1228 \DWTAGsubroutinetype&0x15 \\
1229 \DWTAGtypedef&0x16 \\
1230 \DWTAGuniontype&0x17 \\
1231 \DWTAGunspecifiedparameters&0x18 \\
1232 \DWTAGvariant&0x19 \\
1233 \DWTAGcommonblock&0x1a \\
1234 \DWTAGcommoninclusion&0x1b \\
1235 \DWTAGinheritance&0x1c \\
1236 \DWTAGinlinedsubroutine&0x1d \\
1237 \DWTAGmodule&0x1e \\
1238 \DWTAGptrtomembertype&0x1f \\
1239 \DWTAGsettype&0x20 \\
1240 \DWTAGsubrangetype&0x21 \\
1241 \DWTAGwithstmt&0x22 \\
1242 \DWTAGaccessdeclaration&0x23 \\
1243 \DWTAGbasetype&0x24 \\
1244 \DWTAGcatchblock&0x25 \\
1245 \DWTAGconsttype&0x26 \\
1246 \DWTAGconstant&0x27 \\
1247 \DWTAGenumerator&0x28 \\
1248 \DWTAGfiletype&0x29 \\
1249 \DWTAGfriend&0x2a \\
1250 \DWTAGnamelist&0x2b \\
1251 \DWTAGnamelistitem&0x2c \\
1252 \DWTAGpackedtype&0x2d \\
1253 \DWTAGsubprogram&0x2e \\
1254 \DWTAGtemplatetypeparameter&0x2f \\
1255 \DWTAGtemplatevalueparameter&0x30 \\
1256 \DWTAGthrowntype&0x31 \\
1257 \DWTAGtryblock&0x32 \\
1258 \DWTAGvariantpart&0x33 \\
1259 \DWTAGvariable&0x34 \\
1260 \DWTAGvolatiletype&0x35 \\
1261 \DWTAGdwarfprocedure&0x36 \\
1262 \DWTAGrestricttype&0x37 \\
1263 \DWTAGinterfacetype&0x38 \\
1264 \DWTAGnamespace&0x39 \\
1265 \DWTAGimportedmodule&0x3a \\
1266 \DWTAGunspecifiedtype&0x3b \\
1267 \DWTAGpartialunit&0x3c \\
1268 \DWTAGimportedunit&0x3d \\
1269 \DWTAGcondition&\xiiif \\
1270 \DWTAGsharedtype&0x40 \\
1271 \DWTAGtypeunit & 0x41 \\
1272 \DWTAGrvaluereferencetype & 0x42 \\
1273 \DWTAGtemplatealias & 0x43 \\
1274 \DWTAGcoarraytype~\ddag & 0x44 \\
1275 \DWTAGgenericsubrange~\ddag & 0x45 \\
1276 \DWTAGdynamictype~\ddag & 0x46 \\
1277 \DWTAGatomictype~\ddag & 0x47 \\
1278 \DWTAGcallsite~\ddag & 0x48 \\
1279 \DWTAGcallsiteparameter~\ddag & 0x49 \\
1280 \DWTAGlouser&0x4080 \\
1281 \DWTAGhiuser&\xffff \\
1286 Following the tag encoding is a 1-byte value that determines
1287 whether a debugging information entry using this abbreviation
1288 has child entries or not. If the value is
1290 the next physically succeeding entry of any debugging
1291 information entry using this abbreviation is the first
1292 child of that entry. If the 1-byte value following the
1293 abbreviation\textquoteright s tag encoding is
1294 \DWCHILDRENnoTARG, the next
1295 physically succeeding entry of any debugging information entry
1296 using this abbreviation is a sibling of that entry. (Either
1297 the first child or sibling entries may be null entries). The
1298 encodings for the child determination byte are given in
1299 Table \refersec{tab:childdeterminationencodings}
1301 Section \refersec{chap:relationshipofdebugginginformationentries},
1302 each chain of sibling entries is terminated by a null entry.)
1306 \setlength{\extrarowheight}{0.1cm}
1307 \begin{longtable}{l|c}
1308 \caption{Child determination encodings}
1309 \label{tab:childdeterminationencodings}
1310 \addtoindexx{Child determination encodings} \\
1311 \hline \bfseries Children determination name&\bfseries Value \\ \hline
1313 \bfseries Children determination name&\bfseries Value \\ \hline
1315 \hline \emph{Continued on next page}
1319 \DWCHILDRENno&0x00 \\
1320 \DWCHILDRENyes&0x01 \\ \hline
1325 Finally, the child encoding is followed by a series of
1326 attribute specifications. Each attribute specification
1327 consists of two parts. The first part is an
1328 unsigned LEB128\addtoindexx{LEB128!unsigned}
1329 number representing the attribute\textquoteright s name.
1330 The second part is an
1331 unsigned LEB128\addtoindexx{LEB128!unsigned}
1332 number representing the attribute\textquoteright s form.
1333 The series of attribute specifications ends with an
1334 entry containing 0 for the name and 0 for the form.
1337 \DWFORMindirectTARG{} is a special case. For
1338 attributes with this form, the attribute value itself in the
1340 section begins with an unsigned
1341 LEB128 number that represents its form. This allows producers
1342 to choose forms for particular attributes
1343 \addtoindexx{abbreviations table!dynamic forms in}
1345 without having to add a new entry to the abbreviations table.
1347 The attribute form \DWFORMimplicitconstTARG{} is another special case.
1348 For attributes with this form, the attribute specification contains
1349 a third part, which is a signed LEB128\addtoindexx{LEB128!signed}
1350 number. The value of this number is used as the value of the
1351 attribute, and no value is stored in the \dotdebuginfo{} section.
1353 The abbreviations for a given compilation unit end with an
1354 entry consisting of a 0 byte for the abbreviation code.
1357 Appendix \refersec{app:compilationunitsandabbreviationstableexample}
1358 for a depiction of the organization of the
1359 debugging information.}
1362 \subsection{Attribute Encodings}
1363 \label{datarep:attributeencodings}
1365 The encodings for the attribute names are given in
1366 Table \referfol{tab:attributeencodings}.
1369 \setlength{\extrarowheight}{0.1cm}
1370 \begin{longtable}{l|c|l}
1371 \caption{Attribute encodings}
1372 \label{tab:attributeencodings}
1373 \addtoindexx{attribute encodings} \\
1374 \hline \bfseries Attribute name&\bfseries Value &\bfseries Classes \\ \hline
1376 \bfseries Attribute name&\bfseries Value &\bfseries Classes\\ \hline
1378 \hline \emph{Continued on next page}
1380 \hline \ddag\ \textit{New in DWARF Version 5}
1382 \DWATsibling&0x01&\livelink{chap:classreference}{reference}
1383 \addtoindexx{sibling attribute} \\
1384 \DWATlocation&0x02&\livelink{chap:classexprloc}{exprloc},
1385 \livelink{chap:classloclistptr}{loclistptr}
1386 \addtoindexx{location attribute} \\
1387 \DWATname&0x03&\livelink{chap:classstring}{string}
1388 \addtoindexx{name attribute} \\
1389 \DWATordering&0x09&\livelink{chap:classconstant}{constant}
1390 \addtoindexx{ordering attribute} \\
1391 \DWATbytesize&0x0b&\livelink{chap:classconstant}{constant},
1392 \livelink{chap:classexprloc}{exprloc},
1393 \livelink{chap:classreference}{reference}
1394 \addtoindexx{byte size attribute} \\
1395 \textit{Reserved}&0x0c\footnote{Code 0x0c is reserved to allow backward compatible support of the
1396 DW\_AT\_bit\_offset \mbox{attribute} which was
1397 defined in \DWARFVersionIII{} and earlier.}
1398 &\livelink{chap:classconstant}{constant},
1399 \livelink{chap:classexprloc}{exprloc},
1400 \livelink{chap:classreference}{reference}
1401 \addtoindexx{bit offset attribute (Version 3)}
1402 \addtoindexx{DW\_AT\_bit\_offset (deprecated)} \\
1403 \DWATbitsize&0x0d&\livelink{chap:classconstant}{constant},
1404 \livelink{chap:classexprloc}{exprloc},
1405 \livelink{chap:classreference}{reference}
1406 \addtoindexx{bit size attribute} \\
1407 \DWATstmtlist&0x10&\livelink{chap:classlineptr}{lineptr}
1408 \addtoindexx{statement list attribute} \\
1409 \DWATlowpc&0x11&\livelink{chap:classaddress}{address}
1410 \addtoindexx{low PC attribute} \\
1411 \DWAThighpc&0x12&\livelink{chap:classaddress}{address},
1412 \livelink{chap:classconstant}{constant}
1413 \addtoindexx{high PC attribute} \\
1414 \DWATlanguage&0x13&\livelink{chap:classconstant}{constant}
1415 \addtoindexx{language attribute} \\
1416 \DWATdiscr&0x15&\livelink{chap:classreference}{reference}
1417 \addtoindexx{discriminant attribute} \\
1418 \DWATdiscrvalue&0x16&\livelink{chap:classconstant}{constant}
1419 \addtoindexx{discriminant value attribute} \\
1420 \DWATvisibility&0x17&\livelink{chap:classconstant}{constant}
1421 \addtoindexx{visibility attribute} \\
1422 \DWATimport&0x18&\livelink{chap:classreference}{reference}
1423 \addtoindexx{import attribute} \\
1424 \DWATstringlength&0x19&\livelink{chap:classexprloc}{exprloc},
1425 \livelink{chap:classloclistptr}{loclistptr}
1426 \addtoindexx{string length attribute} \\
1427 \DWATcommonreference&0x1a&\livelink{chap:classreference}{reference}
1428 \addtoindexx{common reference attribute} \\
1429 \DWATcompdir&0x1b&\livelink{chap:classstring}{string}
1430 \addtoindexx{compilation directory attribute} \\
1431 \DWATconstvalue&0x1c&\livelink{chap:classblock}{block},
1432 \livelink{chap:classconstant}{constant},
1433 \livelink{chap:classstring}{string}
1434 \addtoindexx{constant value attribute} \\
1435 \DWATcontainingtype&0x1d&\livelink{chap:classreference}{reference}
1436 \addtoindexx{containing type attribute} \\
1437 \DWATdefaultvalue&0x1e&\livelink{chap:classconstant}{constant},
1438 \livelink{chap:classreference}{reference},
1439 \livelink{chap:classflag}{flag}
1440 \addtoindexx{default value attribute} \\
1441 \DWATinline&0x20&\livelink{chap:classconstant}{constant}
1442 \addtoindexx{inline attribute} \\
1443 \DWATisoptional&0x21&\livelink{chap:classflag}{flag}
1444 \addtoindexx{is optional attribute} \\
1445 \DWATlowerbound&0x22&\livelink{chap:classconstant}{constant},
1446 \livelink{chap:classexprloc}{exprloc},
1447 \livelink{chap:classreference}{reference}
1448 \addtoindexx{lower bound attribute} \\
1449 \DWATproducer&0x25&\livelink{chap:classstring}{string}
1450 \addtoindexx{producer attribute} \\
1451 \DWATprototyped&0x27&\livelink{chap:classflag}{flag}
1452 \addtoindexx{prototyped attribute} \\
1453 \DWATreturnaddr&0x2a&\livelink{chap:classexprloc}{exprloc},
1454 \livelink{chap:classloclistptr}{loclistptr}
1455 \addtoindexx{return address attribute} \\
1456 \DWATstartscope&0x2c&\livelink{chap:classconstant}{constant},
1457 \livelink{chap:classrangelistptr}{rangelistptr}
1458 \addtoindexx{start scope attribute} \\
1459 \DWATbitstride&0x2e&\livelink{chap:classconstant}{constant},
1460 \livelink{chap:classexprloc}{exprloc},
1461 \livelink{chap:classreference}{reference}
1462 \addtoindexx{bit stride attribute} \\
1463 \DWATupperbound&0x2f&\livelink{chap:classconstant}{constant},
1464 \livelink{chap:classexprloc}{exprloc},
1465 \livelink{chap:classreference}{reference}
1466 \addtoindexx{upper bound attribute} \\
1467 \DWATabstractorigin&0x31&\livelink{chap:classreference}{reference}
1468 \addtoindexx{abstract origin attribute} \\
1469 \DWATaccessibility&0x32&\livelink{chap:classconstant}{constant}
1470 \addtoindexx{accessibility attribute} \\
1471 \DWATaddressclass&0x33&\livelink{chap:classconstant}{constant}
1472 \addtoindexx{address class attribute} \\
1473 \DWATartificial&0x34&\livelink{chap:classflag}{flag}
1474 \addtoindexx{artificial attribute} \\
1475 \DWATbasetypes&0x35&\livelink{chap:classreference}{reference}
1476 \addtoindexx{base types attribute} \\
1477 \DWATcallingconvention&0x36&\livelink{chap:classconstant}{constant}
1478 \addtoindexx{calling convention attribute} \\
1479 \DWATcount&0x37&\livelink{chap:classconstant}{constant},
1480 \livelink{chap:classexprloc}{exprloc},
1481 \livelink{chap:classreference}{reference}
1482 \addtoindexx{count attribute} \\
1483 \DWATdatamemberlocation&0x38&\livelink{chap:classconstant}{constant},
1484 \livelink{chap:classexprloc}{exprloc},
1485 \livelink{chap:classloclistptr}{loclistptr}
1486 \addtoindexx{data member attribute} \\
1487 \DWATdeclcolumn&0x39&\livelink{chap:classconstant}{constant}
1488 \addtoindexx{declaration column attribute} \\
1489 \DWATdeclfile&0x3a&\livelink{chap:classconstant}{constant}
1490 \addtoindexx{declaration file attribute} \\
1491 \DWATdeclline&0x3b&\livelink{chap:classconstant}{constant}
1492 \addtoindexx{declaration line attribute} \\
1493 \DWATdeclaration&0x3c&\livelink{chap:classflag}{flag}
1494 \addtoindexx{declaration attribute} \\
1495 \DWATdiscrlist&0x3d&\livelink{chap:classblock}{block}
1496 \addtoindexx{discriminant list attribute} \\
1497 \DWATencoding&0x3e&\livelink{chap:classconstant}{constant}
1498 \addtoindexx{encoding attribute} \\
1499 \DWATexternal&\xiiif&\livelink{chap:classflag}{flag}
1500 \addtoindexx{external attribute} \\
1501 \DWATframebase&0x40&\livelink{chap:classexprloc}{exprloc},
1502 \livelink{chap:classloclistptr}{loclistptr}
1503 \addtoindexx{frame base attribute} \\
1504 \DWATfriend&0x41&\livelink{chap:classreference}{reference}
1505 \addtoindexx{friend attribute} \\
1506 \DWATidentifiercase&0x42&\livelink{chap:classconstant}{constant}
1507 \addtoindexx{identifier case attribute} \\
1509 \textit{Reserved}&0x43\footnote{Code 0x43 is reserved to allow backward compatible support of the
1510 DW\_AT\_macro\_info \mbox{attribute} which was
1511 defined in \DWARFVersionIV{} and earlier.}
1513 &\livelink{chap:classmacptr}{macptr}
1514 \addtoindexx{macro information attribute (legacy)!encoding} \\
1515 \DWATnamelistitem&0x44&\livelink{chap:classreference}{reference}
1516 \addtoindexx{name list item attribute} \\
1517 \DWATpriority&0x45&\livelink{chap:classreference}{reference}
1518 \addtoindexx{priority attribute} \\
1519 \DWATsegment&0x46&\livelink{chap:classexprloc}{exprloc},
1520 \livelink{chap:classloclistptr}{loclistptr}
1521 \addtoindexx{segment attribute} \\
1522 \DWATspecification&0x47&\livelink{chap:classreference}{reference}
1523 \addtoindexx{specification attribute} \\
1524 \DWATstaticlink&0x48&\livelink{chap:classexprloc}{exprloc},
1525 \livelink{chap:classloclistptr}{loclistptr}
1526 \addtoindexx{static link attribute} \\
1527 \DWATtype&0x49&\livelink{chap:classreference}{reference}
1528 \addtoindexx{type attribute} \\
1529 \DWATuselocation&0x4a&\livelink{chap:classexprloc}{exprloc},
1530 \livelink{chap:classloclistptr}{loclistptr}
1531 \addtoindexx{location list attribute} \\
1532 \DWATvariableparameter&0x4b&\livelink{chap:classflag}{flag}
1533 \addtoindexx{variable parameter attribute} \\
1534 \DWATvirtuality&0x4c&\livelink{chap:classconstant}{constant}
1535 \addtoindexx{virtuality attribute} \\
1536 \DWATvtableelemlocation&0x4d&\livelink{chap:classexprloc}{exprloc},
1537 \livelink{chap:classloclistptr}{loclistptr}
1538 \addtoindexx{vtable element location attribute} \\
1539 \DWATallocated&0x4e&\livelink{chap:classconstant}{constant},
1540 \livelink{chap:classexprloc}{exprloc},
1541 \livelink{chap:classreference}{reference}
1542 \addtoindexx{allocated attribute} \\
1543 \DWATassociated&0x4f&\livelink{chap:classconstant}{constant},
1544 \livelink{chap:classexprloc}{exprloc},
1545 \livelink{chap:classreference}{reference}
1546 \addtoindexx{associated attribute} \\
1547 \DWATdatalocation&0x50&\livelink{chap:classexprloc}{exprloc}
1548 \addtoindexx{data location attribute} \\
1549 \DWATbytestride&0x51&\livelink{chap:classconstant}{constant},
1550 \livelink{chap:classexprloc}{exprloc},
1551 \livelink{chap:classreference}{reference}
1552 \addtoindexx{byte stride attribute} \\
1553 \DWATentrypc&0x52&\livelink{chap:classaddress}{address},
1554 \livelink{chap:classconstant}{constant}
1555 \addtoindexx{entry PC attribute} \\
1556 \DWATuseUTFeight&0x53&\livelink{chap:classflag}{flag}
1557 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8} \\
1558 \DWATextension&0x54&\livelink{chap:classreference}{reference}
1559 \addtoindexx{extension attribute} \\
1560 \DWATranges&0x55&\livelink{chap:classrangelistptr}{rangelistptr}
1561 \addtoindexx{ranges attribute} \\
1562 \DWATtrampoline&0x56&\livelink{chap:classaddress}{address},
1563 \livelink{chap:classflag}{flag},
1564 \livelink{chap:classreference}{reference},
1565 \livelink{chap:classstring}{string}
1566 \addtoindexx{trampoline attribute} \\
1567 \DWATcallcolumn&0x57&\livelink{chap:classconstant}{constant}
1568 \addtoindexx{call column attribute} \\
1569 \DWATcallfile&0x58&\livelink{chap:classconstant}{constant}
1570 \addtoindexx{call file attribute} \\
1571 \DWATcallline&0x59&\livelink{chap:classconstant}{constant}
1572 \addtoindexx{call line attribute} \\
1573 \DWATdescription&0x5a&\livelink{chap:classstring}{string}
1574 \addtoindexx{description attribute} \\
1575 \DWATbinaryscale&0x5b&\livelink{chap:classconstant}{constant}
1576 \addtoindexx{binary scale attribute} \\
1577 \DWATdecimalscale&0x5c&\livelink{chap:classconstant}{constant}
1578 \addtoindexx{decimal scale attribute} \\
1579 \DWATsmall{} &0x5d&\livelink{chap:classreference}{reference}
1580 \addtoindexx{small attribute} \\
1581 \DWATdecimalsign&0x5e&\livelink{chap:classconstant}{constant}
1582 \addtoindexx{decimal scale attribute} \\
1583 \DWATdigitcount&0x5f&\livelink{chap:classconstant}{constant}
1584 \addtoindexx{digit count attribute} \\
1585 \DWATpicturestring&0x60&\livelink{chap:classstring}{string}
1586 \addtoindexx{picture string attribute} \\
1587 \DWATmutable&0x61&\livelink{chap:classflag}{flag}
1588 \addtoindexx{mutable attribute} \\
1589 \DWATthreadsscaled&0x62&\livelink{chap:classflag}{flag}
1590 \addtoindexx{thread scaled attribute} \\
1591 \DWATexplicit&0x63&\livelink{chap:classflag}{flag}
1592 \addtoindexx{explicit attribute} \\
1593 \DWATobjectpointer&0x64&\livelink{chap:classreference}{reference}
1594 \addtoindexx{object pointer attribute} \\
1595 \DWATendianity&0x65&\livelink{chap:classconstant}{constant}
1596 \addtoindexx{endianity attribute} \\
1597 \DWATelemental&0x66&\livelink{chap:classflag}{flag}
1598 \addtoindexx{elemental attribute} \\
1599 \DWATpure&0x67&\livelink{chap:classflag}{flag}
1600 \addtoindexx{pure attribute} \\
1601 \DWATrecursive&0x68&\livelink{chap:classflag}{flag}
1602 \addtoindexx{recursive attribute} \\
1603 \DWATsignature{} &0x69&\livelink{chap:classreference}{reference}
1604 \addtoindexx{signature attribute} \\
1605 \DWATmainsubprogram{} &0x6a&\livelink{chap:classflag}{flag}
1606 \addtoindexx{main subprogram attribute} \\
1607 \DWATdatabitoffset{} &0x6b&\livelink{chap:classconstant}{constant}
1608 \addtoindexx{data bit offset attribute} \\
1609 \DWATconstexpr{} &0x6c&\livelink{chap:classflag}{flag}
1610 \addtoindexx{constant expression attribute} \\
1611 \DWATenumclass{} &0x6d&\livelink{chap:classflag}{flag}
1612 \addtoindexx{enumeration class attribute} \\
1613 \DWATlinkagename{} &0x6e&\livelink{chap:classstring}{string}
1614 \addtoindexx{linkage name attribute} \\
1615 \DWATstringlengthbitsize{}~\ddag&0x6f&
1616 \livelink{chap:classconstant}{constant}
1617 \addtoindexx{string length attribute!size of length} \\
1618 \DWATstringlengthbytesize{}~\ddag&0x70&
1619 \livelink{chap:classconstant}{constant}
1620 \addtoindexx{string length attribute!size of length} \\
1621 \DWATrank~\ddag&0x71&
1622 \livelink{chap:classconstant}{constant},
1623 \livelink{chap:classexprloc}{exprloc}
1624 \addtoindexx{rank attribute} \\
1625 \DWATstroffsetsbase~\ddag&0x72&
1626 \livelinki{chap:classstroffsetsptr}{stroffsetsptr}{stroffsetsptr class}
1627 \addtoindexx{string offsets base!encoding} \\
1628 \DWATaddrbase~\ddag &0x73&
1629 \livelinki{chap:classaddrptr}{addrptr}{addrptr class}
1630 \addtoindexx{address table base!encoding} \\
1631 \DWATrangesbase~\ddag&0x74&
1632 \livelinki{chap:classrangelistptr}{rangelistptr}{rangelistptr class}
1633 \addtoindexx{ranges base!encoding} \\
1634 \DWATdwoid~\ddag &0x75&
1635 \livelink{chap:classconstant}{constant}
1636 \addtoindexx{split DWARF object file id!encoding} \\
1637 \DWATdwoname~\ddag &0x76&
1638 \livelink{chap:classstring}{string}
1639 \addtoindexx{split DWARF object file name!encoding} \\
1640 \DWATreference~\ddag &0x77&
1641 \livelink{chap:classflag}{flag} \\
1642 \DWATrvaluereference~\ddag &0x78&
1643 \livelink{chap:classflag}{flag} \\
1644 \DWATmacros~\ddag &0x79&\livelink{chap:classmacptr}{macptr}
1645 \addtoindexx{macro information attribute} \\
1646 \DWATcallallcalls~\ddag &0x7a&\CLASSflag
1647 \addtoindexx{all calls summary attribute} \\
1648 \DWATcallallsourcecalls~\ddag &0x7b &\CLASSflag
1649 \addtoindexx{all source calls summary attribute} \\
1650 \DWATcallalltailcalls~\ddag &0x7c&\CLASSflag
1651 \addtoindexx{all tail calls summary attribute} \\
1652 \DWATcallreturnpc~\ddag &0x7d &\CLASSaddress
1653 \addtoindexx{call return PC attribute} \\
1654 \DWATcallvalue~\ddag &0x7e &\CLASSexprloc
1655 \addtoindexx{call value attribute} \\
1656 \DWATcallorigin~\ddag &0x7f &\CLASSexprloc
1657 \addtoindexx{call origin attribute} \\
1658 \DWATcallparameter~\ddag &0x80 &\CLASSreference
1659 \addtoindexx{call parameter attribute} \\
1660 \DWATcallpc~\ddag &0x81 &\CLASSaddress
1661 \addtoindexx{call PC attribute} \\
1662 \DWATcalltailcall~\ddag &0x82 &\CLASSflag
1663 \addtoindexx{call tail call attribute} \\
1664 \DWATcalltarget~\ddag &0x83 &\CLASSexprloc
1665 \addtoindexx{call target attribute} \\
1666 \DWATcalltargetclobbered~\ddag &0x84 &\CLASSexprloc
1667 \addtoindexx{call target clobbered attribute} \\
1668 \DWATcalldatalocation~\ddag &0x85 &\CLASSexprloc
1669 \addtoindexx{call data location attribute} \\
1670 \DWATcalldatavalue~\ddag &0x86 &\CLASSexprloc
1671 \addtoindexx{call data value attribute} \\
1672 \DWATnoreturn~\ddag &0x87 &\CLASSflag
1673 \addtoindexx{noreturn attribute} \\
1674 \DWATalignment~\ddag &0x88 &\CLASSconstant
1675 \addtoindexx{alignment attribute} \\
1676 \DWATexportsymbols~\ddag &0x89 &\CLASSflag
1677 \addtoindexx{export symbols attribute} \\
1678 \DWATdeleted~\ddag &0x8a &\CLASSflag \addtoindexx{deleted attribute} \\
1679 \DWATdefaulted~\ddag &0x8b &\CLASSconstant \addtoindexx{defaulted attribute} \\
1680 \DWATlouser&0x2000 & --- \addtoindexx{low user attribute encoding} \\
1681 \DWAThiuser&\xiiifff& --- \addtoindexx{high user attribute encoding} \\
1686 The attribute form governs how the value of the attribute is
1687 encoded. There are nine classes of form, listed below. Each
1688 class is a set of forms which have related representations
1689 and which are given a common interpretation according to the
1690 attribute in which the form is used.
1692 Form \DWFORMsecoffsetTARG{}
1694 \addtoindexx{rangelistptr class}
1696 \addtoindexx{macptr class}
1698 \addtoindexx{loclistptr class}
1700 \addtoindexx{lineptr class}
1706 \CLASSrangelistptr{} or
1707 \CLASSstroffsetsptr;
1708 the list of classes allowed by the applicable attribute in
1709 Table \refersec{tab:attributeencodings}
1710 determines the class of the form.
1713 In the form descriptions that follow, some forms are said
1714 to depend in part on the value of an attribute of the
1715 \definition{\associatedcompilationunit}:
1718 In the case of a \splitDWARFobjectfile{}, the associated
1719 compilation unit is the skeleton compilation unit corresponding
1720 to the containing unit.
1721 \item Otherwise, the associated compilation unit
1722 is the containing unit.
1726 Each possible form belongs to one or more of the following classes
1727 (see Table \refersec{tab:classesofattributevalue} for a summary of
1728 the purpose and general usage of each class):
1731 \item \livelinki{chap:classaddress}{address}{address class} \\
1732 \livetarg{datarep:classaddress}{}
1733 Represented as either:
1735 \item An object of appropriate size to hold an
1736 address on the target machine
1738 The size is encoded in the compilation unit header
1739 (see Section \refersec{datarep:compilationunitheader}).
1740 This address is relocatable in a relocatable object file and
1741 is relocated in an executable file or shared object file.
1743 \item An indirect index into a table of addresses (as
1744 described in the previous bullet) in the
1745 \dotdebugaddr{} section (\DWFORMaddrxTARG).
1746 The representation of a \DWFORMaddrxNAME{} value is an unsigned
1747 \addtoindex{LEB128} value, which is interpreted as a zero-based
1748 index into an array of addresses in the \dotdebugaddr{} section.
1749 The index is relative to the value of the \DWATaddrbase{} attribute
1750 of the associated compilation unit.
1755 \item \livelink{chap:classaddrptr}{addrptr} \\
1756 \livetarg{datarep:classaddrptr}{}
1757 This is an offset into the \dotdebugaddr{} section (\DWFORMsecoffset). It
1758 consists of an offset from the beginning of the \dotdebugaddr{} section to the
1759 beginning of the list of machine addresses information for the
1760 referencing entity. It is relocatable in
1761 a relocatable object file, and relocated in an executable or
1762 shared object file. In the \thirtytwobitdwarfformat, this offset
1763 is a 4-byte unsigned value; in the 64-bit DWARF
1764 format, it is an 8-byte unsigned value (see Section
1765 \refersec{datarep:32bitand64bitdwarfformats}).
1767 \textit{This class is new in \DWARFVersionV.}
1770 \item \livelink{chap:classblock}{block} \\
1771 \livetarg{datarep:classblock}{}
1772 Blocks come in four forms:
1775 A 1-byte length followed by 0 to 255 contiguous information
1776 bytes (\DWFORMblockoneTARG).
1779 A 2-byte length followed by 0 to 65,535 contiguous information
1780 bytes (\DWFORMblocktwoTARG).
1783 A 4-byte length followed by 0 to 4,294,967,295 contiguous
1784 information bytes (\DWFORMblockfourTARG).
1787 An unsigned LEB128\addtoindexx{LEB128!unsigned}
1788 length followed by the number of bytes
1789 specified by the length (\DWFORMblockTARG).
1792 In all forms, the length is the number of information bytes
1793 that follow. The information bytes may contain any mixture
1794 of relocated (or relocatable) addresses, references to other
1795 debugging information entries or data bytes.
1797 \item \livelinki{chap:classconstant}{constant}{constant class} \\
1798 \livetarg{datarep:classconstant}{}
1799 There are eight forms of constants. There are fixed length
1800 constant data forms for one-, two-, four-, eight- and sixteen-byte values
1804 \DWFORMdatafourTARG,
1805 \DWFORMdataeightTARG{} and
1806 \DWFORMdatasixteenTARG).
1807 There are variable length constant
1808 data forms encoded using
1809 signed LEB128 numbers (\DWFORMsdataTARG) and unsigned
1810 LEB128 numbers (\DWFORMudataTARG).
1811 There is also an implicit constant (\DWFORMimplicitconst),
1812 whose value is provided as part of the abbreviation
1816 The data in \DWFORMdataone,
1819 \DWFORMdataeight{} and
1820 \DWFORMdatasixteen{}
1821 can be anything. Depending on context, it may
1822 be a signed integer, an unsigned integer, a floating\dash point
1823 constant, or anything else. A consumer must use context to
1824 know how to interpret the bits, which if they are target
1825 machine data (such as an integer or floating-point constant)
1826 will be in target machine \byteorder.
1828 \textit{If one of the \DWFORMdataTARG\textless n\textgreater
1829 forms is used to represent a
1830 signed or unsigned integer, it can be hard for a consumer
1831 to discover the context necessary to determine which
1832 interpretation is intended. Producers are therefore strongly
1833 encouraged to use \DWFORMsdata{} or
1834 \DWFORMudata{} for signed and
1835 unsigned integers respectively, rather than
1836 \DWFORMdata\textless n\textgreater.}
1839 \item \livelinki{chap:classexprloc}{exprloc}{exprloc class} \\
1840 \livetarg{datarep:classexprloc}{}
1841 This is an unsigned LEB128\addtoindexx{LEB128!unsigned} length followed by the
1842 number of information bytes specified by the length
1843 (\DWFORMexprlocTARG).
1844 The information bytes contain a DWARF expression
1845 (see Section \refersec{chap:dwarfexpressions})
1846 or location description
1847 (see Section \refersec{chap:locationdescriptions}).
1850 \item \livelinki{chap:classflag}{flag}{flag class} \\
1851 \livetarg{datarep:classflag}{}
1852 A flag \addtoindexx{flag class}
1853 is represented explicitly as a single byte of data
1854 (\DWFORMflagTARG) or
1855 implicitly (\DWFORMflagpresentTARG).
1857 first case, if the \nolink{flag} has value zero, it indicates the
1858 absence of the attribute; if the \nolink{flag} has a non-zero value,
1859 it indicates the presence of the attribute. In the second
1860 case, the attribute is implicitly indicated as present, and
1861 no value is encoded in the debugging information entry itself.
1863 \item \livelinki{chap:classlineptr}{lineptr}{lineptr class} \\
1864 \livetarg{datarep:classlineptr}{}
1865 This is an offset into
1866 \addtoindexx{section offset!in class lineptr value}
1868 \dotdebugline{} or \dotdebuglinedwo{} section
1870 It consists of an offset from the beginning of the
1872 section to the first byte of
1873 the data making up the line number list for the compilation
1875 It is relocatable in a relocatable object file, and
1876 relocated in an executable or shared object file. In the
1877 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
1878 in the \sixtyfourbitdwarfformat, it is an 8-byte unsigned value
1879 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1882 \item \livelinki{chap:classloclistptr}{loclistptr}{loclistptr class} \\
1883 \livetarg{datarep:classloclistptr}{}
1884 This is an offset into the
1888 It consists of an offset from the
1889 \addtoindexx{section offset!in class loclistptr value}
1892 section to the first byte of
1893 the data making up the
1894 \addtoindex{location list} for the compilation unit.
1895 It is relocatable in a relocatable object file, and
1896 relocated in an executable or shared object file. In the
1897 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
1898 in the \sixtyfourbitdwarfformat, it is an 8-byte unsigned value
1899 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1902 \item \livelinki{chap:classmacptr}{macptr}{macptr class} \\
1903 \livetarg{datarep:classmacptr}{}
1905 \addtoindexx{section offset!in class macptr value}
1907 \dotdebugmacro{} or \dotdebugmacrodwo{} section
1909 It consists of an offset from the beginning of the
1910 \dotdebugmacro{} or \dotdebugmacrodwo{}
1911 section to the the header making up the
1912 macro information list for the compilation unit.
1913 It is relocatable in a relocatable object file, and
1914 relocated in an executable or shared object file. In the
1915 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
1916 in the \sixtyfourbitdwarfformat, it is an 8-byte unsigned value
1917 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1920 \item \livelinki{chap:classrangelistptr}{rangelistptr}{rangelistptr class} \\
1921 \livetarg{datarep:classrangelistptr}{}
1923 \addtoindexx{section offset!in class rangelistptr value}
1924 offset into the \dotdebugranges{} section
1927 offset from the beginning of the
1928 \dotdebugranges{} section
1929 to the beginning of the non-contiguous address ranges
1930 information for the referencing entity.
1931 It is relocatable in
1932 a relocatable object file, and relocated in an executable or
1934 However, if a \DWATrangesbase{} attribute applies, the offset
1935 is relative to the base offset given by \DWATrangesbase.
1936 In the \thirtytwobitdwarfformat, this offset
1937 is a 4-byte unsigned value; in the 64-bit DWARF
1938 format, it is an 8-byte unsigned value (see Section
1939 \refersec{datarep:32bitand64bitdwarfformats}).
1942 \textit{Because classes
1947 \CLASSrangelistptr{} and
1948 \CLASSstroffsetsptr{}
1949 share a common representation, it is not possible for an
1950 attribute to allow more than one of these classes}
1954 \item \livelinki{chap:classreference}{reference}{reference class} \\
1955 \livetarg{datarep:classreference}{}
1956 There are four types of reference.
1959 \addtoindexx{reference class}
1960 first type of reference can identify any debugging
1961 information entry within the containing unit.
1964 \addtoindexx{section offset!in class reference value}
1965 offset from the first byte of the compilation
1966 header for the compilation unit containing the reference. There
1967 are five forms for this type of reference. There are fixed
1968 length forms for one, two, four and eight byte offsets
1974 and \DWFORMrefeightTARG).
1975 There is also an unsigned variable
1976 length offset encoded form that uses
1977 unsigned LEB128\addtoindexx{LEB128!unsigned} numbers
1978 (\DWFORMrefudataTARG).
1979 Because this type of reference is within
1980 the containing compilation unit no relocation of the value
1983 The second type of reference can identify any debugging
1984 information entry within a
1985 \dotdebuginfo{} section; in particular,
1986 it may refer to an entry in a different compilation unit
1987 from the unit containing the reference, and may refer to an
1988 entry in a different shared object file. This type of reference
1989 (\DWFORMrefaddrTARG)
1990 is an offset from the beginning of the
1992 section of the target executable or shared object file, or, for
1993 references within a \addtoindex{supplementary object file},
1994 an offset from the beginning of the local \dotdebuginfo{} section;
1995 it is relocatable in a relocatable object file and frequently
1996 relocated in an executable or shared object file. For
1997 references from one shared object or static executable file
1998 to another, the relocation and identification of the target
1999 object must be performed by the consumer. In the
2000 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
2001 in the \sixtyfourbitdwarfformat, it is an 8-byte
2003 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
2005 \textit{A debugging information entry that may be referenced by
2006 another compilation unit using
2007 \DWFORMrefaddr{} must have a global symbolic name.}
2009 \textit{For a reference from one executable or shared object file to
2010 another, the reference is resolved by the debugger to identify
2011 the executable or shared object file and the offset into that
2012 file\textquoteright s \dotdebuginfo{}
2013 section in the same fashion as the run
2014 time loader, either when the debug information is first read,
2015 or when the reference is used.}
2017 The third type of reference can identify any debugging
2018 information type entry that has been placed in its own
2019 \addtoindex{type unit}. This type of
2020 reference (\DWFORMrefsigeightTARG) is the
2021 \addtoindexx{type signature}
2022 8-byte type signature
2023 (see Section \refersec{datarep:typesignaturecomputation})
2024 that was computed for the type.
2026 The fourth type of reference is a reference from within the
2027 \dotdebuginfo{} section of the executable or shared object file to
2028 a debugging information entry in the \dotdebuginfo{} section of
2029 a \addtoindex{supplementary object file}.
2030 This type of reference (\DWFORMrefsupTARG) is an offset from the
2031 beginning of the \dotdebuginfo{} section in the
2032 \addtoindex{supplementary object file}.
2034 \textit{The use of compilation unit relative references will reduce the
2035 number of link\dash time relocations and so speed up linking. The
2036 use of the second, third and fourth type of reference allows for the
2037 sharing of information, such as types, across compilation
2038 units, while the fourth type further allows for sharing of information
2039 across compilation units from different executables or shared object files.}
2041 \textit{A reference to any kind of compilation unit identifies the
2042 debugging information entry for that unit, not the preceding
2046 \item \livelinki{chap:classstring}{string}{string class} \\
2047 \livetarg{datarep:classstring}{}
2048 A string is a sequence of contiguous non\dash null bytes followed by
2050 \addtoindexx{string class}
2051 A string may be represented:
2053 \setlength{\itemsep}{0em}
2054 \item immediately in the debugging information entry itself
2055 (\DWFORMstringTARG),
2058 \addtoindexx{section offset!in class string value}
2059 offset into a string table contained in
2060 the \dotdebugstr{} section of the object file (\DWFORMstrpTARG),
2061 the \dotdebuglinestr{} section of the object file (\DWFORMlinestrpTARG),
2062 or as an offset into a string table contained in the
2063 \dotdebugstr{} section of a \addtoindex{supplementary object file}
2064 (\DWFORMstrpsupTARG). \DWFORMstrpsupNAME{} offsets from the \dotdebuginfo{}
2065 section of a \addtoindex{supplementary object file}
2066 refer to the local \dotdebugstr{} section of that same file.
2067 In the \thirtytwobitdwarfformat, the representation of a
2068 \DWFORMstrpNAME{}, \DWFORMstrpNAME{} or \DWFORMstrpsupNAME{}
2069 value is a 4-byte unsigned offset; in the \sixtyfourbitdwarfformat,
2070 it is an 8-byte unsigned offset
2071 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
2074 \item as an indirect offset into the string table using an
2075 index into a table of offsets contained in the
2076 \dotdebugstroffsets{} section of the object file (\DWFORMstrxTARG).
2077 The representation of a \DWFORMstrxNAME{} value is an unsigned
2078 \addtoindex{LEB128} value, which is interpreted as a zero-based
2079 index into an array of offsets in the \dotdebugstroffsets{} section.
2080 The offset entries in the \dotdebugstroffsets{} section have the
2081 same representation as \DWFORMstrp{} values.
2083 Any combination of these three forms may be used within a single compilation.
2085 If the \DWATuseUTFeight{}
2086 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8} attribute is specified for the
2087 compilation, partial, skeleton or type unit entry, string values are encoded using the
2088 UTF\dash 8 (\addtoindex{Unicode} Transformation Format\dash 8) from the Universal
2089 Character Set standard (ISO/IEC 10646\dash 1:1993).
2090 \addtoindexx{ISO 10646 character set standard}
2091 Otherwise, the string representation is unspecified.
2093 \textit{The \addtoindex{Unicode} Standard Version 3 is fully compatible with
2094 ISO/IEC 10646\dash 1:1993.
2095 \addtoindexx{ISO 10646 character set standard}
2096 It contains all the same characters
2097 and encoding points as ISO/IEC 10646, as well as additional
2098 information about the characters and their use.}
2100 \textit{Earlier versions of DWARF did not specify the representation
2101 of strings; for compatibility, this version also does
2102 not. However, the UTF\dash 8 representation is strongly recommended.}
2105 \item \livelinki{chap:classstroffsetsptr}{stroffsetsptr}{stroffsetsptr class} \\
2106 \livetarg{datarep:classstroffsetsptr}{}
2107 This is an offset into the \dotdebugstroffsets{} section
2108 (\DWFORMsecoffset). It consists of an offset from the beginning of the
2109 \dotdebugstroffsets{} section to the
2110 beginning of the string offsets information for the
2111 referencing entity. It is relocatable in
2112 a relocatable object file, and relocated in an executable or
2113 shared object file. In the \thirtytwobitdwarfformat, this offset
2114 is a 4-byte unsigned value; in the \sixtyfourbitdwarfformat,
2115 it is an 8-byte unsigned value (see Section
2116 \refersec{datarep:32bitand64bitdwarfformats}).
2118 \textit{This class is new in \DWARFVersionV.}
2122 In no case does an attribute use one of the classes
2127 \CLASSrangelistptr{} or
2128 \CLASSstroffsetsptr{}
2129 to point into either the
2130 \dotdebuginfo{} or \dotdebugstr{} section.
2132 The form encodings are listed in
2133 Table \referfol{tab:attributeformencodings}.
2137 \setlength{\extrarowheight}{0.1cm}
2138 \begin{longtable}{l|c|l}
2139 \caption{Attribute form encodings} \label{tab:attributeformencodings} \\
2140 \hline \bfseries Form name&\bfseries Value &\bfseries Classes \\ \hline
2142 \bfseries Form name&\bfseries Value &\bfseries Classes\\ \hline
2144 \hline \emph{Continued on next page}
2146 \hline \ddag\ \textit{New in DWARF Version 5}
2149 \DWFORMaddr &0x01&\livelink{chap:classaddress}{address} \\
2150 \textit{Reserved} &0x02& \\
2151 \DWFORMblocktwo &0x03&\livelink{chap:classblock}{block} \\
2152 \DWFORMblockfour &0x04&\livelink{chap:classblock}{block} \\
2153 \DWFORMdatatwo &0x05&\livelink{chap:classconstant}{constant} \\
2154 \DWFORMdatafour &0x06&\livelink{chap:classconstant}{constant} \\
2155 \DWFORMdataeight &0x07&\livelink{chap:classconstant}{constant} \\
2156 \DWFORMstring&0x08&\livelink{chap:classstring}{string} \\
2157 \DWFORMblock&0x09&\livelink{chap:classblock}{block} \\
2158 \DWFORMblockone &0x0a&\livelink{chap:classblock}{block} \\
2159 \DWFORMdataone &0x0b&\livelink{chap:classconstant}{constant} \\
2160 \DWFORMflag&0x0c&\livelink{chap:classflag}{flag} \\
2161 \DWFORMsdata&0x0d&\livelink{chap:classconstant}{constant} \\
2162 \DWFORMstrp&0x0e&\livelink{chap:classstring}{string} \\
2163 \DWFORMudata&0x0f&\livelink{chap:classconstant}{constant} \\
2164 \DWFORMrefaddr&0x10&\livelink{chap:classreference}{reference} \\
2165 \DWFORMrefone&0x11&\livelink{chap:classreference}{reference} \\
2166 \DWFORMreftwo&0x12&\livelink{chap:classreference}{reference} \\
2167 \DWFORMreffour&0x13&\livelink{chap:classreference}{reference} \\
2168 \DWFORMrefeight&0x14&\livelink{chap:classreference}{reference} \\
2169 \DWFORMrefudata&0x15&\livelink{chap:classreference}{reference} \\
2170 \DWFORMindirect&0x16&(see Section \refersec{datarep:abbreviationstables}) \\
2171 \DWFORMsecoffset{} &0x17& \CLASSaddrptr, \CLASSlineptr, \CLASSloclistptr, \\
2172 & & \CLASSmacptr, \CLASSrangelistptr, \CLASSstroffsetsptr \\
2173 \DWFORMexprloc{} &0x18&\livelink{chap:classexprloc}{exprloc} \\
2174 \DWFORMflagpresent{} &0x19&\livelink{chap:classflag}{flag} \\
2175 \DWFORMstrx{} \ddag &0x1a&\livelink{chap:classstring}{string} \\
2176 \DWFORMaddrx{} \ddag &0x1b&\livelink{chap:classaddress}{address} \\
2177 \DWFORMrefsup{}~\ddag &0x1c &\livelink{chap:classreference}{reference} \\
2178 \DWFORMstrpsup{}~\ddag &0x1d &\livelink{chap:classstring}{string} \\
2179 \DWFORMdatasixteen~\ddag &0x1e &\CLASSconstant \\
2180 \DWFORMlinestrp~\ddag &0x1f &\CLASSstring \\
2181 \DWFORMrefsigeight &0x20 &\livelink{chap:classreference}{reference} \\
2182 \DWFORMimplicitconst~\ddag &0x21 &\CLASSconstant \\
2188 \section{Variable Length Data}
2189 \label{datarep:variablelengthdata}
2190 \addtoindexx{variable length data|see {LEB128}}
2192 \addtoindexx{Little-Endian Base 128|see{LEB128}}
2193 encoded using \doublequote{Little-Endian Base 128}
2194 \addtoindexx{little-endian encoding|see{endian attribute}}
2196 \addtoindexx{LEB128}
2197 LEB128 is a scheme for encoding integers
2198 densely that exploits the assumption that most integers are
2201 \textit{This encoding is equally suitable whether the target machine
2202 architecture represents data in big-endian or little-endian
2203 \byteorder. It is \doublequote{little-endian} only in the sense that it
2204 avoids using space to represent the \doublequote{big} end of an
2205 unsigned integer, when the big end is all zeroes or sign
2208 Unsigned LEB128\addtoindexx{LEB128!unsigned} (\addtoindex{ULEB128})
2209 numbers are encoded as follows:
2210 \addtoindexx{LEB128!unsigned, encoding as}
2211 start at the low order end of an unsigned integer and chop
2212 it into 7-bit chunks. Place each chunk into the low order 7
2213 bits of a byte. Typically, several of the high order bytes
2214 will be zero; discard them. Emit the remaining bytes in a
2215 stream, starting with the low order byte; set the high order
2216 bit on each byte except the last emitted byte. The high bit
2217 of zero on the last byte indicates to the decoder that it
2218 has encountered the last byte.
2220 The integer zero is a special case, consisting of a single
2223 Table \refersec{tab:examplesofunsignedleb128encodings}
2224 gives some examples of unsigned LEB128\addtoindexx{LEB128!unsigned}
2226 0x80 in each case is the high order bit of the byte, indicating
2227 that an additional byte follows.
2230 The encoding for signed, two\textquoteright{s} complement LEB128
2231 (\addtoindex{SLEB128}) \addtoindexx{LEB128!signed, encoding as}
2232 numbers is similar, except that the criterion for discarding
2233 high order bytes is not whether they are zero, but whether
2234 they consist entirely of sign extension bits. Consider the
2235 4-byte integer -2. The three high level bytes of the number
2236 are sign extension, thus LEB128 would represent it as a single
2237 byte containing the low order 7 bits, with the high order
2238 bit cleared to indicate the end of the byte stream. Note
2239 that there is nothing within the LEB128 representation that
2240 indicates whether an encoded number is signed or unsigned. The
2241 decoder must know what type of number to expect.
2242 Table \refersec{tab:examplesofunsignedleb128encodings}
2243 gives some examples of unsigned LEB128\addtoindexx{LEB128!unsigned}
2244 numbers and Table \refersec{tab:examplesofsignedleb128encodings}
2245 gives some examples of signed LEB128\addtoindexx{LEB128!signed}
2248 \textit{Appendix \refersec{app:variablelengthdataencodingdecodinginformative}
2249 \addtoindexx{LEB128!examples}
2250 gives algorithms for encoding and decoding these forms.}
2254 \setlength{\extrarowheight}{0.1cm}
2255 \begin{longtable}{c|c|c}
2256 \caption{Examples of unsigned LEB128 encodings}
2257 \label{tab:examplesofunsignedleb128encodings}
2258 \addtoindexx{LEB128 encoding!examples}\addtoindexx{LEB128!unsigned} \\
2259 \hline \bfseries Number&\bfseries First byte &\bfseries Second byte \\ \hline
2261 \bfseries Number&\bfseries First Byte &\bfseries Second byte\\ \hline
2263 \hline \emph{Continued on next page}
2269 128& 0 + 0x80 & 1 \\
2270 129& 1 + 0x80 & 1 \\
2271 %130& 2 + 0x80 & 1 \\
2272 12857& 57 + 0x80 & 100 \\
2279 \setlength{\extrarowheight}{0.1cm}
2280 \begin{longtable}{c|c|c}
2281 \caption{Examples of signed LEB128 encodings}
2282 \label{tab:examplesofsignedleb128encodings}
2283 \addtoindexx{LEB128!signed} \\
2284 \hline \bfseries Number&\bfseries First byte &\bfseries Second byte \\ \hline
2286 \bfseries Number&\bfseries First Byte &\bfseries Second byte\\ \hline
2288 \hline \emph{Continued on next page}
2294 127& 127 + 0x80 & 0 \\
2295 -127& 1 + 0x80 & 0x7f \\
2296 128& 0 + 0x80 & 1 \\
2297 -128& 0 + 0x80 & 0x7f \\
2298 129& 1 + 0x80 & 1 \\
2299 -129& 0x7f + 0x80 & 0x7e \\
2306 \section{DWARF Expressions and Location Descriptions}
2307 \label{datarep:dwarfexpressionsandlocationdescriptions}
2308 \subsection{DWARF Expressions}
2309 \label{datarep:dwarfexpressions}
2312 \addtoindexx{DWARF expression!operator encoding}
2313 DWARF expression is stored in a \nolink{block} of contiguous
2314 bytes. The bytes form a sequence of operations. Each operation
2315 is a 1-byte code that identifies that operation, followed by
2316 zero or more bytes of additional data. The encodings for the
2317 operations are described in
2318 Table \refersec{tab:dwarfoperationencodings}.
2321 \setlength{\extrarowheight}{0.1cm}
2322 \begin{longtable}{l|c|c|l}
2323 \caption{DWARF operation encodings} \label{tab:dwarfoperationencodings} \\
2324 \hline & &\bfseries No. of &\\
2325 \bfseries Operation&\bfseries Code &\bfseries Operands &\bfseries Notes\\ \hline
2327 & &\bfseries No. of &\\
2328 \bfseries Operation&\bfseries Code &\bfseries Operands &\bfseries Notes\\ \hline
2330 \hline \emph{Continued on next page}
2332 \hline \ddag\ \textit{New in DWARF Version 5}
2335 \DWOPaddr&0x03&1 & constant address \\
2336 & & &(size is target specific) \\
2338 \DWOPderef&0x06&0 & \\
2340 \DWOPconstoneu&0x08&1&1-byte constant \\
2341 \DWOPconstones&0x09&1&1-byte constant \\
2342 \DWOPconsttwou&0x0a&1&2-byte constant \\
2343 \DWOPconsttwos&0x0b&1&2-byte constant \\
2344 \DWOPconstfouru&0x0c&1&4-byte constant \\
2345 \DWOPconstfours&0x0d&1&4-byte constant \\
2346 \DWOPconsteightu&0x0e&1&8-byte constant \\
2347 \DWOPconsteights&0x0f&1&8-byte constant \\
2348 \DWOPconstu&0x10&1&ULEB128 constant \\
2349 \DWOPconsts&0x11&1&SLEB128 constant \\
2350 \DWOPdup&0x12&0 & \\
2351 \DWOPdrop&0x13&0 & \\
2352 \DWOPover&0x14&0 & \\
2353 \DWOPpick&0x15&1&1-byte stack index \\
2354 \DWOPswap&0x16&0 & \\
2355 \DWOProt&0x17&0 & \\
2356 \DWOPxderef&0x18&0 & \\
2357 \DWOPabs&0x19&0 & \\
2358 \DWOPand&0x1a&0 & \\
2359 \DWOPdiv&0x1b&0 & \\
2360 \DWOPminus&0x1c&0 & \\
2361 \DWOPmod&0x1d&0 & \\
2362 \DWOPmul&0x1e&0 & \\
2363 \DWOPneg&0x1f&0 & \\
2364 \DWOPnot&0x20&0 & \\
2366 \DWOPplus&0x22&0 & \\
2367 \DWOPplusuconst&0x23&1&ULEB128 addend \\
2368 \DWOPshl&0x24&0 & \\
2369 \DWOPshr&0x25&0 & \\
2370 \DWOPshra&0x26&0 & \\
2371 \DWOPxor&0x27&0 & \\
2373 \DWOPbra&0x28&1 & signed 2-byte constant \\
2380 \DWOPskip&0x2f&1&signed 2-byte constant \\ \hline
2382 \DWOPlitzero & 0x30 & 0 & \\
2383 \DWOPlitone & 0x31 & 0& literals 0 .. 31 = \\
2384 \ldots & & &\hspace{0.3cm}(\DWOPlitzero{} + literal) \\
2385 \DWOPlitthirtyone & 0x4f & 0 & \\ \hline
2387 \DWOPregzero & 0x50 & 0 & \\*
2388 \DWOPregone & 0x51 & 0® 0 .. 31 = \\*
2389 \ldots & & &\hspace{0.3cm}(\DWOPregzero{} + regnum) \\*
2390 \DWOPregthirtyone & 0x6f & 0 & \\ \hline
2392 \DWOPbregzero & 0x70 &1 & SLEB128 offset \\*
2393 \DWOPbregone & 0x71 & 1 &base register 0 .. 31 = \\*
2394 ... & & &\hspace{0.3cm}(\DWOPbregzero{} + regnum) \\*
2395 \DWOPbregthirtyone & 0x8f & 1 & \\ \hline
2397 \DWOPregx{} & 0x90 &1&ULEB128 register \\
2398 \DWOPfbreg{} & 0x91&1&SLEB128 offset \\
2399 \DWOPbregx{} & 0x92&2 &ULEB128 register, \\*
2400 & & &SLEB128 offset \\
2401 \DWOPpiece{} & 0x93 &1& ULEB128 size of piece \\
2402 \DWOPderefsize{} & 0x94 &1& 1-byte size of data retrieved \\
2403 \DWOPxderefsize{} & 0x95&1&1-byte size of data retrieved \\
2404 \DWOPnop{} & 0x96 &0& \\
2406 \DWOPpushobjectaddress&0x97&0 & \\
2407 \DWOPcalltwo&0x98&1& 2-byte offset of DIE \\
2408 \DWOPcallfour&0x99&1& 4-byte offset of DIE \\
2409 \DWOPcallref&0x9a&1& 4\dash\ or 8-byte offset of DIE \\
2410 \DWOPformtlsaddress&0x9b &0& \\
2411 \DWOPcallframecfa{} &0x9c &0& \\
2412 \DWOPbitpiece&0x9d &2&ULEB128 size, \\*
2414 \DWOPimplicitvalue{} &0x9e &2&ULEB128 size, \\*
2415 &&&\nolink{block} of that size\\
2416 \DWOPstackvalue{} &0x9f &0& \\
2417 \DWOPimplicitpointer{}~\ddag &0xa0& 2 &4- or 8-byte offset of DIE, \\*
2418 &&&SLEB128 constant offset \\
2419 \DWOPaddrx~\ddag&0xa1&1&ULEB128 indirect address \\
2420 \DWOPconstx~\ddag&0xa2&1&ULEB128 indirect constant \\
2421 \DWOPentryvalue~\ddag&0xa3&2&ULEB128 size, \\*
2422 &&&\nolink{block} of that size\\
2423 \DWOPconsttype~\ddag & 0xa4 & 3 & ULEB128 type entry offset,\\*
2424 & & & 1-byte size, \\*
2425 & & & constant value \\
2426 \DWOPregvaltype~\ddag & 0xa5 & 2 & ULEB128 register number, \\*
2427 &&& ULEB128 constant offset \\
2428 \DWOPdereftype~\ddag & 0xa6 & 2 & 1-byte size, \\*
2429 &&& ULEB128 type entry offset \\
2430 \DWOPxdereftype~\ddag & 0xa7 & 2 & 1-byte size, \\*
2431 &&& ULEB128 type entry offset \\
2432 \DWOPconvert~\ddag & 0xa8 & 1 & ULEB128 type entry offset \\
2433 \DWOPreinterpret~\ddag & 0xa9 & 1 & ULEB128 type entry offset \\
2434 \DWOPlouser{} &0xe0 && \\
2435 \DWOPhiuser{} &\xff && \\
2441 \subsection{Location Descriptions}
2442 \label{datarep:locationdescriptions}
2444 A location description is used to compute the
2445 location of a variable or other entity.
2447 \subsection{Location Lists}
2448 \label{datarep:locationlists}
2450 Each entry in a \addtoindex{location list} is either a location list entry,
2451 a base address selection entry, or an
2452 \addtoindexx{end-of-list entry!in location list}
2456 \subsubsection{Location List Entries in Non-Split Objects}
2457 A \addtoindex{location list} entry consists of two address offsets followed
2458 by an unsigned 2-byte length, followed by a block of contiguous bytes
2459 that contains a DWARF location description. The length
2460 specifies the number of bytes in that block. The two offsets
2461 are the same size as an address on the target machine.
2464 A base address selection entry and an
2465 \addtoindexx{end-of-list entry!in location list}
2466 end-of-list entry each
2467 consist of two (constant or relocated) address offsets. The two
2468 offsets are the same size as an address on the target machine.
2470 For a \addtoindex{location list} to be specified, the base address of
2471 \addtoindexx{base address selection entry!in location list}
2472 the corresponding compilation unit must be defined
2473 (see Section \refersec{chap:fullandpartialcompilationunitentries}).
2475 \subsubsection{Location List Entries in Split Objects}
2476 \label{datarep:locationlistentriesinsplitobjects}
2477 An alternate form for location list entries is used in split objects.
2478 Each entry begins with an unsigned 1-byte code that indicates the kind of entry
2479 that follows. The encodings for these constants are given in
2480 Table \refersec{tab:locationlistentryencodingvalues}.
2484 \setlength{\extrarowheight}{0.1cm}
2485 \begin{longtable}{l|c}
2486 \caption{Location list entry encoding values} \label{tab:locationlistentryencodingvalues} \\
2487 \hline \bfseries Location list entry encoding name&\bfseries Value \\ \hline
2489 \bfseries Location list entry encoding name&\bfseries Value\\ \hline
2491 \hline \emph{Continued on next page}
2495 \DWLLEendoflistentry & 0x0 \\
2496 \DWLLEbaseaddressselectionentry & 0x01 \\
2497 \DWLLEstartendentry & 0x02 \\
2498 \DWLLEstartlengthentry & 0x03 \\
2499 \DWLLEoffsetpairentry & 0x04 \\
2503 \section{Base Type Attribute Encodings}
2504 \label{datarep:basetypeattributeencodings}
2506 The\hypertarget{chap:DWATencodingencodingofbasetype}{}
2507 encodings of the constants used in the
2508 \DWATencodingDEFN{} attribute\addtoindexx{encoding attribute}
2510 Table \refersec{tab:basetypeencodingvalues}
2513 \setlength{\extrarowheight}{0.1cm}
2514 \begin{longtable}{l|c}
2515 \caption{Base type encoding values} \label{tab:basetypeencodingvalues} \\
2516 \hline \bfseries Base type encoding name&\bfseries Value \\ \hline
2518 \bfseries Base type encoding name&\bfseries Value\\ \hline
2520 \hline \emph{Continued on next page}
2523 \ddag \ \textit{New in \DWARFVersionV}
2525 \DWATEaddress&0x01 \\
2526 \DWATEboolean&0x02 \\
2527 \DWATEcomplexfloat&0x03 \\
2529 \DWATEsigned&0x05 \\
2530 \DWATEsignedchar&0x06 \\
2531 \DWATEunsigned&0x07 \\
2532 \DWATEunsignedchar&0x08 \\
2533 \DWATEimaginaryfloat&0x09 \\
2534 \DWATEpackeddecimal&0x0a \\
2535 \DWATEnumericstring&0x0b \\
2536 \DWATEedited&0x0c \\
2537 \DWATEsignedfixed&0x0d \\
2538 \DWATEunsignedfixed&0x0e \\
2539 \DWATEdecimalfloat & 0x0f \\
2540 \DWATEUTF{} & 0x10 \\
2541 \DWATEUCS~\ddag & 0x11 \\
2542 \DWATEASCII~\ddag & 0x12 \\
2543 \DWATElouser{} & 0x80 \\
2544 \DWATEhiuser{} & \xff \\
2549 The encodings of the constants used in the
2550 \DWATdecimalsign{} attribute
2552 Table \refersec{tab:decimalsignencodings}.
2555 \setlength{\extrarowheight}{0.1cm}
2556 \begin{longtable}{l|c}
2557 \caption{Decimal sign encodings} \label{tab:decimalsignencodings} \\
2558 \hline \bfseries Decimal sign code name&\bfseries Value \\ \hline
2560 \bfseries Decimal sign code name&\bfseries Value\\ \hline
2562 % \hline \emph{Continued on next page}
2566 \DWDSunsigned{} & 0x01 \\
2567 \DWDSleadingoverpunch{} & 0x02 \\
2568 \DWDStrailingoverpunch{} & 0x03 \\
2569 \DWDSleadingseparate{} & 0x04 \\
2570 \DWDStrailingseparate{} & 0x05 \\
2575 The encodings of the constants used in the
2576 \DWATendianity{} attribute are given in
2577 Table \refersec{tab:endianityencodings}.
2580 \setlength{\extrarowheight}{0.1cm}
2581 \begin{longtable}{l|c}
2582 \caption{Endianity encodings} \label{tab:endianityencodings}\\
2583 \hline \bfseries Endian code name&\bfseries Value \\ \hline
2585 \bfseries Endian code name&\bfseries Value\\ \hline
2587 \hline \emph{Continued on next page}
2592 \DWENDdefault{} & 0x00 \\
2593 \DWENDbig{} & 0x01 \\
2594 \DWENDlittle{} & 0x02 \\
2595 \DWENDlouser{} & 0x40 \\
2596 \DWENDhiuser{} & \xff \\
2602 \section{Accessibility Codes}
2603 \label{datarep:accessibilitycodes}
2604 The encodings of the constants used in the
2605 \DWATaccessibility{}
2607 \addtoindexx{accessibility attribute}
2609 Table \refersec{tab:accessibilityencodings}.
2612 \setlength{\extrarowheight}{0.1cm}
2613 \begin{longtable}{l|c}
2614 \caption{Accessibility encodings} \label{tab:accessibilityencodings}\\
2615 \hline \bfseries Accessibility code name&\bfseries Value \\ \hline
2617 \bfseries Accessibility code name&\bfseries Value\\ \hline
2619 \hline \emph{Continued on next page}
2624 \DWACCESSpublic&0x01 \\
2625 \DWACCESSprotected&0x02 \\
2626 \DWACCESSprivate&0x03 \\
2632 \section{Visibility Codes}
2633 \label{datarep:visibilitycodes}
2634 The encodings of the constants used in the
2635 \DWATvisibility{} attribute are given in
2636 Table \refersec{tab:visibilityencodings}.
2639 \setlength{\extrarowheight}{0.1cm}
2640 \begin{longtable}{l|c}
2641 \caption{Visibility encodings} \label{tab:visibilityencodings}\\
2642 \hline \bfseries Visibility code name&\bfseries Value \\ \hline
2644 \bfseries Visibility code name&\bfseries Value\\ \hline
2646 \hline \emph{Continued on next page}
2652 \DWVISexported&0x02 \\
2653 \DWVISqualified&0x03 \\
2658 \section{Virtuality Codes}
2659 \label{datarep:vitualitycodes}
2661 The encodings of the constants used in the
2662 \DWATvirtuality{} attribute are given in
2663 Table \refersec{tab:virtualityencodings}.
2666 \setlength{\extrarowheight}{0.1cm}
2667 \begin{longtable}{l|c}
2668 \caption{Virtuality encodings} \label{tab:virtualityencodings}\\
2669 \hline \bfseries Virtuality code name&\bfseries Value \\ \hline
2671 \bfseries Virtuality code name&\bfseries Value\\ \hline
2673 \hline \emph{Continued on next page}
2678 \DWVIRTUALITYnone&0x00 \\
2679 \DWVIRTUALITYvirtual&0x01 \\
2680 \DWVIRTUALITYpurevirtual&0x02 \\
2687 \DWVIRTUALITYnone{} is equivalent to the absence of the
2691 \section{Source Languages}
2692 \label{datarep:sourcelanguages}
2694 The encodings of the constants used
2695 \addtoindexx{language attribute, encoding}
2697 \addtoindexx{language name encoding}
2700 attribute are given in
2701 Table \refersec{tab:languageencodings}.
2703 % If we don't force a following space it looks odd
2705 and their associated values are reserved, but the
2706 languages they represent are not well supported.
2707 Table \refersec{tab:languageencodings}
2709 \addtoindexx{lower bound attribute!default}
2710 default lower bound, if any, assumed for
2711 an omitted \DWATlowerbound{} attribute in the context of a
2712 \DWTAGsubrangetype{} debugging information entry for each
2716 \setlength{\extrarowheight}{0.1cm}
2717 \begin{longtable}{l|c|c}
2718 \caption{Language encodings} \label{tab:languageencodings}\\
2719 \hline \bfseries Language name&\bfseries Value &\bfseries Default Lower Bound \\ \hline
2721 \bfseries Language name&\bfseries Value &\bfseries Default Lower Bound\\ \hline
2723 \hline \emph{Continued on next page}
2726 \dag \ \textit{See text} \\ \ddag \ \textit{New in \DWARFVersionV}
2728 \addtoindexx{ISO-defined language names}
2730 \DWLANGCeightynine &0x0001 &0 \addtoindexx{C:1989 (ISO)} \\
2731 \DWLANGC{} &0x0002 &0 \addtoindexx{C!non-standard} \\
2732 \DWLANGAdaeightythree{} \dag &0x0003 &1 \addtoindexx{Ada:1983 (ISO)} \\
2733 \DWLANGCplusplus{} &0x0004 &0 \addtoindexx{C++98 (ISO)} \\
2734 \DWLANGCobolseventyfour{} \dag &0x0005 &1 \addtoindexx{COBOL:1974 (ISO)} \\
2735 \DWLANGCoboleightyfive{} \dag &0x0006 &1 \addtoindexx{COBOL:1985 (ISO)} \\
2736 \DWLANGFortranseventyseven &0x0007 &1 \addtoindexx{FORTRAN:1977 (ISO)} \\
2737 \DWLANGFortranninety &0x0008 &1 \addtoindexx{Fortran:1990 (ISO)} \\
2738 \DWLANGPascaleightythree &0x0009 &1 \addtoindexx{Pascal:1983 (ISO)} \\
2739 \DWLANGModulatwo &0x000a &1 \addtoindexx{Modula-2:1996 (ISO)} \\
2740 \DWLANGJava &0x000b &0 \addtoindexx{Java} \\
2741 \DWLANGCninetynine &0x000c &0 \addtoindexx{C:1999 (ISO)} \\
2742 \DWLANGAdaninetyfive{} \dag &0x000d &1 \addtoindexx{Ada:1995 (ISO)} \\
2743 \DWLANGFortranninetyfive &0x000e &1 \addtoindexx{Fortran:1995 (ISO)} \\
2744 \DWLANGPLI{} \dag &0x000f &1 \addtoindexx{PL/I:1976 (ANSI)}\\
2745 \DWLANGObjC{} &0x0010 &0 \addtoindexx{Objective C}\\
2746 \DWLANGObjCplusplus{} &0x0011 &0 \addtoindexx{Objective C++}\\
2747 \DWLANGUPC{} &0x0012 &0 \addtoindexx{UPC}\\
2748 \DWLANGD{} &0x0013 &0 \addtoindexx{D language}\\
2749 \DWLANGPython{} \dag &0x0014 &0 \addtoindexx{Python}\\
2750 \DWLANGOpenCL{} \dag \ddag &0x0015 &0 \addtoindexx{OpenCL}\\
2751 \DWLANGGo{} \dag \ddag &0x0016 &0 \addtoindexx{Go}\\
2752 \DWLANGModulathree{} \dag \ddag &0x0017 &1 \addtoindexx{Modula-3}\\
2753 \DWLANGHaskell{} \dag \ddag &0x0018 &0 \addtoindexx{Haskell}\\
2754 \DWLANGCpluspluszerothree{} \ddag &0x0019 &0 \addtoindexx{C++03 (ISO)}\\
2755 \DWLANGCpluspluseleven{} \ddag &0x001a &0 \addtoindexx{C++11 (ISO)} \\
2756 \DWLANGOCaml{} \ddag &0x001b &0 \addtoindexx{OCaml}\\
2757 \DWLANGRust{} \ddag &0x001c &0 \addtoindexx{Rust}\\
2758 \DWLANGCeleven{} \ddag &0x001d &0 \addtoindexx{C:2011 (ISO)}\\
2759 \DWLANGSwift{} \ddag &0x001e &0 \addtoindexx{Swift} \\
2760 \DWLANGJulia{} \ddag &0x001f &1 \addtoindexx{Julia} \\
2761 \DWLANGDylan{} \ddag &0x0020 &0 \addtoindexx{Dylan} \\
2762 \DWLANGCplusplusfourteen{}~\ddag &0x0021 &0 \addtoindexx{C++14 (ISO)} \\
2763 \DWLANGFortranzerothree{}~\ddag &0x0022 &1 \addtoindexx{Fortran:2004 (ISO)} \\
2764 \DWLANGFortranzeroeight{}~\ddag &0x0023 &1 \addtoindexx{Fortran:2010 (ISO)} \\
2765 \DWLANGlouser{} &0x8000 & \\
2766 \DWLANGhiuser{} &\xffff & \\
2771 \section{Address Class Encodings}
2772 \label{datarep:addressclassencodings}
2774 The value of the common
2775 \addtoindex{address class} encoding
2779 \section{Identifier Case}
2780 \label{datarep:identifiercase}
2782 The encodings of the constants used in the
2783 \DWATidentifiercase{} attribute are given in
2784 Table \refersec{tab:identifiercaseencodings}.
2788 \setlength{\extrarowheight}{0.1cm}
2789 \begin{longtable}{l|c}
2790 \caption{Identifier case encodings} \label{tab:identifiercaseencodings}\\
2791 \hline \bfseries Identifier case name&\bfseries Value \\ \hline
2793 \bfseries Identifier case name&\bfseries Value\\ \hline
2795 \hline \emph{Continued on next page}
2799 \DWIDcasesensitive&0x00 \\
2801 \DWIDdowncase&0x02 \\
2802 \DWIDcaseinsensitive&0x03 \\
2806 \section{Calling Convention Encodings}
2807 \label{datarep:callingconventionencodings}
2808 The encodings of the constants used in the
2809 \DWATcallingconvention{} attribute are given in
2810 Table \refersec{tab:callingconventionencodings}.
2813 \setlength{\extrarowheight}{0.1cm}
2814 \begin{longtable}{l|c}
2815 \caption{Calling convention encodings} \label{tab:callingconventionencodings}\\
2816 \hline \bfseries Calling convention name&\bfseries Value \\ \hline
2818 \bfseries Calling convention name&\bfseries Value\\ \hline
2820 \hline \emph{Continued on next page}
2822 \hline \ddag\ \textit{New in DWARF Version 5}
2825 \DWCCnormal &0x01 \\
2826 \DWCCprogram&0x02 \\
2827 \DWCCnocall &0x03 \\
2828 \DWCCpassbyreference~\ddag &0x04 \\
2829 \DWCCpassbyvalue~\ddag &0x05 \\
2830 \DWCClouser &0x40 \\
2837 \section{Inline Codes}
2838 \label{datarep:inlinecodes}
2840 The encodings of the constants used in
2841 \addtoindexx{inline attribute}
2843 \DWATinline{} attribute are given in
2844 Table \refersec{tab:inlineencodings}.
2848 \setlength{\extrarowheight}{0.1cm}
2849 \begin{longtable}{l|c}
2850 \caption{Inline encodings} \label{tab:inlineencodings}\\
2851 \hline \bfseries Inline code name&\bfseries Value \\ \hline
2853 \bfseries Inline Code name&\bfseries Value\\ \hline
2855 \hline \emph{Continued on next page}
2860 \DWINLnotinlined&0x00 \\
2861 \DWINLinlined&0x01 \\
2862 \DWINLdeclarednotinlined&0x02 \\
2863 \DWINLdeclaredinlined&0x03 \\
2868 % this clearpage is ugly, but the following table came
2869 % out oddly without it.
2871 \section{Array Ordering}
2872 \label{datarep:arrayordering}
2874 The encodings of the constants used in the
2875 \DWATordering{} attribute are given in
2876 Table \refersec{tab:orderingencodings}.
2880 \setlength{\extrarowheight}{0.1cm}
2881 \begin{longtable}{l|c}
2882 \caption{Ordering encodings} \label{tab:orderingencodings}\\
2883 \hline \bfseries Ordering name&\bfseries Value \\ \hline
2885 \bfseries Ordering name&\bfseries Value\\ \hline
2887 \hline \emph{Continued on next page}
2892 \DWORDrowmajor&0x00 \\
2893 \DWORDcolmajor&0x01 \\
2899 \section{Discriminant Lists}
2900 \label{datarep:discriminantlists}
2902 The descriptors used in
2903 \addtoindexx{discriminant list attribute}
2905 \DWATdiscrlist{} attribute are
2906 encoded as 1-byte constants. The
2907 defined values are given in
2908 Table \refersec{tab:discriminantdescriptorencodings}.
2910 % Odd that the 'Name' field capitalized here, it is not caps elsewhere.
2912 \setlength{\extrarowheight}{0.1cm}
2913 \begin{longtable}{l|c}
2914 \caption{Discriminant descriptor encodings} \label{tab:discriminantdescriptorencodings}\\
2915 \hline \bfseries Descriptor name&\bfseries Value \\ \hline
2917 \bfseries Descriptor name&\bfseries Value\\ \hline
2919 \hline \emph{Continued on next page}
2931 \section{Name Index Table}
2932 \label{datarep:nameindextable}
2933 The \addtoindexi{version number}{version number!name index table}
2934 in the name index table header is \versiondotdebugnames{}.
2937 The name index attributes and their encodings are listed in Table \referfol{datarep:indexattributeencodings}.
2940 \setlength{\extrarowheight}{0.1cm}
2941 \begin{longtable}{l|c|l}
2942 \caption{Name index attribute encodings} \label{datarep:indexattributeencodings}\\
2943 \hline \bfseries Attribute name &\bfseries Value &\bfseries Form/Class \\ \hline
2945 \bfseries Attribute name &\bfseries Value &\bfseries Form/Class \\ \hline
2947 \hline \emph{Continued on next page}
2950 \ddag~\textit{New in \DWARFVersionV}
2952 \DWIDXcompileunit~\ddag & 1 & \CLASSconstant \\
2953 \DWIDXtypeunit~\ddag & 2 & \CLASSconstant \\
2954 \DWIDXdieoffset~\ddag & 3 & \CLASSreference \\
2955 \DWIDXparent~\ddag & 4 & \CLASSconstant \\
2956 \DWIDXtypehash~\ddag & 5 & \DWFORMdataeight \\
2957 \DWIDXlouser~\ddag & 0x2000 & \\
2958 \DWIDXhiuser~\ddag & \xiiifff & \\
2962 The abbreviations table ends with an entry consisting of a single 0
2963 byte for the abbreviation code. The size of the table given by
2964 \texttt{abbrev\_table\_size} may include optional padding following the
2967 \section{Defaulted Member Encodings}
2968 \hypertarget{datarep:defaultedmemberencodings}{}
2970 The encodings of the constants used in the \DWATdefaulted{} attribute
2971 are given in Table \referfol{datarep:defaultedattributeencodings}.
2974 \setlength{\extrarowheight}{0.1cm}
2975 \begin{longtable}{l|c}
2976 \caption{Defaulted attribute encodings} \label{datarep:defaultedattributeencodings} \\
2977 \hline \bfseries Defaulted name &\bfseries Value \\ \hline
2979 \bfseries Defaulted name &\bfseries Value \\ \hline
2981 \hline \emph{Continued on next page}
2984 \ddag~\textit{New in \DWARFVersionV}
2986 \DWDEFAULTEDno~\ddag & 0x00 \\
2987 \DWDEFAULTEDinclass~\ddag & 0x01 \\
2988 \DWDEFAULTEDoutofclass~\ddag & 0x02 \\
2993 \section{Address Range Table}
2994 \label{datarep:addrssrangetable}
2996 Each set of entries in the table of address ranges contained
2997 in the \dotdebugaranges{}
2998 section begins with a header containing:
2999 \begin{enumerate}[1. ]
3000 % FIXME The unit length text is not fully consistent across
3003 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3004 \addttindexx{unit\_length}
3005 A 4-byte or 12-byte length containing the length of the
3006 \addtoindexx{initial length}
3007 set of entries for this compilation unit, not including the
3008 length field itself. In the \thirtytwobitdwarfformat, this is a
3009 4-byte unsigned integer (which must be less than \xfffffffzero);
3010 in the \sixtyfourbitdwarfformat, this consists of the 4-byte value
3011 \wffffffff followed by an 8-byte unsigned integer that gives
3013 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
3015 \item version (\HFTuhalf) \\
3016 A 2-byte version identifier representing the version of the
3017 DWARF information for the address range table.
3020 This value in this field \addtoindexx{version number!address range table} is 2.
3022 \item debug\_info\_offset (\livelink{datarep:sectionoffsetlength}{section offset}) \\
3024 \addtoindexx{section offset!in .debug\_aranges header}
3025 4-byte or 8-byte offset into the
3026 \dotdebuginfo{} section of
3027 the compilation unit header. In the \thirtytwobitdwarfformat,
3028 this is a 4-byte unsigned offset; in the \sixtyfourbitdwarfformat,
3029 this is an 8-byte unsigned offset
3030 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
3032 \item \texttt{address\_size} (\HFTubyte) \\
3033 A 1-byte unsigned integer containing the size in bytes of an
3034 \addttindexx{address\_size}
3036 \addtoindexx{size of an address}
3037 (or the offset portion of an address for segmented
3038 \addtoindexx{address space!segmented}
3039 addressing) on the target system.
3041 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
3042 A 1-byte unsigned integer containing the size in bytes of a
3043 segment selector on the target system.
3047 This header is followed by a series of tuples. Each tuple
3048 consists of a segment, an address and a length.
3049 The segment selector
3050 size is given by the \HFNsegmentselectorsize{} field of the header; the
3051 address and length size are each given by the \addttindex{address\_size}
3052 field of the header.
3053 The first tuple following the header in
3054 each set begins at an offset that is a multiple of the size
3055 of a single tuple (that is, the size of a segment selector
3056 plus twice the \addtoindex{size of an address}).
3057 The header is padded, if
3058 necessary, to that boundary. Each set of tuples is terminated
3059 by a 0 for the segment, a 0 for the address and 0 for the
3060 length. If the \HFNsegmentselectorsize{} field in the header is zero,
3061 the segment selectors are omitted from all tuples, including
3062 the terminating tuple.
3065 \section{Line Number Information}
3066 \label{datarep:linenumberinformation}
3068 The \addtoindexi{version number}{version number!line number information}
3069 in the line number program header is \versiondotdebugline{}.
3072 The boolean values \doublequote{true} and \doublequote{false}
3073 used by the line number information program are encoded
3074 as a single byte containing the value 0
3075 for \doublequote{false,} and a non-zero value for \doublequote{true.}
3078 The encodings for the standard opcodes are given in
3079 \addtoindexx{line number opcodes!standard opcode encoding}
3080 Table \refersec{tab:linenumberstandardopcodeencodings}.
3083 \setlength{\extrarowheight}{0.1cm}
3084 \begin{longtable}{l|c}
3085 \caption{Line number standard opcode encodings} \label{tab:linenumberstandardopcodeencodings}\\
3086 \hline \bfseries Opcode name&\bfseries Value \\ \hline
3088 \bfseries Opcode name&\bfseries Value\\ \hline
3090 \hline \emph{Continued on next page}
3096 \DWLNSadvancepc&0x02 \\
3097 \DWLNSadvanceline&0x03 \\
3098 \DWLNSsetfile&0x04 \\
3099 \DWLNSsetcolumn&0x05 \\
3100 \DWLNSnegatestmt&0x06 \\
3101 \DWLNSsetbasicblock&0x07 \\
3102 \DWLNSconstaddpc&0x08 \\
3103 \DWLNSfixedadvancepc&0x09 \\
3104 \DWLNSsetprologueend&0x0a \\*
3105 \DWLNSsetepiloguebegin&0x0b \\*
3106 \DWLNSsetisa&0x0c \\*
3112 The encodings for the extended opcodes are given in
3113 \addtoindexx{line number opcodes!extended opcode encoding}
3114 Table \refersec{tab:linenumberextendedopcodeencodings}.
3117 \setlength{\extrarowheight}{0.1cm}
3118 \begin{longtable}{l|c}
3119 \caption{Line number extended opcode encodings} \label{tab:linenumberextendedopcodeencodings}\\
3120 \hline \bfseries Opcode name&\bfseries Value \\ \hline
3122 \bfseries Opcode name&\bfseries Value\\ \hline
3124 \hline \emph{Continued on next page}
3126 \hline %\ddag~\textit{New in DWARF Version 5}
3129 \DWLNEendsequence &0x01 \\
3130 \DWLNEsetaddress &0x02 \\
3131 \textit{Reserved} &0x03\footnote{Code 0x03 is reserved to allow backward compatible support of the
3132 DW\_LNE\_define\_file operation which was defined in \DWARFVersionIV{}
3134 \DWLNEsetdiscriminator &0x04 \\
3135 \DWLNElouser &0x80 \\
3136 \DWLNEhiuser &\xff \\
3142 The encodings for the line number header entry formats are given in
3143 \addtoindexx{line number opcodes!file entry format encoding}
3144 Table \refersec{tab:linenumberheaderentryformatencodings}.
3147 \setlength{\extrarowheight}{0.1cm}
3148 \begin{longtable}{l|c}
3149 \caption{Line number header entry format \mbox{encodings}} \label{tab:linenumberheaderentryformatencodings}\\
3150 \hline \bfseries Line number header entry format name&\bfseries Value \\ \hline
3152 \bfseries Line number header entry format name&\bfseries Value\\ \hline
3154 \hline \emph{Continued on next page}
3156 \hline \ddag~\textit{New in DWARF Version 5}
3158 \DWLNCTpath~\ddag & 0x1 \\
3159 \DWLNCTdirectoryindex~\ddag & 0x2 \\
3160 \DWLNCTtimestamp~\ddag & 0x3 \\
3161 \DWLNCTsize~\ddag & 0x4 \\
3162 \DWLNCTMDfive~\ddag & 0x5 \\
3163 \DWLNCTlouser~\ddag & 0x2000 \\
3164 \DWLNCThiuser~\ddag & \xiiifff \\
3169 \section{Macro Information}
3170 \label{datarep:macroinformation}
3171 The \addtoindexi{version number}{version number!macro information}
3172 in the macro information header is \versiondotdebugmacro{}.
3175 The source line numbers and source file indices encoded in the
3176 macro information section are represented as
3177 unsigned LEB128\addtoindexx{LEB128!unsigned} numbers.
3180 The macro information entry type is encoded as a single unsigned byte.
3182 \addtoindexx{macro information entry types!encoding}
3184 Table \refersec{tab:macroinfoentrytypeencodings}.
3188 \setlength{\extrarowheight}{0.1cm}
3189 \begin{longtable}{l|c}
3190 \caption{Macro information entry type encodings} \label{tab:macroinfoentrytypeencodings}\\
3191 \hline \bfseries Macro information entry type name&\bfseries Value \\ \hline
3193 \bfseries Macro information entry type name&\bfseries Value\\ \hline
3195 \hline \emph{Continued on next page}
3197 \hline \ddag~\textit{New in DWARF Version 5}
3200 \DWMACROdefine~\ddag &0x01 \\
3201 \DWMACROundef~\ddag &0x02 \\
3202 \DWMACROstartfile~\ddag &0x03 \\
3203 \DWMACROendfile~\ddag &0x04 \\
3204 \DWMACROdefinestrp~\ddag &0x05 \\
3205 \DWMACROundefstrp~\ddag &0x06 \\
3206 \DWMACROimport~\ddag &0x07 \\
3207 \DWMACROdefinesup~\ddag &0x08 \\
3208 \DWMACROundefsup~\ddag &0x09 \\
3209 \DWMACROimportsup~\ddag &0x0a \\
3210 \DWMACROdefinestrx~\ddag &0x0b \\
3211 \DWMACROundefstrx~\ddag &0x0c \\
3212 \DWMACROlouser~\ddag &0xe0 \\
3213 \DWMACROhiuser~\ddag &\xff \\
3219 \section{Call Frame Information}
3220 \label{datarep:callframeinformation}
3222 In the \thirtytwobitdwarfformat, the value of the CIE id in the
3223 CIE header is \xffffffff; in the \sixtyfourbitdwarfformat, the
3224 value is \xffffffffffffffff.
3226 The value of the CIE \addtoindexi{version number}{version number!call frame information}
3227 is \versiondotdebugframe.
3230 Call frame instructions are encoded in one or more bytes. The
3231 primary opcode is encoded in the high order two bits of
3232 the first byte (that is, opcode = byte $\gg$ 6). An operand
3233 or extended opcode may be encoded in the low order 6
3234 bits. Additional operands are encoded in subsequent bytes.
3235 The instructions and their encodings are presented in
3236 Table \refersec{tab:callframeinstructionencodings}.
3239 \setlength{\extrarowheight}{0.1cm}
3240 \begin{longtable}{l|c|c|l|l}
3241 \caption{Call frame instruction encodings} \label{tab:callframeinstructionencodings} \\
3242 \hline &\bfseries High 2 &\bfseries Low 6 & & \\
3243 \bfseries Instruction&\bfseries Bits &\bfseries Bits &\bfseries Operand 1 &\bfseries Operand 2\\ \hline
3245 & \bfseries High 2 &\bfseries Low 6 & &\\
3246 \bfseries Instruction&\bfseries Bits &\bfseries Bits &\bfseries Operand 1 &\bfseries Operand 2\\ \hline
3248 \hline \emph{Continued on next page}
3253 \DWCFAadvanceloc&0x1&delta & \\
3254 \DWCFAoffset&0x2®ister&ULEB128 offset \\
3255 \DWCFArestore&0x3®ister & & \\
3256 \DWCFAnop&0&0 & & \\
3257 \DWCFAsetloc&0&0x01&address & \\
3258 \DWCFAadvancelocone&0&0x02&1-byte delta & \\
3259 \DWCFAadvanceloctwo&0&0x03&2-byte delta & \\
3260 \DWCFAadvancelocfour&0&0x04&4-byte delta & \\
3261 \DWCFAoffsetextended&0&0x05&ULEB128 register&ULEB128 offset \\
3262 \DWCFArestoreextended&0&0x06&ULEB128 register & \\
3263 \DWCFAundefined&0&0x07&ULEB128 register & \\
3264 \DWCFAsamevalue&0&0x08 &ULEB128 register & \\
3265 \DWCFAregister&0&0x09&ULEB128 register &ULEB128 offset \\
3266 \DWCFArememberstate&0&0x0a & & \\
3267 \DWCFArestorestate&0&0x0b & & \\
3268 \DWCFAdefcfa&0&0x0c &ULEB128 register&ULEB128 offset \\
3269 \DWCFAdefcfaregister&0&0x0d&ULEB128 register & \\
3270 \DWCFAdefcfaoffset&0&0x0e &ULEB128 offset & \\
3271 \DWCFAdefcfaexpression&0&0x0f &BLOCK \\
3272 \DWCFAexpression&0&0x10&ULEB128 register & BLOCK \\
3274 \DWCFAoffsetextendedsf&0&0x11&ULEB128 register&SLEB128 offset \\
3275 \DWCFAdefcfasf&0&0x12&ULEB128 register&SLEB128 offset \\
3276 \DWCFAdefcfaoffsetsf&0&0x13&SLEB128 offset & \\
3277 \DWCFAvaloffset&0&0x14&ULEB128&ULEB128 \\
3278 \DWCFAvaloffsetsf&0&0x15&ULEB128&SLEB128 \\
3279 \DWCFAvalexpression&0&0x16&ULEB128&BLOCK \\
3280 \DWCFAlouser&0&0x1c & & \\
3281 \DWCFAhiuser&0&\xiiif & & \\
3285 \section{Non-contiguous Address Ranges}
3286 \label{datarep:noncontiguousaddressranges}
3288 Each entry in a \addtoindex{range list}
3289 (see Section \refersec{chap:noncontiguousaddressranges})
3291 \addtoindexx{base address selection entry!in range list}
3293 \addtoindexx{range list}
3294 a base address selection entry, or an end-of-list entry.
3296 A \addtoindex{range list} entry consists of two relative addresses. The
3297 addresses are the same size as addresses on the target machine.
3300 A base address selection entry and an
3301 \addtoindexx{end-of-list entry!in range list}
3302 end-of-list entry each
3303 \addtoindexx{base address selection entry!in range list}
3304 consist of two (constant or relocated) addresses. The two
3305 addresses are the same size as addresses on the target machine.
3307 For a \addtoindex{range list} to be specified, the base address of the
3308 \addtoindexx{base address selection entry!in range list}
3309 corresponding compilation unit must be defined
3310 (see Section \refersec{chap:fullandpartialcompilationunitentries}).
3313 \section{String Offsets Table}
3314 \label{chap:stringoffsetstable}
3315 Each set of entries in the string offsets table contained in the
3316 \dotdebugstroffsets{} or \dotdebugstroffsetsdwo{}
3317 section begins with a header containing:
3318 \begin{enumerate}[1. ]
3319 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3320 \addttindexx{unit\_length}
3321 A 4-byte or 12-byte length containing the length of
3322 the set of entries for this compilation unit, not
3323 including the length field itself. In the 32-bit
3324 DWARF format, this is a 4-byte unsigned integer
3325 (which must be less than \xfffffffzero); in the 64-bit
3326 DWARF format, this consists of the 4-byte value
3327 \wffffffff followed by an 8-byte unsigned integer
3328 that gives the actual length (see
3329 Section \refersec{datarep:32bitand64bitdwarfformats}).
3332 \item \texttt{version} (\HFTuhalf) \\
3333 \addtoindexx{version number!string offsets table}
3334 A 2-byte version identifier containing the value
3335 \versiondotdebugstroffsets{}.
3338 \item \textit{padding} (\HFTuhalf) \\
3340 Reserved to DWARF (must be zero).
3344 This header is followed by a series of string table offsets
3345 that have the same representation as \DWFORMstrp.
3346 For the 32-bit DWARF format, each offset is 4 bytes long; for
3347 the 64-bit DWARF format, each offset is 8 bytes long.
3349 The \DWATstroffsetsbase{} attribute points to the first
3350 entry following the header. The entries are indexed
3351 sequentially from this base entry, starting from 0.
3353 \section{Address Table}
3354 \label{chap:addresstable}
3355 Each set of entries in the address table contained in the
3356 \dotdebugaddr{} section begins with a header containing:
3357 \begin{enumerate}[1. ]
3358 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3359 \addttindexx{unit\_length}
3360 A 4-byte or 12-byte length containing the length of
3361 the set of entries for this compilation unit, not
3362 including the length field itself. In the 32-bit
3363 DWARF format, this is a 4-byte unsigned integer
3364 (which must be less than \xfffffffzero); in the 64-bit
3365 DWARF format, this consists of the 4-byte value
3366 \wffffffff followed by an 8-byte unsigned integer
3367 that gives the actual length (see
3368 Section \refersec{datarep:32bitand64bitdwarfformats}).
3371 \item \texttt{version} (\HFTuhalf) \\
3372 \addtoindexx{version number!address table}
3373 A 2-byte version identifier containing the value
3374 \versiondotdebugaddr{}.
3378 \item \texttt{address\_size} (\HFTubyte) \\
3379 A 1-byte unsigned integer containing the size in
3380 bytes of an address (or the offset portion of an
3381 address for segmented addressing) on the target
3385 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
3386 A 1-byte unsigned integer containing the size in
3387 bytes of a segment selector on the target system.
3390 This header is followed by a series of segment/address pairs.
3391 The segment size is given by the \HFNsegmentselectorsize{} field of the
3392 header, and the address size is given by the \addttindex{address\_size}
3393 field of the header. If the \HFNsegmentselectorsize{} field in the header
3394 is zero, the entries consist only of an addresses.
3396 The \DWATaddrbase{} attribute points to the first entry
3397 following the header. The entries are indexed sequentially
3398 from this base entry, starting from 0.
3401 \section{Range List Table}
3402 \label{app:rangelisttable}
3403 Each set of entries in the range list table contained in the
3404 \dotdebugranges{} section begins with a header containing:
3405 \begin{enumerate}[1. ]
3406 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3407 \addttindexx{unit\_length}
3408 A 4-byte or 12-byte length containing the length of
3409 the set of entries for this compilation unit, not
3410 including the length field itself. In the 32-bit
3411 DWARF format, this is a 4-byte unsigned integer
3412 (which must be less than \xfffffffzero); in the 64-bit
3413 DWARF format, this consists of the 4-byte value
3414 \wffffffff followed by an 8-byte unsigned integer
3415 that gives the actual length (see
3416 Section \refersec{datarep:32bitand64bitdwarfformats}).
3419 \item \texttt{version} (\HFTuhalf) \\
3420 \addtoindexx{version number!range list table}
3421 A 2-byte version identifier containing the value
3422 \versiondotdebugranges{}.
3426 \item \texttt{address\_size} (\HFTubyte) \\
3427 A 1-byte unsigned integer containing the size in
3428 bytes of an address (or the offset portion of an
3429 address for segmented addressing) on the target
3433 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
3434 A 1-byte unsigned integer containing the size in
3435 bytes of a segment selector on the target system.
3438 This header is followed by a series of range list entries as
3439 described in Section \refersec{chap:noncontiguousaddressranges}.
3440 The segment size is given by the
3441 \HFNsegmentselectorsize{} field of the header, and the address size is
3442 given by the \addttindex{address\_size} field of the header. If the
3443 \HFNsegmentselectorsize{} field in the header is zero, the segment
3444 selector is omitted from the range list entries.
3446 The \DWATrangesbase{} attribute points to the first entry
3447 following the header. The entries are referenced by a byte
3448 offset relative to this base address.
3451 \section{Location List Table}
3452 \label{datarep:locationlisttable}
3453 Each set of entries in the location list table contained in the
3454 \dotdebugloc{} or \dotdebuglocdwo{} sections begins with a header containing:
3455 \begin{enumerate}[1. ]
3456 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3457 \addttindexx{unit\_length}
3458 A 4-byte or 12-byte length containing the length of
3459 the set of entries for this compilation unit, not
3460 including the length field itself. In the 32-bit
3461 DWARF format, this is a 4-byte unsigned integer
3462 (which must be less than \xfffffffzero); in the 64-bit
3463 DWARF format, this consists of the 4-byte value
3464 \wffffffff followed by an 8-byte unsigned integer
3465 that gives the actual length (see
3466 Section \refersec{datarep:32bitand64bitdwarfformats}).
3469 \item \texttt{version} (\HFTuhalf) \\
3470 \addtoindexx{version number!location list table}
3471 A 2-byte version identifier containing the value
3472 \versiondotdebugloc{}.
3476 \item \texttt{address\_size} (\HFTubyte) \\
3477 A 1-byte unsigned integer containing the size in
3478 bytes of an address (or the offset portion of an
3479 address for segmented addressing) on the target
3483 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
3484 A 1-byte unsigned integer containing the size in
3485 bytes of a segment selector on the target system.
3488 This header is followed by a series of location list entries as
3489 described in Section \refersec{chap:locationlists}.
3490 The segment size is given by the
3491 \HFNsegmentselectorsize{} field of the header, and the address size is
3492 given by the \HFNaddresssize{} field of the header. If the
3493 \HFNsegmentselectorsize{} field in the header is zero, the segment
3494 selector is omitted from range list entries.
3496 The entries are referenced by a byte offset relative to the first
3497 location list following this header.
3500 \section{Dependencies and Constraints}
3501 \label{datarep:dependenciesandconstraints}
3502 The debugging information in this format is intended to
3503 exist in sections of an object file, or an equivalent
3504 separate file or database, having names beginning with
3505 the prefix ".debug\_" (see Appendix
3506 \refersec{app:dwarfsectionversionnumbersinformative}
3507 for a complete list of such names).
3508 Except as specifically specified, this information is not
3509 aligned on 2-, 4- or 8-byte boundaries. Consequently:
3512 \item For the \thirtytwobitdwarfformat{} and a target architecture with
3513 32-bit addresses, an assembler or compiler must provide a way
3514 to produce 2-byte and 4-byte quantities without alignment
3515 restrictions, and the linker must be able to relocate a
3517 \addtoindexx{section offset!alignment of}
3518 section offset that occurs at an arbitrary
3521 \item For the \thirtytwobitdwarfformat{} and a target architecture with
3522 64-bit addresses, an assembler or compiler must provide a
3523 way to produce 2-byte, 4-byte and 8-byte quantities without
3524 alignment restrictions, and the linker must be able to relocate
3525 an 8-byte address or 4-byte
3526 \addtoindexx{section offset!alignment of}
3527 section offset that occurs at an
3528 arbitrary alignment.
3530 \item For the \sixtyfourbitdwarfformat{} and a target architecture with
3531 32-bit addresses, an assembler or compiler must provide a
3532 way to produce 2-byte, 4-byte and 8-byte quantities without
3533 alignment restrictions, and the linker must be able to relocate
3534 a 4-byte address or 8-byte
3535 \addtoindexx{section offset!alignment of}
3536 section offset that occurs at an
3537 arbitrary alignment.
3539 \textit{It is expected that this will be required only for very large
3540 32-bit programs or by those architectures which support
3541 a mix of 32-bit and 64-bit code and data within the same
3544 \item For the \sixtyfourbitdwarfformat{} and a target architecture with
3545 64-bit addresses, an assembler or compiler must provide a
3546 way to produce 2-byte, 4-byte and 8-byte quantities without
3547 alignment restrictions, and the linker must be able to
3548 relocate an 8-byte address or
3549 \addtoindexx{section offset!alignment of}
3550 section offset that occurs at
3551 an arbitrary alignment.
3555 \section{Integer Representation Names}
3556 \label{datarep:integerrepresentationnames}
3557 The sizes of the integers used in the lookup by name, lookup
3558 by address, line number, call frame information and other sections
3560 Table \ref{tab:integerrepresentationnames}.
3564 \setlength{\extrarowheight}{0.1cm}
3565 \begin{longtable}{c|l}
3566 \caption{Integer representation names} \label{tab:integerrepresentationnames}\\
3567 \hline \bfseries Representation name&\bfseries Representation \\ \hline
3569 \bfseries Representation name&\bfseries Representation\\ \hline
3571 \hline \emph{Continued on next page}
3576 \HFTsbyte& signed, 1-byte integer \\
3577 \HFTubyte&unsigned, 1-byte integer \\
3578 \HFTuhalf&unsigned, 2-byte integer \\
3579 \HFTuword&unsigned, 4-byte integer \\
3585 \section{Type Signature Computation}
3586 \label{datarep:typesignaturecomputation}
3588 A \addtoindex{type signature} is used by a DWARF consumer
3589 to resolve type references to the type definitions that
3590 are contained in \addtoindex{type unit}s (see Section
3591 \refersec{chap:typeunitentries}).
3593 \textit{A type signature is computed only by a DWARF producer;
3594 \addtoindexx{type signature!computation} a consumer need
3595 compare two type signatures to check for equality.}
3598 The type signature for a type T0 is formed from the
3599 \MDfive{}\footnote{\livetarg{def:MDfive}{MD5} Message Digest Algorithm,
3600 R.L. Rivest, RFC 1321, April 1992}
3601 digest of a flattened description of the type. The flattened
3602 description of the type is a byte sequence derived from the
3603 DWARF encoding of the type as follows:
3604 \begin{enumerate}[1. ]
3606 \item Start with an empty sequence S and a list V of visited
3607 types, where V is initialized to a list containing the type
3608 T0 as its single element. Elements in V are indexed from 1,
3611 \item If the debugging information entry represents a type that
3612 is nested inside another type or a namespace, append to S
3613 the type\textquoteright s context as follows: For each surrounding type
3614 or namespace, beginning with the outermost such construct,
3615 append the letter 'C', the DWARF tag of the construct, and
3616 the name (taken from
3617 \addtoindexx{name attribute}
3618 the \DWATname{} attribute) of the type
3619 \addtoindexx{name attribute}
3620 or namespace (including its trailing null byte).
3622 \item Append to S the letter 'D', followed by the DWARF tag of
3623 the debugging information entry.
3625 \item For each of the attributes in
3626 Table \refersec{tab:attributesusedintypesignaturecomputation}
3628 the debugging information entry, in the order listed,
3629 append to S a marker letter (see below), the DWARF attribute
3630 code, and the attribute value.
3633 \caption{Attributes used in type signature computation}
3634 \label{tab:attributesusedintypesignaturecomputation}
3635 \simplerule[\textwidth]
3637 \autocols[0pt]{c}{2}{l}{
3653 \DWATcontainingtype,
3657 \DWATdatamemberlocation,
3678 \DWATrvaluereference,
3682 \DWATstringlengthbitsize,
3683 \DWATstringlengthbytesize,
3688 \DWATvariableparameter,
3691 \DWATvtableelemlocation
3694 \simplerule[\textwidth]
3697 Note that except for the initial
3698 \DWATname{} attribute,
3699 \addtoindexx{name attribute}
3700 attributes are appended in order according to the alphabetical
3701 spelling of their identifier.
3703 If an implementation defines any vendor-specific attributes,
3704 any such attributes that are essential to the definition of
3705 the type are also included at the end of the above list,
3706 in their own alphabetical suborder.
3708 An attribute that refers to another type entry T is processed
3709 as follows: (a) If T is in the list V at some V[x], use the
3710 letter 'R' as the marker and use the unsigned LEB128\addtoindexx{LEB128!unsigned}
3711 encoding of x as the attribute value; otherwise, (b) use the letter 'T'
3712 as the marker, process the type T recursively by performing
3713 Steps 2 through 7, and use the result as the attribute value.
3716 Other attribute values use the letter 'A' as the marker, and
3717 the value consists of the form code (encoded as an unsigned
3718 LEB128 value) followed by the encoding of the value according
3719 to the form code. To ensure reproducibility of the signature,
3720 the set of forms used in the signature computation is limited
3729 \item If the tag in Step 3 is one of \DWTAGpointertype,
3730 \DWTAGreferencetype,
3731 \DWTAGrvaluereferencetype,
3732 \DWTAGptrtomembertype,
3733 or \DWTAGfriend, and the referenced
3734 type (via the \DWATtype{} or
3735 \DWATfriend{} attribute) has a
3736 \DWATname{} attribute, append to S the letter 'N', the DWARF
3737 attribute code (\DWATtype{} or
3738 \DWATfriend), the context of
3739 the type (according to the method in Step 2), the letter 'E',
3740 and the name of the type. For \DWTAGfriend, if the referenced
3741 entry is a \DWTAGsubprogram, the context is omitted and the
3742 name to be used is the ABI-specific name of the subprogram
3743 (for example, the mangled linker name).
3746 \item If the tag in Step 3 is not one of \DWTAGpointertype,
3747 \DWTAGreferencetype,
3748 \DWTAGrvaluereferencetype,
3749 \DWTAGptrtomembertype, or
3750 \DWTAGfriend, but has
3751 a \DWATtype{} attribute, or if the referenced type (via
3753 \DWATfriend{} attribute) does not have a
3754 \DWATname{} attribute, the attribute is processed according to
3755 the method in Step 4 for an attribute that refers to another
3759 \item Visit each child C of the debugging information
3760 entry as follows: If C is a nested type entry or a member
3761 function entry, and has
3762 a \DWATname{} attribute, append to
3763 \addtoindexx{name attribute}
3764 S the letter 'S', the tag of C, and its name; otherwise,
3765 process C recursively by performing Steps 3 through 7,
3766 appending the result to S. Following the last child (or if
3767 there are no children), append a zero byte.
3772 For the purposes of this algorithm, if a debugging information
3774 \DWATspecification{}
3775 attribute that refers to
3776 another entry D (which has a
3779 then S inherits the attributes and children of D, and S is
3780 processed as if those attributes and children were present in
3781 the entry S. Exception: if a particular attribute is found in
3782 both S and D, the attribute in S is used and the corresponding
3783 one in D is ignored.
3786 DWARF tag and attribute codes are appended to the sequence
3787 as unsigned LEB128\addtoindexx{LEB128!unsigned} values,
3788 using the values defined earlier in this chapter.
3790 \textit{A grammar describing this computation may be found in
3791 Appendix \refersec{app:typesignaturecomputationgrammar}.
3794 \textit{An attribute that refers to another type entry is
3795 recursively processed or replaced with the name of the
3796 referent (in Step 4, 5 or 6). If neither treatment applies to
3797 an attribute that references another type entry, the entry
3798 that contains that attribute is not suitable for a
3799 separate \addtoindex{type unit}.}
3801 \textit{If a debugging information entry contains an attribute from
3802 the list above that would require an unsupported form, that
3803 entry is not suitable for a separate
3804 \addtoindex{type unit}.}
3806 \textit{A type is suitable for a separate
3807 \addtoindex{type unit} only
3808 if all of the type entries that it contains or refers to in
3809 Steps 6 and 7 are themselves suitable for a separate
3810 \addtoindex{type unit}.}
3813 Where the DWARF producer may reasonably choose two or more
3814 different forms for a given attribute, it should choose
3815 the simplest possible form in computing the signature. (For
3816 example, a constant value should be preferred to a location
3817 expression when possible.)
3819 Once the string S has been formed from the DWARF encoding,
3820 an 16-byte \MDfive{} digest is computed for the string and the
3821 last eight bytes are taken as the type signature.
3823 \textit{The string S is intended to be a flattened representation of
3824 the type that uniquely identifies that type (that is, a different
3825 type is highly unlikely to produce the same string).}
3828 \textit{A debugging information entry is not be placed in a
3829 separate \addtoindex{type unit}
3830 if any of the following apply:}
3834 \item \textit{The entry has an attribute whose value is a location
3842 contains a reference to
3843 another debugging information entry (for example, a \DWOPcallref{}
3844 operator), as it is unlikely that the entry will remain
3845 identical across compilation units.}
3847 \item \textit{The entry has an attribute whose value refers
3848 to a code location or a \addtoindex{location list}.}
3850 \item \textit{The entry has an attribute whose value refers
3851 to another debugging information entry that does not represent
3857 \textit{Certain attributes are not included in the type signature:}
3860 \item \textit{The \DWATdeclaration{} attribute is not included because it
3861 indicates that the debugging information entry represents an
3862 incomplete declaration, and incomplete declarations should
3864 \addtoindexx{type unit}
3865 separate type units.}
3867 \item \textit{The \DWATdescription{} attribute is not included because
3868 it does not provide any information unique to the defining
3869 declaration of the type.}
3871 \item \textit{The \DWATdeclfile,
3873 \DWATdeclcolumn{} attributes are not included because they
3874 may vary from one source file to the next, and would prevent
3875 two otherwise identical type declarations from producing the
3876 same \MDfive{} digest.}
3878 \item \textit{The \DWATobjectpointer{} attribute is not included
3879 because the information it provides is not necessary for the
3880 computation of a unique type signature.}
3884 \textit{Nested types and some types referred to by a debugging
3885 information entry are encoded by name rather than by recursively
3886 encoding the type to allow for cases where a complete definition
3887 of the type might not be available in all compilation units.}
3890 \textit{If a type definition contains the definition of a member function,
3891 it cannot be moved as is into a type unit, because the member function
3892 contains attributes that are unique to that compilation unit.
3893 Such a type definition can be moved to a type unit by rewriting the
3895 debugging information entry
3898 moving the member function declaration into a separate declaration tree,
3899 and replacing the function definition in the type with a non-defining
3900 declaration of the function (as if the function had been defined out of
3903 An example that illustrates the computation of an \MDfive{} digest may be found in
3904 Appendix \refersec{app:usingtypeunits}.
3906 \section{Name Table Hash Function}
3907 \label{datarep:nametablehashfunction}
3908 The hash function used for hashing name strings in the accelerated
3909 access name index table (see Section \refersec{chap:acceleratedaccess})
3910 is defined in \addtoindex{C} as shown in
3911 Figure \referfol{fig:nametablehashfunctiondefinition}.\footnoteRR{
3912 This hash function is sometimes known as the
3914 "\addtoindex{Bernstein hash function}" or the
3916 "\addtoindex{DJB hash function}"
3918 \hrefself{http://en.wikipedia.org/wiki/List\_of\_hash\_functions} or
3919 \hrefself{http://stackoverflow.com/questions/10696223/reason-for-5381-number-in-djb-hash-function)}.}
3925 uint32_t /* must be a 32-bit integer type */
3926 hash(unsigned char *str)
3928 uint32_t hash = 5381;
3932 hash = hash * 33 + c;
3939 \caption{Name Table Hash Function Definition}
3940 \label{fig:nametablehashfunctiondefinition}