1 \chapter{Data Representation}
2 \label{datarep:datarepresentation}
4 This section describes the binary representation of the
5 debugging information entry itself, of the attribute types
6 and of other fundamental elements described above.
9 \section{Vendor Extensibility}
10 \label{datarep:vendorextensibility}
11 \addtoindexx{vendor extensibility}
12 \addtoindexx{vendor specific extensions|see{vendor extensibility}}
15 \addtoindexx{extensibility|see{vendor extensibility}}
16 reserve a portion of the DWARF name space and ranges of
17 enumeration values for use for vendor specific extensions,
18 special labels are reserved for tag names, attribute names,
19 base type encodings, location operations, language names,
20 calling conventions and call frame instructions.
22 The labels denoting the beginning and end of the reserved
23 \hypertarget{chap:DWXXXlohiuser}{}
24 value range for vendor specific extensions consist of the
26 (\DWATlouserMARK{}\DWAThiuserMARK{} DW\_AT,
27 \DWATElouserMARK{}\DWATEhiuserMARK{} DW\_ATE,
28 \DWCClouserMARK{}\DWCChiuserMARK{} DW\_CC,
29 \DWCFAlouserMARK{}\DWCFAhiuserMARK{} DW\_CFA
30 \DWENDlouserMARK{}\DWENDhiuserMARK{} DW\_END,
31 \DWLANGlouserMARK{}\DWLANGhiuserMARK{} DW\_LANG,
32 \DWLNElouserMARK{}\DWLNEhiuserMARK{} DW\_LNE,
33 \DWMACROlouserMARK{}\DWMACROhiuserMARK{}DW\_MACRO,
34 \DWOPlouserMARK{}\DWOPhiuserMARK{} DW\_OP or
35 \DWTAGlouserMARK{}\DWTAGhiuserMARK{} DW\_TAG,
36 respectively) followed by
37 \_lo\_user or \_hi\_user.
38 Values in the range between \textit{prefix}\_lo\_user
39 and \textit{prefix}\_hi\_user inclusive,
40 are reserved for vendor specific extensions. Vendors may
41 use values in this range without conflicting with current or
42 future system\dash defined values. All other values are reserved
43 for use by the system.
45 \textit{For example, for DIE tags, the special
46 labels are \DWTAGlouserNAME{} and \DWTAGhiuserNAME.}
48 \textit{There may also be codes for vendor specific extensions
49 between the number of standard line number opcodes and
50 the first special line number opcode. However, since the
51 number of standard opcodes varies with the DWARF version,
52 the range for extensions is also version dependent. Thus,
53 \DWLNSlouserTARG{} and
54 \DWLNShiuserTARG{} symbols are not defined.
57 Vendor defined tags, attributes, base type encodings, location
58 atoms, language names, line number actions, calling conventions
59 and call frame instructions, conventionally use the form
60 \text{prefix\_vendor\_id\_name}, where
61 \textit{vendor\_id}\addtoindexx{vendor id} is some identifying
62 character sequence chosen so as to avoid conflicts with
65 To ensure that extensions added by one vendor may be safely
66 ignored by consumers that do not understand those extensions,
67 the following rules must be followed:
68 \begin{enumerate}[1. ]
70 \item New attributes are added in such a way that a
71 debugger may recognize the format of a new attribute value
72 without knowing the content of that attribute value.
74 \item The semantics of any new attributes do not alter
75 the semantics of previously existing attributes.
77 \item The semantics of any new tags do not conflict with
78 the semantics of previously existing tags.
80 \item New forms of attribute value are not added.
85 \section{Reserved Values}
86 \label{datarep:reservedvalues}
87 \subsection{Error Values}
88 \label{datarep:errorvalues}
89 \addtoindexx{reserved values!error}
92 \addtoindexx{error value}
93 a convenience for consumers of DWARF information, the value
94 0 is reserved in the encodings for attribute names, attribute
95 forms, base type encodings, location operations, languages,
96 line number program opcodes, macro information entries and tag
97 names to represent an error condition or unknown value. DWARF
98 does not specify names for these reserved values, because they
99 do not represent valid encodings for the given type and do
100 not appear in DWARF debugging information.
103 \subsection{Initial Length Values}
104 \label{datarep:initiallengthvalues}
105 \addtoindexx{reserved values!initial length}
107 An \livetarg{datarep:initiallengthvalues}{initial length} field
108 \addtoindexx{initial length field|see{initial length}}
109 is one of the fields that occur at the beginning
110 of those DWARF sections that have a header
114 \dotdebugnames{}) or the length field
115 that occurs at the beginning of the CIE and FDE structures
116 in the \dotdebugframe{} section.
119 In an \addtoindex{initial length} field, the values \wfffffffzero through
120 \wffffffff are reserved by DWARF to indicate some form of
121 extension relative to \DWARFVersionII; such values must not
122 be interpreted as a length field. The use of one such value,
123 \xffffffff, is defined below
124 (see Section \refersec{datarep:32bitand64bitdwarfformats});
126 the other values is reserved for possible future extensions.
130 \section{Relocatable, Split, Executable, Shared and Package Object Files}
131 \label{datarep:executableobjectsandsharedobjects}
133 \subsection{Relocatable Object Files}
134 \label{datarep:relocatableobjectfiles}
135 A DWARF producer (for example, a compiler) typically generates its
136 debugging information as part of a relocatable object file.
137 Relocatable object files are then combined by a linker to form an
138 executable file. During the linking process, the linker resolves
139 (binds) symbolic references between the various object files, and
140 relocates the contents of each object file into a combined virtual
143 The DWARF debugging information is placed in several sections (see
144 Appendix \refersec{app:debugsectionrelationshipsinformative}), and
145 requires an object file format capable of
146 representing these separate sections. There are symbolic references
147 between these sections, and also between the debugging information
148 sections and the other sections that contain the text and data of the
149 program itself. Many of these references require relocation, and the
150 producer must emit the relocation information appropriate to the
151 object file format and the target processor architecture. These
152 references include the following:
155 \item The compilation unit header (see Section
156 \refersec{datarep:unitheaders}) in the \dotdebuginfo{}
157 section contains a reference to the \dotdebugabbrev{} table. This
158 reference requires a relocation so that after linking, it refers to
159 that contribution to the combined \dotdebugabbrev{} section in the
162 \item Debugging information entries may have attributes with the form
163 \DWFORMaddr{} (see Section \refersec{datarep:attributeencodings}).
164 These attributes represent locations
165 within the virtual address space of the program, and require
168 \item Debugging information entries may have attributes with the form
169 \DWFORMsecoffset{} (see Section \refersec{datarep:attributeencodings}).
170 These attributes refer to
171 debugging information in other debugging information sections within
172 the object file, and must be relocated during the linking process.
174 However, if a \DWATrangesbase{} attribute is present, the offset in
175 a \DWATranges{} attribute (which uses form \DWFORMsecoffset) is
176 relative to the given base offset {no relocation is involved}.
178 \item Debugging information entries may have attributes with the form
179 \DWFORMrefone, \DWFORMreftwo, \DWFORMreffour, \DWFORMrefeight, or
180 \DWFORMrefudata{} (see Section \refersec{datarep:attributeencodings}).
181 These attributes refer to other
182 debugging information entries within the same compilation unit, and
183 are relative to the beginning of the current compilation unit. These
184 values do not need relocation.
186 \item Debugging information entries may have attributes with the form
187 \DWFORMrefaddr{} (see Section \refersec{datarep:attributeencodings}).
188 These attributes refer to
189 debugging information entries that may be outside the current
190 compilation unit. These values require both symbolic binding and
193 \item Debugging information entries may have attributes with the form
194 \DWFORMstrp{} (see Section \refersec{datarep:attributeencodings}).
195 These attributes refer to strings in
196 the \dotdebugstr{} section. These values require relocation.
198 \item Entries in the \dotdebugloc{}, \dotdebugranges{}, and \dotdebugaranges{}
199 sections contain references to locations within the virtual address
200 space of the program, and require relocation.
202 \item In the \dotdebugline{} section, the operand of the \DWLNEsetaddress{}
203 opcode is a reference to a location within the virtual address space
204 of the program, and requires relocation.
206 \item The \dotdebugstroffsets{} section contains a list of string offsets,
207 each of which is an offset of a string in the \dotdebugstr{} section. Each
208 of these offsets requires relocation. Depending on the implementation,
209 these relocations may be implicit (that is, the producer may not need to
210 emit any explicit relocation information for these offsets).
213 \subsection{Split DWARF Object Files}
214 \label{datarep:splitdwarfobjectfiles}
215 \addtoindexx{split DWARF object file}
216 A DWARF producer may partition the debugging
217 information such that the majority of the debugging
218 information can remain in individual object files without
219 being processed by the linker.
221 \subsubsection{First Partition (with Skeleton Unit)}
222 The first partition contains
223 debugging information that must still be processed by the linker,
224 and includes the following:
227 The line number tables, range tables, frame tables, and
228 accelerated access tables, in the usual sections:
229 \dotdebugline, \dotdebuglinestr, \dotdebugranges, \dotdebugframe,
230 \dotdebugnames{} and \dotdebugaranges,
234 An address table, in the \dotdebugaddr{} section. This table
235 contains all addresses and constants that require
236 link-time relocation, and items in the table can be
237 referenced indirectly from the debugging information via
238 the \DWFORMaddrx{} form, and by the \DWOPaddrx{} and
239 \DWOPconstx{} operators.
241 A skeleton compilation unit, as described in Section
242 \refersec{chap:skeletoncompilationunitentries},
243 in the \dotdebuginfo{} section.
245 An abbreviations table for the skeleton compilation unit,
246 in the \dotdebugabbrev{} section.
248 A string table, in the \dotdebugstr{} section. The string
249 table is necessary only if the skeleton compilation unit
250 uses either indirect string form, \DWFORMstrp{} or
253 A string offsets table, in the \dotdebugstroffsets{}
254 section. The string offsets table is necessary only if
255 the skeleton compilation unit uses the \DWFORMstrx{} form.
257 The attributes contained in the skeleton compilation
258 unit can be used by a DWARF consumer to find the object file
259 or DWARF object file that contains the second partition.
261 \subsubsection{Second Partition (Unlinked or In \texttt{.dwo} File)}
262 The second partition contains the debugging information that
263 does not need to be processed by the linker. These sections
264 may be left in the object files and ignored by the linker
265 (that is, not combined and copied to the executable object), or
266 they may be placed by the producer in a separate DWARF object
267 file. This partition includes the following:
270 The full compilation unit, in the \dotdebuginfodwo{} section.
273 The full compilation unit entry includes a \DWATdwoid{}
274 attribute whose value is the same as that of the \DWATdwoid{}
275 attribute of the associated skeleton unit.
278 Attributes contained in the full compilation unit
279 may refer to machine addresses indirectly using the \DWFORMaddrx{}
280 form, which accesses the table of addresses specified by the
281 \DWATaddrbase{} attribute in the associated skeleton unit.
282 Location expressions may similarly do so using the \DWOPaddrx{} and
283 \DWOPconstx{} operations.
285 \DWATranges{} attributes contained in the full compilation unit
286 may refer to range table entries with a \DWFORMsecoffset{} offset
287 relative to the base offset specified by the \DWATrangesbase{}
288 attribute in the associated skeleton unit.
290 \item Separate type units, in the \dotdebuginfodwo{} section.
293 Abbreviations table(s) for the compilation unit and type
294 units, in the \dotdebugabbrevdwo{} section.
296 \item Location lists, in the \dotdebuglocdwo{} section.
299 A \addtoindex{specialized line number table} (for the type units),
300 in the \dotdebuglinedwo{} section. This table
301 contains only the directory and filename lists needed to
302 interpret \DWATdeclfile{} attributes in the debugging
305 \item Macro information, in the \dotdebugmacrodwo{} section.
307 \item A string table, in the \dotdebugstrdwo{} section.
309 \item A string offsets table, in the \dotdebugstroffsetsdwo{}
313 Except where noted otherwise, all references in this document
314 to a debugging information section (for example, \dotdebuginfo),
315 applies also to the corresponding split DWARF section (for example,
318 Split DWARF object files do not get linked with any other files,
319 therefore references between sections must not make use of
320 normal object file relocation information. As a result, symbolic
321 references within or between sections are not possible.
323 \subsection{Executable Objects}
324 \label{chap:executableobjects}
325 The relocated addresses in the debugging information for an
326 executable object are virtual addresses.
329 \subsection{Shared Object Files}
330 \label{datarep:sharedobject Files}
332 addresses in the debugging information for a shared object file
333 are offsets relative to the start of the lowest region of
334 memory loaded from that shared object file.
337 \textit{This requirement makes the debugging information for
338 shared object files position independent. Virtual addresses in a
339 shared object file may be calculated by adding the offset to the
340 base address at which the object file was attached. This offset
341 is available in the run\dash time linker\textquoteright s data structures.}
343 \subsection{DWARF Package Files}
344 \label{datarep:dwarfpackagefiles}
345 \textit{Using \splitDWARFobjectfile{s} allows the developer to compile,
346 link, and debug an application quickly with less link-time overhead,
347 but a more convenient format is needed for saving the debug
348 information for later debugging of a deployed application. A
349 DWARF package file can be used to collect the debugging
350 information from the object (or separate DWARF object) files
351 produced during the compilation of an application.}
353 \textit{The package file is typically placed in the same directory as the
354 application, and is given the same name with a \doublequote{\texttt{.dwp}}
355 extension.\addtoindexx{\texttt{.dwp} file extension}}
357 A DWARF package file is itself an object file, using the
358 \addtoindexx{package files}
359 \addtoindexx{DWARF package files}
360 same object file format (including \byteorder) as the
361 corresponding application binary. It consists only of a file
362 header, a section table, a number of DWARF debug information
363 sections, and two index sections.
366 Each DWARF package file contains no more than one of each of the
367 following sections, copied from a set of object or DWARF object
368 files, and combined, section by section:
374 \dotdebugstroffsetsdwo
379 The string table section in \dotdebugstrdwo{} contains all the
380 strings referenced from DWARF attributes using the form
381 \DWFORMstrx. Any attribute in a compilation unit or a type
382 unit using this form refers to an entry in that unit's
383 contribution to the \dotdebugstroffsetsdwo{} section, which in turn
384 provides the offset of a string in the \dotdebugstrdwo{}
387 The DWARF package file also contains two index sections that
388 provide a fast way to locate debug information by compilation
389 unit signature (\DWATdwoid) for compilation units, or by type
390 signature for type units:
396 \subsubsection{The Compilation Unit (CU) Index Section}
397 The \dotdebugcuindex{} section is a hashed lookup table that maps a
398 compilation unit signature to a set of contributions in the
399 various debug information sections. Each contribution is stored
400 as an offset within its corresponding section and a size.
402 Each \compunitset{} may contain contributions from the
405 \dotdebuginfodwo{} (required)
406 \dotdebugabbrevdwo{} (required)
409 \dotdebugstroffsetsdwo
413 \textit{Note that a \compunitset{} is not able to represent \dotdebugmacinfo{}
414 information from \DWARFVersionIV{} or earlier formats.}
416 \subsubsection{The Type Unit (TU) Index Section}
417 The \dotdebugtuindex{} section is a hashed lookup table that maps a
418 type signature to a set of offsets into the various debug
419 information sections. Each contribution is stored as an offset
420 within its corresponding section and a size.
422 Each \typeunitset{} may contain contributions from the following
425 \dotdebuginfodwo{} (required)
426 \dotdebugabbrevdwo{} (required)
428 \dotdebugstroffsetsdwo
431 \textit{Merging of type units with the same type signature
432 across \texttt{.dwo} files when creating a \texttt{.dwp} file
433 can be achieved using COMDAT-based techniques similar to those
434 described in Appendix
435 \refersec{app:dwarfcompressionandduplicateeliminationinformative}.
436 In fact, this is necessary in order to combine all \dotdebuginfodwo{}
437 section contributions into a single \dotdebuginfodwo{} section in a
440 \subsubsection{Format of the CU and TU Index Sections}
441 Both index sections have the same format, and serve to map a
442 64-bit signature to a set of contributions to the debug sections.
443 Each index section begins with a header, followed by a hash table of
444 signatures, a parallel table of indexes, a table of offsets, and
445 a table of sizes. The index sections are aligned at 8-byte
446 boundaries in the DWARF package file.
449 The index section header contains the following fields:
450 \begin{enumerate}[1. ]
451 \item \texttt{version} (\HFTuhalf) \\
453 \addtoindexx{version number!CU index information}
454 \addtoindexx{version number!TU index information}
455 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
456 This number is specific to the CU and TU index information
457 and is independent of the DWARF version number.
459 The version number is \versiondotdebugcuindex.
461 \item \textit{padding} (\HFTuhalf) \\
462 Reserved to DWARF (must be zero).
464 \item \texttt{column\_count} (\HFTuword) \\
465 The number of columns in the table of section counts that follows.
466 For brevity, the contents of this field is referred to as $C$ below.
468 \item \texttt{unit\_count} (\HFTuword) \\
469 The number of compilation units or type units in the index.
470 For brevity, the contents of this field is referred to as $U$ below.
472 \item \texttt{slot\_count} (\HFTuword) \\
473 The number of slots in the hash table.
474 For brevity, the contents of this field is referred to as $S$ below.
478 \textit{We assume that $U$ and $S$ do not exceed $2^{32}$.}
480 The size of the hash table, $S$, must be $2^k$ such that:
481 \hspace{0.3cm}$2^k\ \ >\ \ 3*U/2$
483 The hash table begins at offset 16 in the section, and consists
484 of an array of $S$ 8-byte slots. Each slot contains a 64-bit
486 % (using the \byteorder{} of the application binary).
488 The parallel table of indices begins immediately after the hash table
489 (at offset \mbox{$16 + 8 * S$} from the beginning of the section), and
490 consists of an array of $S$ 4-byte slots,
491 % (using the byte order of the application binary),
492 corresponding 1-1 with slots in the hash
493 table. Each entry in the parallel table contains a row index into
494 the tables of offsets and sizes.
496 Unused slots in the hash table have 0 in both the hash table
497 entry and the parallel table entry. While 0 is a valid hash
498 value, the row index in a used slot will always be non-zero.
500 Given a 64-bit compilation unit signature or a type signature $X$,
501 an entry in the hash table is located as follows:
502 \begin{enumerate}[1. ]
503 \item Calculate a primary hash $H = X\ \&\ MASK(k)$, where $MASK(k)$ is a
504 mask with the low-order $k$ bits all set to 1.
506 \item Calculate a secondary hash $H' = (((X>>32)\ \&\ MASK(k))\ |\ 1)$.
508 \item If the hash table entry at index $H$ matches the signature, use
509 that entry. If the hash table entry at index $H$ is unused (all
510 zeroes), terminate the search: the signature is not present
513 \item Let $H = (H + H')\ modulo\ S$. Repeat at Step 3.
516 Because $S > U$, and $H'$ and $S$ are relatively prime, the search is
517 guaranteed to stop at an unused slot or find the match.
520 The table of offsets begins immediately following the parallel
521 table (at offset \mbox{$16 + 12 * S$} from the beginning of the section).
522 The table is a two-dimensional array of 4-byte words,
523 %(using the byte order of the application binary),
524 with $C$ columns and $U + 1$
525 rows, in row-major order. Each row in the array is indexed
526 starting from 0. The first row provides a key to the columns:
527 each column in this row provides a section identifier for a debug
528 section, and the offsets in the same column of subsequent rows
529 refer to that section. The section identifiers are shown in
530 Table \referfol{tab:dwarfpackagefilesectionidentifierencodings}.
534 \setlength{\extrarowheight}{0.1cm}
535 \begin{longtable}{l|c|l}
536 \caption{DWARF package file section identifier \mbox{encodings}}
537 \label{tab:dwarfpackagefilesectionidentifierencodings}
538 \addtoindexx{DWARF package files!section identifier encodings} \\
539 \hline \bfseries Section identifier &\bfseries Value &\bfseries Section \\ \hline
541 \bfseries Section identifier &\bfseries Value &\bfseries Section\\ \hline
543 \hline \emph{Continued on next page}
547 \DWSECTINFOTARG & 1 & \dotdebuginfodwo \\
548 \textit{Reserved} & 2 & \\
549 \DWSECTABBREVTARG & 3 & \dotdebugabbrevdwo \\
550 \DWSECTLINETARG & 4 & \dotdebuglinedwo \\
551 \DWSECTLOCTARG & 5 & \dotdebuglocdwo \\
552 \DWSECTSTROFFSETSTARG & 6 & \dotdebugstroffsetsdwo \\
553 %DWSECTMACINFO & & \dotdebugmacinfodwo \\
554 \DWSECTMACROTARG & 7 & \dotdebugmacrodwo \\
558 The offsets provided by the CU and TU index sections are the
559 base offsets for the contributions made by each CU or TU to the
560 corresponding section in the package file. Each CU and TU header
561 contains a \HFNdebugabbrevoffset{} field, used to find the abbreviations
562 table for that CU or TU within the contribution to the
563 \dotdebugabbrevdwo{} section for that CU or TU, and are
564 interpreted as relative to the base offset given in the index
565 section. Likewise, offsets into \dotdebuglinedwo{} from
566 \DWATstmtlist{} attributes are interpreted as relative to
567 the base offset for \dotdebuglinedwo{}, and offsets into other debug
568 sections obtained from DWARF attributes are also
569 interpreted as relative to the corresponding base offset.
571 The table of sizes begins immediately following the table of
572 offsets, and provides the sizes of the contributions made by each
573 CU or TU to the corresponding section in the package file. Like
574 the table of offsets, it is a two-dimensional array of 4-byte
575 words, with $C$ columns and $U$ rows, in row-major order. Each row in
576 the array is indexed starting from 1 (row 0 of the table of
577 offsets also serves as the key for the table of sizes).
579 \subsection{DWARF Supplementary Object Files}
580 \label{datarep:dwarfsupplemetaryobjectfiles}
581 In order to minimize the size of debugging information, it is possible
582 to move duplicate debug information entries, strings and macro entries from
583 several executables or shared object files into a separate
584 \addtoindexi{\textit{supplementary object file}}{supplementary object file} by some
585 post-linking utility; the moved entries and strings can be then referenced
586 from the debugging information of each of those executable or shared object files.
589 A DWARF \addtoindex{supplementary object file} is itself an object file,
590 using the same object
591 file format, \byteorder{}, and size as the corresponding application executables
592 or shared libraries. It consists only of a file header, section table, and
593 a number of DWARF debug information sections. Both the
594 \addtoindex{supplementary object file}
595 and all the executable or shared object files that reference entries or strings in that
596 file must contain a \dotdebugsup{} section that establishes the relationship.
598 The \dotdebugsup{} section contains:
599 \begin{enumerate}[1. ]
600 \item \texttt{version} (\HFTuhalf) \\
601 \addttindexx{version}
602 A 2-byte unsigned integer representing the version of the DWARF
603 information for the compilation unit (see Appendix G). The
604 value in this field is \versiondotdebugsup.
606 \item \texttt{is\_supplementary} (\HFTubyte) \\
607 \addttindexx{is\_supplementary}
608 A 1-byte unsigned integer, which contains the value 1 if it is
609 in the \addtoindex{supplementary object file} that other executable or
610 shared object files refer to, or 0 if it is an executable or shared object
611 referring to a \addtoindex{supplementary object file}.
614 \item \texttt{sup\_filename} (null terminated filename string) \\
615 \addttindexx{sup\_filename}
616 If \addttindex{is\_supplementary} is 0, this contains either an absolute
617 filename for the \addtoindex{supplementary object file}, or a filename
618 relative to the object file containing the \dotdebugsup{} section.
619 If \addttindex{is\_supplementary} is 1, then \addttindex{sup\_filename}
620 is not needed and must be an empty string (a single null byte).
623 \item \texttt{sup\_checksum\_len} (unsigned LEB128) \\
624 \addttindexx{sup\_checksum\_len}
625 Length of the following \addttindex{sup\_checksum} field;
626 his value can be 0 if no checksum is provided.
629 \item \texttt{sup\_checksum} (array of \HFTubyte) \\
630 \addttindexx{sup\_checksum}
631 Some checksum or cryptographic hash function of the \dotdebuginfo{},
632 \dotdebugstr{} and \dotdebugmacro{} sections of the
633 \addtoindex{supplementary object file}, or some unique identifier
634 which the implementation can choose to verify that the supplementary
635 section object file matches what the debug information in the executable
636 or shared object file expects.
639 Debug information entries that refer to an executable's or shared
640 object's addresses must \emph{not} be moved to supplementary files (the
641 addesses will likely not be the same). Similarly,
642 entries referenced from within location expressions or using loclistptr
643 form attributes must not be moved to a \addtoindex{supplementary object file}.
645 Executable or shared object file compilation units can use
646 \DWTAGimportedunit{} with \DWFORMrefsup{} form \DWATimport{} attribute
647 to import entries from the \addtoindex{supplementary object file}, other \DWFORMrefsup{}
648 attributes to refer to them and \DWFORMstrpsup{} form attributes to
649 refer to strings that are used by debug information of multiple
650 executables or shared object files. Within the \addtoindex{supplementary object file}'s
651 debugging sections, form \DWFORMrefsup{} or \DWFORMstrpsup{} are
652 not used, and all reference forms referring to some other sections
653 refer to the local sections in the \addtoindex{supplementary object file}.
655 In macro information, \DWMACROdefinesup{} or
656 \DWMACROundefsup{} opcodes can refer to strings in the
657 \dotdebugstr{} section of the \addtoindex{supplementary object file},
658 or \DWMACROimportsup{}
659 can refer to \dotdebugmacro{} section entries. Within the
660 \dotdebugmacro{} section of a \addtoindex{supplementary object file},
661 \DWMACROdefinestrp{} and \DWMACROundefstrp{}
662 opcodes refer to the local \dotdebugstr{} section in that
663 supplementary file, not the one in
664 the executable or shared object file.
668 \section{32-Bit and 64-Bit DWARF Formats}
669 \label{datarep:32bitand64bitdwarfformats}
670 \hypertarget{datarep:xxbitdwffmt}{}
671 \addtoindexx{32-bit DWARF format}
672 \addtoindexx{64-bit DWARF format}
673 There are two closely related file formats. In the 32-bit DWARF
674 format, all values that represent lengths of DWARF sections
675 and offsets relative to the beginning of DWARF sections are
676 represented using four bytes. In the 64-bit DWARF format, all
677 values that represent lengths of DWARF sections and offsets
678 relative to the beginning of DWARF sections are represented
679 using eight bytes. A special convention applies to the initial
680 length field of certain DWARF sections, as well as the CIE and
681 FDE structures, so that the 32-bit and 64-bit DWARF formats
682 can coexist and be distinguished within a single linked object.
684 The differences between the 32- and 64-bit DWARF formats are
685 detailed in the following:
686 \begin{enumerate}[1. ]
688 \item In the 32-bit DWARF format, an
689 \addtoindex{initial length} field (see
690 \addtoindexx{initial length!encoding}
691 Section \ref{datarep:initiallengthvalues} on page \pageref{datarep:initiallengthvalues})
692 is an unsigned 4-byte integer (which
693 must be less than \xfffffffzero); in the 64-bit DWARF format,
694 an \addtoindex{initial length} field is 12 bytes in size,
697 \item The first four bytes have the value \xffffffff.
699 \item The following eight bytes contain the actual length
700 represented as an unsigned 8-byte integer.
703 \textit{This representation allows a DWARF consumer to dynamically
704 detect that a DWARF section contribution is using the 64-bit
705 format and to adapt its processing accordingly.}
708 \item Section offset and section length
709 \hypertarget{datarep:sectionoffsetlength}{}
710 \addtoindexx{section length!use in headers}
712 \addtoindexx{section offset!use in headers}
713 in the headers of DWARF sections (other than initial length
714 \addtoindexx{initial length}
715 fields) are listed following. In the 32-bit DWARF format these
716 are 4-byte unsigned integer values; in the 64-bit DWARF format,
717 they are 8-byte unsigned integer values.
721 Section &Name & Role \\ \hline
722 \dotdebugaranges{} & \addttindex{debug\_info\_offset} & offset in \dotdebuginfo{} \\
723 \dotdebugframe{}/CIE & \addttindex{CIE\_id} & CIE distinguished value \\
724 \dotdebugframe{}/FDE & \addttindex{CIE\_pointer} & offset in \dotdebugframe{} \\
725 \dotdebuginfo{} & \addttindex{debug\_abbrev\_offset} & offset in \dotdebugabbrev{} \\
726 \dotdebugline{} & \addttindex{header\_length} & length of header itself \\
727 \dotdebugnames{} & entry in array of CUs & offset in \dotdebuginfo{} \\
733 The \texttt{CIE\_id} field in a CIE structure must be 64 bits because
734 it overlays the \texttt{CIE\_pointer} in a FDE structure; this implicit
735 union must be accessed to distinguish whether a CIE or FDE is
736 present, consequently, these two fields must exactly overlay
737 each other (both offset and size).
739 \item Within the body of the \dotdebuginfo{}
740 section, certain forms of attribute value depend on the choice
741 of DWARF format as follows. For the 32-bit DWARF format,
742 the value is a 4-byte unsigned integer; for the 64-bit DWARF
743 format, the value is an 8-byte unsigned integer.
745 \begin{tabular}{lp{6cm}}
746 Form & Role \\ \hline
747 \DWFORMlinestrp & offset in \dotdebuglinestr \\
748 \DWFORMrefaddr & offset in \dotdebuginfo{} \\
749 \DWFORMrefsup & offset in \dotdebuginfo{} section of a \mbox{supplementary} object file \\
750 \addtoindexx{supplementary object file}
751 \DWFORMsecoffset & offset in a section other than \\
752 & \dotdebuginfo{} or \dotdebugstr{} \\
753 \DWFORMstrp & offset in \dotdebugstr{} \\
754 \DWFORMstrpsup & offset in \dotdebugstr{} section of a \mbox{supplementary} object file \\
755 \DWOPcallref & offset in \dotdebuginfo{} \\
760 \item Within the body of the \dotdebugline{} section, certain forms of content
761 description depend on the choice of DWARF format as follows: for the
762 32-bit DWARF format, the value is a 4-byte unsigned integer; for the
763 64-bit DWARF format, the value is a 8-byte unsigned integer.
765 \begin{tabular}{lp{6cm}}
766 Form & Role \\ \hline
767 \DWFORMlinestrp & offset in \dotdebuglinestr
771 \item Within the body of the \dotdebugnames{}
772 sections, the representation of each entry in the array of
773 compilation units (CUs) and the array of local type units
774 (TUs), which represents an offset in the
776 section, depends on the DWARF format as follows: in the
777 32-bit DWARF format, each entry is a 4-byte unsigned integer;
778 in the 64-bit DWARF format, it is a 8-byte unsigned integer.
781 \item In the body of the \dotdebugstroffsets{} and \dotdebugstroffsetsdwo{}
782 sections, the size of entries in the body depend on the DWARF
783 format as follows: in the 32-bit DWARF format, entries are 4-byte
784 unsigned integer values; in the 64-bit DWARF format, they are
785 8-byte unsigned integers.
787 \item In the body of the \dotdebugaddr{}, \dotdebugloc{} and \dotdebugranges{}
788 sections, the contents of the address size fields depends on the
789 DWARF format as follows: in the 32-bit DWARF format, these fields
790 contain 4; in the 64-bit DWARF format these fields contain 8.
794 The 32-bit and 64-bit DWARF format conventions must \emph{not} be
795 intermixed within a single compilation unit.
797 \textit{Attribute values and section header fields that represent
798 addresses in the target program are not affected by these
801 A DWARF consumer that supports the 64-bit DWARF format must
802 support executables in which some compilation units use the
803 32-bit format and others use the 64-bit format provided that
804 the combination links correctly (that is, provided that there
805 are no link\dash time errors due to truncation or overflow). (An
806 implementation is not required to guarantee detection and
807 reporting of all such errors.)
809 \textit{It is expected that DWARF producing compilers will \emph{not} use
810 the 64-bit format \emph{by default}. In most cases, the division of
811 even very large applications into a number of executable and
812 shared object files will suffice to assure that the DWARF sections
813 within each individual linked object are less than 4 GBytes
814 in size. However, for those cases where needed, the 64-bit
815 format allows the unusual case to be handled as well. Even
816 in this case, it is expected that only application supplied
817 objects will need to be compiled using the 64-bit format;
818 separate 32-bit format versions of system supplied shared
819 executable libraries can still be used.}
823 \section{Format of Debugging Information}
824 \label{datarep:formatofdebugginginformation}
826 For each compilation unit compiled with a DWARF producer,
827 a contribution is made to the \dotdebuginfo{} section of
828 the object file. Each such contribution consists of a
829 compilation unit header
830 (see Section \refersec{datarep:compilationunitheader})
832 single \DWTAGcompileunit{} or
833 \DWTAGpartialunit{} debugging
834 information entry, together with its children.
836 For each type defined in a compilation unit, a separate
837 contribution may also be made to the
839 section of the object file. Each
840 such contribution consists of a
841 \addtoindex{type unit} header
842 (see Section \refersec{datarep:typeunitheader})
843 followed by a \DWTAGtypeunit{} entry, together with
846 Each debugging information entry begins with a code that
847 represents an entry in a separate
848 \addtoindex{abbreviations table}. This
849 code is followed directly by a series of attribute values.
851 The appropriate entry in the
852 \addtoindex{abbreviations table} guides the
853 interpretation of the information contained directly in the
854 \dotdebuginfo{} section.
857 Multiple debugging information entries may share the same
858 abbreviation table entry. Each compilation unit is associated
859 with a particular abbreviation table, but multiple compilation
860 units may share the same table.
862 \subsection{Unit Headers}
863 \label{datarep:unitheaders}
864 Unit headers contain a field, \addttindex{unit\_type}, whose value indicates the kind of
865 compilation unit that follows. The encodings for the unit type
866 enumeration are shown in Table \refersec{tab:unitheaderunitkindencodings}.
870 \setlength{\extrarowheight}{0.1cm}
871 \begin{longtable}{l|c}
872 \caption{Unit header unit type encodings}
873 \label{tab:unitheaderunitkindencodings}
874 \addtoindexx{unit header unit type encodings} \\
875 \hline \bfseries Unit header unit type encodings&\bfseries Value \\ \hline
877 \bfseries Unit header unit type encodings&\bfseries Value \\ \hline
879 \hline \emph{Continued on next page}
881 \hline \ddag\ \textit{New in DWARF Version 5}
883 \DWUTcompileTARG~\ddag &0x01 \\
884 \DWUTtypeTARG~\ddag &0x02 \\
885 \DWUTpartialTARG~\ddag &0x03 \\ \hline
890 \subsubsection{Compilation Unit Header}
891 \label{datarep:compilationunitheader}
892 \begin{enumerate}[1. ]
894 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
895 \addttindexx{unit\_length}
897 \addtoindexx{initial length}
898 unsigned integer representing the length
899 of the \dotdebuginfo{}
900 contribution for that compilation unit,
901 not including the length field itself. In the \thirtytwobitdwarfformat,
902 this is a 4-byte unsigned integer (which must be less
903 than \xfffffffzero); in the \sixtyfourbitdwarfformat, this consists
904 of the 4-byte value \wffffffff followed by an 8-byte unsigned
905 integer that gives the actual length
906 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
908 \item \texttt{version} (\HFTuhalf) \\
909 \addttindexx{version}
910 A 2-byte unsigned integer representing the version of the
911 DWARF information for the compilation unit \addtoindexx{version number!compilation unit}
912 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
913 The value in this field is \versiondotdebuginfo.
916 \item \texttt{unit\_type} (\HFTubyte) \\
917 \addttindexx{unit\_type}
918 A 1-byte unsigned integer identifying this unit as a compilation unit.
919 The value of this field is
920 \DWUTcompile{} for a {normal compilation} unit or
921 \DWUTpartial{} for a {partial compilation} unit
922 (see Section \refersec{chap:normalandpartialcompilationunitentries}).
924 \textit{This field is new in \DWARFVersionV.}
927 \item \HFNdebugabbrevoffset{} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
929 \addtoindexx{section offset!in .debug\_info header}
930 4-byte or 8-byte unsigned offset into the
932 section. This offset associates the compilation unit with a
933 particular set of debugging information entry abbreviations. In
934 the \thirtytwobitdwarfformat, this is a 4-byte unsigned length;
935 in the \sixtyfourbitdwarfformat, this is an 8-byte unsigned length
936 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
938 \item \texttt{address\_size} (\HFTubyte) \\
939 \addttindexx{address\_size}
940 A 1-byte unsigned integer representing the size in bytes of
941 an address on the target architecture. If the system uses
942 \addtoindexx{address space!segmented}
943 segmented addressing, this value represents the size of the
944 offset portion of an address.
948 \subsubsection{Type Unit Header}
949 \label{datarep:typeunitheader}
951 The header for the series of debugging information entries
952 contributing to the description of a type that has been
953 placed in its own \addtoindex{type unit}, within the
954 \dotdebuginfo{} section,
955 consists of the following information:
956 \begin{enumerate}[1. ]
958 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
959 \addttindexx{unit\_length}
960 A 4-byte or 12-byte unsigned integer
961 \addtoindexx{initial length}
962 representing the length
963 of the \dotdebuginfo{} contribution for that type unit,
964 not including the length field itself. In the \thirtytwobitdwarfformat,
965 this is a 4-byte unsigned integer (which must be
966 less than \xfffffffzero); in the \sixtyfourbitdwarfformat, this
967 consists of the 4-byte value \wffffffff followed by an
968 8-byte unsigned integer that gives the actual length
969 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
972 \item \texttt{version} (\HFTuhalf) \\
973 \addttindexx{version}
974 A 2-byte unsigned integer representing the version of the
975 DWARF information for the
976 type unit\addtoindexx{version number!type unit}
977 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
978 The value in this field is \versiondotdebuginfo.
980 \item \texttt{unit\_type} (\HFTubyte) \\
981 \addttindexx{unit\_type}
982 A 1-byte unsigned integer identifying this unit as a type unit.
983 The value of this field is \DWUTtype{} for a type unit
984 (see Section \refersec{chap:typeunitentries}).
986 \textit{This field is new in \DWARFVersionV.}
989 \item \HFNdebugabbrevoffset{} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
991 \addtoindexx{section offset!in .debug\_info header}
992 4-byte or 8-byte unsigned offset into the
994 section. This offset associates the type unit with a
995 particular set of debugging information entry abbreviations. In
996 the \thirtytwobitdwarfformat, this is a 4-byte unsigned length;
997 in the \sixtyfourbitdwarfformat, this is an 8-byte unsigned length
998 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1001 \item \texttt{address\_size} (\HFTubyte) \\
1002 \addttindexx{address\_size}
1003 A 1-byte unsigned integer representing the size
1004 \addtoindexx{size of an address}
1006 an address on the target architecture. If the system uses
1007 \addtoindexx{address space!segmented}
1008 segmented addressing, this value represents the size of the
1009 offset portion of an address.
1011 \item \texttt{type\_signature} (8-byte unsigned integer) \\
1012 \addttindexx{type\_signature}
1013 \addtoindexx{type signature}
1014 A unique 64-bit signature (see Section
1015 \refersec{datarep:typesignaturecomputation})
1016 of the type described in this type
1019 \textit{An attribute that refers (using
1020 \DWFORMrefsigeight{}) to
1021 the primary type contained in this
1022 \addtoindex{type unit} uses this value.}
1024 \item \texttt{type\_offset} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
1025 \addttindexx{type\_offset}
1026 A 4-byte or 8-byte unsigned offset
1027 \addtoindexx{section offset!in .debug\_info header}
1028 relative to the beginning
1029 of the \addtoindex{type unit} header.
1030 This offset refers to the debugging
1031 information entry that describes the type. Because the type
1032 may be nested inside a namespace or other structures, and may
1033 contain references to other types that have not been placed in
1034 separate type units, it is not necessarily either the first or
1035 the only entry in the type unit. In the \thirtytwobitdwarfformat,
1036 this is a 4-byte unsigned length; in the \sixtyfourbitdwarfformat,
1037 this is an 8-byte unsigned length
1038 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1042 \subsection{Debugging Information Entry}
1043 \label{datarep:debugginginformationentry}
1045 Each debugging information entry begins with an
1046 unsigned LEB128\addtoindexx{LEB128!unsigned}
1047 number containing the abbreviation code for the entry. This
1048 code represents an entry within the abbreviations table
1049 associated with the compilation unit containing this entry. The
1050 abbreviation code is followed by a series of attribute values.
1052 On some architectures, there are alignment constraints on
1053 section boundaries. To make it easier to pad debugging
1054 information sections to satisfy such constraints, the
1055 abbreviation code 0 is reserved. Debugging information entries
1056 consisting of only the abbreviation code 0 are considered
1059 \subsection{Abbreviations Tables}
1060 \label{datarep:abbreviationstables}
1062 The abbreviations tables for all compilation units
1063 are contained in a separate object file section called
1065 As mentioned before, multiple compilation
1066 units may share the same abbreviations table.
1068 The abbreviations table for a single compilation unit consists
1069 of a series of abbreviation declarations. Each declaration
1070 specifies the tag and attributes for a particular form of
1071 debugging information entry. Each declaration begins with
1072 an unsigned LEB128\addtoindexx{LEB128!unsigned}
1073 number representing the abbreviation
1074 code itself. It is this code that appears at the beginning
1075 of a debugging information entry in the
1077 section. As described above, the abbreviation
1078 code 0 is reserved for null debugging information entries. The
1079 abbreviation code is followed by another unsigned LEB128\addtoindexx{LEB128!unsigned}
1080 number that encodes the entry\textquoteright s tag. The encodings for the
1081 tag names are given in
1082 Table \referfol{tab:tagencodings}.
1085 \setlength{\extrarowheight}{0.1cm}
1086 \begin{longtable}{l|c}
1087 \caption{Tag encodings} \label{tab:tagencodings} \\
1088 \hline \bfseries Tag name&\bfseries Value\\ \hline
1090 \bfseries Tag name&\bfseries Value \\ \hline
1092 \hline \emph{Continued on next page}
1094 \hline \ddag\ \textit{New in DWARF Version 5}
1096 \DWTAGarraytype{} &0x01 \\
1097 \DWTAGclasstype&0x02 \\
1098 \DWTAGentrypoint&0x03 \\
1099 \DWTAGenumerationtype&0x04 \\
1100 \DWTAGformalparameter&0x05 \\
1101 \DWTAGimporteddeclaration&0x08 \\
1103 \DWTAGlexicalblock&0x0b \\
1104 \DWTAGmember&0x0d \\
1105 \DWTAGpointertype&0x0f \\
1106 \DWTAGreferencetype&0x10 \\
1107 \DWTAGcompileunit&0x11 \\
1108 \DWTAGstringtype&0x12 \\
1109 \DWTAGstructuretype&0x13 \\
1110 \DWTAGsubroutinetype&0x15 \\
1111 \DWTAGtypedef&0x16 \\
1112 \DWTAGuniontype&0x17 \\
1113 \DWTAGunspecifiedparameters&0x18 \\
1114 \DWTAGvariant&0x19 \\
1115 \DWTAGcommonblock&0x1a \\
1116 \DWTAGcommoninclusion&0x1b \\
1117 \DWTAGinheritance&0x1c \\
1118 \DWTAGinlinedsubroutine&0x1d \\
1119 \DWTAGmodule&0x1e \\
1120 \DWTAGptrtomembertype&0x1f \\
1121 \DWTAGsettype&0x20 \\
1122 \DWTAGsubrangetype&0x21 \\
1123 \DWTAGwithstmt&0x22 \\
1124 \DWTAGaccessdeclaration&0x23 \\
1125 \DWTAGbasetype&0x24 \\
1126 \DWTAGcatchblock&0x25 \\
1127 \DWTAGconsttype&0x26 \\
1128 \DWTAGconstant&0x27 \\
1129 \DWTAGenumerator&0x28 \\
1130 \DWTAGfiletype&0x29 \\
1131 \DWTAGfriend&0x2a \\
1132 \DWTAGnamelist&0x2b \\
1133 \DWTAGnamelistitem&0x2c \\
1134 \DWTAGpackedtype&0x2d \\
1135 \DWTAGsubprogram&0x2e \\
1136 \DWTAGtemplatetypeparameter&0x2f \\
1137 \DWTAGtemplatevalueparameter&0x30 \\
1138 \DWTAGthrowntype&0x31 \\
1139 \DWTAGtryblock&0x32 \\
1140 \DWTAGvariantpart&0x33 \\
1141 \DWTAGvariable&0x34 \\
1142 \DWTAGvolatiletype&0x35 \\
1143 \DWTAGdwarfprocedure&0x36 \\
1144 \DWTAGrestricttype&0x37 \\
1145 \DWTAGinterfacetype&0x38 \\
1146 \DWTAGnamespace&0x39 \\
1147 \DWTAGimportedmodule&0x3a \\
1148 \DWTAGunspecifiedtype&0x3b \\
1149 \DWTAGpartialunit&0x3c \\
1150 \DWTAGimportedunit&0x3d \\
1151 \DWTAGcondition&\xiiif \\
1152 \DWTAGsharedtype&0x40 \\
1153 \DWTAGtypeunit & 0x41 \\
1154 \DWTAGrvaluereferencetype & 0x42 \\
1155 \DWTAGtemplatealias & 0x43 \\
1156 \DWTAGcoarraytype~\ddag & 0x44 \\
1157 \DWTAGgenericsubrange~\ddag & 0x45 \\
1158 \DWTAGdynamictype~\ddag & 0x46 \\
1159 \DWTAGatomictype~\ddag & 0x47 \\
1160 \DWTAGcallsite~\ddag & 0x48 \\
1161 \DWTAGcallsiteparameter~\ddag & 0x49 \\
1162 \DWTAGlouser&0x4080 \\
1163 \DWTAGhiuser&\xffff \\
1167 Following the tag encoding is a 1-byte value that determines
1168 whether a debugging information entry using this abbreviation
1169 has child entries or not. If the value is
1171 the next physically succeeding entry of any debugging
1172 information entry using this abbreviation is the first
1173 child of that entry. If the 1-byte value following the
1174 abbreviation\textquoteright s tag encoding is
1175 \DWCHILDRENnoTARG, the next
1176 physically succeeding entry of any debugging information entry
1177 using this abbreviation is a sibling of that entry. (Either
1178 the first child or sibling entries may be null entries). The
1179 encodings for the child determination byte are given in
1180 Table \refersec{tab:childdeterminationencodings}
1182 Section \refersec{chap:relationshipofdebugginginformationentries},
1183 each chain of sibling entries is terminated by a null entry.)
1187 \setlength{\extrarowheight}{0.1cm}
1188 \begin{longtable}{l|c}
1189 \caption{Child determination encodings}
1190 \label{tab:childdeterminationencodings}
1191 \addtoindexx{Child determination encodings} \\
1192 \hline \bfseries Children determination name&\bfseries Value \\ \hline
1194 \bfseries Children determination name&\bfseries Value \\ \hline
1196 \hline \emph{Continued on next page}
1200 \DWCHILDRENno&0x00 \\
1201 \DWCHILDRENyes&0x01 \\ \hline
1206 Finally, the child encoding is followed by a series of
1207 attribute specifications. Each attribute specification
1208 consists of two parts. The first part is an
1209 unsigned LEB128\addtoindexx{LEB128!unsigned}
1210 number representing the attribute\textquoteright s name.
1211 The second part is an
1212 unsigned LEB128\addtoindexx{LEB128!unsigned}
1213 number representing the attribute\textquoteright s form.
1214 The series of attribute specifications ends with an
1215 entry containing 0 for the name and 0 for the form.
1218 \DWFORMindirectTARG{} is a special case. For
1219 attributes with this form, the attribute value itself in the
1221 section begins with an unsigned
1222 LEB128 number that represents its form. This allows producers
1223 to choose forms for particular attributes
1224 \addtoindexx{abbreviations table!dynamic forms in}
1226 without having to add a new entry to the abbreviations table.
1228 The attribute form \DWFORMimplicitconstTARG{} is another special case.
1229 For attributes with this form, the attribute specification contains
1230 a third part, which is a signed LEB128\addtoindexx{LEB128!signed}
1231 number. The value of this number is used as the value of the
1232 attribute, and no value is stored in the \dotdebuginfo{} section.
1234 The abbreviations for a given compilation unit end with an
1235 entry consisting of a 0 byte for the abbreviation code.
1238 Appendix \refersec{app:compilationunitsandabbreviationstableexample}
1239 for a depiction of the organization of the
1240 debugging information.}
1243 \subsection{Attribute Encodings}
1244 \label{datarep:attributeencodings}
1246 The encodings for the attribute names are given in
1247 Table \referfol{tab:attributeencodings}.
1250 \setlength{\extrarowheight}{0.1cm}
1251 \begin{longtable}{l|c|l}
1252 \caption{Attribute encodings}
1253 \label{tab:attributeencodings}
1254 \addtoindexx{attribute encodings} \\
1255 \hline \bfseries Attribute name&\bfseries Value &\bfseries Classes \\ \hline
1257 \bfseries Attribute name&\bfseries Value &\bfseries Classes\\ \hline
1259 \hline \emph{Continued on next page}
1261 \hline \ddag\ \textit{New in DWARF Version 5}
1263 \DWATsibling&0x01&\livelink{chap:classreference}{reference}
1264 \addtoindexx{sibling attribute} \\
1265 \DWATlocation&0x02&\livelink{chap:classexprloc}{exprloc},
1266 \livelink{chap:classloclistptr}{loclistptr}
1267 \addtoindexx{location attribute} \\
1268 \DWATname&0x03&\livelink{chap:classstring}{string}
1269 \addtoindexx{name attribute} \\
1270 \DWATordering&0x09&\livelink{chap:classconstant}{constant}
1271 \addtoindexx{ordering attribute} \\
1272 \DWATbytesize&0x0b&\livelink{chap:classconstant}{constant},
1273 \livelink{chap:classexprloc}{exprloc},
1274 \livelink{chap:classreference}{reference}
1275 \addtoindexx{byte size attribute} \\
1276 \textit{Reserved}&0x0c\footnote{Code 0x0c is reserved to allow backward compatible support of the
1277 DW\_AT\_bit\_offset \mbox{attribute} which was
1278 defined in \DWARFVersionIII{} and earlier.}
1279 &\livelink{chap:classconstant}{constant},
1280 \livelink{chap:classexprloc}{exprloc},
1281 \livelink{chap:classreference}{reference}
1282 \addtoindexx{bit offset attribute (Version 3)}
1283 \addtoindexx{DW\_AT\_bit\_offset (deprecated)} \\
1284 \DWATbitsize&0x0d&\livelink{chap:classconstant}{constant},
1285 \livelink{chap:classexprloc}{exprloc},
1286 \livelink{chap:classreference}{reference}
1287 \addtoindexx{bit size attribute} \\
1288 \DWATstmtlist&0x10&\livelink{chap:classlineptr}{lineptr}
1289 \addtoindexx{statement list attribute} \\
1290 \DWATlowpc&0x11&\livelink{chap:classaddress}{address}
1291 \addtoindexx{low PC attribute} \\
1292 \DWAThighpc&0x12&\livelink{chap:classaddress}{address},
1293 \livelink{chap:classconstant}{constant}
1294 \addtoindexx{high PC attribute} \\
1295 \DWATlanguage&0x13&\livelink{chap:classconstant}{constant}
1296 \addtoindexx{language attribute} \\
1297 \DWATdiscr&0x15&\livelink{chap:classreference}{reference}
1298 \addtoindexx{discriminant attribute} \\
1299 \DWATdiscrvalue&0x16&\livelink{chap:classconstant}{constant}
1300 \addtoindexx{discriminant value attribute} \\
1301 \DWATvisibility&0x17&\livelink{chap:classconstant}{constant}
1302 \addtoindexx{visibility attribute} \\
1303 \DWATimport&0x18&\livelink{chap:classreference}{reference}
1304 \addtoindexx{import attribute} \\
1305 \DWATstringlength&0x19&\livelink{chap:classexprloc}{exprloc},
1306 \livelink{chap:classloclistptr}{loclistptr}
1307 \addtoindexx{string length attribute} \\
1308 \DWATcommonreference&0x1a&\livelink{chap:classreference}{reference}
1309 \addtoindexx{common reference attribute} \\
1310 \DWATcompdir&0x1b&\livelink{chap:classstring}{string}
1311 \addtoindexx{compilation directory attribute} \\
1312 \DWATconstvalue&0x1c&\livelink{chap:classblock}{block},
1313 \livelink{chap:classconstant}{constant},
1314 \livelink{chap:classstring}{string}
1315 \addtoindexx{constant value attribute} \\
1316 \DWATcontainingtype&0x1d&\livelink{chap:classreference}{reference}
1317 \addtoindexx{containing type attribute} \\
1318 \DWATdefaultvalue&0x1e&\livelink{chap:classconstant}{constant},
1319 \livelink{chap:classreference}{reference},
1320 \livelink{chap:classflag}{flag}
1321 \addtoindexx{default value attribute} \\
1322 \DWATinline&0x20&\livelink{chap:classconstant}{constant}
1323 \addtoindexx{inline attribute} \\
1324 \DWATisoptional&0x21&\livelink{chap:classflag}{flag}
1325 \addtoindexx{is optional attribute} \\
1326 \DWATlowerbound&0x22&\livelink{chap:classconstant}{constant},
1327 \livelink{chap:classexprloc}{exprloc},
1328 \livelink{chap:classreference}{reference}
1329 \addtoindexx{lower bound attribute} \\
1330 \DWATproducer&0x25&\livelink{chap:classstring}{string}
1331 \addtoindexx{producer attribute} \\
1332 \DWATprototyped&0x27&\livelink{chap:classflag}{flag}
1333 \addtoindexx{prototyped attribute} \\
1334 \DWATreturnaddr&0x2a&\livelink{chap:classexprloc}{exprloc},
1335 \livelink{chap:classloclistptr}{loclistptr}
1336 \addtoindexx{return address attribute} \\
1337 \DWATstartscope&0x2c&\livelink{chap:classconstant}{constant},
1338 \livelink{chap:classrangelistptr}{rangelistptr}
1339 \addtoindexx{start scope attribute} \\
1340 \DWATbitstride&0x2e&\livelink{chap:classconstant}{constant},
1341 \livelink{chap:classexprloc}{exprloc},
1342 \livelink{chap:classreference}{reference}
1343 \addtoindexx{bit stride attribute} \\
1344 \DWATupperbound&0x2f&\livelink{chap:classconstant}{constant},
1345 \livelink{chap:classexprloc}{exprloc},
1346 \livelink{chap:classreference}{reference}
1347 \addtoindexx{upper bound attribute} \\
1348 \DWATabstractorigin&0x31&\livelink{chap:classreference}{reference}
1349 \addtoindexx{abstract origin attribute} \\
1350 \DWATaccessibility&0x32&\livelink{chap:classconstant}{constant}
1351 \addtoindexx{accessibility attribute} \\
1352 \DWATaddressclass&0x33&\livelink{chap:classconstant}{constant}
1353 \addtoindexx{address class attribute} \\
1354 \DWATartificial&0x34&\livelink{chap:classflag}{flag}
1355 \addtoindexx{artificial attribute} \\
1356 \DWATbasetypes&0x35&\livelink{chap:classreference}{reference}
1357 \addtoindexx{base types attribute} \\
1358 \DWATcallingconvention&0x36&\livelink{chap:classconstant}{constant}
1359 \addtoindexx{calling convention attribute} \\
1360 \DWATcount&0x37&\livelink{chap:classconstant}{constant},
1361 \livelink{chap:classexprloc}{exprloc},
1362 \livelink{chap:classreference}{reference}
1363 \addtoindexx{count attribute} \\
1364 \DWATdatamemberlocation&0x38&\livelink{chap:classconstant}{constant},
1365 \livelink{chap:classexprloc}{exprloc},
1366 \livelink{chap:classloclistptr}{loclistptr}
1367 \addtoindexx{data member attribute} \\
1368 \DWATdeclcolumn&0x39&\livelink{chap:classconstant}{constant}
1369 \addtoindexx{declaration column attribute} \\
1370 \DWATdeclfile&0x3a&\livelink{chap:classconstant}{constant}
1371 \addtoindexx{declaration file attribute} \\
1372 \DWATdeclline&0x3b&\livelink{chap:classconstant}{constant}
1373 \addtoindexx{declaration line attribute} \\
1374 \DWATdeclaration&0x3c&\livelink{chap:classflag}{flag}
1375 \addtoindexx{declaration attribute} \\
1376 \DWATdiscrlist&0x3d&\livelink{chap:classblock}{block}
1377 \addtoindexx{discriminant list attribute} \\
1378 \DWATencoding&0x3e&\livelink{chap:classconstant}{constant}
1379 \addtoindexx{encoding attribute} \\
1380 \DWATexternal&\xiiif&\livelink{chap:classflag}{flag}
1381 \addtoindexx{external attribute} \\
1382 \DWATframebase&0x40&\livelink{chap:classexprloc}{exprloc},
1383 \livelink{chap:classloclistptr}{loclistptr}
1384 \addtoindexx{frame base attribute} \\
1385 \DWATfriend&0x41&\livelink{chap:classreference}{reference}
1386 \addtoindexx{friend attribute} \\
1387 \DWATidentifiercase&0x42&\livelink{chap:classconstant}{constant}
1388 \addtoindexx{identifier case attribute} \\
1389 \DWATmacroinfo\footnote{\raggedright Not used in \DWARFVersionV.
1390 Reserved for compatibility and coexistence
1391 with prior DWARF versions.}
1392 &0x43&\livelink{chap:classmacptr}{macptr}
1393 \addtoindexx{macro information attribute (legacy)!encoding} \\
1394 \DWATnamelistitem&0x44&\livelink{chap:classreference}{reference}
1395 \addtoindexx{name list item attribute} \\
1396 \DWATpriority&0x45&\livelink{chap:classreference}{reference}
1397 \addtoindexx{priority attribute} \\
1398 \DWATsegment&0x46&\livelink{chap:classexprloc}{exprloc},
1399 \livelink{chap:classloclistptr}{loclistptr}
1400 \addtoindexx{segment attribute} \\
1401 \DWATspecification&0x47&\livelink{chap:classreference}{reference}
1402 \addtoindexx{specification attribute} \\
1403 \DWATstaticlink&0x48&\livelink{chap:classexprloc}{exprloc},
1404 \livelink{chap:classloclistptr}{loclistptr}
1405 \addtoindexx{static link attribute} \\
1406 \DWATtype&0x49&\livelink{chap:classreference}{reference}
1407 \addtoindexx{type attribute} \\
1408 \DWATuselocation&0x4a&\livelink{chap:classexprloc}{exprloc},
1409 \livelink{chap:classloclistptr}{loclistptr}
1410 \addtoindexx{location list attribute} \\
1411 \DWATvariableparameter&0x4b&\livelink{chap:classflag}{flag}
1412 \addtoindexx{variable parameter attribute} \\
1413 \DWATvirtuality&0x4c&\livelink{chap:classconstant}{constant}
1414 \addtoindexx{virtuality attribute} \\
1415 \DWATvtableelemlocation&0x4d&\livelink{chap:classexprloc}{exprloc},
1416 \livelink{chap:classloclistptr}{loclistptr}
1417 \addtoindexx{vtable element location attribute} \\
1418 \DWATallocated&0x4e&\livelink{chap:classconstant}{constant},
1419 \livelink{chap:classexprloc}{exprloc},
1420 \livelink{chap:classreference}{reference}
1421 \addtoindexx{allocated attribute} \\
1422 \DWATassociated&0x4f&\livelink{chap:classconstant}{constant},
1423 \livelink{chap:classexprloc}{exprloc},
1424 \livelink{chap:classreference}{reference}
1425 \addtoindexx{associated attribute} \\
1426 \DWATdatalocation&0x50&\livelink{chap:classexprloc}{exprloc}
1427 \addtoindexx{data location attribute} \\
1428 \DWATbytestride&0x51&\livelink{chap:classconstant}{constant},
1429 \livelink{chap:classexprloc}{exprloc},
1430 \livelink{chap:classreference}{reference}
1431 \addtoindexx{byte stride attribute} \\
1432 \DWATentrypc&0x52&\livelink{chap:classaddress}{address},
1433 \livelink{chap:classconstant}{constant}
1434 \addtoindexx{entry PC attribute} \\
1435 \DWATuseUTFeight&0x53&\livelink{chap:classflag}{flag}
1436 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8} \\
1437 \DWATextension&0x54&\livelink{chap:classreference}{reference}
1438 \addtoindexx{extension attribute} \\
1439 \DWATranges&0x55&\livelink{chap:classrangelistptr}{rangelistptr}
1440 \addtoindexx{ranges attribute} \\
1441 \DWATtrampoline&0x56&\livelink{chap:classaddress}{address},
1442 \livelink{chap:classflag}{flag},
1443 \livelink{chap:classreference}{reference},
1444 \livelink{chap:classstring}{string}
1445 \addtoindexx{trampoline attribute} \\
1446 \DWATcallcolumn&0x57&\livelink{chap:classconstant}{constant}
1447 \addtoindexx{call column attribute} \\
1448 \DWATcallfile&0x58&\livelink{chap:classconstant}{constant}
1449 \addtoindexx{call file attribute} \\
1450 \DWATcallline&0x59&\livelink{chap:classconstant}{constant}
1451 \addtoindexx{call line attribute} \\
1452 \DWATdescription&0x5a&\livelink{chap:classstring}{string}
1453 \addtoindexx{description attribute} \\
1454 \DWATbinaryscale&0x5b&\livelink{chap:classconstant}{constant}
1455 \addtoindexx{binary scale attribute} \\
1456 \DWATdecimalscale&0x5c&\livelink{chap:classconstant}{constant}
1457 \addtoindexx{decimal scale attribute} \\
1458 \DWATsmall{} &0x5d&\livelink{chap:classreference}{reference}
1459 \addtoindexx{small attribute} \\
1460 \DWATdecimalsign&0x5e&\livelink{chap:classconstant}{constant}
1461 \addtoindexx{decimal scale attribute} \\
1462 \DWATdigitcount&0x5f&\livelink{chap:classconstant}{constant}
1463 \addtoindexx{digit count attribute} \\
1464 \DWATpicturestring&0x60&\livelink{chap:classstring}{string}
1465 \addtoindexx{picture string attribute} \\
1466 \DWATmutable&0x61&\livelink{chap:classflag}{flag}
1467 \addtoindexx{mutable attribute} \\
1468 \DWATthreadsscaled&0x62&\livelink{chap:classflag}{flag}
1469 \addtoindexx{thread scaled attribute} \\
1470 \DWATexplicit&0x63&\livelink{chap:classflag}{flag}
1471 \addtoindexx{explicit attribute} \\
1472 \DWATobjectpointer&0x64&\livelink{chap:classreference}{reference}
1473 \addtoindexx{object pointer attribute} \\
1474 \DWATendianity&0x65&\livelink{chap:classconstant}{constant}
1475 \addtoindexx{endianity attribute} \\
1476 \DWATelemental&0x66&\livelink{chap:classflag}{flag}
1477 \addtoindexx{elemental attribute} \\
1478 \DWATpure&0x67&\livelink{chap:classflag}{flag}
1479 \addtoindexx{pure attribute} \\
1480 \DWATrecursive&0x68&\livelink{chap:classflag}{flag}
1481 \addtoindexx{recursive attribute} \\
1482 \DWATsignature{} &0x69&\livelink{chap:classreference}{reference}
1483 \addtoindexx{signature attribute} \\
1484 \DWATmainsubprogram{} &0x6a&\livelink{chap:classflag}{flag}
1485 \addtoindexx{main subprogram attribute} \\
1486 \DWATdatabitoffset{} &0x6b&\livelink{chap:classconstant}{constant}
1487 \addtoindexx{data bit offset attribute} \\
1488 \DWATconstexpr{} &0x6c&\livelink{chap:classflag}{flag}
1489 \addtoindexx{constant expression attribute} \\
1490 \DWATenumclass{} &0x6d&\livelink{chap:classflag}{flag}
1491 \addtoindexx{enumeration class attribute} \\
1492 \DWATlinkagename{} &0x6e&\livelink{chap:classstring}{string}
1493 \addtoindexx{linkage name attribute} \\
1494 \DWATstringlengthbitsize{}~\ddag&0x6f&
1495 \livelink{chap:classconstant}{constant}
1496 \addtoindexx{string length attribute!size of length} \\
1497 \DWATstringlengthbytesize{}~\ddag&0x70&
1498 \livelink{chap:classconstant}{constant}
1499 \addtoindexx{string length attribute!size of length} \\
1500 \DWATrank~\ddag&0x71&
1501 \livelink{chap:classconstant}{constant},
1502 \livelink{chap:classexprloc}{exprloc}
1503 \addtoindexx{rank attribute} \\
1504 \DWATstroffsetsbase~\ddag&0x72&
1505 \livelinki{chap:classstroffsetsptr}{stroffsetsptr}{stroffsetsptr class}
1506 \addtoindexx{string offsets base!encoding} \\
1507 \DWATaddrbase~\ddag &0x73&
1508 \livelinki{chap:classaddrptr}{addrptr}{addrptr class}
1509 \addtoindexx{address table base!encoding} \\
1510 \DWATrangesbase~\ddag&0x74&
1511 \livelinki{chap:classrangelistptr}{rangelistptr}{rangelistptr class}
1512 \addtoindexx{ranges base!encoding} \\
1513 \DWATdwoid~\ddag &0x75&
1514 \livelink{chap:classconstant}{constant}
1515 \addtoindexx{split DWARF object file id!encoding} \\
1516 \DWATdwoname~\ddag &0x76&
1517 \livelink{chap:classstring}{string}
1518 \addtoindexx{split DWARF object file name!encoding} \\
1519 \DWATreference~\ddag &0x77&
1520 \livelink{chap:classflag}{flag} \\
1521 \DWATrvaluereference~\ddag &0x78&
1522 \livelink{chap:classflag}{flag} \\
1523 \DWATmacros~\ddag &0x79&\livelink{chap:classmacptr}{macptr}
1524 \addtoindexx{macro information attribute} \\
1525 \DWATcallallcalls~\ddag &0x7a&\CLASSflag
1526 \addtoindexx{all calls summary attribute} \\
1527 \DWATcallallsourcecalls~\ddag &0x7b &\CLASSflag
1528 \addtoindexx{all source calls summary attribute} \\
1529 \DWATcallalltailcalls~\ddag &0x7c&\CLASSflag
1530 \addtoindexx{all tail calls summary attribute} \\
1531 \DWATcallreturnpc~\ddag &0x7d &\CLASSaddress
1532 \addtoindexx{call return PC attribute} \\
1533 \DWATcallvalue~\ddag &0x7e &\CLASSexprloc
1534 \addtoindexx{call value attribute} \\
1535 \DWATcallorigin~\ddag &0x7f &\CLASSexprloc
1536 \addtoindexx{call origin attribute} \\
1537 \DWATcallparameter~\ddag &0x80 &\CLASSreference
1538 \addtoindexx{call parameter attribute} \\
1539 \DWATcallpc~\ddag &0x81 &\CLASSaddress
1540 \addtoindexx{call PC attribute} \\
1541 \DWATcalltailcall~\ddag &0x82 &\CLASSflag
1542 \addtoindexx{call tail call attribute} \\
1543 \DWATcalltarget~\ddag &0x83 &\CLASSexprloc
1544 \addtoindexx{call target attribute} \\
1545 \DWATcalltargetclobbered~\ddag &0x84 &\CLASSexprloc
1546 \addtoindexx{call target clobbered attribute} \\
1547 \DWATcalldatalocation~\ddag &0x85 &\CLASSexprloc
1548 \addtoindexx{call data location attribute} \\
1549 \DWATcalldatavalue~\ddag &0x86 &\CLASSexprloc
1550 \addtoindexx{call data value attribute} \\
1551 \DWATnoreturn~\ddag &0x87 &\CLASSflag
1552 \addtoindexx{noreturn attribute} \\
1553 \DWATalignment~\ddag &0x88 &\CLASSconstant
1554 \addtoindexx{alignment attribute} \\
1555 \DWATexportsymbols~\ddag &0x89 &\CLASSflag
1556 \addtoindexx{export symbols attribute} \\
1557 \DWATdeleted~\ddag &0x8a &\CLASSflag \addtoindexx{deleted attribute} \\
1558 \DWATdefaulted~\ddag &0x8b &\CLASSconstant \addtoindexx{defaulted attribute} \\
1559 \DWATlouser&0x2000 & --- \addtoindexx{low user attribute encoding} \\
1560 \DWAThiuser&\xiiifff& --- \addtoindexx{high user attribute encoding} \\
1565 The attribute form governs how the value of the attribute is
1566 encoded. There are nine classes of form, listed below. Each
1567 class is a set of forms which have related representations
1568 and which are given a common interpretation according to the
1569 attribute in which the form is used.
1571 Form \DWFORMsecoffsetTARG{}
1573 \addtoindexx{rangelistptr class}
1575 \addtoindexx{macptr class}
1577 \addtoindexx{loclistptr class}
1579 \addtoindexx{lineptr class}
1585 \CLASSrangelistptr{} or
1586 \CLASSstroffsetsptr;
1587 the list of classes allowed by the applicable attribute in
1588 Table \refersec{tab:attributeencodings}
1589 determines the class of the form.
1592 In the form descriptions that follow, some forms are said
1593 to depend in part on the value of an attribute of the
1594 \definition{\associatedcompilationunit}:
1597 In the case of a \splitDWARFobjectfile{}, the associated
1598 compilation unit is the skeleton compilation unit corresponding
1599 to the containing unit.
1600 \item Otherwise, the associated compilation unit
1601 is the containing unit.
1605 Each possible form belongs to one or more of the following classes
1606 (see Table \refersec{tab:classesofattributevalue} for a summary of
1607 the purpose and general usage of each class):
1610 \item \livelinki{chap:classaddress}{address}{address class} \\
1611 \livetarg{datarep:classaddress}{}
1612 Represented as either:
1614 \item An object of appropriate size to hold an
1615 address on the target machine
1617 The size is encoded in the compilation unit header
1618 (see Section \refersec{datarep:compilationunitheader}).
1619 This address is relocatable in a relocatable object file and
1620 is relocated in an executable file or shared object file.
1622 \item An indirect index into a table of addresses (as
1623 described in the previous bullet) in the
1624 \dotdebugaddr{} section (\DWFORMaddrxTARG).
1625 The representation of a \DWFORMaddrxNAME{} value is an unsigned
1626 \addtoindex{LEB128} value, which is interpreted as a zero-based
1627 index into an array of addresses in the \dotdebugaddr{} section.
1628 The index is relative to the value of the \DWATaddrbase{} attribute
1629 of the associated compilation unit.
1634 \item \livelink{chap:classaddrptr}{addrptr} \\
1635 \livetarg{datarep:classaddrptr}{}
1636 This is an offset into the \dotdebugaddr{} section (\DWFORMsecoffset). It
1637 consists of an offset from the beginning of the \dotdebugaddr{} section to the
1638 beginning of the list of machine addresses information for the
1639 referencing entity. It is relocatable in
1640 a relocatable object file, and relocated in an executable or
1641 shared object file. In the \thirtytwobitdwarfformat, this offset
1642 is a 4-byte unsigned value; in the 64-bit DWARF
1643 format, it is an 8-byte unsigned value (see Section
1644 \refersec{datarep:32bitand64bitdwarfformats}).
1646 \textit{This class is new in \DWARFVersionV.}
1649 \item \livelink{chap:classblock}{block} \\
1650 \livetarg{datarep:classblock}{}
1651 Blocks come in four forms:
1654 A 1-byte length followed by 0 to 255 contiguous information
1655 bytes (\DWFORMblockoneTARG).
1658 A 2-byte length followed by 0 to 65,535 contiguous information
1659 bytes (\DWFORMblocktwoTARG).
1662 A 4-byte length followed by 0 to 4,294,967,295 contiguous
1663 information bytes (\DWFORMblockfourTARG).
1666 An unsigned LEB128\addtoindexx{LEB128!unsigned}
1667 length followed by the number of bytes
1668 specified by the length (\DWFORMblockTARG).
1671 In all forms, the length is the number of information bytes
1672 that follow. The information bytes may contain any mixture
1673 of relocated (or relocatable) addresses, references to other
1674 debugging information entries or data bytes.
1676 \item \livelinki{chap:classconstant}{constant}{constant class} \\
1677 \livetarg{datarep:classconstant}{}
1678 There are eight forms of constants. There are fixed length
1679 constant data forms for one-, two-, four-, eight- and sixteen-byte values
1683 \DWFORMdatafourTARG,
1684 \DWFORMdataeightTARG{} and
1685 \DWFORMdatasixteenTARG).
1686 There are also variable length constant
1687 data forms encoded using LEB128 numbers (see below).
1688 Both signed (\DWFORMsdataTARG) and unsigned
1689 (\DWFORMudataTARG) variable length constants are available.
1690 There is also an implicit constant (\DWFORMimplicitconst),
1691 whose value is provided as part of the abbreviation
1695 The data in \DWFORMdataone,
1698 \DWFORMdataeight{} and
1699 \DWFORMdatasixteen{}
1700 can be anything. Depending on context, it may
1701 be a signed integer, an unsigned integer, a floating\dash point
1702 constant, or anything else. A consumer must use context to
1703 know how to interpret the bits, which if they are target
1704 machine data (such as an integer or floating-point constant)
1705 will be in target machine \byteorder.
1707 \textit{If one of the \DWFORMdataTARG\textless n\textgreater
1708 forms is used to represent a
1709 signed or unsigned integer, it can be hard for a consumer
1710 to discover the context necessary to determine which
1711 interpretation is intended. Producers are therefore strongly
1712 encouraged to use \DWFORMsdata{} or
1713 \DWFORMudata{} for signed and
1714 unsigned integers respectively, rather than
1715 \DWFORMdata\textless n\textgreater.}
1718 \item \livelinki{chap:classexprloc}{exprloc}{exprloc class} \\
1719 \livetarg{datarep:classexprloc}{}
1720 This is an unsigned LEB128\addtoindexx{LEB128!unsigned} length followed by the
1721 number of information bytes specified by the length
1722 (\DWFORMexprlocTARG).
1723 The information bytes contain a DWARF expression
1724 (see Section \refersec{chap:dwarfexpressions})
1725 or location description
1726 (see Section \refersec{chap:locationdescriptions}).
1729 \item \livelinki{chap:classflag}{flag}{flag class} \\
1730 \livetarg{datarep:classflag}{}
1731 A flag \addtoindexx{flag class}
1732 is represented explicitly as a single byte of data
1733 (\DWFORMflagTARG) or
1734 implicitly (\DWFORMflagpresentTARG).
1736 first case, if the \nolink{flag} has value zero, it indicates the
1737 absence of the attribute; if the \nolink{flag} has a non\dash zero value,
1738 it indicates the presence of the attribute. In the second
1739 case, the attribute is implicitly indicated as present, and
1740 no value is encoded in the debugging information entry itself.
1742 \item \livelinki{chap:classlineptr}{lineptr}{lineptr class} \\
1743 \livetarg{datarep:classlineptr}{}
1744 This is an offset into
1745 \addtoindexx{section offset!in class lineptr value}
1747 \dotdebugline{} or \dotdebuglinedwo{} section
1749 It consists of an offset from the beginning of the
1751 section to the first byte of
1752 the data making up the line number list for the compilation
1754 It is relocatable in a relocatable object file, and
1755 relocated in an executable or shared object file. In the
1756 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
1757 in the \sixtyfourbitdwarfformat, it is an 8-byte unsigned value
1758 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1761 \item \livelinki{chap:classloclistptr}{loclistptr}{loclistptr class} \\
1762 \livetarg{datarep:classloclistptr}{}
1763 This is an offset into the
1767 It consists of an offset from the
1768 \addtoindexx{section offset!in class loclistptr value}
1771 section to the first byte of
1772 the data making up the
1773 \addtoindex{location list} for the compilation unit.
1774 It is relocatable in a relocatable object file, and
1775 relocated in an executable or shared object file. In the
1776 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
1777 in the \sixtyfourbitdwarfformat, it is an 8-byte unsigned value
1778 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1781 \item \livelinki{chap:classmacptr}{macptr}{macptr class} \\
1782 \livetarg{datarep:classmacptr}{}
1784 \addtoindexx{section offset!in class macptr value}
1786 \dotdebugmacro{} or \dotdebugmacrodwo{} section
1788 It consists of an offset from the beginning of the
1789 \dotdebugmacro{} or \dotdebugmacrodwo{}
1790 section to the the header making up the
1791 macro information list for the compilation unit.
1792 It is relocatable in a relocatable object file, and
1793 relocated in an executable or shared object file. In the
1794 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
1795 in the \sixtyfourbitdwarfformat, it is an 8-byte unsigned value
1796 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1799 \item \livelinki{chap:classrangelistptr}{rangelistptr}{rangelistptr class} \\
1800 \livetarg{datarep:classrangelistptr}{}
1802 \addtoindexx{section offset!in class rangelistptr value}
1803 offset into the \dotdebugranges{} section
1806 offset from the beginning of the
1807 \dotdebugranges{} section
1808 to the beginning of the non\dash contiguous address ranges
1809 information for the referencing entity.
1810 It is relocatable in
1811 a relocatable object file, and relocated in an executable or
1813 However, if a \DWATrangesbase{} attribute applies, the offset
1814 is relative to the base offset given by \DWATrangesbase.
1815 In the \thirtytwobitdwarfformat, this offset
1816 is a 4-byte unsigned value; in the 64-bit DWARF
1817 format, it is an 8-byte unsigned value (see Section
1818 \refersec{datarep:32bitand64bitdwarfformats}).
1821 \textit{Because classes
1826 \CLASSrangelistptr{} and
1827 \CLASSstroffsetsptr{}
1828 share a common representation, it is not possible for an
1829 attribute to allow more than one of these classes}
1833 \item \livelinki{chap:classreference}{reference}{reference class} \\
1834 \livetarg{datarep:classreference}{}
1835 There are four types of reference.
1838 \addtoindexx{reference class}
1839 first type of reference can identify any debugging
1840 information entry within the containing unit.
1843 \addtoindexx{section offset!in class reference value}
1844 offset from the first byte of the compilation
1845 header for the compilation unit containing the reference. There
1846 are five forms for this type of reference. There are fixed
1847 length forms for one, two, four and eight byte offsets
1853 and \DWFORMrefeightTARG).
1854 There is also an unsigned variable
1855 length offset encoded form that uses
1856 unsigned LEB128\addtoindexx{LEB128!unsigned} numbers
1857 (\DWFORMrefudataTARG).
1858 Because this type of reference is within
1859 the containing compilation unit no relocation of the value
1862 The second type of reference can identify any debugging
1863 information entry within a
1864 \dotdebuginfo{} section; in particular,
1865 it may refer to an entry in a different compilation unit
1866 from the unit containing the reference, and may refer to an
1867 entry in a different shared object file. This type of reference
1868 (\DWFORMrefaddrTARG)
1869 is an offset from the beginning of the
1871 section of the target executable or shared object file, or, for
1872 references within a \addtoindex{supplementary object file},
1873 an offset from the beginning of the local \dotdebuginfo{} section;
1874 it is relocatable in a relocatable object file and frequently
1875 relocated in an executable or shared object file. For
1876 references from one shared object or static executable file
1877 to another, the relocation and identification of the target
1878 object must be performed by the consumer. In the
1879 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
1880 in the \sixtyfourbitdwarfformat, it is an 8-byte
1882 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1884 \textit{A debugging information entry that may be referenced by
1885 another compilation unit using
1886 \DWFORMrefaddr{} must have a global symbolic name.}
1888 \textit{For a reference from one executable or shared object file to
1889 another, the reference is resolved by the debugger to identify
1890 the executable or shared object file and the offset into that
1891 file\textquoteright s \dotdebuginfo{}
1892 section in the same fashion as the run
1893 time loader, either when the debug information is first read,
1894 or when the reference is used.}
1896 The third type of reference can identify any debugging
1897 information type entry that has been placed in its own
1898 \addtoindex{type unit}. This type of
1899 reference (\DWFORMrefsigeightTARG) is the
1900 \addtoindexx{type signature}
1901 64-bit type signature
1902 (see Section \refersec{datarep:typesignaturecomputation})
1903 that was computed for the type.
1905 The fourth type of reference is a reference from within the
1906 \dotdebuginfo{} section of the executable or shared object file to
1907 a debugging information entry in the \dotdebuginfo{} section of
1908 a \addtoindex{supplementary object file}.
1909 This type of reference (\DWFORMrefsupTARG) is an offset from the
1910 beginning of the \dotdebuginfo{} section in the
1911 \addtoindex{supplementary object file}.
1913 \textit{The use of compilation unit relative references will reduce the
1914 number of link\dash time relocations and so speed up linking. The
1915 use of the second, third and fourth type of reference allows for the
1916 sharing of information, such as types, across compilation
1917 units, while the fourth type further allows for sharing of information
1918 across compilation units from different executables or shared object files.}
1920 \textit{A reference to any kind of compilation unit identifies the
1921 debugging information entry for that unit, not the preceding
1925 \item \livelinki{chap:classstring}{string}{string class} \\
1926 \livetarg{datarep:classstring}{}
1927 A string is a sequence of contiguous non\dash null bytes followed by
1929 \addtoindexx{string class}
1930 A string may be represented:
1932 \setlength{\itemsep}{0em}
1933 \item immediately in the debugging information entry itself
1934 (\DWFORMstringTARG),
1937 \addtoindexx{section offset!in class string value}
1938 offset into a string table contained in
1939 the \dotdebugstr{} section of the object file (\DWFORMstrpTARG),
1940 the \dotdebuglinestr{} section of the object file (\DWFORMlinestrpTARG),
1941 or as an offset into a string table contained in the
1942 \dotdebugstr{} section of a \addtoindex{supplementary object file}
1943 (\DWFORMstrpsupTARG). \DWFORMstrpsupNAME{} offsets from the \dotdebuginfo{}
1944 section of a \addtoindex{supplementary object file}
1945 refer to the local \dotdebugstr{} section of that same file.
1946 In the \thirtytwobitdwarfformat, the representation of a
1947 \DWFORMstrpNAME{}, \DWFORMstrpNAME{} or \DWFORMstrpsupNAME{}
1948 value is a 4-byte unsigned offset; in the \sixtyfourbitdwarfformat,
1949 it is an 8-byte unsigned offset
1950 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1953 \item as an indirect offset into the string table using an
1954 index into a table of offsets contained in the
1955 \dotdebugstroffsets{} section of the object file (\DWFORMstrxTARG).
1956 The representation of a \DWFORMstrxNAME{} value is an unsigned
1957 \addtoindex{LEB128} value, which is interpreted as a zero-based
1958 index into an array of offsets in the \dotdebugstroffsets{} section.
1959 The offset entries in the \dotdebugstroffsets{} section have the
1960 same representation as \DWFORMstrp{} values.
1962 Any combination of these three forms may be used within a single compilation.
1964 If the \DWATuseUTFeight{}
1965 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8} attribute is specified for the
1966 compilation, partial, skeleton or type unit entry, string values are encoded using the
1967 UTF\dash 8 (\addtoindex{Unicode} Transformation Format\dash 8) from the Universal
1968 Character Set standard (ISO/IEC 10646\dash 1:1993).
1969 \addtoindexx{ISO 10646 character set standard}
1970 Otherwise, the string representation is unspecified.
1972 \textit{The \addtoindex{Unicode} Standard Version 3 is fully compatible with
1973 ISO/IEC 10646\dash 1:1993.
1974 \addtoindexx{ISO 10646 character set standard}
1975 It contains all the same characters
1976 and encoding points as ISO/IEC 10646, as well as additional
1977 information about the characters and their use.}
1979 \textit{Earlier versions of DWARF did not specify the representation
1980 of strings; for compatibility, this version also does
1981 not. However, the UTF\dash 8 representation is strongly recommended.}
1984 \item \livelinki{chap:classstroffsetsptr}{stroffsetsptr}{stroffsetsptr class} \\
1985 \livetarg{datarep:classstroffsetsptr}{}
1986 This is an offset into the \dotdebugstroffsets{} section
1987 (\DWFORMsecoffset). It consists of an offset from the beginning of the
1988 \dotdebugstroffsets{} section to the
1989 beginning of the string offsets information for the
1990 referencing entity. It is relocatable in
1991 a relocatable object file, and relocated in an executable or
1992 shared object file. In the \thirtytwobitdwarfformat, this offset
1993 is a 4-byte unsigned value; in the 64-bit DWARF
1994 format, it is an 8-byte unsigned value (see Section
1995 \refersec{datarep:32bitand64bitdwarfformats}).
1997 \textit{This class is new in \DWARFVersionV.}
2001 In no case does an attribute use one of the classes
2006 \CLASSrangelistptr{} or
2007 \CLASSstroffsetsptr{}
2008 to point into either the
2009 \dotdebuginfo{} or \dotdebugstr{} section.
2011 The form encodings are listed in
2012 Table \referfol{tab:attributeformencodings}.
2016 \setlength{\extrarowheight}{0.1cm}
2017 \begin{longtable}{l|c|l}
2018 \caption{Attribute form encodings} \label{tab:attributeformencodings} \\
2019 \hline \bfseries Form name&\bfseries Value &\bfseries Classes \\ \hline
2021 \bfseries Form name&\bfseries Value &\bfseries Classes\\ \hline
2023 \hline \emph{Continued on next page}
2025 \hline \ddag\ \textit{New in DWARF Version 5}
2028 \DWFORMaddr &0x01&\livelink{chap:classaddress}{address} \\
2029 \textit{Reserved} &0x02& \\
2030 \DWFORMblocktwo &0x03&\livelink{chap:classblock}{block} \\
2031 \DWFORMblockfour &0x04&\livelink{chap:classblock}{block} \\
2032 \DWFORMdatatwo &0x05&\livelink{chap:classconstant}{constant} \\
2033 \DWFORMdatafour &0x06&\livelink{chap:classconstant}{constant} \\
2034 \DWFORMdataeight &0x07&\livelink{chap:classconstant}{constant} \\
2035 \DWFORMstring&0x08&\livelink{chap:classstring}{string} \\
2036 \DWFORMblock&0x09&\livelink{chap:classblock}{block} \\
2037 \DWFORMblockone &0x0a&\livelink{chap:classblock}{block} \\
2038 \DWFORMdataone &0x0b&\livelink{chap:classconstant}{constant} \\
2039 \DWFORMflag&0x0c&\livelink{chap:classflag}{flag} \\
2040 \DWFORMsdata&0x0d&\livelink{chap:classconstant}{constant} \\
2041 \DWFORMstrp&0x0e&\livelink{chap:classstring}{string} \\
2042 \DWFORMudata&0x0f&\livelink{chap:classconstant}{constant} \\
2043 \DWFORMrefaddr&0x10&\livelink{chap:classreference}{reference} \\
2044 \DWFORMrefone&0x11&\livelink{chap:classreference}{reference} \\
2045 \DWFORMreftwo&0x12&\livelink{chap:classreference}{reference} \\
2046 \DWFORMreffour&0x13&\livelink{chap:classreference}{reference} \\
2047 \DWFORMrefeight&0x14&\livelink{chap:classreference}{reference} \\
2048 \DWFORMrefudata&0x15&\livelink{chap:classreference}{reference} \\
2049 \DWFORMindirect&0x16&(see Section \refersec{datarep:abbreviationstables}) \\
2050 \DWFORMsecoffset{} &0x17& \CLASSaddrptr, \CLASSlineptr, \CLASSloclistptr, \\
2051 & & \CLASSmacptr, \CLASSrangelistptr, \CLASSstroffsetsptr \\
2052 \DWFORMexprloc{} &0x18&\livelink{chap:classexprloc}{exprloc} \\
2053 \DWFORMflagpresent{} &0x19&\livelink{chap:classflag}{flag} \\
2054 \DWFORMstrx{} \ddag &0x1a&\livelink{chap:classstring}{string} \\
2055 \DWFORMaddrx{} \ddag &0x1b&\livelink{chap:classaddress}{address} \\
2056 \DWFORMrefsup{}~\ddag &0x1c &\livelink{chap:classreference}{reference} \\
2057 \DWFORMstrpsup{}~\ddag &0x1d &\livelink{chap:classstring}{string} \\
2058 \DWFORMdatasixteen~\ddag &0x1e &\CLASSconstant \\
2059 \DWFORMlinestrp~\ddag &0x1f &\CLASSstring \\
2060 \DWFORMrefsigeight &0x20 &\livelink{chap:classreference}{reference} \\
2061 \DWFORMimplicitconst~\ddag &0x21 &\CLASSconstant \\
2067 \section{Variable Length Data}
2068 \label{datarep:variablelengthdata}
2069 \addtoindexx{variable length data|see {LEB128}}
2071 \addtoindexx{Little Endian Base 128|see{LEB128}}
2072 encoded using \doublequote{Little Endian Base 128}
2073 \addtoindexx{little-endian encoding|see{endian attribute}}
2075 \addtoindexx{LEB128}
2076 LEB128 is a scheme for encoding integers
2077 densely that exploits the assumption that most integers are
2080 \textit{This encoding is equally suitable whether the target machine
2081 architecture represents data in big\dash\ endian or little\dash endian
2082 \byteorder. It is \doublequote{little\dash endian} only in the sense that it
2083 avoids using space to represent the \doublequote{big} end of an
2084 unsigned integer, when the big end is all zeroes or sign
2087 Unsigned LEB128\addtoindexx{LEB128!unsigned} (\addtoindex{ULEB128})
2088 numbers are encoded as follows:
2089 \addtoindexx{LEB128!unsigned, encoding as}
2090 start at the low order end of an unsigned integer and chop
2091 it into 7-bit chunks. Place each chunk into the low order 7
2092 bits of a byte. Typically, several of the high order bytes
2093 will be zero; discard them. Emit the remaining bytes in a
2094 stream, starting with the low order byte; set the high order
2095 bit on each byte except the last emitted byte. The high bit
2096 of zero on the last byte indicates to the decoder that it
2097 has encountered the last byte.
2099 The integer zero is a special case, consisting of a single
2102 Table \refersec{tab:examplesofunsignedleb128encodings}
2103 gives some examples of unsigned LEB128\addtoindexx{LEB128!unsigned}
2105 0x80 in each case is the high order bit of the byte, indicating
2106 that an additional byte follows.
2109 The encoding for signed, two\textquoteright{s} complement LEB128
2110 (\addtoindex{SLEB128}) \addtoindexx{LEB128!signed, encoding as}
2111 numbers is similar, except that the criterion for discarding
2112 high order bytes is not whether they are zero, but whether
2113 they consist entirely of sign extension bits. Consider the
2114 4-byte integer -2. The three high level bytes of the number
2115 are sign extension, thus LEB128 would represent it as a single
2116 byte containing the low order 7 bits, with the high order
2117 bit cleared to indicate the end of the byte stream. Note
2118 that there is nothing within the LEB128 representation that
2119 indicates whether an encoded number is signed or unsigned. The
2120 decoder must know what type of number to expect.
2121 Table \refersec{tab:examplesofunsignedleb128encodings}
2122 gives some examples of unsigned LEB128\addtoindexx{LEB128!unsigned}
2123 numbers and Table \refersec{tab:examplesofsignedleb128encodings}
2124 gives some examples of signed LEB128\addtoindexx{LEB128!signed}
2127 \textit{Appendix \refersec{app:variablelengthdataencodingdecodinginformative}
2128 \addtoindexx{LEB128!examples}
2129 gives algorithms for encoding and decoding these forms.}
2133 \setlength{\extrarowheight}{0.1cm}
2134 \begin{longtable}{c|c|c}
2135 \caption{Examples of unsigned LEB128 encodings}
2136 \label{tab:examplesofunsignedleb128encodings}
2137 \addtoindexx{LEB128 encoding!examples}\addtoindexx{LEB128!unsigned} \\
2138 \hline \bfseries Number&\bfseries First byte &\bfseries Second byte \\ \hline
2140 \bfseries Number&\bfseries First Byte &\bfseries Second byte\\ \hline
2142 \hline \emph{Continued on next page}
2148 128& 0 + 0x80 & 1 \\
2149 129& 1 + 0x80 & 1 \\
2150 %130& 2 + 0x80 & 1 \\
2151 12857& 57 + 0x80 & 100 \\
2158 \setlength{\extrarowheight}{0.1cm}
2159 \begin{longtable}{c|c|c}
2160 \caption{Examples of signed LEB128 encodings}
2161 \label{tab:examplesofsignedleb128encodings}
2162 \addtoindexx{LEB128!signed} \\
2163 \hline \bfseries Number&\bfseries First byte &\bfseries Second byte \\ \hline
2165 \bfseries Number&\bfseries First Byte &\bfseries Second byte\\ \hline
2167 \hline \emph{Continued on next page}
2173 127& 127 + 0x80 & 0 \\
2174 -127& 1 + 0x80 & 0x7f \\
2175 128& 0 + 0x80 & 1 \\
2176 -128& 0 + 0x80 & 0x7f \\
2177 129& 1 + 0x80 & 1 \\
2178 -129& 0x7f + 0x80 & 0x7e \\
2185 \section{DWARF Expressions and Location Descriptions}
2186 \label{datarep:dwarfexpressionsandlocationdescriptions}
2187 \subsection{DWARF Expressions}
2188 \label{datarep:dwarfexpressions}
2191 \addtoindexx{DWARF expression!operator encoding}
2192 DWARF expression is stored in a \nolink{block} of contiguous
2193 bytes. The bytes form a sequence of operations. Each operation
2194 is a 1-byte code that identifies that operation, followed by
2195 zero or more bytes of additional data. The encodings for the
2196 operations are described in
2197 Table \refersec{tab:dwarfoperationencodings}.
2200 \setlength{\extrarowheight}{0.1cm}
2201 \begin{longtable}{l|c|c|l}
2202 \caption{DWARF operation encodings} \label{tab:dwarfoperationencodings} \\
2203 \hline & &\bfseries No. of &\\
2204 \bfseries Operation&\bfseries Code &\bfseries Operands &\bfseries Notes\\ \hline
2206 & &\bfseries No. of &\\
2207 \bfseries Operation&\bfseries Code &\bfseries Operands &\bfseries Notes\\ \hline
2209 \hline \emph{Continued on next page}
2211 \hline \ddag\ \textit{New in DWARF Version 5}
2214 \DWOPaddr&0x03&1 & constant address \\
2215 & & &(size is target specific) \\
2217 \DWOPderef&0x06&0 & \\
2219 \DWOPconstoneu&0x08&1&1-byte constant \\
2220 \DWOPconstones&0x09&1&1-byte constant \\
2221 \DWOPconsttwou&0x0a&1&2-byte constant \\
2222 \DWOPconsttwos&0x0b&1&2-byte constant \\
2223 \DWOPconstfouru&0x0c&1&4-byte constant \\
2224 \DWOPconstfours&0x0d&1&4-byte constant \\
2225 \DWOPconsteightu&0x0e&1&8-byte constant \\
2226 \DWOPconsteights&0x0f&1&8-byte constant \\
2227 \DWOPconstu&0x10&1&ULEB128 constant \\
2228 \DWOPconsts&0x11&1&SLEB128 constant \\
2229 \DWOPdup&0x12&0 & \\
2230 \DWOPdrop&0x13&0 & \\
2231 \DWOPover&0x14&0 & \\
2232 \DWOPpick&0x15&1&1-byte stack index \\
2233 \DWOPswap&0x16&0 & \\
2234 \DWOProt&0x17&0 & \\
2235 \DWOPxderef&0x18&0 & \\
2236 \DWOPabs&0x19&0 & \\
2237 \DWOPand&0x1a&0 & \\
2238 \DWOPdiv&0x1b&0 & \\
2239 \DWOPminus&0x1c&0 & \\
2240 \DWOPmod&0x1d&0 & \\
2241 \DWOPmul&0x1e&0 & \\
2242 \DWOPneg&0x1f&0 & \\
2243 \DWOPnot&0x20&0 & \\
2245 \DWOPplus&0x22&0 & \\
2246 \DWOPplusuconst&0x23&1&ULEB128 addend \\
2247 \DWOPshl&0x24&0 & \\
2248 \DWOPshr&0x25&0 & \\
2249 \DWOPshra&0x26&0 & \\
2250 \DWOPxor&0x27&0 & \\
2252 \DWOPbra&0x28&1 & signed 2-byte constant \\
2259 \DWOPskip&0x2f&1&signed 2-byte constant \\ \hline
2261 \DWOPlitzero & 0x30 & 0 & \\
2262 \DWOPlitone & 0x31 & 0& literals 0 .. 31 = \\
2263 \ldots & & &\hspace{0.3cm}(\DWOPlitzero{} + literal) \\
2264 \DWOPlitthirtyone & 0x4f & 0 & \\ \hline
2266 \DWOPregzero & 0x50 & 0 & \\*
2267 \DWOPregone & 0x51 & 0® 0 .. 31 = \\*
2268 \ldots & & &\hspace{0.3cm}(\DWOPregzero{} + regnum) \\*
2269 \DWOPregthirtyone & 0x6f & 0 & \\ \hline
2271 \DWOPbregzero & 0x70 &1 & SLEB128 offset \\*
2272 \DWOPbregone & 0x71 & 1 &base register 0 .. 31 = \\*
2273 ... & & &\hspace{0.3cm}(\DWOPbregzero{} + regnum) \\*
2274 \DWOPbregthirtyone & 0x8f & 1 & \\ \hline
2276 \DWOPregx{} & 0x90 &1&ULEB128 register \\
2277 \DWOPfbreg{} & 0x91&1&SLEB128 offset \\
2278 \DWOPbregx{} & 0x92&2 &ULEB128 register, \\*
2279 & & &SLEB128 offset \\
2280 \DWOPpiece{} & 0x93 &1& ULEB128 size of piece \\
2281 \DWOPderefsize{} & 0x94 &1& 1-byte size of data retrieved \\
2282 \DWOPxderefsize{} & 0x95&1&1-byte size of data retrieved \\
2283 \DWOPnop{} & 0x96 &0& \\
2285 \DWOPpushobjectaddress&0x97&0 & \\
2286 \DWOPcalltwo&0x98&1& 2-byte offset of DIE \\
2287 \DWOPcallfour&0x99&1& 4-byte offset of DIE \\
2288 \DWOPcallref&0x9a&1& 4\dash\ or 8-byte offset of DIE \\
2289 \DWOPformtlsaddress&0x9b &0& \\
2290 \DWOPcallframecfa{} &0x9c &0& \\
2291 \DWOPbitpiece&0x9d &2&ULEB128 size, \\*
2293 \DWOPimplicitvalue{} &0x9e &2&ULEB128 size, \\*
2294 &&&\nolink{block} of that size\\
2295 \DWOPstackvalue{} &0x9f &0& \\
2296 \DWOPimplicitpointer{}~\ddag &0xa0& 2 &4- or 8-byte offset of DIE, \\*
2297 &&&SLEB128 constant offset \\
2298 \DWOPaddrx~\ddag&0xa1&1&ULEB128 indirect address \\
2299 \DWOPconstx~\ddag&0xa2&1&ULEB128 indirect constant \\
2300 \DWOPentryvalue~\ddag&0xa3&2&ULEB128 size, \\*
2301 &&&\nolink{block} of that size\\
2302 \DWOPconsttype~\ddag & 0xa4 & 3 & ULEB128 type entry offset,\\*
2303 & & & 1-byte size, \\*
2304 & & & constant value \\
2305 \DWOPregvaltype~\ddag & 0xa5 & 2 & ULEB128 register number, \\*
2306 &&& ULEB128 constant offset \\
2307 \DWOPdereftype~\ddag & 0xa6 & 2 & 1-byte size, \\*
2308 &&& ULEB128 type entry offset \\
2309 \DWOPxdereftype~\ddag & 0xa7 & 2 & 1-byte size, \\*
2310 &&& ULEB128 type entry offset \\
2311 \DWOPconvert~\ddag & 0xa8 & 1 & ULEB128 type entry offset \\
2312 \DWOPreinterpret~\ddag & 0xa9 & 1 & ULEB128 type entry offset \\
2313 \DWOPlouser{} &0xe0 && \\
2314 \DWOPhiuser{} &\xff && \\
2320 \subsection{Location Descriptions}
2321 \label{datarep:locationdescriptions}
2323 A location description is used to compute the
2324 location of a variable or other entity.
2326 \subsection{Location Lists}
2327 \label{datarep:locationlists}
2329 Each entry in a \addtoindex{location list} is either a location list entry,
2330 a base address selection entry, or an
2331 \addtoindexx{end-of-list entry!in location list}
2335 \subsubsection{Location List Entries in Non-Split Objects}
2336 A \addtoindex{location list} entry consists of two address offsets followed
2337 by an unsigned 2-byte length, followed by a block of contiguous bytes
2338 that contains a DWARF location description. The length
2339 specifies the number of bytes in that block. The two offsets
2340 are the same size as an address on the target machine.
2343 A base address selection entry and an
2344 \addtoindexx{end-of-list entry!in location list}
2345 end-of-list entry each
2346 consist of two (constant or relocated) address offsets. The two
2347 offsets are the same size as an address on the target machine.
2349 For a \addtoindex{location list} to be specified, the base address of
2350 \addtoindexx{base address selection entry!in location list}
2351 the corresponding compilation unit must be defined
2352 (see Section \refersec{chap:normalandpartialcompilationunitentries}).
2354 \subsubsection{Location List Entries in Split Objects}
2355 \label{datarep:locationlistentriesinsplitobjects}
2356 An alternate form for location list entries is used in split objects.
2357 Each entry begins with an unsigned 1-byte code that indicates the kind of entry
2358 that follows. The encodings for these constants are given in
2359 Table \refersec{tab:locationlistentryencodingvalues}.
2363 \setlength{\extrarowheight}{0.1cm}
2364 \begin{longtable}{l|c}
2365 \caption{Location list entry encoding values} \label{tab:locationlistentryencodingvalues} \\
2366 \hline \bfseries Location list entry encoding name&\bfseries Value \\ \hline
2368 \bfseries Location list entry encoding name&\bfseries Value\\ \hline
2370 \hline \emph{Continued on next page}
2374 \DWLLEendoflistentry & 0x0 \\
2375 \DWLLEbaseaddressselectionentry & 0x01 \\
2376 \DWLLEstartendentry & 0x02 \\
2377 \DWLLEstartlengthentry & 0x03 \\
2378 \DWLLEoffsetpairentry & 0x04 \\
2382 \section{Base Type Attribute Encodings}
2383 \label{datarep:basetypeattributeencodings}
2385 The encodings of the
2386 \hypertarget{chap:DWATencodingencodingofbasetype}{}
2387 constants used in the
2388 \DWATencodingDEFN{} attribute\addtoindexx{encoding attribute}
2390 Table \refersec{tab:basetypeencodingvalues}
2393 \setlength{\extrarowheight}{0.1cm}
2394 \begin{longtable}{l|c}
2395 \caption{Base type encoding values} \label{tab:basetypeencodingvalues} \\
2396 \hline \bfseries Base type encoding name&\bfseries Value \\ \hline
2398 \bfseries Base type encoding name&\bfseries Value\\ \hline
2400 \hline \emph{Continued on next page}
2403 \ddag \ \textit{New in \DWARFVersionV}
2405 \DWATEaddress&0x01 \\
2406 \DWATEboolean&0x02 \\
2407 \DWATEcomplexfloat&0x03 \\
2409 \DWATEsigned&0x05 \\
2410 \DWATEsignedchar&0x06 \\
2411 \DWATEunsigned&0x07 \\
2412 \DWATEunsignedchar&0x08 \\
2413 \DWATEimaginaryfloat&0x09 \\
2414 \DWATEpackeddecimal&0x0a \\
2415 \DWATEnumericstring&0x0b \\
2416 \DWATEedited&0x0c \\
2417 \DWATEsignedfixed&0x0d \\
2418 \DWATEunsignedfixed&0x0e \\
2419 \DWATEdecimalfloat & 0x0f \\
2420 \DWATEUTF{} & 0x10 \\
2421 \DWATEUCS~\ddag & 0x11 \\
2422 \DWATEASCII~\ddag & 0x12 \\
2423 \DWATElouser{} & 0x80 \\
2424 \DWATEhiuser{} & \xff \\
2429 The encodings of the constants used in the
2430 \DWATdecimalsign{} attribute
2432 Table \refersec{tab:decimalsignencodings}.
2435 \setlength{\extrarowheight}{0.1cm}
2436 \begin{longtable}{l|c}
2437 \caption{Decimal sign encodings} \label{tab:decimalsignencodings} \\
2438 \hline \bfseries Decimal sign code name&\bfseries Value \\ \hline
2440 \bfseries Decimal sign code name&\bfseries Value\\ \hline
2442 \hline \emph{Continued on next page}
2447 \DWDSunsigned{} & 0x01 \\
2448 \DWDSleadingoverpunch{} & 0x02 \\
2449 \DWDStrailingoverpunch{} & 0x03 \\
2450 \DWDSleadingseparate{} & 0x04 \\
2451 \DWDStrailingseparate{} & 0x05 \\
2457 The encodings of the constants used in the
2458 \DWATendianity{} attribute are given in
2459 Table \refersec{tab:endianityencodings}.
2462 \setlength{\extrarowheight}{0.1cm}
2463 \begin{longtable}{l|c}
2464 \caption{Endianity encodings} \label{tab:endianityencodings}\\
2465 \hline \bfseries Endian code name&\bfseries Value \\ \hline
2467 \bfseries Endian code name&\bfseries Value\\ \hline
2469 \hline \emph{Continued on next page}
2474 \DWENDdefault{} & 0x00 \\
2475 \DWENDbig{} & 0x01 \\
2476 \DWENDlittle{} & 0x02 \\
2477 \DWENDlouser{} & 0x40 \\
2478 \DWENDhiuser{} & \xff \\
2484 \section{Accessibility Codes}
2485 \label{datarep:accessibilitycodes}
2486 The encodings of the constants used in the
2487 \DWATaccessibility{}
2489 \addtoindexx{accessibility attribute}
2491 Table \refersec{tab:accessibilityencodings}.
2494 \setlength{\extrarowheight}{0.1cm}
2495 \begin{longtable}{l|c}
2496 \caption{Accessibility encodings} \label{tab:accessibilityencodings}\\
2497 \hline \bfseries Accessibility code name&\bfseries Value \\ \hline
2499 \bfseries Accessibility code name&\bfseries Value\\ \hline
2501 \hline \emph{Continued on next page}
2506 \DWACCESSpublic&0x01 \\
2507 \DWACCESSprotected&0x02 \\
2508 \DWACCESSprivate&0x03 \\
2514 \section{Visibility Codes}
2515 \label{datarep:visibilitycodes}
2516 The encodings of the constants used in the
2517 \DWATvisibility{} attribute are given in
2518 Table \refersec{tab:visibilityencodings}.
2521 \setlength{\extrarowheight}{0.1cm}
2522 \begin{longtable}{l|c}
2523 \caption{Visibility encodings} \label{tab:visibilityencodings}\\
2524 \hline \bfseries Visibility code name&\bfseries Value \\ \hline
2526 \bfseries Visibility code name&\bfseries Value\\ \hline
2528 \hline \emph{Continued on next page}
2534 \DWVISexported&0x02 \\
2535 \DWVISqualified&0x03 \\
2540 \section{Virtuality Codes}
2541 \label{datarep:vitualitycodes}
2543 The encodings of the constants used in the
2544 \DWATvirtuality{} attribute are given in
2545 Table \refersec{tab:virtualityencodings}.
2548 \setlength{\extrarowheight}{0.1cm}
2549 \begin{longtable}{l|c}
2550 \caption{Virtuality encodings} \label{tab:virtualityencodings}\\
2551 \hline \bfseries Virtuality code name&\bfseries Value \\ \hline
2553 \bfseries Virtuality code name&\bfseries Value\\ \hline
2555 \hline \emph{Continued on next page}
2560 \DWVIRTUALITYnone&0x00 \\
2561 \DWVIRTUALITYvirtual&0x01 \\
2562 \DWVIRTUALITYpurevirtual&0x02 \\
2569 \DWVIRTUALITYnone{} is equivalent to the absence of the
2573 \section{Source Languages}
2574 \label{datarep:sourcelanguages}
2576 The encodings of the constants used
2577 \addtoindexx{language attribute, encoding}
2579 \addtoindexx{language name encoding}
2582 attribute are given in
2583 Table \refersec{tab:languageencodings}.
2585 % If we don't force a following space it looks odd
2587 and their associated values are reserved, but the
2588 languages they represent are not well supported.
2589 Table \refersec{tab:languageencodings}
2591 \addtoindexx{lower bound attribute!default}
2592 default lower bound, if any, assumed for
2593 an omitted \DWATlowerbound{} attribute in the context of a
2594 \DWTAGsubrangetype{} debugging information entry for each
2598 \setlength{\extrarowheight}{0.1cm}
2599 \begin{longtable}{l|c|c}
2600 \caption{Language encodings} \label{tab:languageencodings}\\
2601 \hline \bfseries Language name&\bfseries Value &\bfseries Default Lower Bound \\ \hline
2603 \bfseries Language name&\bfseries Value &\bfseries Default Lower Bound\\ \hline
2605 \hline \emph{Continued on next page}
2608 \dag \ \textit{See text} \\ \ddag \ \textit{New in \DWARFVersionV}
2610 \addtoindexx{ISO-defined language names}
2612 \DWLANGCeightynine &0x0001 &0 \addtoindexx{C:1989 (ISO)} \\
2613 \DWLANGC{} &0x0002 &0 \addtoindexx{C!non-standard} \\
2614 \DWLANGAdaeightythree{} \dag &0x0003 &1 \addtoindexx{Ada:1983 (ISO)} \\
2615 \DWLANGCplusplus{} &0x0004 &0 \addtoindexx{C++:1998 (ISO)} \\
2616 \DWLANGCobolseventyfour{} \dag &0x0005 &1 \addtoindexx{COBOL:1974 (ISO)} \\
2617 \DWLANGCoboleightyfive{} \dag &0x0006 &1 \addtoindexx{COBOL:1985 (ISO)} \\
2618 \DWLANGFortranseventyseven &0x0007 &1 \addtoindexx{FORTRAN:1977 (ISO)} \\
2619 \DWLANGFortranninety &0x0008 &1 \addtoindexx{Fortran:1990 (ISO)} \\
2620 \DWLANGPascaleightythree &0x0009 &1 \addtoindexx{Pascal:1983 (ISO)} \\
2621 \DWLANGModulatwo &0x000a &1 \addtoindexx{Modula-2:1996 (ISO)} \\
2622 \DWLANGJava &0x000b &0 \addtoindexx{Java} \\
2623 \DWLANGCninetynine &0x000c &0 \addtoindexx{C:1999 (ISO)} \\
2624 \DWLANGAdaninetyfive{} \dag &0x000d &1 \addtoindexx{Ada:1995 (ISO)} \\
2625 \DWLANGFortranninetyfive &0x000e &1 \addtoindexx{Fortran:1995 (ISO)} \\
2626 \DWLANGPLI{} \dag &0x000f &1 \addtoindexx{PL/I:1976 (ANSI)}\\
2627 \DWLANGObjC{} &0x0010 &0 \addtoindexx{Objective C}\\
2628 \DWLANGObjCplusplus{} &0x0011 &0 \addtoindexx{Objective C++}\\
2629 \DWLANGUPC{} &0x0012 &0 \addtoindexx{UPC}\\
2630 \DWLANGD{} &0x0013 &0 \addtoindexx{D language}\\
2631 \DWLANGPython{} \dag &0x0014 &0 \addtoindexx{Python}\\
2632 \DWLANGOpenCL{} \dag \ddag &0x0015 &0 \addtoindexx{OpenCL}\\
2633 \DWLANGGo{} \dag \ddag &0x0016 &0 \addtoindexx{Go}\\
2634 \DWLANGModulathree{} \dag \ddag &0x0017 &1 \addtoindexx{Modula-3}\\
2635 \DWLANGHaskell{} \dag \ddag &0x0018 &0 \addtoindexx{Haskell}\\
2636 \DWLANGCpluspluszerothree{} \ddag &0x0019 &0 \addtoindexx{C++:2003 (ISO)}\\
2637 \DWLANGCpluspluseleven{} \ddag &0x001a &0 \addtoindexx{C++:2011 (ISO)}\\
2638 \DWLANGOCaml{} \ddag &0x001b &0 \addtoindexx{OCaml}\\
2639 \DWLANGRust{} \ddag &0x001c &0 \addtoindexx{Rust}\\
2640 \DWLANGCeleven{} \ddag &0x001d &0 \addtoindexx{C:2011 (ISO)}\\
2641 \DWLANGSwift{} \ddag &0x001e &0 \addtoindexx{Swift} \\
2642 \DWLANGJulia{} \ddag &0x001f &1 \addtoindexx{Julia} \\
2643 \DWLANGDylan{} \ddag &0x0020 &0 \addtoindexx{Dylan} \\
2644 \DWLANGCplusplusfourteen{}~\ddag &0x0021 &0 \addtoindexx{C++:2014 (ISO)} \\
2645 \DWLANGFortranzerothree{}~\ddag &0x0022 &1 \addtoindexx{Fortran:2004 (ISO)} \\
2646 \DWLANGFortranzeroeight{}~\ddag &0x0023 &1 \addtoindexx{Fortran:2010 (ISO)} \\
2647 \DWLANGlouser{} &0x8000 & \\
2648 \DWLANGhiuser{} &\xffff & \\
2653 \section{Address Class Encodings}
2654 \label{datarep:addressclassencodings}
2656 The value of the common
2657 \addtoindex{address class} encoding
2661 \section{Identifier Case}
2662 \label{datarep:identifiercase}
2664 The encodings of the constants used in the
2665 \DWATidentifiercase{} attribute are given in
2666 Table \refersec{tab:identifiercaseencodings}.
2670 \setlength{\extrarowheight}{0.1cm}
2671 \begin{longtable}{l|c}
2672 \caption{Identifier case encodings} \label{tab:identifiercaseencodings}\\
2673 \hline \bfseries Identifier case name&\bfseries Value \\ \hline
2675 \bfseries Identifier case name&\bfseries Value\\ \hline
2677 \hline \emph{Continued on next page}
2681 \DWIDcasesensitive&0x00 \\
2683 \DWIDdowncase&0x02 \\
2684 \DWIDcaseinsensitive&0x03 \\
2688 \section{Calling Convention Encodings}
2689 \label{datarep:callingconventionencodings}
2690 The encodings of the constants used in the
2691 \DWATcallingconvention{} attribute are given in
2692 Table \refersec{tab:callingconventionencodings}.
2695 \setlength{\extrarowheight}{0.1cm}
2696 \begin{longtable}{l|c}
2697 \caption{Calling convention encodings} \label{tab:callingconventionencodings}\\
2698 \hline \bfseries Calling convention name&\bfseries Value \\ \hline
2700 \bfseries Calling convention name&\bfseries Value\\ \hline
2702 \hline \emph{Continued on next page}
2704 \hline \ddag\ \textit{New in DWARF Version 5}
2707 \DWCCnormal &0x01 \\
2708 \DWCCprogram&0x02 \\
2709 \DWCCnocall &0x03 \\
2710 \DWCCpassbyreference~\ddag &0x04 \\
2711 \DWCCpassbyvalue~\ddag &0x05 \\
2712 \DWCClouser &0x40 \\
2719 \section{Inline Codes}
2720 \label{datarep:inlinecodes}
2722 The encodings of the constants used in
2723 \addtoindexx{inline attribute}
2725 \DWATinline{} attribute are given in
2726 Table \refersec{tab:inlineencodings}.
2730 \setlength{\extrarowheight}{0.1cm}
2731 \begin{longtable}{l|c}
2732 \caption{Inline encodings} \label{tab:inlineencodings}\\
2733 \hline \bfseries Inline code name&\bfseries Value \\ \hline
2735 \bfseries Inline Code name&\bfseries Value\\ \hline
2737 \hline \emph{Continued on next page}
2742 \DWINLnotinlined&0x00 \\
2743 \DWINLinlined&0x01 \\
2744 \DWINLdeclarednotinlined&0x02 \\
2745 \DWINLdeclaredinlined&0x03 \\
2750 % this clearpage is ugly, but the following table came
2751 % out oddly without it.
2753 \section{Array Ordering}
2754 \label{datarep:arrayordering}
2756 The encodings of the constants used in the
2757 \DWATordering{} attribute are given in
2758 Table \refersec{tab:orderingencodings}.
2762 \setlength{\extrarowheight}{0.1cm}
2763 \begin{longtable}{l|c}
2764 \caption{Ordering encodings} \label{tab:orderingencodings}\\
2765 \hline \bfseries Ordering name&\bfseries Value \\ \hline
2767 \bfseries Ordering name&\bfseries Value\\ \hline
2769 \hline \emph{Continued on next page}
2774 \DWORDrowmajor&0x00 \\
2775 \DWORDcolmajor&0x01 \\
2781 \section{Discriminant Lists}
2782 \label{datarep:discriminantlists}
2784 The descriptors used in
2785 \addtoindexx{discriminant list attribute}
2787 \DWATdiscrlist{} attribute are
2788 encoded as 1-byte constants. The
2789 defined values are given in
2790 Table \refersec{tab:discriminantdescriptorencodings}.
2792 % Odd that the 'Name' field capitalized here, it is not caps elsewhere.
2794 \setlength{\extrarowheight}{0.1cm}
2795 \begin{longtable}{l|c}
2796 \caption{Discriminant descriptor encodings} \label{tab:discriminantdescriptorencodings}\\
2797 \hline \bfseries Descriptor name&\bfseries Value \\ \hline
2799 \bfseries Descriptor name&\bfseries Value\\ \hline
2801 \hline \emph{Continued on next page}
2813 \section{Name Index Table}
2814 \label{datarep:nameindextable}
2815 Each name index table in the \dotdebugnames{} section
2816 begins with a header consisting of:
2817 \begin{enumerate}[1. ]
2818 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
2819 \addttindexx{unit\_length}
2820 A 4-byte or 12-byte initial length field that
2821 contains the size in bytes of this contribution to the \dotdebugnames{}
2822 section, not including the length field itself
2823 (see Section \refersec{datarep:initiallengthvalues}).
2825 \item \texttt{version} (\HFTuhalf) \\
2826 A 2-byte version number\addtoindexx{version number!name index table}
2827 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
2828 This number is specific to the name index table and is
2829 independent of the DWARF version number.
2831 The value in this field is \versiondotdebugnames.
2833 \item padding (\HFTuhalf) \\
2835 \item \texttt{comp\_unit\_count} (\HFTuword) \\
2836 The number of CUs in the CU list.
2838 \item \texttt{local\_type\_unit\_count} (\HFTuword) \\
2839 The number of TUs in the first TU list.
2841 \item \texttt{foreign\_type\_unit\_count} (\HFTuword) \\
2842 The number of TUs in the second TU list.
2844 \item \texttt{bucket\_count} (\HFTuword) \\
2845 The number of hash buckets in the hash lookup table.
2846 If there is no hash lookup table, this field contains 0.
2848 \item \texttt{name\_count} (\HFTuword) \\
2849 The number of unique names in the index.
2851 \item \texttt{abbrev\_table\_size} (\HFTuword) \\
2852 The size in bytes of the abbreviations table.
2854 \item \texttt{augmentation\_string\_size} (\HFTuword) \\
2855 The size in bytes of the augmentation string. This value is
2856 rounded up to a multiple of 4.
2858 \item \texttt{augmentation\_string} (\HFTaugstring) \\
2859 A vendor-specific augmentation string, which provides additional
2860 information about the contents of this index. If provided, the string
2861 begins with a 4-character vendor ID. The remainder of the
2862 string is meant to be read by a cooperating consumer, and its
2863 contents and interpretation are not specified here. The
2864 string is padded with null characters to a multiple of
2865 four bytes in length.
2869 The name index attributes and their encodings are listed in Table \referfol{datarep:indexattributeencodings}.
2872 \setlength{\extrarowheight}{0.1cm}
2873 \begin{longtable}{l|c|l}
2874 \caption{Name index attribute encodings} \label{datarep:indexattributeencodings}\\
2875 \hline \bfseries Attribute name&\bfseries Value &\bfseries Form/Class \\ \hline
2877 \bfseries Attribute name&\bfseries Value &\bfseries Form/Class \\ \hline
2879 \hline \emph{Continued on next page}
2882 \ddag \ \textit{New in \DWARFVersionV}
2884 \DWIDXcompileunit~\ddag & 1 & \CLASSconstant \\
2885 \DWIDXtypeunit~\ddag & 2 & \CLASSconstant \\
2886 \DWIDXdieoffset~\ddag & 3 & \CLASSreference \\
2887 \DWIDXparent~\ddag & 4 & \CLASSconstant \\
2888 \DWIDXtypehash~\ddag & 5 & \DWFORMdataeight \\
2889 \DWIDXlouser~\ddag & 0x2000 & \\
2890 \DWIDXhiuser~\ddag & \xiiifff & \\
2894 The abbreviations table ends with an entry consisting of a single 0
2895 byte for the abbreviation code. The size of the table given by
2896 \texttt{abbrev\_table\_size} may include optional padding following the
2899 \section{Defaulted Member Encodings}
2900 \hypertarget{datarep:defaultedmemberencodings}{}
2902 The encodings of the constants used in the \DWATdefaulted{} attribute
2903 are given in Table \referfol{datarep:defaultedattributeencodings}.
2906 \setlength{\extrarowheight}{0.1cm}
2907 \begin{longtable}{l|c}
2908 \caption{Defaulted attribute encodings} \label{datarep:defaultedattributeencodings} \\
2909 \hline \bfseries Defaulted name &\bfseries Value \\ \hline
2911 \bfseries Defaulted name &\bfseries Value \\ \hline
2913 \hline \emph{Continued on next page}
2916 \ddag~\textit{New in \DWARFVersionV}
2918 \DWDEFAULTEDno~\ddag & 0x00 \\
2919 \DWDEFAULTEDinclass~\ddag & 0x01 \\
2920 \DWDEFAULTEDoutofclass~\ddag & 0x02 \\
2925 \section{Address Range Table}
2926 \label{datarep:addrssrangetable}
2928 Each set of entries in the table of address ranges contained
2929 in the \dotdebugaranges{}
2930 section begins with a header containing:
2931 \begin{enumerate}[1. ]
2932 % FIXME The unit length text is not fully consistent across
2935 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
2936 \addttindexx{unit\_length}
2937 A 4-byte or 12-byte length containing the length of the
2938 \addtoindexx{initial length}
2939 set of entries for this compilation unit, not including the
2940 length field itself. In the \thirtytwobitdwarfformat, this is a
2941 4-byte unsigned integer (which must be less than \xfffffffzero);
2942 in the \sixtyfourbitdwarfformat, this consists of the 4-byte value
2943 \wffffffff followed by an 8-byte unsigned integer that gives
2945 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
2947 \item version (\HFTuhalf) \\
2948 A 2-byte version identifier representing the version of the
2949 DWARF information for the address range table
2950 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
2952 This value in this field \addtoindexx{version number!address range table} is 2.
2954 \item debug\_info\_offset (\livelink{datarep:sectionoffsetlength}{section offset}) \\
2956 \addtoindexx{section offset!in .debug\_aranges header}
2957 4-byte or 8-byte offset into the
2958 \dotdebuginfo{} section of
2959 the compilation unit header. In the \thirtytwobitdwarfformat,
2960 this is a 4-byte unsigned offset; in the \sixtyfourbitdwarfformat,
2961 this is an 8-byte unsigned offset
2962 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
2964 \item \texttt{address\_size} (\HFTubyte) \\
2965 A 1-byte unsigned integer containing the size in bytes of an
2966 \addttindexx{address\_size}
2968 \addtoindexx{size of an address}
2969 (or the offset portion of an address for segmented
2970 \addtoindexx{address space!segmented}
2971 addressing) on the target system.
2973 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
2974 A 1-byte unsigned integer containing the size in bytes of a
2975 segment selector on the target system.
2979 This header is followed by a series of tuples. Each tuple
2980 consists of a segment, an address and a length.
2981 The segment selector
2982 size is given by the \HFNsegmentselectorsize{} field of the header; the
2983 address and length size are each given by the \addttindex{address\_size}
2984 field of the header.
2985 The first tuple following the header in
2986 each set begins at an offset that is a multiple of the size
2987 of a single tuple (that is, the size of a segment selector
2988 plus twice the \addtoindex{size of an address}).
2989 The header is padded, if
2990 necessary, to that boundary. Each set of tuples is terminated
2991 by a 0 for the segment, a 0 for the address and 0 for the
2992 length. If the \HFNsegmentselectorsize{} field in the header is zero,
2993 the segment selectors are omitted from all tuples, including
2994 the terminating tuple.
2997 \section{Line Number Information}
2998 \label{datarep:linenumberinformation}
3000 The \addtoindexi{version number}{version number!line number information}
3001 in the line number program header is \versiondotdebugline{}
3002 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3004 The boolean values \doublequote{true} and \doublequote{false}
3005 used by the line number information program are encoded
3006 as a single byte containing the value 0
3007 for \doublequote{false,} and a non-zero value for \doublequote{true.}
3010 The encodings for the standard opcodes are given in
3011 \addtoindexx{line number opcodes!standard opcode encoding}
3012 Table \refersec{tab:linenumberstandardopcodeencodings}.
3015 \setlength{\extrarowheight}{0.1cm}
3016 \begin{longtable}{l|c}
3017 \caption{Line number standard opcode encodings} \label{tab:linenumberstandardopcodeencodings}\\
3018 \hline \bfseries Opcode name&\bfseries Value \\ \hline
3020 \bfseries Opcode name&\bfseries Value\\ \hline
3022 \hline \emph{Continued on next page}
3028 \DWLNSadvancepc&0x02 \\
3029 \DWLNSadvanceline&0x03 \\
3030 \DWLNSsetfile&0x04 \\
3031 \DWLNSsetcolumn&0x05 \\
3032 \DWLNSnegatestmt&0x06 \\
3033 \DWLNSsetbasicblock&0x07 \\
3034 \DWLNSconstaddpc&0x08 \\
3035 \DWLNSfixedadvancepc&0x09 \\
3036 \DWLNSsetprologueend&0x0a \\*
3037 \DWLNSsetepiloguebegin&0x0b \\*
3038 \DWLNSsetisa&0x0c \\*
3044 The encodings for the extended opcodes are given in
3045 \addtoindexx{line number opcodes!extended opcode encoding}
3046 Table \refersec{tab:linenumberextendedopcodeencodings}.
3049 \setlength{\extrarowheight}{0.1cm}
3050 \begin{longtable}{l|c}
3051 \caption{Line number extended opcode encodings} \label{tab:linenumberextendedopcodeencodings}\\
3052 \hline \bfseries Opcode name&\bfseries Value \\ \hline
3054 \bfseries Opcode name&\bfseries Value\\ \hline
3056 \hline \emph{Continued on next page}
3058 \hline %\ddag~\textit{New in DWARF Version 5}
3061 \DWLNEendsequence &0x01 \\
3062 \DWLNEsetaddress &0x02 \\
3063 \textit{Reserved} &0x03\footnote{Code 0x03 is reserved to allow backward compatible support of the
3064 DW\_LNE\_define\_file operation which was defined in \DWARFVersionIV{}
3066 \DWLNEsetdiscriminator &0x04 \\
3067 \DWLNElouser &0x80 \\
3068 \DWLNEhiuser &\xff \\
3074 The encodings for the line number header entry formats are given in
3075 \addtoindexx{line number opcodes!file entry format encoding}
3076 Table \refersec{tab:linenumberheaderentryformatencodings}.
3079 \setlength{\extrarowheight}{0.1cm}
3080 \begin{longtable}{l|c}
3081 \caption{Line number header entry format \mbox{encodings}} \label{tab:linenumberheaderentryformatencodings}\\
3082 \hline \bfseries Line number header entry format name&\bfseries Value \\ \hline
3084 \bfseries Line number header entry format name&\bfseries Value\\ \hline
3086 \hline \emph{Continued on next page}
3088 \hline \ddag~\textit{New in DWARF Version 5}
3090 \DWLNCTpath~\ddag & 0x1 \\
3091 \DWLNCTdirectoryindex~\ddag & 0x2 \\
3092 \DWLNCTtimestamp~\ddag & 0x3 \\
3093 \DWLNCTsize~\ddag & 0x4 \\
3094 \DWLNCTMDfive~\ddag & 0x5 \\
3095 \DWLNCTlouser~\ddag & 0x2000 \\
3096 \DWLNCThiuser~\ddag & \xiiifff \\
3101 \section{Macro Information}
3102 \label{datarep:macroinformation}
3103 The \addtoindexi{version number}{version number!macro information}
3104 in the macro information header is \versiondotdebugmacro{}
3105 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3107 The source line numbers and source file indices encoded in the
3108 macro information section are represented as
3109 unsigned LEB128\addtoindexx{LEB128!unsigned} numbers.
3112 The macro information entry type is encoded as a single unsigned byte.
3114 \addtoindexx{macro information entry types!encoding}
3116 Table \refersec{tab:macroinfoentrytypeencodings}.
3120 \setlength{\extrarowheight}{0.1cm}
3121 \begin{longtable}{l|c}
3122 \caption{Macro information entry type encodings} \label{tab:macroinfoentrytypeencodings}\\
3123 \hline \bfseries Macro information entry type name&\bfseries Value \\ \hline
3125 \bfseries Macro information entry type name&\bfseries Value\\ \hline
3127 \hline \emph{Continued on next page}
3129 \hline \ddag~\textit{New in DWARF Version 5}
3132 \DWMACROdefine~\ddag &0x01 \\
3133 \DWMACROundef~\ddag &0x02 \\
3134 \DWMACROstartfile~\ddag &0x03 \\
3135 \DWMACROendfile~\ddag &0x04 \\
3136 \DWMACROdefinestrp~\ddag &0x05 \\
3137 \DWMACROundefstrp~\ddag &0x06 \\
3138 \DWMACROimport~\ddag &0x07 \\
3139 \DWMACROdefinesup~\ddag &0x08 \\
3140 \DWMACROundefsup~\ddag &0x09 \\
3141 \DWMACROimportsup~\ddag &0x0a \\
3142 \DWMACROdefinestrx~\ddag &0x0b \\
3143 \DWMACROundefstrx~\ddag &0x0c \\
3144 \DWMACROlouser~\ddag &0xe0 \\
3145 \DWMACROhiuser~\ddag &\xff \\
3151 \section{Call Frame Information}
3152 \label{datarep:callframeinformation}
3154 In the \thirtytwobitdwarfformat, the value of the CIE id in the
3155 CIE header is \xffffffff; in the \sixtyfourbitdwarfformat, the
3156 value is \xffffffffffffffff.
3158 The value of the CIE \addtoindexi{version number}{version number!call frame information}
3159 is 4 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3161 Call frame instructions are encoded in one or more bytes. The
3162 primary opcode is encoded in the high order two bits of
3163 the first byte (that is, opcode = byte $\gg$ 6). An operand
3164 or extended opcode may be encoded in the low order 6
3165 bits. Additional operands are encoded in subsequent bytes.
3166 The instructions and their encodings are presented in
3167 Table \refersec{tab:callframeinstructionencodings}.
3170 \setlength{\extrarowheight}{0.1cm}
3171 \begin{longtable}{l|c|c|l|l}
3172 \caption{Call frame instruction encodings} \label{tab:callframeinstructionencodings} \\
3173 \hline &\bfseries High 2 &\bfseries Low 6 & & \\
3174 \bfseries Instruction&\bfseries Bits &\bfseries Bits &\bfseries Operand 1 &\bfseries Operand 2\\ \hline
3176 & \bfseries High 2 &\bfseries Low 6 & &\\
3177 \bfseries Instruction&\bfseries Bits &\bfseries Bits &\bfseries Operand 1 &\bfseries Operand 2\\ \hline
3179 \hline \emph{Continued on next page}
3184 \DWCFAadvanceloc&0x1&delta & \\
3185 \DWCFAoffset&0x2®ister&ULEB128 offset \\
3186 \DWCFArestore&0x3®ister & & \\
3187 \DWCFAnop&0&0 & & \\
3188 \DWCFAsetloc&0&0x01&address & \\
3189 \DWCFAadvancelocone&0&0x02&1-byte delta & \\
3190 \DWCFAadvanceloctwo&0&0x03&2-byte delta & \\
3191 \DWCFAadvancelocfour&0&0x04&4-byte delta & \\
3192 \DWCFAoffsetextended&0&0x05&ULEB128 register&ULEB128 offset \\
3193 \DWCFArestoreextended&0&0x06&ULEB128 register & \\
3194 \DWCFAundefined&0&0x07&ULEB128 register & \\
3195 \DWCFAsamevalue&0&0x08 &ULEB128 register & \\
3196 \DWCFAregister&0&0x09&ULEB128 register &ULEB128 offset \\
3197 \DWCFArememberstate&0&0x0a & & \\
3198 \DWCFArestorestate&0&0x0b & & \\
3199 \DWCFAdefcfa&0&0x0c &ULEB128 register&ULEB128 offset \\
3200 \DWCFAdefcfaregister&0&0x0d&ULEB128 register & \\
3201 \DWCFAdefcfaoffset&0&0x0e &ULEB128 offset & \\
3202 \DWCFAdefcfaexpression&0&0x0f &BLOCK \\
3203 \DWCFAexpression&0&0x10&ULEB128 register & BLOCK \\
3205 \DWCFAoffsetextendedsf&0&0x11&ULEB128 register&SLEB128 offset \\
3206 \DWCFAdefcfasf&0&0x12&ULEB128 register&SLEB128 offset \\
3207 \DWCFAdefcfaoffsetsf&0&0x13&SLEB128 offset & \\
3208 \DWCFAvaloffset&0&0x14&ULEB128&ULEB128 \\
3209 \DWCFAvaloffsetsf&0&0x15&ULEB128&SLEB128 \\
3210 \DWCFAvalexpression&0&0x16&ULEB128&BLOCK \\
3211 \DWCFAlouser&0&0x1c & & \\
3212 \DWCFAhiuser&0&\xiiif & & \\
3216 \section{Non-contiguous Address Ranges}
3217 \label{datarep:noncontiguousaddressranges}
3219 Each entry in a \addtoindex{range list}
3220 (see Section \refersec{chap:noncontiguousaddressranges})
3222 \addtoindexx{base address selection entry!in range list}
3224 \addtoindexx{range list}
3225 a base address selection entry, or an end-of-list entry.
3227 A \addtoindex{range list} entry consists of two relative addresses. The
3228 addresses are the same size as addresses on the target machine.
3231 A base address selection entry and an
3232 \addtoindexx{end-of-list entry!in range list}
3233 end-of-list entry each
3234 \addtoindexx{base address selection entry!in range list}
3235 consist of two (constant or relocated) addresses. The two
3236 addresses are the same size as addresses on the target machine.
3238 For a \addtoindex{range list} to be specified, the base address of the
3239 \addtoindexx{base address selection entry!in range list}
3240 corresponding compilation unit must be defined
3241 (see Section \refersec{chap:normalandpartialcompilationunitentries}).
3244 \section{String Offsets Table}
3245 \label{chap:stringoffsetstable}
3246 Each set of entries in the string offsets table contained in the
3247 \dotdebugstroffsets{} or \dotdebugstroffsetsdwo{}
3248 section begins with a header containing:
3249 \begin{enumerate}[1. ]
3250 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3251 \addttindexx{unit\_length}
3252 A 4-byte or 12-byte length containing the length of
3253 the set of entries for this compilation unit, not
3254 including the length field itself. In the 32-bit
3255 DWARF format, this is a 4-byte unsigned integer
3256 (which must be less than \xfffffffzero); in the 64-bit
3257 DWARF format, this consists of the 4-byte value
3258 \wffffffff followed by an 8-byte unsigned integer
3259 that gives the actual length (see
3260 Section \refersec{datarep:32bitand64bitdwarfformats}).
3263 \item \texttt{version} (\HFTuhalf) \\
3264 A 2-byte version identifier containing the value
3265 \versiondotdebugstroffsets{}
3266 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3268 \item \texttt{padding} (\HFTuhalf) \\
3271 This header is followed by a series of string table offsets
3272 that have the same representation as \DWFORMstrp.
3273 For the 32-bit DWARF format, each offset is 4 bytes long; for
3274 the 64-bit DWARF format, each offset is 8 bytes long.
3276 The \DWATstroffsetsbase{} attribute points to the first
3277 entry following the header. The entries are indexed
3278 sequentially from this base entry, starting from 0.
3280 \section{Address Table}
3281 \label{chap:addresstable}
3282 Each set of entries in the address table contained in the
3283 \dotdebugaddr{} section begins with a header containing:
3284 \begin{enumerate}[1. ]
3285 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3286 \addttindexx{unit\_length}
3287 A 4-byte or 12-byte length containing the length of
3288 the set of entries for this compilation unit, not
3289 including the length field itself. In the 32-bit
3290 DWARF format, this is a 4-byte unsigned integer
3291 (which must be less than \xfffffffzero); in the 64-bit
3292 DWARF format, this consists of the 4-byte value
3293 \wffffffff followed by an 8-byte unsigned integer
3294 that gives the actual length (see
3295 Section \refersec{datarep:32bitand64bitdwarfformats}).
3298 \item \texttt{version} (\HFTuhalf) \\
3299 A 2-byte version identifier containing the value
3300 \versiondotdebugaddr{}
3301 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3304 \item \texttt{address\_size} (\HFTubyte) \\
3305 A 1-byte unsigned integer containing the size in
3306 bytes of an address (or the offset portion of an
3307 address for segmented addressing) on the target
3311 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
3312 A 1-byte unsigned integer containing the size in
3313 bytes of a segment selector on the target system.
3316 This header is followed by a series of segment/address pairs.
3317 The segment size is given by the \HFNsegmentselectorsize{} field of the
3318 header, and the address size is given by the \addttindex{address\_size}
3319 field of the header. If the \HFNsegmentselectorsize{} field in the header
3320 is zero, the entries consist only of an addresses.
3322 The \DWATaddrbase{} attribute points to the first entry
3323 following the header. The entries are indexed sequentially
3324 from this base entry, starting from 0.
3327 \section{Range List Table}
3328 \label{app:rangelisttable}
3329 Each set of entries in the range list table contained in the
3330 \dotdebugranges{} section begins with a header containing:
3331 \begin{enumerate}[1. ]
3332 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3333 \addttindexx{unit\_length}
3334 A 4-byte or 12-byte length containing the length of
3335 the set of entries for this compilation unit, not
3336 including the length field itself. In the 32-bit
3337 DWARF format, this is a 4-byte unsigned integer
3338 (which must be less than \xfffffffzero); in the 64-bit
3339 DWARF format, this consists of the 4-byte value
3340 \wffffffff followed by an 8-byte unsigned integer
3341 that gives the actual length (see
3342 Section \refersec{datarep:32bitand64bitdwarfformats}).
3345 \item \texttt{version} (\HFTuhalf) \\
3346 A 2-byte version identifier containing the value
3347 \versiondotdebugranges{}
3348 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3351 \item \texttt{address\_size} (\HFTubyte) \\
3352 A 1-byte unsigned integer containing the size in
3353 bytes of an address (or the offset portion of an
3354 address for segmented addressing) on the target
3358 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
3359 A 1-byte unsigned integer containing the size in
3360 bytes of a segment selector on the target system.
3363 This header is followed by a series of range list entries as
3364 described in Section \refersec{chap:noncontiguousaddressranges}.
3365 The segment size is given by the
3366 \HFNsegmentselectorsize{} field of the header, and the address size is
3367 given by the \addttindex{address\_size} field of the header. If the
3368 \HFNsegmentselectorsize{} field in the header is zero, the segment
3369 selector is omitted from the range list entries.
3371 The \DWATrangesbase{} attribute points to the first entry
3372 following the header. The entries are referenced by a byte
3373 offset relative to this base address.
3376 \section{Location List Table}
3377 \label{datarep:locationlisttable}
3378 Each set of entries in the location list table contained in the
3379 \dotdebugloc{} or \dotdebuglocdwo{} sections begins with a header containing:
3380 \begin{enumerate}[1. ]
3381 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3382 \addttindexx{unit\_length}
3383 A 4-byte or 12-byte length containing the length of
3384 the set of entries for this compilation unit, not
3385 including the length field itself. In the 32-bit
3386 DWARF format, this is a 4-byte unsigned integer
3387 (which must be less than \xfffffffzero); in the 64-bit
3388 DWARF format, this consists of the 4-byte value
3389 \wffffffff followed by an 8-byte unsigned integer
3390 that gives the actual length (see
3391 Section \refersec{datarep:32bitand64bitdwarfformats}).
3394 \item \texttt{version} (\HFTuhalf) \\
3395 A 2-byte version identifier containing the value
3396 \versiondotdebugloc{}
3397 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3400 \item \texttt{address\_size} (\HFTubyte) \\
3401 A 1-byte unsigned integer containing the size in
3402 bytes of an address (or the offset portion of an
3403 address for segmented addressing) on the target
3407 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
3408 A 1-byte unsigned integer containing the size in
3409 bytes of a segment selector on the target system.
3412 This header is followed by a series of location list entries as
3413 described in Section \refersec{chap:locationlists}.
3414 The segment size is given by the
3415 \HFNsegmentselectorsize{} field of the header, and the address size is
3416 given by the \HFNaddresssize{} field of the header. If the
3417 \HFNsegmentselectorsize{} field in the header is zero, the segment
3418 selector is omitted from range list entries.
3420 The entries are referenced by a byte offset relative to the first
3421 location list following this header.
3424 \section{Dependencies and Constraints}
3425 \label{datarep:dependenciesandconstraints}
3426 The debugging information in this format is intended to
3427 exist in sections of an object file, or an equivalent
3428 separate file or database, having names beginning with
3429 the prefix ".debug\_" (see Appendix
3430 \refersec{app:dwarfsectionversionnumbersinformative}
3431 for a complete list of such names).
3432 Except as specifically specified, this information is not
3433 aligned on 2-, 4- or 8-byte boundaries. Consequently:
3436 \item For the \thirtytwobitdwarfformat{} and a target architecture with
3437 32-bit addresses, an assembler or compiler must provide a way
3438 to produce 2-byte and 4-byte quantities without alignment
3439 restrictions, and the linker must be able to relocate a
3441 \addtoindexx{section offset!alignment of}
3442 section offset that occurs at an arbitrary
3445 \item For the \thirtytwobitdwarfformat{} and a target architecture with
3446 64-bit addresses, an assembler or compiler must provide a
3447 way to produce 2-byte, 4-byte and 8-byte quantities without
3448 alignment restrictions, and the linker must be able to relocate
3449 an 8-byte address or 4-byte
3450 \addtoindexx{section offset!alignment of}
3451 section offset that occurs at an
3452 arbitrary alignment.
3454 \item For the \sixtyfourbitdwarfformat{} and a target architecture with
3455 32-bit addresses, an assembler or compiler must provide a
3456 way to produce 2-byte, 4-byte and 8-byte quantities without
3457 alignment restrictions, and the linker must be able to relocate
3458 a 4-byte address or 8-byte
3459 \addtoindexx{section offset!alignment of}
3460 section offset that occurs at an
3461 arbitrary alignment.
3463 \textit{It is expected that this will be required only for very large
3464 32-bit programs or by those architectures which support
3465 a mix of 32-bit and 64-bit code and data within the same
3468 \item For the \sixtyfourbitdwarfformat{} and a target architecture with
3469 64-bit addresses, an assembler or compiler must provide a
3470 way to produce 2-byte, 4-byte and 8-byte quantities without
3471 alignment restrictions, and the linker must be able to
3472 relocate an 8-byte address or
3473 \addtoindexx{section offset!alignment of}
3474 section offset that occurs at
3475 an arbitrary alignment.
3479 \section{Integer Representation Names}
3480 \label{datarep:integerrepresentationnames}
3481 The sizes of the integers used in the lookup by name, lookup
3482 by address, line number, call frame information and other sections
3484 Table \ref{tab:integerrepresentationnames}.
3488 \setlength{\extrarowheight}{0.1cm}
3489 \begin{longtable}{c|l}
3490 \caption{Integer representation names} \label{tab:integerrepresentationnames}\\
3491 \hline \bfseries Representation name&\bfseries Representation \\ \hline
3493 \bfseries Representation name&\bfseries Representation\\ \hline
3495 \hline \emph{Continued on next page}
3500 \HFTsbyte& signed, 1-byte integer \\
3501 \HFTubyte&unsigned, 1-byte integer \\
3502 \HFTuhalf&unsigned, 2-byte integer \\
3503 \HFTuword&unsigned, 4-byte integer \\
3509 \section{Type Signature Computation}
3510 \label{datarep:typesignaturecomputation}
3512 A \addtoindex{type signature} is used by a DWARF consumer
3513 to resolve type references to the type definitions that
3514 are contained in \addtoindex{type unit}s (see Section
3515 \refersec{chap:typeunitentries}).
3517 \textit{A type signature is computed only by a DWARF producer;
3518 \addtoindexx{type signature!computation} a consumer need
3519 compare two type signatures to check for equality.}
3522 The type signature for a type T0 is formed from the
3523 \MDfive{}\footnote{\livetarg{def:MDfive}{MD5} Message Digest Algorithm,
3524 R.L. Rivest, RFC 1321, April 1992}
3525 hash of a flattened description of the type. The flattened
3526 description of the type is a byte sequence derived from the
3527 DWARF encoding of the type as follows:
3528 \begin{enumerate}[1. ]
3530 \item Start with an empty sequence S and a list V of visited
3531 types, where V is initialized to a list containing the type
3532 T0 as its single element. Elements in V are indexed from 1,
3535 \item If the debugging information entry represents a type that
3536 is nested inside another type or a namespace, append to S
3537 the type\textquoteright s context as follows: For each surrounding type
3538 or namespace, beginning with the outermost such construct,
3539 append the letter 'C', the DWARF tag of the construct, and
3540 the name (taken from
3541 \addtoindexx{name attribute}
3542 the \DWATname{} attribute) of the type
3543 \addtoindexx{name attribute}
3544 or namespace (including its trailing null byte).
3546 \item Append to S the letter 'D', followed by the DWARF tag of
3547 the debugging information entry.
3549 \item For each of the attributes in
3550 Table \refersec{tab:attributesusedintypesignaturecomputation}
3552 the debugging information entry, in the order listed,
3553 append to S a marker letter (see below), the DWARF attribute
3554 code, and the attribute value.
3557 \caption{Attributes used in type signature computation}
3558 \label{tab:attributesusedintypesignaturecomputation}
3559 \simplerule[\textwidth]
3561 \autocols[0pt]{c}{2}{l}{
3577 \DWATcontainingtype,
3581 \DWATdatamemberlocation,
3602 \DWATrvaluereference,
3606 \DWATstringlengthbitsize,
3607 \DWATstringlengthbytesize,
3612 \DWATvariableparameter,
3615 \DWATvtableelemlocation
3618 \simplerule[\textwidth]
3621 Note that except for the initial
3622 \DWATname{} attribute,
3623 \addtoindexx{name attribute}
3624 attributes are appended in order according to the alphabetical
3625 spelling of their identifier.
3627 If an implementation defines any vendor-specific attributes,
3628 any such attributes that are essential to the definition of
3629 the type are also included at the end of the above list,
3630 in their own alphabetical suborder.
3632 An attribute that refers to another type entry T is processed
3633 as follows: (a) If T is in the list V at some V[x], use the
3634 letter 'R' as the marker and use the unsigned LEB128\addtoindexx{LEB128!unsigned}
3635 encoding of x as the attribute value; otherwise, (b) use the letter 'T'
3636 as the marker, process the type T recursively by performing
3637 Steps 2 through 7, and use the result as the attribute value.
3640 Other attribute values use the letter 'A' as the marker, and
3641 the value consists of the form code (encoded as an unsigned
3642 LEB128 value) followed by the encoding of the value according
3643 to the form code. To ensure reproducibility of the signature,
3644 the set of forms used in the signature computation is limited
3653 \item If the tag in Step 3 is one of \DWTAGpointertype,
3654 \DWTAGreferencetype,
3655 \DWTAGrvaluereferencetype,
3656 \DWTAGptrtomembertype,
3657 or \DWTAGfriend, and the referenced
3658 type (via the \DWATtype{} or
3659 \DWATfriend{} attribute) has a
3660 \DWATname{} attribute, append to S the letter 'N', the DWARF
3661 attribute code (\DWATtype{} or
3662 \DWATfriend), the context of
3663 the type (according to the method in Step 2), the letter 'E',
3664 and the name of the type. For \DWTAGfriend, if the referenced
3665 entry is a \DWTAGsubprogram, the context is omitted and the
3666 name to be used is the ABI-specific name of the subprogram
3667 (for example, the mangled linker name).
3670 \item If the tag in Step 3 is not one of \DWTAGpointertype,
3671 \DWTAGreferencetype,
3672 \DWTAGrvaluereferencetype,
3673 \DWTAGptrtomembertype, or
3674 \DWTAGfriend, but has
3675 a \DWATtype{} attribute, or if the referenced type (via
3677 \DWATfriend{} attribute) does not have a
3678 \DWATname{} attribute, the attribute is processed according to
3679 the method in Step 4 for an attribute that refers to another
3683 \item Visit each child C of the debugging information
3684 entry as follows: If C is a nested type entry or a member
3685 function entry, and has
3686 a \DWATname{} attribute, append to
3687 \addtoindexx{name attribute}
3688 S the letter 'S', the tag of C, and its name; otherwise,
3689 process C recursively by performing Steps 3 through 7,
3690 appending the result to S. Following the last child (or if
3691 there are no children), append a zero byte.
3696 For the purposes of this algorithm, if a debugging information
3698 \DWATspecification{}
3699 attribute that refers to
3700 another entry D (which has a
3703 then S inherits the attributes and children of D, and S is
3704 processed as if those attributes and children were present in
3705 the entry S. Exception: if a particular attribute is found in
3706 both S and D, the attribute in S is used and the corresponding
3707 one in D is ignored.
3710 DWARF tag and attribute codes are appended to the sequence
3711 as unsigned LEB128\addtoindexx{LEB128!unsigned} values,
3712 using the values defined earlier in this chapter.
3714 \textit{A grammar describing this computation may be found in
3715 Appendix \refersec{app:typesignaturecomputationgrammar}.
3718 \textit{An attribute that refers to another type entry is
3719 recursively processed or replaced with the name of the
3720 referent (in Step 4, 5 or 6). If neither treatment applies to
3721 an attribute that references another type entry, the entry
3722 that contains that attribute is not suitable for a
3723 separate \addtoindex{type unit}.}
3725 \textit{If a debugging information entry contains an attribute from
3726 the list above that would require an unsupported form, that
3727 entry is not suitable for a separate
3728 \addtoindex{type unit}.}
3730 \textit{A type is suitable for a separate
3731 \addtoindex{type unit} only
3732 if all of the type entries that it contains or refers to in
3733 Steps 6 and 7 are themselves suitable for a separate
3734 \addtoindex{type unit}.}
3737 Where the DWARF producer may reasonably choose two or more
3738 different forms for a given attribute, it should choose
3739 the simplest possible form in computing the signature. (For
3740 example, a constant value should be preferred to a location
3741 expression when possible.)
3743 Once the string S has been formed from the DWARF encoding,
3744 an \MDfive{} hash is computed for the string and the
3745 least significant 64 bits are taken as the type signature.
3747 \textit{The string S is intended to be a flattened representation of
3748 the type that uniquely identifies that type (that is, a different
3749 type is highly unlikely to produce the same string).}
3752 \textit{A debugging information entry is not be placed in a
3753 separate \addtoindex{type unit}
3754 if any of the following apply:}
3758 \item \textit{The entry has an attribute whose value is a location
3759 expression, and the location expression contains a reference to
3760 another debugging information entry (for example, a \DWOPcallref{}
3761 operator), as it is unlikely that the entry will remain
3762 identical across compilation units.}
3764 \item \textit{The entry has an attribute whose value refers
3765 to a code location or a \addtoindex{location list}.}
3767 \item \textit{The entry has an attribute whose value refers
3768 to another debugging information entry that does not represent
3774 \textit{Certain attributes are not included in the type signature:}
3777 \item \textit{The \DWATdeclaration{} attribute is not included because it
3778 indicates that the debugging information entry represents an
3779 incomplete declaration, and incomplete declarations should
3781 \addtoindexx{type unit}
3782 separate type units.}
3784 \item \textit{The \DWATdescription{} attribute is not included because
3785 it does not provide any information unique to the defining
3786 declaration of the type.}
3788 \item \textit{The \DWATdeclfile,
3790 \DWATdeclcolumn{} attributes are not included because they
3791 may vary from one source file to the next, and would prevent
3792 two otherwise identical type declarations from producing the
3793 same \MDfive{} hash.}
3795 \item \textit{The \DWATobjectpointer{} attribute is not included
3796 because the information it provides is not necessary for the
3797 computation of a unique type signature.}
3801 \textit{Nested types and some types referred to by a debugging
3802 information entry are encoded by name rather than by recursively
3803 encoding the type to allow for cases where a complete definition
3804 of the type might not be available in all compilation units.}
3807 \textit{If a type definition contains the definition of a member function,
3808 it cannot be moved as is into a type unit, because the member function
3809 contains attributes that are unique to that compilation unit.
3810 Such a type definition can be moved to a type unit by rewriting the DIE tree,
3811 moving the member function declaration into a separate declaration tree,
3812 and replacing the function definition in the type with a non-defining
3813 declaration of the function (as if the function had been defined out of
3816 An example that illustrates the computation of an \MDfive{} hash may be found in
3817 Appendix \refersec{app:usingtypeunits}.
3819 \section{Name Table Hash Function}
3820 \label{datarep:nametablehashfunction}
3821 The hash function used for hashing name strings in the accelerated
3822 access name index table (see Section \refersec{chap:acceleratedaccess})
3823 is defined in \addtoindex{C} as shown in
3824 Figure \referfol{fig:nametablehashfunctiondefinition}.\footnote{
3825 This hash function is sometimes informally known as the
3826 "\addtoindex{DJB hash function}" or the "\addtoindex{Berstein hash function}"
3828 \hrefself{http://en.wikipedia.org/wiki/List\_of\_hash\_functions} or
3829 \hrefself{http://stackoverflow.com/questions/10696223/reason-for-5381-number-in-djb-hash-function)}.}
3831 \begin{figure}[here]
3834 unsigned long \* must be a 32-bit integer type *\
3835 hash(unsigned char *str)
3837 unsigned long hash = 5381;
3841 hash = hash * 33 + c;
3847 \caption{Name Table Hash Function Definition}
3848 \label{fig:nametablehashfunctiondefinition}