1 \chapter{Data Representation}
2 \label{datarep:datarepresentation}
4 This section describes the binary representation of the
5 debugging information entry itself, of the attribute types
6 and of other fundamental elements described above.
8 \section{Vendor Extensibility}
9 \label{datarep:vendorextensibility}
10 \addtoindexx{vendor extensibility}
11 \addtoindexx{vendor specific extensions|see{vendor extensibility}}
14 \addtoindexx{extensibility|see{vendor extensibility}}
15 reserve a portion of the DWARF name space and ranges of
16 enumeration values for use for vendor specific extensions,
17 special labels are reserved for tag names, attribute names,
18 base type encodings, location operations, language names,
19 calling conventions and call frame instructions.
21 The labels denoting the beginning and end of the reserved
22 \hypertarget{chap:DWXXXlohiuser}{}
23 value range for vendor specific extensions consist of the
25 (\DWATlouserMARK{}\DWAThiuserMARK{} DW\_AT,
26 \DWATElouserMARK{}\DWATEhiuserMARK{} DW\_ATE,
27 \DWCClouserMARK{}\DWCChiuserMARK{} DW\_CC,
28 \DWCFAlouserMARK{}\DWCFAhiuserMARK{} DW\_CFA
29 \DWENDlouserMARK{}\DWENDhiuserMARK{} DW\_END,
30 \DWLANGlouserMARK{}\DWLANGhiuserMARK{} DW\_LANG,
31 \DWLNElouserMARK{}\DWLNEhiuserMARK{} DW\_LNE,
32 \DWMACROlouserMARK{}\DWMACROhiuserMARK{}DW\_MACRO,
33 \DWOPlouserMARK{}\DWOPhiuserMARK{} DW\_OP or
34 \DWTAGlouserMARK{}\DWTAGhiuserMARK{} DW\_TAG,
35 respectively) followed by
36 \_lo\_user or \_hi\_user.
37 Values in the range between \textit{prefix}\_lo\_user
38 and \textit{prefix}\_hi\_user inclusive,
39 are reserved for vendor specific extensions. Vendors may
40 use values in this range without conflicting with current or
41 future system\dash defined values. All other values are reserved
42 for use by the system.
44 \textit{For example, for DIE tags, the special
45 labels are \DWTAGlouserNAME{} and \DWTAGhiuserNAME.}
47 \textit{There may also be codes for vendor specific extensions
48 between the number of standard line number opcodes and
49 the first special line number opcode. However, since the
50 number of standard opcodes varies with the DWARF version,
51 the range for extensions is also version dependent. Thus,
52 \DWLNSlouserTARG{} and
53 \DWLNShiuserTARG{} symbols are not defined.
56 Vendor defined tags, attributes, base type encodings, location
57 atoms, language names, line number actions, calling conventions
58 and call frame instructions, conventionally use the form
59 \text{prefix\_vendor\_id\_name}, where
60 \textit{vendor\_id}\addtoindexx{vendor id} is some identifying
61 character sequence chosen so as to avoid conflicts with
64 To ensure that extensions added by one vendor may be safely
65 ignored by consumers that do not understand those extensions,
66 the following rules must be followed:
67 \begin{enumerate}[1. ]
69 \item New attributes are added in such a way that a
70 debugger may recognize the format of a new attribute value
71 without knowing the content of that attribute value.
73 \item The semantics of any new attributes do not alter
74 the semantics of previously existing attributes.
76 \item The semantics of any new tags do not conflict with
77 the semantics of previously existing tags.
79 \item New forms of attribute value are not added.
84 \section{Reserved Values}
85 \label{datarep:reservedvalues}
86 \subsection{Error Values}
87 \label{datarep:errorvalues}
88 \addtoindexx{reserved values!error}
91 \addtoindexx{error value}
92 a convenience for consumers of DWARF information, the value
93 0 is reserved in the encodings for attribute names, attribute
94 forms, base type encodings, location operations, languages,
95 line number program opcodes, macro information entries and tag
96 names to represent an error condition or unknown value. DWARF
97 does not specify names for these reserved values, because they
98 do not represent valid encodings for the given type and do
99 not appear in DWARF debugging information.
102 \subsection{Initial Length Values}
103 \label{datarep:initiallengthvalues}
104 \addtoindexx{reserved values!initial length}
106 An \livetarg{datarep:initiallengthvalues}{initial length} field
107 \addtoindexx{initial length field|see{initial length}}
108 is one of the fields that occur at the beginning
109 of those DWARF sections that have a header
113 \dotdebugnames{}) or the length field
114 that occurs at the beginning of the CIE and FDE structures
115 in the \dotdebugframe{} section.
118 In an \addtoindex{initial length} field, the values \wfffffffzero through
119 \wffffffff are reserved by DWARF to indicate some form of
120 extension relative to \DWARFVersionII; such values must not
121 be interpreted as a length field. The use of one such value,
122 \xffffffff, is defined below
123 (see Section \refersec{datarep:32bitand64bitdwarfformats});
125 the other values is reserved for possible future extensions.
129 \section{Relocatable, Split, Executable, Shared and Package Object Files}
130 \label{datarep:executableobjectsandsharedobjects}
132 \subsection{Relocatable Object Files}
133 \label{datarep:relocatableobjectfiles}
134 A DWARF producer (for example, a compiler) typically generates its
135 debugging information as part of a relocatable object file.
136 Relocatable object files are then combined by a linker to form an
137 executable file. During the linking process, the linker resolves
138 (binds) symbolic references between the various object files, and
139 relocates the contents of each object file into a combined virtual
142 The DWARF debugging information is placed in several sections (see
143 Appendix \refersec{app:debugsectionrelationshipsinformative}), and
144 requires an object file format capable of
145 representing these separate sections. There are symbolic references
146 between these sections, and also between the debugging information
147 sections and the other sections that contain the text and data of the
148 program itself. Many of these references require relocation, and the
149 producer must emit the relocation information appropriate to the
150 object file format and the target processor architecture. These
151 references include the following:
154 \item The compilation unit header (see Section
155 \refersec{datarep:unitheaders}) in the \dotdebuginfo{}
156 section contains a reference to the \dotdebugabbrev{} table. This
157 reference requires a relocation so that after linking, it refers to
158 that contribution to the combined \dotdebugabbrev{} section in the
161 \item Debugging information entries may have attributes with the form
162 \DWFORMaddr{} (see Section \refersec{datarep:attributeencodings}).
163 These attributes represent locations
164 within the virtual address space of the program, and require
167 \item A DWARF expression may contain a \DWOPaddr{} (see Section
168 \refersec{chap:literalencodings}) which contains a location within
169 the virtual address space of the program, and require relocation.
172 \item Debugging information entries may have attributes with the form
173 \DWFORMsecoffset{} (see Section \refersec{datarep:attributeencodings}).
174 These attributes refer to
175 debugging information in other debugging information sections within
176 the object file, and must be relocated during the linking process.
178 However, if a \DWATrangesbase{} attribute is present, the offset in
179 a \DWATranges{} attribute (which uses form \DWFORMsecoffset) is
180 relative to the given base offset--no relocation is involved.
182 \item Debugging information entries may have attributes with the form
183 \DWFORMrefaddr{} (see Section \refersec{datarep:attributeencodings}).
184 These attributes refer to
185 debugging information entries that may be outside the current
186 compilation unit. These values require both symbolic binding and
189 \item Debugging information entries may have attributes with the form
190 \DWFORMstrp{} (see Section \refersec{datarep:attributeencodings}).
191 These attributes refer to strings in
192 the \dotdebugstr{} section. These values require relocation.
194 \item Entries in the \dotdebugaddr, \dotdebugloc{}, \dotdebugranges{}
195 and \dotdebugaranges{}
196 sections contain references to locations within the virtual address
197 space of the program, and require relocation.
199 \item In the \dotdebugline{} section, the operand of the \DWLNEsetaddress{}
200 opcode is a reference to a location within the virtual address space
201 of the program, and requires relocation.
203 \item The \dotdebugstroffsets{} section contains a list of string offsets,
204 each of which is an offset of a string in the \dotdebugstr{} section. Each
205 of these offsets requires relocation. Depending on the implementation,
206 these relocations may be implicit (that is, the producer may not need to
207 emit any explicit relocation information for these offsets).
209 \item The \HFNdebuginfooffset{} field in the \dotdebugaranges header and
210 the list of compilation units following the \dotdebugnames{} header contain
211 references to the \dotdebuginfo{} section. These references require relocation
212 so that after linking they refer to the correct contribution in the combined
213 \dotdebuginfo{} section in the executable file.
215 \item Frame descriptor entries in the \dotdebugframe{} section
216 (see Section \refersec{chap:structureofcallframeinformation}) contain an
217 \HFNinitiallocation{} field value within the virtual address
218 space of the program and require relocation.
223 \textit{Note that operands of classes \CLASSblock, \CLASSconstant{} and
224 \CLASSflag{} do not require relocation. Attribute operands that use
225 form \DWFORMstring{} also do not require relocation. Further,
226 attribute operands that use form
227 \DWFORMrefone, \DWFORMreftwo, \DWFORMreffour, \DWFORMrefeight, or
228 \DWFORMrefudata{} do not need relocation.}
230 \subsection{Split DWARF Object Files}
231 \label{datarep:splitdwarfobjectfiles}
232 \addtoindexx{split DWARF object file}
233 A DWARF producer may partition the debugging
234 information such that the majority of the debugging
235 information can remain in individual object files without
236 being processed by the linker.
239 \subsubsection{First Partition (with Skeleton Unit)}
240 The first partition contains
241 debugging information that must still be processed by the linker,
242 and includes the following:
245 The line number tables, range tables, frame tables, and
246 accelerated access tables, in the usual sections:
247 \dotdebugline, \dotdebuglinestr, \dotdebugranges, \dotdebugframe,
248 \dotdebugnames{} and \dotdebugaranges,
252 An address table, in the \dotdebugaddr{} section. This table
253 contains all addresses and constants that require
254 link-time relocation, and items in the table can be
255 referenced indirectly from the debugging information via
256 the \DWFORMaddrx{} form, and by the \DWOPaddrx{} and
257 \DWOPconstx{} operators.
259 A skeleton compilation unit, as described in Section
260 \refersec{chap:skeletoncompilationunitentries},
261 in the \dotdebuginfo{} section.
263 An abbreviations table for the skeleton compilation unit,
264 in the \dotdebugabbrev{} section.
266 A string table, in the \dotdebugstr{} section. The string
267 table is necessary only if the skeleton compilation unit
268 uses either indirect string form, \DWFORMstrp{} or
271 A string offsets table, in the \dotdebugstroffsets{}
272 section. The string offsets table is necessary only if
273 the skeleton compilation unit uses the \DWFORMstrx{} form.
275 The attributes contained in the skeleton compilation
276 unit can be used by a DWARF consumer to find the
280 DWARF object file that contains the second partition.
282 \subsubsection{Second Partition (Unlinked or In \texttt{.dwo} File)}
283 The second partition contains the debugging information that
284 does not need to be processed by the linker. These sections
285 may be left in the object files and ignored by the linker
286 (that is, not combined and copied to the executable object file), or
287 they may be placed by the producer in a separate DWARF object
288 file. This partition includes the following:
291 The full compilation unit, in the \dotdebuginfodwo{} section.
294 The full compilation unit entry includes a \DWATdwoid{}
295 attribute whose form and value is the same as that of the \DWATdwoid{}
296 attribute of the associated skeleton unit.
299 Attributes contained in the full compilation unit
300 may refer to machine addresses indirectly using the \DWFORMaddrx{}
301 form, which accesses the table of addresses specified by the
302 \DWATaddrbase{} attribute in the associated skeleton unit.
303 Location expressions may similarly do so using the \DWOPaddrx{} and
304 \DWOPconstx{} operations.
306 \DWATranges{} attributes contained in the full compilation unit
307 may refer to range table entries with a \DWFORMsecoffset{} offset
308 relative to the base offset specified by the \DWATrangesbase{}
309 attribute in the associated skeleton unit.
311 \item Separate type units, in the \dotdebuginfodwo{} section.
314 Abbreviations table(s) for the compilation unit and type
315 units, in the \dotdebugabbrevdwo{} section.
317 \item Location lists, in the \dotdebuglocdwo{} section.
320 A \addtoindex{specialized line number table} (for the type units),
321 in the \dotdebuglinedwo{} section. This table
322 contains only the directory and filename lists needed to
323 interpret \DWATdeclfile{} attributes in the debugging
326 \item Macro information, in the \dotdebugmacrodwo{} section.
328 \item A string table, in the \dotdebugstrdwo{} section.
330 \item A string offsets table, in the \dotdebugstroffsetsdwo{}
334 Except where noted otherwise, all references in this document
335 to a debugging information section (for example, \dotdebuginfo),
336 applies also to the corresponding split DWARF section (for example,
340 Split DWARF object files do not get linked with any other files,
341 therefore references between sections must not make use of
342 normal object file relocation information. As a result, symbolic
343 references within or between sections are not possible.
345 \subsection{Executable Objects}
346 \label{chap:executableobjects}
347 The relocated addresses in the debugging information for an
348 executable object are virtual addresses.
351 \subsection{Shared Object Files}
352 \label{datarep:sharedobjectfiles}
354 addresses in the debugging information for a shared object file
355 are offsets relative to the start of the lowest region of
356 memory loaded from that shared object file.
359 \textit{This requirement makes the debugging information for
360 shared object files position independent. Virtual addresses in a
361 shared object file may be calculated by adding the offset to the
362 base address at which the object file was attached. This offset
363 is available in the run\dash time linker\textquoteright s data structures.}
365 \subsection{DWARF Package Files}
366 \label{datarep:dwarfpackagefiles}
367 \textit{Using \splitDWARFobjectfile{s} allows the developer to compile,
368 link, and debug an application quickly with less link-time overhead,
369 but a more convenient format is needed for saving the debug
370 information for later debugging of a deployed application. A
371 DWARF package file can be used to collect the debugging
372 information from the object (or separate DWARF object) files
373 produced during the compilation of an application.}
375 \textit{The package file is typically placed in the same directory as the
376 application, and is given the same name with a \doublequote{\texttt{.dwp}}
377 extension.\addtoindexx{\texttt{.dwp} file extension}}
379 A DWARF package file is itself an object file, using the
380 \addtoindexx{package files}
381 \addtoindexx{DWARF package files}
382 same object file format (including \byteorder) as the
383 corresponding application binary. It consists only of a file
384 header, a section table, a number of DWARF debug information
385 sections, and two index sections.
388 Each DWARF package file contains no more than one of each of the
389 following sections, copied from a set of object or DWARF object
390 files, and combined, section by section:
396 \dotdebugstroffsetsdwo
401 The string table section in \dotdebugstrdwo{} contains all the
402 strings referenced from DWARF attributes using the form
403 \DWFORMstrx. Any attribute in a compilation unit or a type
404 unit using this form refers to an entry in that unit's
405 contribution to the \dotdebugstroffsetsdwo{} section, which in turn
406 provides the offset of a string in the \dotdebugstrdwo{}
409 The DWARF package file also contains two index sections that
410 provide a fast way to locate debug information by compilation
411 unit signature (\DWATdwoid) for compilation units, or by type
412 signature for type units:
418 \subsubsection{The Compilation Unit (CU) Index Section}
419 The \dotdebugcuindex{} section is a hashed lookup table that maps a
420 compilation unit signature to a set of contributions in the
421 various debug information sections. Each contribution is stored
422 as an offset within its corresponding section and a size.
424 Each \compunitset{} may contain contributions from the
427 \dotdebuginfodwo{} (required)
428 \dotdebugabbrevdwo{} (required)
431 \dotdebugstroffsetsdwo
435 \textit{Note that a \compunitset{} is not able to represent \dotdebugmacinfo{}
436 information from \DWARFVersionIV{} or earlier formats.}
438 \subsubsection{The Type Unit (TU) Index Section}
439 The \dotdebugtuindex{} section is a hashed lookup table that maps a
440 type signature to a set of offsets into the various debug
441 information sections. Each contribution is stored as an offset
442 within its corresponding section and a size.
444 Each \typeunitset{} may contain contributions from the following
447 \dotdebuginfodwo{} (required)
448 \dotdebugabbrevdwo{} (required)
450 \dotdebugstroffsetsdwo
453 \subsubsection{Format of the CU and TU Index Sections}
454 Both index sections have the same format, and serve to map a
455 64-bit signature to a set of contributions to the debug sections.
456 Each index section begins with a header, followed by a hash table of
457 signatures, a parallel table of indexes, a table of offsets, and
458 a table of sizes. The index sections are aligned at 8-byte
459 boundaries in the DWARF package file.
462 The index section header contains the following fields:
463 \begin{enumerate}[1. ]
464 \item \texttt{version} (\HFTuhalf) \\
466 \addtoindexx{version number!CU index information}
467 \addtoindexx{version number!TU index information}
468 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
469 This number is specific to the CU and TU index information
470 and is independent of the DWARF version number.
472 The version number is \versiondotdebugcuindex.
474 \item \textit{padding} (\HFTuhalf) \\
475 Reserved to DWARF (must be zero).
477 \item \texttt{column\_count} (\HFTuword) \\
478 The number of columns in the table of section counts that follows.
479 For brevity, the contents of this field is referred to as $C$ below.
481 \item \texttt{unit\_count} (\HFTuword) \\
482 The number of compilation units or type units in the index.
483 For brevity, the contents of this field is referred to as $U$ below.
485 \item \texttt{slot\_count} (\HFTuword) \\
486 The number of slots in the hash table.
487 For brevity, the contents of this field is referred to as $S$ below.
491 \textit{We assume that $U$ and $S$ do not exceed $2^{32}$.}
493 The size of the hash table, $S$, must be $2^k$ such that:
494 \hspace{0.3cm}$2^k\ \ >\ \ 3*U/2$
496 The hash table begins at offset 16 in the section, and consists
497 of an array of $S$ 8-byte slots. Each slot contains a 64-bit
499 % (using the \byteorder{} of the application binary).
501 The parallel table of indices begins immediately after the hash table
502 (at offset \mbox{$16 + 8 * S$} from the beginning of the section), and
503 consists of an array of $S$ 4-byte slots,
504 % (using the byte order of the application binary),
505 corresponding 1-1 with slots in the hash
506 table. Each entry in the parallel table contains a row index into
507 the tables of offsets and sizes.
509 Unused slots in the hash table have 0 in both the hash table
510 entry and the parallel table entry. While 0 is a valid hash
511 value, the row index in a used slot will always be non-zero.
513 Given a 64-bit compilation unit signature or a type signature $X$,
514 an entry in the hash table is located as follows:
515 \begin{enumerate}[1. ]
516 \item Calculate a primary hash $H = X\ \&\ MASK(k)$, where $MASK(k)$ is a
517 mask with the low-order $k$ bits all set to 1.
519 \item Calculate a secondary hash $H' = (((X>>32)\ \&\ MASK(k))\ |\ 1)$.
521 \item If the hash table entry at index $H$ matches the signature, use
522 that entry. If the hash table entry at index $H$ is unused (all
523 zeroes), terminate the search: the signature is not present
526 \item Let $H = (H + H')\ modulo\ S$. Repeat at Step 3.
529 Because $S > U$, and $H'$ and $S$ are relatively prime, the search is
530 guaranteed to stop at an unused slot or find the match.
533 The table of offsets begins immediately following the parallel
534 table (at offset \mbox{$16 + 12 * S$} from the beginning of the section).
535 The table is a two-dimensional array of 4-byte words,
536 %(using the byte order of the application binary),
537 with $C$ columns and $U + 1$
538 rows, in row-major order. Each row in the array is indexed
539 starting from 0. The first row provides a key to the columns:
540 each column in this row provides a section identifier for a debug
541 section, and the offsets in the same column of subsequent rows
542 refer to that section. The section identifiers are shown in
543 Table \referfol{tab:dwarfpackagefilesectionidentifierencodings}.
547 \setlength{\extrarowheight}{0.1cm}
548 \begin{longtable}{l|c|l}
549 \caption{DWARF package file section identifier \mbox{encodings}}
550 \label{tab:dwarfpackagefilesectionidentifierencodings}
551 \addtoindexx{DWARF package files!section identifier encodings} \\
552 \hline \bfseries Section identifier &\bfseries Value &\bfseries Section \\ \hline
554 \bfseries Section identifier &\bfseries Value &\bfseries Section\\ \hline
556 \hline \emph{Continued on next page}
560 \DWSECTINFOTARG & 1 & \dotdebuginfodwo \\
561 \textit{Reserved} & 2 & \\
562 \DWSECTABBREVTARG & 3 & \dotdebugabbrevdwo \\
563 \DWSECTLINETARG & 4 & \dotdebuglinedwo \\
564 \DWSECTLOCTARG & 5 & \dotdebuglocdwo \\
565 \DWSECTSTROFFSETSTARG & 6 & \dotdebugstroffsetsdwo \\
566 %DWSECTMACINFO & & \dotdebugmacinfodwo \\
567 \DWSECTMACROTARG & 7 & \dotdebugmacrodwo \\
571 The offsets provided by the CU and TU index sections are the
572 base offsets for the contributions made by each CU or TU to the
573 corresponding section in the package file. Each CU and TU header
574 contains a \HFNdebugabbrevoffset{} field, used to find the abbreviations
575 table for that CU or TU within the contribution to the
576 \dotdebugabbrevdwo{} section for that CU or TU, and are
577 interpreted as relative to the base offset given in the index
578 section. Likewise, offsets into \dotdebuglinedwo{} from
579 \DWATstmtlist{} attributes are interpreted as relative to
580 the base offset for \dotdebuglinedwo{}, and offsets into other debug
581 sections obtained from DWARF attributes are also
582 interpreted as relative to the corresponding base offset.
584 The table of sizes begins immediately following the table of
585 offsets, and provides the sizes of the contributions made by each
586 CU or TU to the corresponding section in the package file. Like
587 the table of offsets, it is a two-dimensional array of 4-byte
588 words, with $C$ columns and $U$ rows, in row-major order. Each row in
589 the array is indexed starting from 1 (row 0 of the table of
590 offsets also serves as the key for the table of sizes).
592 \subsection{DWARF Supplementary Object Files}
593 \label{datarep:dwarfsupplemetaryobjectfiles}
594 In order to minimize the size of debugging information, it is possible
595 to move duplicate debug information entries, strings and macro entries from
596 several executables or shared object files into a separate
597 \addtoindexi{\textit{supplementary object file}}{supplementary object file} by some
598 post-linking utility; the moved entries and strings can be then referenced
599 from the debugging information of each of those executable or shared object files.
602 A DWARF \addtoindex{supplementary object file} is itself an object file,
603 using the same object
604 file format, \byteorder{}, and size as the corresponding application executables
605 or shared libraries. It consists only of a file header, section table, and
606 a number of DWARF debug information sections. Both the
607 \addtoindex{supplementary object file}
608 and all the executable or shared object files that reference entries or strings in that
609 file must contain a \dotdebugsup{} section that establishes the relationship.
611 The \dotdebugsup{} section contains:
612 \begin{enumerate}[1. ]
613 \item \texttt{version} (\HFTuhalf) \\
614 \addttindexx{version}
615 A 2-byte unsigned integer representing the version of the DWARF
616 information for the compilation unit (see Appendix G). The
617 value in this field is \versiondotdebugsup.
619 \item \texttt{is\_supplementary} (\HFTubyte) \\
620 \addttindexx{is\_supplementary}
621 A 1-byte unsigned integer, which contains the value 1 if it is
622 in the \addtoindex{supplementary object file} that other executable or
623 shared object files refer to, or 0 if it is an executable or shared object
624 referring to a \addtoindex{supplementary object file}.
627 \item \texttt{sup\_filename} (null terminated filename string) \\
628 \addttindexx{sup\_filename}
629 If \addttindex{is\_supplementary} is 0, this contains either an absolute
630 filename for the \addtoindex{supplementary object file}, or a filename
631 relative to the object file containing the \dotdebugsup{} section.
632 If \addttindex{is\_supplementary} is 1, then \addttindex{sup\_filename}
633 is not needed and must be an empty string (a single null byte).
636 \item \texttt{sup\_checksum\_len} (unsigned LEB128) \\
637 \addttindexx{sup\_checksum\_len}
638 Length of the following \addttindex{sup\_checksum} field;
639 his value can be 0 if no checksum is provided.
642 \item \texttt{sup\_checksum} (array of \HFTubyte) \\
643 \addttindexx{sup\_checksum}
644 Some checksum or cryptographic hash function of the \dotdebuginfo{},
645 \dotdebugstr{} and \dotdebugmacro{} sections of the
646 \addtoindex{supplementary object file}, or some unique identifier
647 which the implementation can choose to verify that the supplementary
648 section object file matches what the debug information in the executable
649 or shared object file expects.
652 Debug information entries that refer to an executable's or shared
653 object's addresses must \emph{not} be moved to supplementary files (the
654 addesses will likely not be the same). Similarly,
655 entries referenced from within location expressions or using loclistptr
656 form attributes must not be moved to a \addtoindex{supplementary object file}.
658 Executable or shared object file compilation units can use
659 \DWTAGimportedunit{} with \DWFORMrefsup{} form \DWATimport{} attribute
660 to import entries from the \addtoindex{supplementary object file}, other \DWFORMrefsup{}
661 attributes to refer to them and \DWFORMstrpsup{} form attributes to
662 refer to strings that are used by debug information of multiple
663 executables or shared object files. Within the \addtoindex{supplementary object file}'s
664 debugging sections, form \DWFORMrefsup{} or \DWFORMstrpsup{} are
665 not used, and all reference forms referring to some other sections
666 refer to the local sections in the \addtoindex{supplementary object file}.
668 In macro information, \DWMACROdefinesup{} or
669 \DWMACROundefsup{} opcodes can refer to strings in the
670 \dotdebugstr{} section of the \addtoindex{supplementary object file},
671 or \DWMACROimportsup{}
672 can refer to \dotdebugmacro{} section entries. Within the
673 \dotdebugmacro{} section of a \addtoindex{supplementary object file},
674 \DWMACROdefinestrp{} and \DWMACROundefstrp{}
675 opcodes refer to the local \dotdebugstr{} section in that
676 supplementary file, not the one in
677 the executable or shared object file.
681 \section{32-Bit and 64-Bit DWARF Formats}
682 \label{datarep:32bitand64bitdwarfformats}
683 \hypertarget{datarep:xxbitdwffmt}{}
684 \addtoindexx{32-bit DWARF format}
685 \addtoindexx{64-bit DWARF format}
686 There are two closely related file formats. In the 32-bit DWARF
687 format, all values that represent lengths of DWARF sections
688 and offsets relative to the beginning of DWARF sections are
689 represented using four bytes. In the 64-bit DWARF format, all
690 values that represent lengths of DWARF sections and offsets
691 relative to the beginning of DWARF sections are represented
692 using eight bytes. A special convention applies to the initial
693 length field of certain DWARF sections, as well as the CIE and
694 FDE structures, so that the 32-bit and 64-bit DWARF formats
695 can coexist and be distinguished within a single linked object.
697 The differences between the 32- and 64-bit DWARF formats are
698 detailed in the following:
699 \begin{enumerate}[1. ]
701 \item In the 32-bit DWARF format, an
702 \addtoindex{initial length} field (see
703 \addtoindexx{initial length!encoding}
704 Section \ref{datarep:initiallengthvalues} on page \pageref{datarep:initiallengthvalues})
705 is an unsigned 4-byte integer (which
706 must be less than \xfffffffzero); in the 64-bit DWARF format,
707 an \addtoindex{initial length} field is 12 bytes in size,
710 \item The first four bytes have the value \xffffffff.
712 \item The following eight bytes contain the actual length
713 represented as an unsigned 8-byte integer.
716 \textit{This representation allows a DWARF consumer to dynamically
717 detect that a DWARF section contribution is using the 64-bit
718 format and to adapt its processing accordingly.}
721 \item Section offset and section length
722 \hypertarget{datarep:sectionoffsetlength}{}
723 \addtoindexx{section length!use in headers}
725 \addtoindexx{section offset!use in headers}
726 in the headers of DWARF sections (other than initial length
727 \addtoindexx{initial length}
728 fields) are listed following. In the 32-bit DWARF format these
729 are 4-byte unsigned integer values; in the 64-bit DWARF format,
730 they are 8-byte unsigned integer values.
734 Section &Name & Role \\ \hline
735 \dotdebugaranges{} & \addttindex{debug\_info\_offset} & offset in \dotdebuginfo{} \\
736 \dotdebugframe{}/CIE & \addttindex{CIE\_id} & CIE distinguished value \\
737 \dotdebugframe{}/FDE & \addttindex{CIE\_pointer} & offset in \dotdebugframe{} \\
738 \dotdebuginfo{} & \addttindex{debug\_abbrev\_offset} & offset in \dotdebugabbrev{} \\
739 \dotdebugline{} & \addttindex{header\_length} & length of header itself \\
740 \dotdebugnames{} & entry in array of CUs & offset in \dotdebuginfo{} \\
746 The \texttt{CIE\_id} field in a CIE structure must be 64 bits because
747 it overlays the \texttt{CIE\_pointer} in a FDE structure; this implicit
748 union must be accessed to distinguish whether a CIE or FDE is
749 present, consequently, these two fields must exactly overlay
750 each other (both offset and size).
752 \item Within the body of the \dotdebuginfo{}
753 section, certain forms of attribute value depend on the choice
754 of DWARF format as follows. For the 32-bit DWARF format,
755 the value is a 4-byte unsigned integer; for the 64-bit DWARF
756 format, the value is an 8-byte unsigned integer.
758 \begin{tabular}{lp{6cm}}
759 Form & Role \\ \hline
760 \DWFORMlinestrp & offset in \dotdebuglinestr \\
761 \DWFORMrefaddr & offset in \dotdebuginfo{} \\
762 \DWFORMrefsup & offset in \dotdebuginfo{} section of a \mbox{supplementary} object file \\
763 \addtoindexx{supplementary object file}
764 \DWFORMsecoffset & offset in a section other than \\
765 & \dotdebuginfo{} or \dotdebugstr{} \\
766 \DWFORMstrp & offset in \dotdebugstr{} \\
767 \DWFORMstrpsup & offset in \dotdebugstr{} section of a \mbox{supplementary} object file \\
768 \DWOPcallref & offset in \dotdebuginfo{} \\
773 \item Within the body of the \dotdebugline{} section, certain forms of content
774 description depend on the choice of DWARF format as follows: for the
775 32-bit DWARF format, the value is a 4-byte unsigned integer; for the
776 64-bit DWARF format, the value is a 8-byte unsigned integer.
778 \begin{tabular}{lp{6cm}}
779 Form & Role \\ \hline
780 \DWFORMlinestrp & offset in \dotdebuglinestr
784 \item Within the body of the \dotdebugnames{}
785 sections, the representation of each entry in the array of
786 compilation units (CUs) and the array of local type units
787 (TUs), which represents an offset in the
789 section, depends on the DWARF format as follows: in the
790 32-bit DWARF format, each entry is a 4-byte unsigned integer;
791 in the 64-bit DWARF format, it is a 8-byte unsigned integer.
794 \item In the body of the \dotdebugstroffsets{} and \dotdebugstroffsetsdwo{}
795 sections, the size of entries in the body depend on the DWARF
796 format as follows: in the 32-bit DWARF format, entries are 4-byte
797 unsigned integer values; in the 64-bit DWARF format, they are
798 8-byte unsigned integers.
800 \item In the body of the \dotdebugaddr{}, \dotdebugloc{} and \dotdebugranges{}
801 sections, the contents of the address size fields depends on the
802 DWARF format as follows: in the 32-bit DWARF format, these fields
803 contain 4; in the 64-bit DWARF format these fields contain 8.
807 The 32-bit and 64-bit DWARF format conventions must \emph{not} be
808 intermixed within a single compilation unit.
810 \textit{Attribute values and section header fields that represent
811 addresses in the target program are not affected by these
814 A DWARF consumer that supports the 64-bit DWARF format must
815 support executables in which some compilation units use the
816 32-bit format and others use the 64-bit format provided that
817 the combination links correctly (that is, provided that there
818 are no link\dash time errors due to truncation or overflow). (An
819 implementation is not required to guarantee detection and
820 reporting of all such errors.)
822 \textit{It is expected that DWARF producing compilers will \emph{not} use
823 the 64-bit format \emph{by default}. In most cases, the division of
824 even very large applications into a number of executable and
825 shared object files will suffice to assure that the DWARF sections
826 within each individual linked object are less than 4 GBytes
827 in size. However, for those cases where needed, the 64-bit
828 format allows the unusual case to be handled as well. Even
829 in this case, it is expected that only application supplied
830 objects will need to be compiled using the 64-bit format;
831 separate 32-bit format versions of system supplied shared
832 executable libraries can still be used.}
836 \section{Format of Debugging Information}
837 \label{datarep:formatofdebugginginformation}
839 For each compilation unit compiled with a DWARF producer,
840 a contribution is made to the \dotdebuginfo{} section of
841 the object file. Each such contribution consists of a
842 compilation unit header
843 (see Section \refersec{datarep:compilationunitheader})
845 single \DWTAGcompileunit{} or
846 \DWTAGpartialunit{} debugging
847 information entry, together with its children.
849 For each type defined in a compilation unit, a separate
850 contribution may also be made to the
852 section of the object file. Each
853 such contribution consists of a
854 \addtoindex{type unit} header
855 (see Section \refersec{datarep:typeunitheader})
856 followed by a \DWTAGtypeunit{} entry, together with
859 Each debugging information entry begins with a code that
860 represents an entry in a separate
861 \addtoindex{abbreviations table}. This
862 code is followed directly by a series of attribute values.
864 The appropriate entry in the
865 \addtoindex{abbreviations table} guides the
866 interpretation of the information contained directly in the
867 \dotdebuginfo{} section.
870 Multiple debugging information entries may share the same
871 abbreviation table entry. Each compilation unit is associated
872 with a particular abbreviation table, but multiple compilation
873 units may share the same table.
875 \subsection{Unit Headers}
876 \label{datarep:unitheaders}
877 Unit headers contain a field, \addttindex{unit\_type}, whose value indicates the kind of
878 compilation unit that follows. The encodings for the unit type
879 enumeration are shown in Table \refersec{tab:unitheaderunitkindencodings}.
883 \setlength{\extrarowheight}{0.1cm}
884 \begin{longtable}{l|c}
885 \caption{Unit header unit type encodings}
886 \label{tab:unitheaderunitkindencodings}
887 \addtoindexx{unit header unit type encodings} \\
888 \hline \bfseries Unit header unit type encodings&\bfseries Value \\ \hline
890 \bfseries Unit header unit type encodings&\bfseries Value \\ \hline
892 \hline \emph{Continued on next page}
894 \hline \ddag\ \textit{New in DWARF Version 5}
896 \DWUTcompileTARG~\ddag &0x01 \\
897 \DWUTtypeTARG~\ddag &0x02 \\
898 \DWUTpartialTARG~\ddag &0x03 \\ \hline
903 \subsubsection{Compilation Unit Header}
904 \label{datarep:compilationunitheader}
905 \begin{enumerate}[1. ]
907 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
908 \addttindexx{unit\_length}
910 \addtoindexx{initial length}
911 unsigned integer representing the length
912 of the \dotdebuginfo{}
913 contribution for that compilation unit,
914 not including the length field itself. In the \thirtytwobitdwarfformat,
915 this is a 4-byte unsigned integer (which must be less
916 than \xfffffffzero); in the \sixtyfourbitdwarfformat, this consists
917 of the 4-byte value \wffffffff followed by an 8-byte unsigned
918 integer that gives the actual length
919 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
921 \item \texttt{version} (\HFTuhalf) \\
922 \addttindexx{version}
923 A 2-byte unsigned integer representing the version of the
924 DWARF information for the compilation unit \addtoindexx{version number!compilation unit}
925 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
926 The value in this field is \versiondotdebuginfo.
929 \item \texttt{unit\_type} (\HFTubyte) \\
930 \addttindexx{unit\_type}
931 A 1-byte unsigned integer identifying this unit as a compilation unit.
932 The value of this field is
933 \DWUTcompile{} for a {normal compilation} unit or
934 \DWUTpartial{} for a {partial compilation} unit
935 (see Section \refersec{chap:normalandpartialcompilationunitentries}).
937 \textit{This field is new in \DWARFVersionV.}
940 \item \HFNdebugabbrevoffset{} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
942 \addtoindexx{section offset!in .debug\_info header}
943 4-byte or 8-byte unsigned offset into the
945 section. This offset associates the compilation unit with a
946 particular set of debugging information entry abbreviations. In
947 the \thirtytwobitdwarfformat, this is a 4-byte unsigned length;
948 in the \sixtyfourbitdwarfformat, this is an 8-byte unsigned length
949 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
951 \item \texttt{address\_size} (\HFTubyte) \\
952 \addttindexx{address\_size}
953 A 1-byte unsigned integer representing the size in bytes of
954 an address on the target architecture. If the system uses
955 \addtoindexx{address space!segmented}
956 segmented addressing, this value represents the size of the
957 offset portion of an address.
961 \subsubsection{Type Unit Header}
962 \label{datarep:typeunitheader}
964 The header for the series of debugging information entries
965 contributing to the description of a type that has been
966 placed in its own \addtoindex{type unit}, within the
967 \dotdebuginfo{} section,
968 consists of the following information:
969 \begin{enumerate}[1. ]
971 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
972 \addttindexx{unit\_length}
973 A 4-byte or 12-byte unsigned integer
974 \addtoindexx{initial length}
975 representing the length
976 of the \dotdebuginfo{} contribution for that type unit,
977 not including the length field itself. In the \thirtytwobitdwarfformat,
978 this is a 4-byte unsigned integer (which must be
979 less than \xfffffffzero); in the \sixtyfourbitdwarfformat, this
980 consists of the 4-byte value \wffffffff followed by an
981 8-byte unsigned integer that gives the actual length
982 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
985 \item \texttt{version} (\HFTuhalf) \\
986 \addttindexx{version}
987 A 2-byte unsigned integer representing the version of the
988 DWARF information for the
989 type unit\addtoindexx{version number!type unit}
990 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
991 The value in this field is \versiondotdebuginfo.
993 \item \texttt{unit\_type} (\HFTubyte) \\
994 \addttindexx{unit\_type}
995 A 1-byte unsigned integer identifying this unit as a type unit.
996 The value of this field is \DWUTtype{} for a type unit
997 (see Section \refersec{chap:typeunitentries}).
999 \textit{This field is new in \DWARFVersionV.}
1002 \item \HFNdebugabbrevoffset{} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
1004 \addtoindexx{section offset!in .debug\_info header}
1005 4-byte or 8-byte unsigned offset into the
1007 section. This offset associates the type unit with a
1008 particular set of debugging information entry abbreviations. In
1009 the \thirtytwobitdwarfformat, this is a 4-byte unsigned length;
1010 in the \sixtyfourbitdwarfformat, this is an 8-byte unsigned length
1011 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1014 \item \texttt{address\_size} (\HFTubyte) \\
1015 \addttindexx{address\_size}
1016 A 1-byte unsigned integer representing the size
1017 \addtoindexx{size of an address}
1019 an address on the target architecture. If the system uses
1020 \addtoindexx{address space!segmented}
1021 segmented addressing, this value represents the size of the
1022 offset portion of an address.
1024 \item \texttt{type\_signature} (8-byte unsigned integer) \\
1025 \addttindexx{type\_signature}
1026 \addtoindexx{type signature}
1027 A unique 64-bit signature (see Section
1028 \refersec{datarep:typesignaturecomputation})
1029 of the type described in this type
1032 \textit{An attribute that refers (using
1033 \DWFORMrefsigeight{}) to
1034 the primary type contained in this
1035 \addtoindex{type unit} uses this value.}
1037 \item \texttt{type\_offset} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
1038 \addttindexx{type\_offset}
1039 A 4-byte or 8-byte unsigned offset
1040 \addtoindexx{section offset!in .debug\_info header}
1041 relative to the beginning
1042 of the \addtoindex{type unit} header.
1043 This offset refers to the debugging
1044 information entry that describes the type. Because the type
1045 may be nested inside a namespace or other structures, and may
1046 contain references to other types that have not been placed in
1047 separate type units, it is not necessarily either the first or
1048 the only entry in the type unit. In the \thirtytwobitdwarfformat,
1049 this is a 4-byte unsigned length; in the \sixtyfourbitdwarfformat,
1050 this is an 8-byte unsigned length
1051 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1055 \subsection{Debugging Information Entry}
1056 \label{datarep:debugginginformationentry}
1058 Each debugging information entry begins with an
1059 unsigned LEB128\addtoindexx{LEB128!unsigned}
1060 number containing the abbreviation code for the entry. This
1061 code represents an entry within the abbreviations table
1062 associated with the compilation unit containing this entry. The
1063 abbreviation code is followed by a series of attribute values.
1065 On some architectures, there are alignment constraints on
1066 section boundaries. To make it easier to pad debugging
1067 information sections to satisfy such constraints, the
1068 abbreviation code 0 is reserved. Debugging information entries
1069 consisting of only the abbreviation code 0 are considered
1072 \subsection{Abbreviations Tables}
1073 \label{datarep:abbreviationstables}
1075 The abbreviations tables for all compilation units
1076 are contained in a separate object file section called
1078 As mentioned before, multiple compilation
1079 units may share the same abbreviations table.
1081 The abbreviations table for a single compilation unit consists
1082 of a series of abbreviation declarations. Each declaration
1083 specifies the tag and attributes for a particular form of
1084 debugging information entry. Each declaration begins with
1085 an unsigned LEB128\addtoindexx{LEB128!unsigned}
1086 number representing the abbreviation
1087 code itself. It is this code that appears at the beginning
1088 of a debugging information entry in the
1090 section. As described above, the abbreviation
1091 code 0 is reserved for null debugging information entries. The
1092 abbreviation code is followed by another unsigned LEB128\addtoindexx{LEB128!unsigned}
1093 number that encodes the entry\textquoteright s tag. The encodings for the
1094 tag names are given in
1095 Table \referfol{tab:tagencodings}.
1098 \setlength{\extrarowheight}{0.1cm}
1099 \begin{longtable}{l|c}
1100 \caption{Tag encodings} \label{tab:tagencodings} \\
1101 \hline \bfseries Tag name&\bfseries Value\\ \hline
1103 \bfseries Tag name&\bfseries Value \\ \hline
1105 \hline \emph{Continued on next page}
1107 \hline \ddag\ \textit{New in DWARF Version 5}
1109 \DWTAGarraytype{} &0x01 \\
1110 \DWTAGclasstype&0x02 \\
1111 \DWTAGentrypoint&0x03 \\
1112 \DWTAGenumerationtype&0x04 \\
1113 \DWTAGformalparameter&0x05 \\
1114 \DWTAGimporteddeclaration&0x08 \\
1116 \DWTAGlexicalblock&0x0b \\
1117 \DWTAGmember&0x0d \\
1118 \DWTAGpointertype&0x0f \\
1119 \DWTAGreferencetype&0x10 \\
1120 \DWTAGcompileunit&0x11 \\
1121 \DWTAGstringtype&0x12 \\
1122 \DWTAGstructuretype&0x13 \\
1123 \DWTAGsubroutinetype&0x15 \\
1124 \DWTAGtypedef&0x16 \\
1125 \DWTAGuniontype&0x17 \\
1126 \DWTAGunspecifiedparameters&0x18 \\
1127 \DWTAGvariant&0x19 \\
1128 \DWTAGcommonblock&0x1a \\
1129 \DWTAGcommoninclusion&0x1b \\
1130 \DWTAGinheritance&0x1c \\
1131 \DWTAGinlinedsubroutine&0x1d \\
1132 \DWTAGmodule&0x1e \\
1133 \DWTAGptrtomembertype&0x1f \\
1134 \DWTAGsettype&0x20 \\
1135 \DWTAGsubrangetype&0x21 \\
1136 \DWTAGwithstmt&0x22 \\
1137 \DWTAGaccessdeclaration&0x23 \\
1138 \DWTAGbasetype&0x24 \\
1139 \DWTAGcatchblock&0x25 \\
1140 \DWTAGconsttype&0x26 \\
1141 \DWTAGconstant&0x27 \\
1142 \DWTAGenumerator&0x28 \\
1143 \DWTAGfiletype&0x29 \\
1144 \DWTAGfriend&0x2a \\
1145 \DWTAGnamelist&0x2b \\
1146 \DWTAGnamelistitem&0x2c \\
1147 \DWTAGpackedtype&0x2d \\
1148 \DWTAGsubprogram&0x2e \\
1149 \DWTAGtemplatetypeparameter&0x2f \\
1150 \DWTAGtemplatevalueparameter&0x30 \\
1151 \DWTAGthrowntype&0x31 \\
1152 \DWTAGtryblock&0x32 \\
1153 \DWTAGvariantpart&0x33 \\
1154 \DWTAGvariable&0x34 \\
1155 \DWTAGvolatiletype&0x35 \\
1156 \DWTAGdwarfprocedure&0x36 \\
1157 \DWTAGrestricttype&0x37 \\
1158 \DWTAGinterfacetype&0x38 \\
1159 \DWTAGnamespace&0x39 \\
1160 \DWTAGimportedmodule&0x3a \\
1161 \DWTAGunspecifiedtype&0x3b \\
1162 \DWTAGpartialunit&0x3c \\
1163 \DWTAGimportedunit&0x3d \\
1164 \DWTAGcondition&\xiiif \\
1165 \DWTAGsharedtype&0x40 \\
1166 \DWTAGtypeunit & 0x41 \\
1167 \DWTAGrvaluereferencetype & 0x42 \\
1168 \DWTAGtemplatealias & 0x43 \\
1169 \DWTAGcoarraytype~\ddag & 0x44 \\
1170 \DWTAGgenericsubrange~\ddag & 0x45 \\
1171 \DWTAGdynamictype~\ddag & 0x46 \\
1172 \DWTAGatomictype~\ddag & 0x47 \\
1173 \DWTAGcallsite~\ddag & 0x48 \\
1174 \DWTAGcallsiteparameter~\ddag & 0x49 \\
1175 \DWTAGlouser&0x4080 \\
1176 \DWTAGhiuser&\xffff \\
1180 Following the tag encoding is a 1-byte value that determines
1181 whether a debugging information entry using this abbreviation
1182 has child entries or not. If the value is
1184 the next physically succeeding entry of any debugging
1185 information entry using this abbreviation is the first
1186 child of that entry. If the 1-byte value following the
1187 abbreviation\textquoteright s tag encoding is
1188 \DWCHILDRENnoTARG, the next
1189 physically succeeding entry of any debugging information entry
1190 using this abbreviation is a sibling of that entry. (Either
1191 the first child or sibling entries may be null entries). The
1192 encodings for the child determination byte are given in
1193 Table \refersec{tab:childdeterminationencodings}
1195 Section \refersec{chap:relationshipofdebugginginformationentries},
1196 each chain of sibling entries is terminated by a null entry.)
1200 \setlength{\extrarowheight}{0.1cm}
1201 \begin{longtable}{l|c}
1202 \caption{Child determination encodings}
1203 \label{tab:childdeterminationencodings}
1204 \addtoindexx{Child determination encodings} \\
1205 \hline \bfseries Children determination name&\bfseries Value \\ \hline
1207 \bfseries Children determination name&\bfseries Value \\ \hline
1209 \hline \emph{Continued on next page}
1213 \DWCHILDRENno&0x00 \\
1214 \DWCHILDRENyes&0x01 \\ \hline
1219 Finally, the child encoding is followed by a series of
1220 attribute specifications. Each attribute specification
1221 consists of two parts. The first part is an
1222 unsigned LEB128\addtoindexx{LEB128!unsigned}
1223 number representing the attribute\textquoteright s name.
1224 The second part is an
1225 unsigned LEB128\addtoindexx{LEB128!unsigned}
1226 number representing the attribute\textquoteright s form.
1227 The series of attribute specifications ends with an
1228 entry containing 0 for the name and 0 for the form.
1231 \DWFORMindirectTARG{} is a special case. For
1232 attributes with this form, the attribute value itself in the
1234 section begins with an unsigned
1235 LEB128 number that represents its form. This allows producers
1236 to choose forms for particular attributes
1237 \addtoindexx{abbreviations table!dynamic forms in}
1239 without having to add a new entry to the abbreviations table.
1241 The attribute form \DWFORMimplicitconstTARG{} is another special case.
1242 For attributes with this form, the attribute specification contains
1243 a third part, which is a signed LEB128\addtoindexx{LEB128!signed}
1244 number. The value of this number is used as the value of the
1245 attribute, and no value is stored in the \dotdebuginfo{} section.
1247 The abbreviations for a given compilation unit end with an
1248 entry consisting of a 0 byte for the abbreviation code.
1251 Appendix \refersec{app:compilationunitsandabbreviationstableexample}
1252 for a depiction of the organization of the
1253 debugging information.}
1256 \subsection{Attribute Encodings}
1257 \label{datarep:attributeencodings}
1259 The encodings for the attribute names are given in
1260 Table \referfol{tab:attributeencodings}.
1263 \setlength{\extrarowheight}{0.1cm}
1264 \begin{longtable}{l|c|l}
1265 \caption{Attribute encodings}
1266 \label{tab:attributeencodings}
1267 \addtoindexx{attribute encodings} \\
1268 \hline \bfseries Attribute name&\bfseries Value &\bfseries Classes \\ \hline
1270 \bfseries Attribute name&\bfseries Value &\bfseries Classes\\ \hline
1272 \hline \emph{Continued on next page}
1274 \hline \ddag\ \textit{New in DWARF Version 5}
1276 \DWATsibling&0x01&\livelink{chap:classreference}{reference}
1277 \addtoindexx{sibling attribute} \\
1278 \DWATlocation&0x02&\livelink{chap:classexprloc}{exprloc},
1279 \livelink{chap:classloclistptr}{loclistptr}
1280 \addtoindexx{location attribute} \\
1281 \DWATname&0x03&\livelink{chap:classstring}{string}
1282 \addtoindexx{name attribute} \\
1283 \DWATordering&0x09&\livelink{chap:classconstant}{constant}
1284 \addtoindexx{ordering attribute} \\
1285 \DWATbytesize&0x0b&\livelink{chap:classconstant}{constant},
1286 \livelink{chap:classexprloc}{exprloc},
1287 \livelink{chap:classreference}{reference}
1288 \addtoindexx{byte size attribute} \\
1289 \textit{Reserved}&0x0c\footnote{Code 0x0c is reserved to allow backward compatible support of the
1290 DW\_AT\_bit\_offset \mbox{attribute} which was
1291 defined in \DWARFVersionIII{} and earlier.}
1292 &\livelink{chap:classconstant}{constant},
1293 \livelink{chap:classexprloc}{exprloc},
1294 \livelink{chap:classreference}{reference}
1295 \addtoindexx{bit offset attribute (Version 3)}
1296 \addtoindexx{DW\_AT\_bit\_offset (deprecated)} \\
1297 \DWATbitsize&0x0d&\livelink{chap:classconstant}{constant},
1298 \livelink{chap:classexprloc}{exprloc},
1299 \livelink{chap:classreference}{reference}
1300 \addtoindexx{bit size attribute} \\
1301 \DWATstmtlist&0x10&\livelink{chap:classlineptr}{lineptr}
1302 \addtoindexx{statement list attribute} \\
1303 \DWATlowpc&0x11&\livelink{chap:classaddress}{address}
1304 \addtoindexx{low PC attribute} \\
1305 \DWAThighpc&0x12&\livelink{chap:classaddress}{address},
1306 \livelink{chap:classconstant}{constant}
1307 \addtoindexx{high PC attribute} \\
1308 \DWATlanguage&0x13&\livelink{chap:classconstant}{constant}
1309 \addtoindexx{language attribute} \\
1310 \DWATdiscr&0x15&\livelink{chap:classreference}{reference}
1311 \addtoindexx{discriminant attribute} \\
1312 \DWATdiscrvalue&0x16&\livelink{chap:classconstant}{constant}
1313 \addtoindexx{discriminant value attribute} \\
1314 \DWATvisibility&0x17&\livelink{chap:classconstant}{constant}
1315 \addtoindexx{visibility attribute} \\
1316 \DWATimport&0x18&\livelink{chap:classreference}{reference}
1317 \addtoindexx{import attribute} \\
1318 \DWATstringlength&0x19&\livelink{chap:classexprloc}{exprloc},
1319 \livelink{chap:classloclistptr}{loclistptr}
1320 \addtoindexx{string length attribute} \\
1321 \DWATcommonreference&0x1a&\livelink{chap:classreference}{reference}
1322 \addtoindexx{common reference attribute} \\
1323 \DWATcompdir&0x1b&\livelink{chap:classstring}{string}
1324 \addtoindexx{compilation directory attribute} \\
1325 \DWATconstvalue&0x1c&\livelink{chap:classblock}{block},
1326 \livelink{chap:classconstant}{constant},
1327 \livelink{chap:classstring}{string}
1328 \addtoindexx{constant value attribute} \\
1329 \DWATcontainingtype&0x1d&\livelink{chap:classreference}{reference}
1330 \addtoindexx{containing type attribute} \\
1331 \DWATdefaultvalue&0x1e&\livelink{chap:classconstant}{constant},
1332 \livelink{chap:classreference}{reference},
1333 \livelink{chap:classflag}{flag}
1334 \addtoindexx{default value attribute} \\
1335 \DWATinline&0x20&\livelink{chap:classconstant}{constant}
1336 \addtoindexx{inline attribute} \\
1337 \DWATisoptional&0x21&\livelink{chap:classflag}{flag}
1338 \addtoindexx{is optional attribute} \\
1339 \DWATlowerbound&0x22&\livelink{chap:classconstant}{constant},
1340 \livelink{chap:classexprloc}{exprloc},
1341 \livelink{chap:classreference}{reference}
1342 \addtoindexx{lower bound attribute} \\
1343 \DWATproducer&0x25&\livelink{chap:classstring}{string}
1344 \addtoindexx{producer attribute} \\
1345 \DWATprototyped&0x27&\livelink{chap:classflag}{flag}
1346 \addtoindexx{prototyped attribute} \\
1347 \DWATreturnaddr&0x2a&\livelink{chap:classexprloc}{exprloc},
1348 \livelink{chap:classloclistptr}{loclistptr}
1349 \addtoindexx{return address attribute} \\
1350 \DWATstartscope&0x2c&\livelink{chap:classconstant}{constant},
1351 \livelink{chap:classrangelistptr}{rangelistptr}
1352 \addtoindexx{start scope attribute} \\
1353 \DWATbitstride&0x2e&\livelink{chap:classconstant}{constant},
1354 \livelink{chap:classexprloc}{exprloc},
1355 \livelink{chap:classreference}{reference}
1356 \addtoindexx{bit stride attribute} \\
1357 \DWATupperbound&0x2f&\livelink{chap:classconstant}{constant},
1358 \livelink{chap:classexprloc}{exprloc},
1359 \livelink{chap:classreference}{reference}
1360 \addtoindexx{upper bound attribute} \\
1361 \DWATabstractorigin&0x31&\livelink{chap:classreference}{reference}
1362 \addtoindexx{abstract origin attribute} \\
1363 \DWATaccessibility&0x32&\livelink{chap:classconstant}{constant}
1364 \addtoindexx{accessibility attribute} \\
1365 \DWATaddressclass&0x33&\livelink{chap:classconstant}{constant}
1366 \addtoindexx{address class attribute} \\
1367 \DWATartificial&0x34&\livelink{chap:classflag}{flag}
1368 \addtoindexx{artificial attribute} \\
1369 \DWATbasetypes&0x35&\livelink{chap:classreference}{reference}
1370 \addtoindexx{base types attribute} \\
1371 \DWATcallingconvention&0x36&\livelink{chap:classconstant}{constant}
1372 \addtoindexx{calling convention attribute} \\
1373 \DWATcount&0x37&\livelink{chap:classconstant}{constant},
1374 \livelink{chap:classexprloc}{exprloc},
1375 \livelink{chap:classreference}{reference}
1376 \addtoindexx{count attribute} \\
1377 \DWATdatamemberlocation&0x38&\livelink{chap:classconstant}{constant},
1378 \livelink{chap:classexprloc}{exprloc},
1379 \livelink{chap:classloclistptr}{loclistptr}
1380 \addtoindexx{data member attribute} \\
1381 \DWATdeclcolumn&0x39&\livelink{chap:classconstant}{constant}
1382 \addtoindexx{declaration column attribute} \\
1383 \DWATdeclfile&0x3a&\livelink{chap:classconstant}{constant}
1384 \addtoindexx{declaration file attribute} \\
1385 \DWATdeclline&0x3b&\livelink{chap:classconstant}{constant}
1386 \addtoindexx{declaration line attribute} \\
1387 \DWATdeclaration&0x3c&\livelink{chap:classflag}{flag}
1388 \addtoindexx{declaration attribute} \\
1389 \DWATdiscrlist&0x3d&\livelink{chap:classblock}{block}
1390 \addtoindexx{discriminant list attribute} \\
1391 \DWATencoding&0x3e&\livelink{chap:classconstant}{constant}
1392 \addtoindexx{encoding attribute} \\
1393 \DWATexternal&\xiiif&\livelink{chap:classflag}{flag}
1394 \addtoindexx{external attribute} \\
1395 \DWATframebase&0x40&\livelink{chap:classexprloc}{exprloc},
1396 \livelink{chap:classloclistptr}{loclistptr}
1397 \addtoindexx{frame base attribute} \\
1398 \DWATfriend&0x41&\livelink{chap:classreference}{reference}
1399 \addtoindexx{friend attribute} \\
1400 \DWATidentifiercase&0x42&\livelink{chap:classconstant}{constant}
1401 \addtoindexx{identifier case attribute} \\
1402 \DWATmacroinfo\footnote{\raggedright Not used in \DWARFVersionV.
1403 Reserved for compatibility and coexistence
1404 with prior DWARF versions.}
1405 &0x43&\livelink{chap:classmacptr}{macptr}
1406 \addtoindexx{macro information attribute (legacy)!encoding} \\
1407 \DWATnamelistitem&0x44&\livelink{chap:classreference}{reference}
1408 \addtoindexx{name list item attribute} \\
1409 \DWATpriority&0x45&\livelink{chap:classreference}{reference}
1410 \addtoindexx{priority attribute} \\
1411 \DWATsegment&0x46&\livelink{chap:classexprloc}{exprloc},
1412 \livelink{chap:classloclistptr}{loclistptr}
1413 \addtoindexx{segment attribute} \\
1414 \DWATspecification&0x47&\livelink{chap:classreference}{reference}
1415 \addtoindexx{specification attribute} \\
1416 \DWATstaticlink&0x48&\livelink{chap:classexprloc}{exprloc},
1417 \livelink{chap:classloclistptr}{loclistptr}
1418 \addtoindexx{static link attribute} \\
1419 \DWATtype&0x49&\livelink{chap:classreference}{reference}
1420 \addtoindexx{type attribute} \\
1421 \DWATuselocation&0x4a&\livelink{chap:classexprloc}{exprloc},
1422 \livelink{chap:classloclistptr}{loclistptr}
1423 \addtoindexx{location list attribute} \\
1424 \DWATvariableparameter&0x4b&\livelink{chap:classflag}{flag}
1425 \addtoindexx{variable parameter attribute} \\
1426 \DWATvirtuality&0x4c&\livelink{chap:classconstant}{constant}
1427 \addtoindexx{virtuality attribute} \\
1428 \DWATvtableelemlocation&0x4d&\livelink{chap:classexprloc}{exprloc},
1429 \livelink{chap:classloclistptr}{loclistptr}
1430 \addtoindexx{vtable element location attribute} \\
1431 \DWATallocated&0x4e&\livelink{chap:classconstant}{constant},
1432 \livelink{chap:classexprloc}{exprloc},
1433 \livelink{chap:classreference}{reference}
1434 \addtoindexx{allocated attribute} \\
1435 \DWATassociated&0x4f&\livelink{chap:classconstant}{constant},
1436 \livelink{chap:classexprloc}{exprloc},
1437 \livelink{chap:classreference}{reference}
1438 \addtoindexx{associated attribute} \\
1439 \DWATdatalocation&0x50&\livelink{chap:classexprloc}{exprloc}
1440 \addtoindexx{data location attribute} \\
1441 \DWATbytestride&0x51&\livelink{chap:classconstant}{constant},
1442 \livelink{chap:classexprloc}{exprloc},
1443 \livelink{chap:classreference}{reference}
1444 \addtoindexx{byte stride attribute} \\
1445 \DWATentrypc&0x52&\livelink{chap:classaddress}{address},
1446 \livelink{chap:classconstant}{constant}
1447 \addtoindexx{entry PC attribute} \\
1448 \DWATuseUTFeight&0x53&\livelink{chap:classflag}{flag}
1449 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8} \\
1450 \DWATextension&0x54&\livelink{chap:classreference}{reference}
1451 \addtoindexx{extension attribute} \\
1452 \DWATranges&0x55&\livelink{chap:classrangelistptr}{rangelistptr}
1453 \addtoindexx{ranges attribute} \\
1454 \DWATtrampoline&0x56&\livelink{chap:classaddress}{address},
1455 \livelink{chap:classflag}{flag},
1456 \livelink{chap:classreference}{reference},
1457 \livelink{chap:classstring}{string}
1458 \addtoindexx{trampoline attribute} \\
1459 \DWATcallcolumn&0x57&\livelink{chap:classconstant}{constant}
1460 \addtoindexx{call column attribute} \\
1461 \DWATcallfile&0x58&\livelink{chap:classconstant}{constant}
1462 \addtoindexx{call file attribute} \\
1463 \DWATcallline&0x59&\livelink{chap:classconstant}{constant}
1464 \addtoindexx{call line attribute} \\
1465 \DWATdescription&0x5a&\livelink{chap:classstring}{string}
1466 \addtoindexx{description attribute} \\
1467 \DWATbinaryscale&0x5b&\livelink{chap:classconstant}{constant}
1468 \addtoindexx{binary scale attribute} \\
1469 \DWATdecimalscale&0x5c&\livelink{chap:classconstant}{constant}
1470 \addtoindexx{decimal scale attribute} \\
1471 \DWATsmall{} &0x5d&\livelink{chap:classreference}{reference}
1472 \addtoindexx{small attribute} \\
1473 \DWATdecimalsign&0x5e&\livelink{chap:classconstant}{constant}
1474 \addtoindexx{decimal scale attribute} \\
1475 \DWATdigitcount&0x5f&\livelink{chap:classconstant}{constant}
1476 \addtoindexx{digit count attribute} \\
1477 \DWATpicturestring&0x60&\livelink{chap:classstring}{string}
1478 \addtoindexx{picture string attribute} \\
1479 \DWATmutable&0x61&\livelink{chap:classflag}{flag}
1480 \addtoindexx{mutable attribute} \\
1481 \DWATthreadsscaled&0x62&\livelink{chap:classflag}{flag}
1482 \addtoindexx{thread scaled attribute} \\
1483 \DWATexplicit&0x63&\livelink{chap:classflag}{flag}
1484 \addtoindexx{explicit attribute} \\
1485 \DWATobjectpointer&0x64&\livelink{chap:classreference}{reference}
1486 \addtoindexx{object pointer attribute} \\
1487 \DWATendianity&0x65&\livelink{chap:classconstant}{constant}
1488 \addtoindexx{endianity attribute} \\
1489 \DWATelemental&0x66&\livelink{chap:classflag}{flag}
1490 \addtoindexx{elemental attribute} \\
1491 \DWATpure&0x67&\livelink{chap:classflag}{flag}
1492 \addtoindexx{pure attribute} \\
1493 \DWATrecursive&0x68&\livelink{chap:classflag}{flag}
1494 \addtoindexx{recursive attribute} \\
1495 \DWATsignature{} &0x69&\livelink{chap:classreference}{reference}
1496 \addtoindexx{signature attribute} \\
1497 \DWATmainsubprogram{} &0x6a&\livelink{chap:classflag}{flag}
1498 \addtoindexx{main subprogram attribute} \\
1499 \DWATdatabitoffset{} &0x6b&\livelink{chap:classconstant}{constant}
1500 \addtoindexx{data bit offset attribute} \\
1501 \DWATconstexpr{} &0x6c&\livelink{chap:classflag}{flag}
1502 \addtoindexx{constant expression attribute} \\
1503 \DWATenumclass{} &0x6d&\livelink{chap:classflag}{flag}
1504 \addtoindexx{enumeration class attribute} \\
1505 \DWATlinkagename{} &0x6e&\livelink{chap:classstring}{string}
1506 \addtoindexx{linkage name attribute} \\
1507 \DWATstringlengthbitsize{}~\ddag&0x6f&
1508 \livelink{chap:classconstant}{constant}
1509 \addtoindexx{string length attribute!size of length} \\
1510 \DWATstringlengthbytesize{}~\ddag&0x70&
1511 \livelink{chap:classconstant}{constant}
1512 \addtoindexx{string length attribute!size of length} \\
1513 \DWATrank~\ddag&0x71&
1514 \livelink{chap:classconstant}{constant},
1515 \livelink{chap:classexprloc}{exprloc}
1516 \addtoindexx{rank attribute} \\
1517 \DWATstroffsetsbase~\ddag&0x72&
1518 \livelinki{chap:classstroffsetsptr}{stroffsetsptr}{stroffsetsptr class}
1519 \addtoindexx{string offsets base!encoding} \\
1520 \DWATaddrbase~\ddag &0x73&
1521 \livelinki{chap:classaddrptr}{addrptr}{addrptr class}
1522 \addtoindexx{address table base!encoding} \\
1523 \DWATrangesbase~\ddag&0x74&
1524 \livelinki{chap:classrangelistptr}{rangelistptr}{rangelistptr class}
1525 \addtoindexx{ranges base!encoding} \\
1526 \DWATdwoid~\ddag &0x75&
1527 \livelink{chap:classconstant}{constant}
1528 \addtoindexx{split DWARF object file id!encoding} \\
1529 \DWATdwoname~\ddag &0x76&
1530 \livelink{chap:classstring}{string}
1531 \addtoindexx{split DWARF object file name!encoding} \\
1532 \DWATreference~\ddag &0x77&
1533 \livelink{chap:classflag}{flag} \\
1534 \DWATrvaluereference~\ddag &0x78&
1535 \livelink{chap:classflag}{flag} \\
1536 \DWATmacros~\ddag &0x79&\livelink{chap:classmacptr}{macptr}
1537 \addtoindexx{macro information attribute} \\
1538 \DWATcallallcalls~\ddag &0x7a&\CLASSflag
1539 \addtoindexx{all calls summary attribute} \\
1540 \DWATcallallsourcecalls~\ddag &0x7b &\CLASSflag
1541 \addtoindexx{all source calls summary attribute} \\
1542 \DWATcallalltailcalls~\ddag &0x7c&\CLASSflag
1543 \addtoindexx{all tail calls summary attribute} \\
1544 \DWATcallreturnpc~\ddag &0x7d &\CLASSaddress
1545 \addtoindexx{call return PC attribute} \\
1546 \DWATcallvalue~\ddag &0x7e &\CLASSexprloc
1547 \addtoindexx{call value attribute} \\
1548 \DWATcallorigin~\ddag &0x7f &\CLASSexprloc
1549 \addtoindexx{call origin attribute} \\
1550 \DWATcallparameter~\ddag &0x80 &\CLASSreference
1551 \addtoindexx{call parameter attribute} \\
1552 \DWATcallpc~\ddag &0x81 &\CLASSaddress
1553 \addtoindexx{call PC attribute} \\
1554 \DWATcalltailcall~\ddag &0x82 &\CLASSflag
1555 \addtoindexx{call tail call attribute} \\
1556 \DWATcalltarget~\ddag &0x83 &\CLASSexprloc
1557 \addtoindexx{call target attribute} \\
1558 \DWATcalltargetclobbered~\ddag &0x84 &\CLASSexprloc
1559 \addtoindexx{call target clobbered attribute} \\
1560 \DWATcalldatalocation~\ddag &0x85 &\CLASSexprloc
1561 \addtoindexx{call data location attribute} \\
1562 \DWATcalldatavalue~\ddag &0x86 &\CLASSexprloc
1563 \addtoindexx{call data value attribute} \\
1564 \DWATnoreturn~\ddag &0x87 &\CLASSflag
1565 \addtoindexx{noreturn attribute} \\
1566 \DWATalignment~\ddag &0x88 &\CLASSconstant
1567 \addtoindexx{alignment attribute} \\
1568 \DWATexportsymbols~\ddag &0x89 &\CLASSflag
1569 \addtoindexx{export symbols attribute} \\
1570 \DWATdeleted~\ddag &0x8a &\CLASSflag \addtoindexx{deleted attribute} \\
1571 \DWATdefaulted~\ddag &0x8b &\CLASSconstant \addtoindexx{defaulted attribute} \\
1572 \DWATlouser&0x2000 & --- \addtoindexx{low user attribute encoding} \\
1573 \DWAThiuser&\xiiifff& --- \addtoindexx{high user attribute encoding} \\
1578 The attribute form governs how the value of the attribute is
1579 encoded. There are nine classes of form, listed below. Each
1580 class is a set of forms which have related representations
1581 and which are given a common interpretation according to the
1582 attribute in which the form is used.
1584 Form \DWFORMsecoffsetTARG{}
1586 \addtoindexx{rangelistptr class}
1588 \addtoindexx{macptr class}
1590 \addtoindexx{loclistptr class}
1592 \addtoindexx{lineptr class}
1598 \CLASSrangelistptr{} or
1599 \CLASSstroffsetsptr;
1600 the list of classes allowed by the applicable attribute in
1601 Table \refersec{tab:attributeencodings}
1602 determines the class of the form.
1605 In the form descriptions that follow, some forms are said
1606 to depend in part on the value of an attribute of the
1607 \definition{\associatedcompilationunit}:
1610 In the case of a \splitDWARFobjectfile{}, the associated
1611 compilation unit is the skeleton compilation unit corresponding
1612 to the containing unit.
1613 \item Otherwise, the associated compilation unit
1614 is the containing unit.
1618 Each possible form belongs to one or more of the following classes
1619 (see Table \refersec{tab:classesofattributevalue} for a summary of
1620 the purpose and general usage of each class):
1623 \item \livelinki{chap:classaddress}{address}{address class} \\
1624 \livetarg{datarep:classaddress}{}
1625 Represented as either:
1627 \item An object of appropriate size to hold an
1628 address on the target machine
1630 The size is encoded in the compilation unit header
1631 (see Section \refersec{datarep:compilationunitheader}).
1632 This address is relocatable in a relocatable object file and
1633 is relocated in an executable file or shared object file.
1635 \item An indirect index into a table of addresses (as
1636 described in the previous bullet) in the
1637 \dotdebugaddr{} section (\DWFORMaddrxTARG).
1638 The representation of a \DWFORMaddrxNAME{} value is an unsigned
1639 \addtoindex{LEB128} value, which is interpreted as a zero-based
1640 index into an array of addresses in the \dotdebugaddr{} section.
1641 The index is relative to the value of the \DWATaddrbase{} attribute
1642 of the associated compilation unit.
1647 \item \livelink{chap:classaddrptr}{addrptr} \\
1648 \livetarg{datarep:classaddrptr}{}
1649 This is an offset into the \dotdebugaddr{} section (\DWFORMsecoffset). It
1650 consists of an offset from the beginning of the \dotdebugaddr{} section to the
1651 beginning of the list of machine addresses information for the
1652 referencing entity. It is relocatable in
1653 a relocatable object file, and relocated in an executable or
1654 shared object file. In the \thirtytwobitdwarfformat, this offset
1655 is a 4-byte unsigned value; in the 64-bit DWARF
1656 format, it is an 8-byte unsigned value (see Section
1657 \refersec{datarep:32bitand64bitdwarfformats}).
1659 \textit{This class is new in \DWARFVersionV.}
1662 \item \livelink{chap:classblock}{block} \\
1663 \livetarg{datarep:classblock}{}
1664 Blocks come in four forms:
1667 A 1-byte length followed by 0 to 255 contiguous information
1668 bytes (\DWFORMblockoneTARG).
1671 A 2-byte length followed by 0 to 65,535 contiguous information
1672 bytes (\DWFORMblocktwoTARG).
1675 A 4-byte length followed by 0 to 4,294,967,295 contiguous
1676 information bytes (\DWFORMblockfourTARG).
1679 An unsigned LEB128\addtoindexx{LEB128!unsigned}
1680 length followed by the number of bytes
1681 specified by the length (\DWFORMblockTARG).
1684 In all forms, the length is the number of information bytes
1685 that follow. The information bytes may contain any mixture
1686 of relocated (or relocatable) addresses, references to other
1687 debugging information entries or data bytes.
1689 \item \livelinki{chap:classconstant}{constant}{constant class} \\
1690 \livetarg{datarep:classconstant}{}
1691 There are eight forms of constants. There are fixed length
1692 constant data forms for one-, two-, four-, eight- and sixteen-byte values
1696 \DWFORMdatafourTARG,
1697 \DWFORMdataeightTARG{} and
1698 \DWFORMdatasixteenTARG).
1699 There are also variable length constant
1700 data forms encoded using LEB128 numbers (see below).
1701 Both signed (\DWFORMsdataTARG) and unsigned
1702 (\DWFORMudataTARG) variable length constants are available.
1703 There is also an implicit constant (\DWFORMimplicitconst),
1704 whose value is provided as part of the abbreviation
1708 The data in \DWFORMdataone,
1711 \DWFORMdataeight{} and
1712 \DWFORMdatasixteen{}
1713 can be anything. Depending on context, it may
1714 be a signed integer, an unsigned integer, a floating\dash point
1715 constant, or anything else. A consumer must use context to
1716 know how to interpret the bits, which if they are target
1717 machine data (such as an integer or floating-point constant)
1718 will be in target machine \byteorder.
1720 \textit{If one of the \DWFORMdataTARG\textless n\textgreater
1721 forms is used to represent a
1722 signed or unsigned integer, it can be hard for a consumer
1723 to discover the context necessary to determine which
1724 interpretation is intended. Producers are therefore strongly
1725 encouraged to use \DWFORMsdata{} or
1726 \DWFORMudata{} for signed and
1727 unsigned integers respectively, rather than
1728 \DWFORMdata\textless n\textgreater.}
1731 \item \livelinki{chap:classexprloc}{exprloc}{exprloc class} \\
1732 \livetarg{datarep:classexprloc}{}
1733 This is an unsigned LEB128\addtoindexx{LEB128!unsigned} length followed by the
1734 number of information bytes specified by the length
1735 (\DWFORMexprlocTARG).
1736 The information bytes contain a DWARF expression
1737 (see Section \refersec{chap:dwarfexpressions})
1738 or location description
1739 (see Section \refersec{chap:locationdescriptions}).
1742 \item \livelinki{chap:classflag}{flag}{flag class} \\
1743 \livetarg{datarep:classflag}{}
1744 A flag \addtoindexx{flag class}
1745 is represented explicitly as a single byte of data
1746 (\DWFORMflagTARG) or
1747 implicitly (\DWFORMflagpresentTARG).
1749 first case, if the \nolink{flag} has value zero, it indicates the
1750 absence of the attribute; if the \nolink{flag} has a non\dash zero value,
1751 it indicates the presence of the attribute. In the second
1752 case, the attribute is implicitly indicated as present, and
1753 no value is encoded in the debugging information entry itself.
1755 \item \livelinki{chap:classlineptr}{lineptr}{lineptr class} \\
1756 \livetarg{datarep:classlineptr}{}
1757 This is an offset into
1758 \addtoindexx{section offset!in class lineptr value}
1760 \dotdebugline{} or \dotdebuglinedwo{} section
1762 It consists of an offset from the beginning of the
1764 section to the first byte of
1765 the data making up the line number list for the compilation
1767 It is relocatable in a relocatable object file, and
1768 relocated in an executable or shared object file. In the
1769 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
1770 in the \sixtyfourbitdwarfformat, it is an 8-byte unsigned value
1771 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1774 \item \livelinki{chap:classloclistptr}{loclistptr}{loclistptr class} \\
1775 \livetarg{datarep:classloclistptr}{}
1776 This is an offset into the
1780 It consists of an offset from the
1781 \addtoindexx{section offset!in class loclistptr value}
1784 section to the first byte of
1785 the data making up the
1786 \addtoindex{location list} for the compilation unit.
1787 It is relocatable in a relocatable object file, and
1788 relocated in an executable or shared object file. In the
1789 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
1790 in the \sixtyfourbitdwarfformat, it is an 8-byte unsigned value
1791 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1794 \item \livelinki{chap:classmacptr}{macptr}{macptr class} \\
1795 \livetarg{datarep:classmacptr}{}
1797 \addtoindexx{section offset!in class macptr value}
1799 \dotdebugmacro{} or \dotdebugmacrodwo{} section
1801 It consists of an offset from the beginning of the
1802 \dotdebugmacro{} or \dotdebugmacrodwo{}
1803 section to the the header making up the
1804 macro information list for the compilation unit.
1805 It is relocatable in a relocatable object file, and
1806 relocated in an executable or shared object file. In the
1807 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
1808 in the \sixtyfourbitdwarfformat, it is an 8-byte unsigned value
1809 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1812 \item \livelinki{chap:classrangelistptr}{rangelistptr}{rangelistptr class} \\
1813 \livetarg{datarep:classrangelistptr}{}
1815 \addtoindexx{section offset!in class rangelistptr value}
1816 offset into the \dotdebugranges{} section
1819 offset from the beginning of the
1820 \dotdebugranges{} section
1821 to the beginning of the non\dash contiguous address ranges
1822 information for the referencing entity.
1823 It is relocatable in
1824 a relocatable object file, and relocated in an executable or
1826 However, if a \DWATrangesbase{} attribute applies, the offset
1827 is relative to the base offset given by \DWATrangesbase.
1828 In the \thirtytwobitdwarfformat, this offset
1829 is a 4-byte unsigned value; in the 64-bit DWARF
1830 format, it is an 8-byte unsigned value (see Section
1831 \refersec{datarep:32bitand64bitdwarfformats}).
1834 \textit{Because classes
1839 \CLASSrangelistptr{} and
1840 \CLASSstroffsetsptr{}
1841 share a common representation, it is not possible for an
1842 attribute to allow more than one of these classes}
1846 \item \livelinki{chap:classreference}{reference}{reference class} \\
1847 \livetarg{datarep:classreference}{}
1848 There are four types of reference.
1851 \addtoindexx{reference class}
1852 first type of reference can identify any debugging
1853 information entry within the containing unit.
1856 \addtoindexx{section offset!in class reference value}
1857 offset from the first byte of the compilation
1858 header for the compilation unit containing the reference. There
1859 are five forms for this type of reference. There are fixed
1860 length forms for one, two, four and eight byte offsets
1866 and \DWFORMrefeightTARG).
1867 There is also an unsigned variable
1868 length offset encoded form that uses
1869 unsigned LEB128\addtoindexx{LEB128!unsigned} numbers
1870 (\DWFORMrefudataTARG).
1871 Because this type of reference is within
1872 the containing compilation unit no relocation of the value
1875 The second type of reference can identify any debugging
1876 information entry within a
1877 \dotdebuginfo{} section; in particular,
1878 it may refer to an entry in a different compilation unit
1879 from the unit containing the reference, and may refer to an
1880 entry in a different shared object file. This type of reference
1881 (\DWFORMrefaddrTARG)
1882 is an offset from the beginning of the
1884 section of the target executable or shared object file, or, for
1885 references within a \addtoindex{supplementary object file},
1886 an offset from the beginning of the local \dotdebuginfo{} section;
1887 it is relocatable in a relocatable object file and frequently
1888 relocated in an executable or shared object file. For
1889 references from one shared object or static executable file
1890 to another, the relocation and identification of the target
1891 object must be performed by the consumer. In the
1892 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
1893 in the \sixtyfourbitdwarfformat, it is an 8-byte
1895 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1897 \textit{A debugging information entry that may be referenced by
1898 another compilation unit using
1899 \DWFORMrefaddr{} must have a global symbolic name.}
1901 \textit{For a reference from one executable or shared object file to
1902 another, the reference is resolved by the debugger to identify
1903 the executable or shared object file and the offset into that
1904 file\textquoteright s \dotdebuginfo{}
1905 section in the same fashion as the run
1906 time loader, either when the debug information is first read,
1907 or when the reference is used.}
1909 The third type of reference can identify any debugging
1910 information type entry that has been placed in its own
1911 \addtoindex{type unit}. This type of
1912 reference (\DWFORMrefsigeightTARG) is the
1913 \addtoindexx{type signature}
1914 64-bit type signature
1915 (see Section \refersec{datarep:typesignaturecomputation})
1916 that was computed for the type.
1918 The fourth type of reference is a reference from within the
1919 \dotdebuginfo{} section of the executable or shared object file to
1920 a debugging information entry in the \dotdebuginfo{} section of
1921 a \addtoindex{supplementary object file}.
1922 This type of reference (\DWFORMrefsupTARG) is an offset from the
1923 beginning of the \dotdebuginfo{} section in the
1924 \addtoindex{supplementary object file}.
1926 \textit{The use of compilation unit relative references will reduce the
1927 number of link\dash time relocations and so speed up linking. The
1928 use of the second, third and fourth type of reference allows for the
1929 sharing of information, such as types, across compilation
1930 units, while the fourth type further allows for sharing of information
1931 across compilation units from different executables or shared object files.}
1933 \textit{A reference to any kind of compilation unit identifies the
1934 debugging information entry for that unit, not the preceding
1938 \item \livelinki{chap:classstring}{string}{string class} \\
1939 \livetarg{datarep:classstring}{}
1940 A string is a sequence of contiguous non\dash null bytes followed by
1942 \addtoindexx{string class}
1943 A string may be represented:
1945 \setlength{\itemsep}{0em}
1946 \item immediately in the debugging information entry itself
1947 (\DWFORMstringTARG),
1950 \addtoindexx{section offset!in class string value}
1951 offset into a string table contained in
1952 the \dotdebugstr{} section of the object file (\DWFORMstrpTARG),
1953 the \dotdebuglinestr{} section of the object file (\DWFORMlinestrpTARG),
1954 or as an offset into a string table contained in the
1955 \dotdebugstr{} section of a \addtoindex{supplementary object file}
1956 (\DWFORMstrpsupTARG). \DWFORMstrpsupNAME{} offsets from the \dotdebuginfo{}
1957 section of a \addtoindex{supplementary object file}
1958 refer to the local \dotdebugstr{} section of that same file.
1959 In the \thirtytwobitdwarfformat, the representation of a
1960 \DWFORMstrpNAME{}, \DWFORMstrpNAME{} or \DWFORMstrpsupNAME{}
1961 value is a 4-byte unsigned offset; in the \sixtyfourbitdwarfformat,
1962 it is an 8-byte unsigned offset
1963 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1966 \item as an indirect offset into the string table using an
1967 index into a table of offsets contained in the
1968 \dotdebugstroffsets{} section of the object file (\DWFORMstrxTARG).
1969 The representation of a \DWFORMstrxNAME{} value is an unsigned
1970 \addtoindex{LEB128} value, which is interpreted as a zero-based
1971 index into an array of offsets in the \dotdebugstroffsets{} section.
1972 The offset entries in the \dotdebugstroffsets{} section have the
1973 same representation as \DWFORMstrp{} values.
1975 Any combination of these three forms may be used within a single compilation.
1977 If the \DWATuseUTFeight{}
1978 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8} attribute is specified for the
1979 compilation, partial, skeleton or type unit entry, string values are encoded using the
1980 UTF\dash 8 (\addtoindex{Unicode} Transformation Format\dash 8) from the Universal
1981 Character Set standard (ISO/IEC 10646\dash 1:1993).
1982 \addtoindexx{ISO 10646 character set standard}
1983 Otherwise, the string representation is unspecified.
1985 \textit{The \addtoindex{Unicode} Standard Version 3 is fully compatible with
1986 ISO/IEC 10646\dash 1:1993.
1987 \addtoindexx{ISO 10646 character set standard}
1988 It contains all the same characters
1989 and encoding points as ISO/IEC 10646, as well as additional
1990 information about the characters and their use.}
1992 \textit{Earlier versions of DWARF did not specify the representation
1993 of strings; for compatibility, this version also does
1994 not. However, the UTF\dash 8 representation is strongly recommended.}
1997 \item \livelinki{chap:classstroffsetsptr}{stroffsetsptr}{stroffsetsptr class} \\
1998 \livetarg{datarep:classstroffsetsptr}{}
1999 This is an offset into the \dotdebugstroffsets{} section
2000 (\DWFORMsecoffset). It consists of an offset from the beginning of the
2001 \dotdebugstroffsets{} section to the
2002 beginning of the string offsets information for the
2003 referencing entity. It is relocatable in
2004 a relocatable object file, and relocated in an executable or
2005 shared object file. In the \thirtytwobitdwarfformat, this offset
2006 is a 4-byte unsigned value; in the \sixtyfourbitdwarfformat,
2007 it is an 8-byte unsigned value (see Section
2008 \refersec{datarep:32bitand64bitdwarfformats}).
2010 \textit{This class is new in \DWARFVersionV.}
2014 In no case does an attribute use one of the classes
2019 \CLASSrangelistptr{} or
2020 \CLASSstroffsetsptr{}
2021 to point into either the
2022 \dotdebuginfo{} or \dotdebugstr{} section.
2024 The form encodings are listed in
2025 Table \referfol{tab:attributeformencodings}.
2029 \setlength{\extrarowheight}{0.1cm}
2030 \begin{longtable}{l|c|l}
2031 \caption{Attribute form encodings} \label{tab:attributeformencodings} \\
2032 \hline \bfseries Form name&\bfseries Value &\bfseries Classes \\ \hline
2034 \bfseries Form name&\bfseries Value &\bfseries Classes\\ \hline
2036 \hline \emph{Continued on next page}
2038 \hline \ddag\ \textit{New in DWARF Version 5}
2041 \DWFORMaddr &0x01&\livelink{chap:classaddress}{address} \\
2042 \textit{Reserved} &0x02& \\
2043 \DWFORMblocktwo &0x03&\livelink{chap:classblock}{block} \\
2044 \DWFORMblockfour &0x04&\livelink{chap:classblock}{block} \\
2045 \DWFORMdatatwo &0x05&\livelink{chap:classconstant}{constant} \\
2046 \DWFORMdatafour &0x06&\livelink{chap:classconstant}{constant} \\
2047 \DWFORMdataeight &0x07&\livelink{chap:classconstant}{constant} \\
2048 \DWFORMstring&0x08&\livelink{chap:classstring}{string} \\
2049 \DWFORMblock&0x09&\livelink{chap:classblock}{block} \\
2050 \DWFORMblockone &0x0a&\livelink{chap:classblock}{block} \\
2051 \DWFORMdataone &0x0b&\livelink{chap:classconstant}{constant} \\
2052 \DWFORMflag&0x0c&\livelink{chap:classflag}{flag} \\
2053 \DWFORMsdata&0x0d&\livelink{chap:classconstant}{constant} \\
2054 \DWFORMstrp&0x0e&\livelink{chap:classstring}{string} \\
2055 \DWFORMudata&0x0f&\livelink{chap:classconstant}{constant} \\
2056 \DWFORMrefaddr&0x10&\livelink{chap:classreference}{reference} \\
2057 \DWFORMrefone&0x11&\livelink{chap:classreference}{reference} \\
2058 \DWFORMreftwo&0x12&\livelink{chap:classreference}{reference} \\
2059 \DWFORMreffour&0x13&\livelink{chap:classreference}{reference} \\
2060 \DWFORMrefeight&0x14&\livelink{chap:classreference}{reference} \\
2061 \DWFORMrefudata&0x15&\livelink{chap:classreference}{reference} \\
2062 \DWFORMindirect&0x16&(see Section \refersec{datarep:abbreviationstables}) \\
2063 \DWFORMsecoffset{} &0x17& \CLASSaddrptr, \CLASSlineptr, \CLASSloclistptr, \\
2064 & & \CLASSmacptr, \CLASSrangelistptr, \CLASSstroffsetsptr \\
2065 \DWFORMexprloc{} &0x18&\livelink{chap:classexprloc}{exprloc} \\
2066 \DWFORMflagpresent{} &0x19&\livelink{chap:classflag}{flag} \\
2067 \DWFORMstrx{} \ddag &0x1a&\livelink{chap:classstring}{string} \\
2068 \DWFORMaddrx{} \ddag &0x1b&\livelink{chap:classaddress}{address} \\
2069 \DWFORMrefsup{}~\ddag &0x1c &\livelink{chap:classreference}{reference} \\
2070 \DWFORMstrpsup{}~\ddag &0x1d &\livelink{chap:classstring}{string} \\
2071 \DWFORMdatasixteen~\ddag &0x1e &\CLASSconstant \\
2072 \DWFORMlinestrp~\ddag &0x1f &\CLASSstring \\
2073 \DWFORMrefsigeight &0x20 &\livelink{chap:classreference}{reference} \\
2074 \DWFORMimplicitconst~\ddag &0x21 &\CLASSconstant \\
2080 \section{Variable Length Data}
2081 \label{datarep:variablelengthdata}
2082 \addtoindexx{variable length data|see {LEB128}}
2084 \addtoindexx{Little Endian Base 128|see{LEB128}}
2085 encoded using \doublequote{Little Endian Base 128}
2086 \addtoindexx{little-endian encoding|see{endian attribute}}
2088 \addtoindexx{LEB128}
2089 LEB128 is a scheme for encoding integers
2090 densely that exploits the assumption that most integers are
2093 \textit{This encoding is equally suitable whether the target machine
2094 architecture represents data in big-endian or little-endian
2095 \byteorder. It is \doublequote{little-endian} only in the sense that it
2096 avoids using space to represent the \doublequote{big} end of an
2097 unsigned integer, when the big end is all zeroes or sign
2100 Unsigned LEB128\addtoindexx{LEB128!unsigned} (\addtoindex{ULEB128})
2101 numbers are encoded as follows:
2102 \addtoindexx{LEB128!unsigned, encoding as}
2103 start at the low order end of an unsigned integer and chop
2104 it into 7-bit chunks. Place each chunk into the low order 7
2105 bits of a byte. Typically, several of the high order bytes
2106 will be zero; discard them. Emit the remaining bytes in a
2107 stream, starting with the low order byte; set the high order
2108 bit on each byte except the last emitted byte. The high bit
2109 of zero on the last byte indicates to the decoder that it
2110 has encountered the last byte.
2112 The integer zero is a special case, consisting of a single
2115 Table \refersec{tab:examplesofunsignedleb128encodings}
2116 gives some examples of unsigned LEB128\addtoindexx{LEB128!unsigned}
2118 0x80 in each case is the high order bit of the byte, indicating
2119 that an additional byte follows.
2122 The encoding for signed, two\textquoteright{s} complement LEB128
2123 (\addtoindex{SLEB128}) \addtoindexx{LEB128!signed, encoding as}
2124 numbers is similar, except that the criterion for discarding
2125 high order bytes is not whether they are zero, but whether
2126 they consist entirely of sign extension bits. Consider the
2127 4-byte integer -2. The three high level bytes of the number
2128 are sign extension, thus LEB128 would represent it as a single
2129 byte containing the low order 7 bits, with the high order
2130 bit cleared to indicate the end of the byte stream. Note
2131 that there is nothing within the LEB128 representation that
2132 indicates whether an encoded number is signed or unsigned. The
2133 decoder must know what type of number to expect.
2134 Table \refersec{tab:examplesofunsignedleb128encodings}
2135 gives some examples of unsigned LEB128\addtoindexx{LEB128!unsigned}
2136 numbers and Table \refersec{tab:examplesofsignedleb128encodings}
2137 gives some examples of signed LEB128\addtoindexx{LEB128!signed}
2140 \textit{Appendix \refersec{app:variablelengthdataencodingdecodinginformative}
2141 \addtoindexx{LEB128!examples}
2142 gives algorithms for encoding and decoding these forms.}
2146 \setlength{\extrarowheight}{0.1cm}
2147 \begin{longtable}{c|c|c}
2148 \caption{Examples of unsigned LEB128 encodings}
2149 \label{tab:examplesofunsignedleb128encodings}
2150 \addtoindexx{LEB128 encoding!examples}\addtoindexx{LEB128!unsigned} \\
2151 \hline \bfseries Number&\bfseries First byte &\bfseries Second byte \\ \hline
2153 \bfseries Number&\bfseries First Byte &\bfseries Second byte\\ \hline
2155 \hline \emph{Continued on next page}
2161 128& 0 + 0x80 & 1 \\
2162 129& 1 + 0x80 & 1 \\
2163 %130& 2 + 0x80 & 1 \\
2164 12857& 57 + 0x80 & 100 \\
2171 \setlength{\extrarowheight}{0.1cm}
2172 \begin{longtable}{c|c|c}
2173 \caption{Examples of signed LEB128 encodings}
2174 \label{tab:examplesofsignedleb128encodings}
2175 \addtoindexx{LEB128!signed} \\
2176 \hline \bfseries Number&\bfseries First byte &\bfseries Second byte \\ \hline
2178 \bfseries Number&\bfseries First Byte &\bfseries Second byte\\ \hline
2180 \hline \emph{Continued on next page}
2186 127& 127 + 0x80 & 0 \\
2187 -127& 1 + 0x80 & 0x7f \\
2188 128& 0 + 0x80 & 1 \\
2189 -128& 0 + 0x80 & 0x7f \\
2190 129& 1 + 0x80 & 1 \\
2191 -129& 0x7f + 0x80 & 0x7e \\
2198 \section{DWARF Expressions and Location Descriptions}
2199 \label{datarep:dwarfexpressionsandlocationdescriptions}
2200 \subsection{DWARF Expressions}
2201 \label{datarep:dwarfexpressions}
2204 \addtoindexx{DWARF expression!operator encoding}
2205 DWARF expression is stored in a \nolink{block} of contiguous
2206 bytes. The bytes form a sequence of operations. Each operation
2207 is a 1-byte code that identifies that operation, followed by
2208 zero or more bytes of additional data. The encodings for the
2209 operations are described in
2210 Table \refersec{tab:dwarfoperationencodings}.
2213 \setlength{\extrarowheight}{0.1cm}
2214 \begin{longtable}{l|c|c|l}
2215 \caption{DWARF operation encodings} \label{tab:dwarfoperationencodings} \\
2216 \hline & &\bfseries No. of &\\
2217 \bfseries Operation&\bfseries Code &\bfseries Operands &\bfseries Notes\\ \hline
2219 & &\bfseries No. of &\\
2220 \bfseries Operation&\bfseries Code &\bfseries Operands &\bfseries Notes\\ \hline
2222 \hline \emph{Continued on next page}
2224 \hline \ddag\ \textit{New in DWARF Version 5}
2227 \DWOPaddr&0x03&1 & constant address \\
2228 & & &(size is target specific) \\
2230 \DWOPderef&0x06&0 & \\
2232 \DWOPconstoneu&0x08&1&1-byte constant \\
2233 \DWOPconstones&0x09&1&1-byte constant \\
2234 \DWOPconsttwou&0x0a&1&2-byte constant \\
2235 \DWOPconsttwos&0x0b&1&2-byte constant \\
2236 \DWOPconstfouru&0x0c&1&4-byte constant \\
2237 \DWOPconstfours&0x0d&1&4-byte constant \\
2238 \DWOPconsteightu&0x0e&1&8-byte constant \\
2239 \DWOPconsteights&0x0f&1&8-byte constant \\
2240 \DWOPconstu&0x10&1&ULEB128 constant \\
2241 \DWOPconsts&0x11&1&SLEB128 constant \\
2242 \DWOPdup&0x12&0 & \\
2243 \DWOPdrop&0x13&0 & \\
2244 \DWOPover&0x14&0 & \\
2245 \DWOPpick&0x15&1&1-byte stack index \\
2246 \DWOPswap&0x16&0 & \\
2247 \DWOProt&0x17&0 & \\
2248 \DWOPxderef&0x18&0 & \\
2249 \DWOPabs&0x19&0 & \\
2250 \DWOPand&0x1a&0 & \\
2251 \DWOPdiv&0x1b&0 & \\
2252 \DWOPminus&0x1c&0 & \\
2253 \DWOPmod&0x1d&0 & \\
2254 \DWOPmul&0x1e&0 & \\
2255 \DWOPneg&0x1f&0 & \\
2256 \DWOPnot&0x20&0 & \\
2258 \DWOPplus&0x22&0 & \\
2259 \DWOPplusuconst&0x23&1&ULEB128 addend \\
2260 \DWOPshl&0x24&0 & \\
2261 \DWOPshr&0x25&0 & \\
2262 \DWOPshra&0x26&0 & \\
2263 \DWOPxor&0x27&0 & \\
2265 \DWOPbra&0x28&1 & signed 2-byte constant \\
2272 \DWOPskip&0x2f&1&signed 2-byte constant \\ \hline
2274 \DWOPlitzero & 0x30 & 0 & \\
2275 \DWOPlitone & 0x31 & 0& literals 0 .. 31 = \\
2276 \ldots & & &\hspace{0.3cm}(\DWOPlitzero{} + literal) \\
2277 \DWOPlitthirtyone & 0x4f & 0 & \\ \hline
2279 \DWOPregzero & 0x50 & 0 & \\*
2280 \DWOPregone & 0x51 & 0® 0 .. 31 = \\*
2281 \ldots & & &\hspace{0.3cm}(\DWOPregzero{} + regnum) \\*
2282 \DWOPregthirtyone & 0x6f & 0 & \\ \hline
2284 \DWOPbregzero & 0x70 &1 & SLEB128 offset \\*
2285 \DWOPbregone & 0x71 & 1 &base register 0 .. 31 = \\*
2286 ... & & &\hspace{0.3cm}(\DWOPbregzero{} + regnum) \\*
2287 \DWOPbregthirtyone & 0x8f & 1 & \\ \hline
2289 \DWOPregx{} & 0x90 &1&ULEB128 register \\
2290 \DWOPfbreg{} & 0x91&1&SLEB128 offset \\
2291 \DWOPbregx{} & 0x92&2 &ULEB128 register, \\*
2292 & & &SLEB128 offset \\
2293 \DWOPpiece{} & 0x93 &1& ULEB128 size of piece \\
2294 \DWOPderefsize{} & 0x94 &1& 1-byte size of data retrieved \\
2295 \DWOPxderefsize{} & 0x95&1&1-byte size of data retrieved \\
2296 \DWOPnop{} & 0x96 &0& \\
2298 \DWOPpushobjectaddress&0x97&0 & \\
2299 \DWOPcalltwo&0x98&1& 2-byte offset of DIE \\
2300 \DWOPcallfour&0x99&1& 4-byte offset of DIE \\
2301 \DWOPcallref&0x9a&1& 4\dash\ or 8-byte offset of DIE \\
2302 \DWOPformtlsaddress&0x9b &0& \\
2303 \DWOPcallframecfa{} &0x9c &0& \\
2304 \DWOPbitpiece&0x9d &2&ULEB128 size, \\*
2306 \DWOPimplicitvalue{} &0x9e &2&ULEB128 size, \\*
2307 &&&\nolink{block} of that size\\
2308 \DWOPstackvalue{} &0x9f &0& \\
2309 \DWOPimplicitpointer{}~\ddag &0xa0& 2 &4- or 8-byte offset of DIE, \\*
2310 &&&SLEB128 constant offset \\
2311 \DWOPaddrx~\ddag&0xa1&1&ULEB128 indirect address \\
2312 \DWOPconstx~\ddag&0xa2&1&ULEB128 indirect constant \\
2313 \DWOPentryvalue~\ddag&0xa3&2&ULEB128 size, \\*
2314 &&&\nolink{block} of that size\\
2315 \DWOPconsttype~\ddag & 0xa4 & 3 & ULEB128 type entry offset,\\*
2316 & & & 1-byte size, \\*
2317 & & & constant value \\
2318 \DWOPregvaltype~\ddag & 0xa5 & 2 & ULEB128 register number, \\*
2319 &&& ULEB128 constant offset \\
2320 \DWOPdereftype~\ddag & 0xa6 & 2 & 1-byte size, \\*
2321 &&& ULEB128 type entry offset \\
2322 \DWOPxdereftype~\ddag & 0xa7 & 2 & 1-byte size, \\*
2323 &&& ULEB128 type entry offset \\
2324 \DWOPconvert~\ddag & 0xa8 & 1 & ULEB128 type entry offset \\
2325 \DWOPreinterpret~\ddag & 0xa9 & 1 & ULEB128 type entry offset \\
2326 \DWOPlouser{} &0xe0 && \\
2327 \DWOPhiuser{} &\xff && \\
2333 \subsection{Location Descriptions}
2334 \label{datarep:locationdescriptions}
2336 A location description is used to compute the
2337 location of a variable or other entity.
2339 \subsection{Location Lists}
2340 \label{datarep:locationlists}
2342 Each entry in a \addtoindex{location list} is either a location list entry,
2343 a base address selection entry, or an
2344 \addtoindexx{end-of-list entry!in location list}
2348 \subsubsection{Location List Entries in Non-Split Objects}
2349 A \addtoindex{location list} entry consists of two address offsets followed
2350 by an unsigned 2-byte length, followed by a block of contiguous bytes
2351 that contains a DWARF location description. The length
2352 specifies the number of bytes in that block. The two offsets
2353 are the same size as an address on the target machine.
2356 A base address selection entry and an
2357 \addtoindexx{end-of-list entry!in location list}
2358 end-of-list entry each
2359 consist of two (constant or relocated) address offsets. The two
2360 offsets are the same size as an address on the target machine.
2362 For a \addtoindex{location list} to be specified, the base address of
2363 \addtoindexx{base address selection entry!in location list}
2364 the corresponding compilation unit must be defined
2365 (see Section \refersec{chap:normalandpartialcompilationunitentries}).
2367 \subsubsection{Location List Entries in Split Objects}
2368 \label{datarep:locationlistentriesinsplitobjects}
2369 An alternate form for location list entries is used in split objects.
2370 Each entry begins with an unsigned 1-byte code that indicates the kind of entry
2371 that follows. The encodings for these constants are given in
2372 Table \refersec{tab:locationlistentryencodingvalues}.
2376 \setlength{\extrarowheight}{0.1cm}
2377 \begin{longtable}{l|c}
2378 \caption{Location list entry encoding values} \label{tab:locationlistentryencodingvalues} \\
2379 \hline \bfseries Location list entry encoding name&\bfseries Value \\ \hline
2381 \bfseries Location list entry encoding name&\bfseries Value\\ \hline
2383 \hline \emph{Continued on next page}
2387 \DWLLEendoflistentry & 0x0 \\
2388 \DWLLEbaseaddressselectionentry & 0x01 \\
2389 \DWLLEstartendentry & 0x02 \\
2390 \DWLLEstartlengthentry & 0x03 \\
2391 \DWLLEoffsetpairentry & 0x04 \\
2395 \section{Base Type Attribute Encodings}
2396 \label{datarep:basetypeattributeencodings}
2398 The encodings of the
2399 \hypertarget{chap:DWATencodingencodingofbasetype}{}
2400 constants used in the
2401 \DWATencodingDEFN{} attribute\addtoindexx{encoding attribute}
2403 Table \refersec{tab:basetypeencodingvalues}
2406 \setlength{\extrarowheight}{0.1cm}
2407 \begin{longtable}{l|c}
2408 \caption{Base type encoding values} \label{tab:basetypeencodingvalues} \\
2409 \hline \bfseries Base type encoding name&\bfseries Value \\ \hline
2411 \bfseries Base type encoding name&\bfseries Value\\ \hline
2413 \hline \emph{Continued on next page}
2416 \ddag \ \textit{New in \DWARFVersionV}
2418 \DWATEaddress&0x01 \\
2419 \DWATEboolean&0x02 \\
2420 \DWATEcomplexfloat&0x03 \\
2422 \DWATEsigned&0x05 \\
2423 \DWATEsignedchar&0x06 \\
2424 \DWATEunsigned&0x07 \\
2425 \DWATEunsignedchar&0x08 \\
2426 \DWATEimaginaryfloat&0x09 \\
2427 \DWATEpackeddecimal&0x0a \\
2428 \DWATEnumericstring&0x0b \\
2429 \DWATEedited&0x0c \\
2430 \DWATEsignedfixed&0x0d \\
2431 \DWATEunsignedfixed&0x0e \\
2432 \DWATEdecimalfloat & 0x0f \\
2433 \DWATEUTF{} & 0x10 \\
2434 \DWATEUCS~\ddag & 0x11 \\
2435 \DWATEASCII~\ddag & 0x12 \\
2436 \DWATElouser{} & 0x80 \\
2437 \DWATEhiuser{} & \xff \\
2442 The encodings of the constants used in the
2443 \DWATdecimalsign{} attribute
2445 Table \refersec{tab:decimalsignencodings}.
2448 \setlength{\extrarowheight}{0.1cm}
2449 \begin{longtable}{l|c}
2450 \caption{Decimal sign encodings} \label{tab:decimalsignencodings} \\
2451 \hline \bfseries Decimal sign code name&\bfseries Value \\ \hline
2453 \bfseries Decimal sign code name&\bfseries Value\\ \hline
2455 \hline \emph{Continued on next page}
2460 \DWDSunsigned{} & 0x01 \\
2461 \DWDSleadingoverpunch{} & 0x02 \\
2462 \DWDStrailingoverpunch{} & 0x03 \\
2463 \DWDSleadingseparate{} & 0x04 \\
2464 \DWDStrailingseparate{} & 0x05 \\
2470 The encodings of the constants used in the
2471 \DWATendianity{} attribute are given in
2472 Table \refersec{tab:endianityencodings}.
2475 \setlength{\extrarowheight}{0.1cm}
2476 \begin{longtable}{l|c}
2477 \caption{Endianity encodings} \label{tab:endianityencodings}\\
2478 \hline \bfseries Endian code name&\bfseries Value \\ \hline
2480 \bfseries Endian code name&\bfseries Value\\ \hline
2482 \hline \emph{Continued on next page}
2487 \DWENDdefault{} & 0x00 \\
2488 \DWENDbig{} & 0x01 \\
2489 \DWENDlittle{} & 0x02 \\
2490 \DWENDlouser{} & 0x40 \\
2491 \DWENDhiuser{} & \xff \\
2497 \section{Accessibility Codes}
2498 \label{datarep:accessibilitycodes}
2499 The encodings of the constants used in the
2500 \DWATaccessibility{}
2502 \addtoindexx{accessibility attribute}
2504 Table \refersec{tab:accessibilityencodings}.
2507 \setlength{\extrarowheight}{0.1cm}
2508 \begin{longtable}{l|c}
2509 \caption{Accessibility encodings} \label{tab:accessibilityencodings}\\
2510 \hline \bfseries Accessibility code name&\bfseries Value \\ \hline
2512 \bfseries Accessibility code name&\bfseries Value\\ \hline
2514 \hline \emph{Continued on next page}
2519 \DWACCESSpublic&0x01 \\
2520 \DWACCESSprotected&0x02 \\
2521 \DWACCESSprivate&0x03 \\
2527 \section{Visibility Codes}
2528 \label{datarep:visibilitycodes}
2529 The encodings of the constants used in the
2530 \DWATvisibility{} attribute are given in
2531 Table \refersec{tab:visibilityencodings}.
2534 \setlength{\extrarowheight}{0.1cm}
2535 \begin{longtable}{l|c}
2536 \caption{Visibility encodings} \label{tab:visibilityencodings}\\
2537 \hline \bfseries Visibility code name&\bfseries Value \\ \hline
2539 \bfseries Visibility code name&\bfseries Value\\ \hline
2541 \hline \emph{Continued on next page}
2547 \DWVISexported&0x02 \\
2548 \DWVISqualified&0x03 \\
2553 \section{Virtuality Codes}
2554 \label{datarep:vitualitycodes}
2556 The encodings of the constants used in the
2557 \DWATvirtuality{} attribute are given in
2558 Table \refersec{tab:virtualityencodings}.
2561 \setlength{\extrarowheight}{0.1cm}
2562 \begin{longtable}{l|c}
2563 \caption{Virtuality encodings} \label{tab:virtualityencodings}\\
2564 \hline \bfseries Virtuality code name&\bfseries Value \\ \hline
2566 \bfseries Virtuality code name&\bfseries Value\\ \hline
2568 \hline \emph{Continued on next page}
2573 \DWVIRTUALITYnone&0x00 \\
2574 \DWVIRTUALITYvirtual&0x01 \\
2575 \DWVIRTUALITYpurevirtual&0x02 \\
2582 \DWVIRTUALITYnone{} is equivalent to the absence of the
2586 \section{Source Languages}
2587 \label{datarep:sourcelanguages}
2589 The encodings of the constants used
2590 \addtoindexx{language attribute, encoding}
2592 \addtoindexx{language name encoding}
2595 attribute are given in
2596 Table \refersec{tab:languageencodings}.
2598 % If we don't force a following space it looks odd
2600 and their associated values are reserved, but the
2601 languages they represent are not well supported.
2602 Table \refersec{tab:languageencodings}
2604 \addtoindexx{lower bound attribute!default}
2605 default lower bound, if any, assumed for
2606 an omitted \DWATlowerbound{} attribute in the context of a
2607 \DWTAGsubrangetype{} debugging information entry for each
2611 \setlength{\extrarowheight}{0.1cm}
2612 \begin{longtable}{l|c|c}
2613 \caption{Language encodings} \label{tab:languageencodings}\\
2614 \hline \bfseries Language name&\bfseries Value &\bfseries Default Lower Bound \\ \hline
2616 \bfseries Language name&\bfseries Value &\bfseries Default Lower Bound\\ \hline
2618 \hline \emph{Continued on next page}
2621 \dag \ \textit{See text} \\ \ddag \ \textit{New in \DWARFVersionV}
2623 \addtoindexx{ISO-defined language names}
2625 \DWLANGCeightynine &0x0001 &0 \addtoindexx{C:1989 (ISO)} \\
2626 \DWLANGC{} &0x0002 &0 \addtoindexx{C!non-standard} \\
2627 \DWLANGAdaeightythree{} \dag &0x0003 &1 \addtoindexx{Ada:1983 (ISO)} \\
2628 \DWLANGCplusplus{} &0x0004 &0 \addtoindexx{C++:1998 (ISO)} \\
2629 \DWLANGCobolseventyfour{} \dag &0x0005 &1 \addtoindexx{COBOL:1974 (ISO)} \\
2630 \DWLANGCoboleightyfive{} \dag &0x0006 &1 \addtoindexx{COBOL:1985 (ISO)} \\
2631 \DWLANGFortranseventyseven &0x0007 &1 \addtoindexx{FORTRAN:1977 (ISO)} \\
2632 \DWLANGFortranninety &0x0008 &1 \addtoindexx{Fortran:1990 (ISO)} \\
2633 \DWLANGPascaleightythree &0x0009 &1 \addtoindexx{Pascal:1983 (ISO)} \\
2634 \DWLANGModulatwo &0x000a &1 \addtoindexx{Modula-2:1996 (ISO)} \\
2635 \DWLANGJava &0x000b &0 \addtoindexx{Java} \\
2636 \DWLANGCninetynine &0x000c &0 \addtoindexx{C:1999 (ISO)} \\
2637 \DWLANGAdaninetyfive{} \dag &0x000d &1 \addtoindexx{Ada:1995 (ISO)} \\
2638 \DWLANGFortranninetyfive &0x000e &1 \addtoindexx{Fortran:1995 (ISO)} \\
2639 \DWLANGPLI{} \dag &0x000f &1 \addtoindexx{PL/I:1976 (ANSI)}\\
2640 \DWLANGObjC{} &0x0010 &0 \addtoindexx{Objective C}\\
2641 \DWLANGObjCplusplus{} &0x0011 &0 \addtoindexx{Objective C++}\\
2642 \DWLANGUPC{} &0x0012 &0 \addtoindexx{UPC}\\
2643 \DWLANGD{} &0x0013 &0 \addtoindexx{D language}\\
2644 \DWLANGPython{} \dag &0x0014 &0 \addtoindexx{Python}\\
2645 \DWLANGOpenCL{} \dag \ddag &0x0015 &0 \addtoindexx{OpenCL}\\
2646 \DWLANGGo{} \dag \ddag &0x0016 &0 \addtoindexx{Go}\\
2647 \DWLANGModulathree{} \dag \ddag &0x0017 &1 \addtoindexx{Modula-3}\\
2648 \DWLANGHaskell{} \dag \ddag &0x0018 &0 \addtoindexx{Haskell}\\
2649 \DWLANGCpluspluszerothree{} \ddag &0x0019 &0 \addtoindexx{C++:2003 (ISO)}\\
2650 \DWLANGCpluspluseleven{} \ddag &0x001a &0 \addtoindexx{C++:2011 (ISO)}\\
2651 \DWLANGOCaml{} \ddag &0x001b &0 \addtoindexx{OCaml}\\
2652 \DWLANGRust{} \ddag &0x001c &0 \addtoindexx{Rust}\\
2653 \DWLANGCeleven{} \ddag &0x001d &0 \addtoindexx{C:2011 (ISO)}\\
2654 \DWLANGSwift{} \ddag &0x001e &0 \addtoindexx{Swift} \\
2655 \DWLANGJulia{} \ddag &0x001f &1 \addtoindexx{Julia} \\
2656 \DWLANGDylan{} \ddag &0x0020 &0 \addtoindexx{Dylan} \\
2657 \DWLANGCplusplusfourteen{}~\ddag &0x0021 &0 \addtoindexx{C++:2014 (ISO)} \\
2658 \DWLANGFortranzerothree{}~\ddag &0x0022 &1 \addtoindexx{Fortran:2004 (ISO)} \\
2659 \DWLANGFortranzeroeight{}~\ddag &0x0023 &1 \addtoindexx{Fortran:2010 (ISO)} \\
2660 \DWLANGlouser{} &0x8000 & \\
2661 \DWLANGhiuser{} &\xffff & \\
2666 \section{Address Class Encodings}
2667 \label{datarep:addressclassencodings}
2669 The value of the common
2670 \addtoindex{address class} encoding
2674 \section{Identifier Case}
2675 \label{datarep:identifiercase}
2677 The encodings of the constants used in the
2678 \DWATidentifiercase{} attribute are given in
2679 Table \refersec{tab:identifiercaseencodings}.
2683 \setlength{\extrarowheight}{0.1cm}
2684 \begin{longtable}{l|c}
2685 \caption{Identifier case encodings} \label{tab:identifiercaseencodings}\\
2686 \hline \bfseries Identifier case name&\bfseries Value \\ \hline
2688 \bfseries Identifier case name&\bfseries Value\\ \hline
2690 \hline \emph{Continued on next page}
2694 \DWIDcasesensitive&0x00 \\
2696 \DWIDdowncase&0x02 \\
2697 \DWIDcaseinsensitive&0x03 \\
2701 \section{Calling Convention Encodings}
2702 \label{datarep:callingconventionencodings}
2703 The encodings of the constants used in the
2704 \DWATcallingconvention{} attribute are given in
2705 Table \refersec{tab:callingconventionencodings}.
2708 \setlength{\extrarowheight}{0.1cm}
2709 \begin{longtable}{l|c}
2710 \caption{Calling convention encodings} \label{tab:callingconventionencodings}\\
2711 \hline \bfseries Calling convention name&\bfseries Value \\ \hline
2713 \bfseries Calling convention name&\bfseries Value\\ \hline
2715 \hline \emph{Continued on next page}
2717 \hline \ddag\ \textit{New in DWARF Version 5}
2720 \DWCCnormal &0x01 \\
2721 \DWCCprogram&0x02 \\
2722 \DWCCnocall &0x03 \\
2723 \DWCCpassbyreference~\ddag &0x04 \\
2724 \DWCCpassbyvalue~\ddag &0x05 \\
2725 \DWCClouser &0x40 \\
2732 \section{Inline Codes}
2733 \label{datarep:inlinecodes}
2735 The encodings of the constants used in
2736 \addtoindexx{inline attribute}
2738 \DWATinline{} attribute are given in
2739 Table \refersec{tab:inlineencodings}.
2743 \setlength{\extrarowheight}{0.1cm}
2744 \begin{longtable}{l|c}
2745 \caption{Inline encodings} \label{tab:inlineencodings}\\
2746 \hline \bfseries Inline code name&\bfseries Value \\ \hline
2748 \bfseries Inline Code name&\bfseries Value\\ \hline
2750 \hline \emph{Continued on next page}
2755 \DWINLnotinlined&0x00 \\
2756 \DWINLinlined&0x01 \\
2757 \DWINLdeclarednotinlined&0x02 \\
2758 \DWINLdeclaredinlined&0x03 \\
2763 % this clearpage is ugly, but the following table came
2764 % out oddly without it.
2766 \section{Array Ordering}
2767 \label{datarep:arrayordering}
2769 The encodings of the constants used in the
2770 \DWATordering{} attribute are given in
2771 Table \refersec{tab:orderingencodings}.
2775 \setlength{\extrarowheight}{0.1cm}
2776 \begin{longtable}{l|c}
2777 \caption{Ordering encodings} \label{tab:orderingencodings}\\
2778 \hline \bfseries Ordering name&\bfseries Value \\ \hline
2780 \bfseries Ordering name&\bfseries Value\\ \hline
2782 \hline \emph{Continued on next page}
2787 \DWORDrowmajor&0x00 \\
2788 \DWORDcolmajor&0x01 \\
2794 \section{Discriminant Lists}
2795 \label{datarep:discriminantlists}
2797 The descriptors used in
2798 \addtoindexx{discriminant list attribute}
2800 \DWATdiscrlist{} attribute are
2801 encoded as 1-byte constants. The
2802 defined values are given in
2803 Table \refersec{tab:discriminantdescriptorencodings}.
2805 % Odd that the 'Name' field capitalized here, it is not caps elsewhere.
2807 \setlength{\extrarowheight}{0.1cm}
2808 \begin{longtable}{l|c}
2809 \caption{Discriminant descriptor encodings} \label{tab:discriminantdescriptorencodings}\\
2810 \hline \bfseries Descriptor name&\bfseries Value \\ \hline
2812 \bfseries Descriptor name&\bfseries Value\\ \hline
2814 \hline \emph{Continued on next page}
2826 \section{Name Index Table}
2827 \label{datarep:nameindextable}
2828 Each name index table in the \dotdebugnames{} section
2829 begins with a header consisting of:
2830 \begin{enumerate}[1. ]
2831 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
2832 \addttindexx{unit\_length}
2833 A 4-byte or 12-byte initial length field that
2834 contains the size in bytes of this contribution to the \dotdebugnames{}
2835 section, not including the length field itself
2836 (see Section \refersec{datarep:initiallengthvalues}).
2838 \item \texttt{version} (\HFTuhalf) \\
2839 A 2-byte version number\addtoindexx{version number!name index table}
2840 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
2841 This number is specific to the name index table and is
2842 independent of the DWARF version number.
2844 The value in this field is \versiondotdebugnames.
2846 \item padding (\HFTuhalf) \\
2848 \item \texttt{comp\_unit\_count} (\HFTuword) \\
2849 The number of CUs in the CU list.
2851 \item \texttt{local\_type\_unit\_count} (\HFTuword) \\
2852 The number of TUs in the first TU list.
2854 \item \texttt{foreign\_type\_unit\_count} (\HFTuword) \\
2855 The number of TUs in the second TU list.
2857 \item \texttt{bucket\_count} (\HFTuword) \\
2858 The number of hash buckets in the hash lookup table.
2859 If there is no hash lookup table, this field contains 0.
2861 \item \texttt{name\_count} (\HFTuword) \\
2862 The number of unique names in the index.
2864 \item \texttt{abbrev\_table\_size} (\HFTuword) \\
2865 The size in bytes of the abbreviations table.
2867 \item \texttt{augmentation\_string\_size} (\HFTuword) \\
2868 The size in bytes of the augmentation string. This value is
2869 rounded up to a multiple of 4.
2871 \item \texttt{augmentation\_string} (\HFTaugstring) \\
2872 A vendor-specific augmentation string, which provides additional
2873 information about the contents of this index. If provided, the string
2874 begins with a 4-character vendor ID. The remainder of the
2875 string is meant to be read by a cooperating consumer, and its
2876 contents and interpretation are not specified here. The
2877 string is padded with null characters to a multiple of
2878 four bytes in length.
2882 The name index attributes and their encodings are listed in Table \referfol{datarep:indexattributeencodings}.
2885 \setlength{\extrarowheight}{0.1cm}
2886 \begin{longtable}{l|c|l}
2887 \caption{Name index attribute encodings} \label{datarep:indexattributeencodings}\\
2888 \hline \bfseries Attribute name &\bfseries Value &\bfseries Form/Class \\ \hline
2890 \bfseries Attribute name &\bfseries Value &\bfseries Form/Class \\ \hline
2892 \hline \emph{Continued on next page}
2895 \ddag~\textit{New in \DWARFVersionV}
2897 \DWIDXcompileunit~\ddag & 1 & \CLASSconstant \\
2898 \DWIDXtypeunit~\ddag & 2 & \CLASSconstant \\
2899 \DWIDXdieoffset~\ddag & 3 & \CLASSreference \\
2900 \DWIDXparent~\ddag & 4 & \CLASSconstant \\
2901 \DWIDXtypehash~\ddag & 5 & \DWFORMdataeight \\
2902 \DWIDXlouser~\ddag & 0x2000 & \\
2903 \DWIDXhiuser~\ddag & \xiiifff & \\
2907 The abbreviations table ends with an entry consisting of a single 0
2908 byte for the abbreviation code. The size of the table given by
2909 \texttt{abbrev\_table\_size} may include optional padding following the
2912 \section{Defaulted Member Encodings}
2913 \hypertarget{datarep:defaultedmemberencodings}{}
2915 The encodings of the constants used in the \DWATdefaulted{} attribute
2916 are given in Table \referfol{datarep:defaultedattributeencodings}.
2919 \setlength{\extrarowheight}{0.1cm}
2920 \begin{longtable}{l|c}
2921 \caption{Defaulted attribute encodings} \label{datarep:defaultedattributeencodings} \\
2922 \hline \bfseries Defaulted name &\bfseries Value \\ \hline
2924 \bfseries Defaulted name &\bfseries Value \\ \hline
2926 \hline \emph{Continued on next page}
2929 \ddag~\textit{New in \DWARFVersionV}
2931 \DWDEFAULTEDno~\ddag & 0x00 \\
2932 \DWDEFAULTEDinclass~\ddag & 0x01 \\
2933 \DWDEFAULTEDoutofclass~\ddag & 0x02 \\
2938 \section{Address Range Table}
2939 \label{datarep:addrssrangetable}
2941 Each set of entries in the table of address ranges contained
2942 in the \dotdebugaranges{}
2943 section begins with a header containing:
2944 \begin{enumerate}[1. ]
2945 % FIXME The unit length text is not fully consistent across
2948 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
2949 \addttindexx{unit\_length}
2950 A 4-byte or 12-byte length containing the length of the
2951 \addtoindexx{initial length}
2952 set of entries for this compilation unit, not including the
2953 length field itself. In the \thirtytwobitdwarfformat, this is a
2954 4-byte unsigned integer (which must be less than \xfffffffzero);
2955 in the \sixtyfourbitdwarfformat, this consists of the 4-byte value
2956 \wffffffff followed by an 8-byte unsigned integer that gives
2958 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
2960 \item version (\HFTuhalf) \\
2961 A 2-byte version identifier representing the version of the
2962 DWARF information for the address range table
2963 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
2965 This value in this field \addtoindexx{version number!address range table} is 2.
2967 \item debug\_info\_offset (\livelink{datarep:sectionoffsetlength}{section offset}) \\
2969 \addtoindexx{section offset!in .debug\_aranges header}
2970 4-byte or 8-byte offset into the
2971 \dotdebuginfo{} section of
2972 the compilation unit header. In the \thirtytwobitdwarfformat,
2973 this is a 4-byte unsigned offset; in the \sixtyfourbitdwarfformat,
2974 this is an 8-byte unsigned offset
2975 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
2977 \item \texttt{address\_size} (\HFTubyte) \\
2978 A 1-byte unsigned integer containing the size in bytes of an
2979 \addttindexx{address\_size}
2981 \addtoindexx{size of an address}
2982 (or the offset portion of an address for segmented
2983 \addtoindexx{address space!segmented}
2984 addressing) on the target system.
2986 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
2987 A 1-byte unsigned integer containing the size in bytes of a
2988 segment selector on the target system.
2992 This header is followed by a series of tuples. Each tuple
2993 consists of a segment, an address and a length.
2994 The segment selector
2995 size is given by the \HFNsegmentselectorsize{} field of the header; the
2996 address and length size are each given by the \addttindex{address\_size}
2997 field of the header.
2998 The first tuple following the header in
2999 each set begins at an offset that is a multiple of the size
3000 of a single tuple (that is, the size of a segment selector
3001 plus twice the \addtoindex{size of an address}).
3002 The header is padded, if
3003 necessary, to that boundary. Each set of tuples is terminated
3004 by a 0 for the segment, a 0 for the address and 0 for the
3005 length. If the \HFNsegmentselectorsize{} field in the header is zero,
3006 the segment selectors are omitted from all tuples, including
3007 the terminating tuple.
3010 \section{Line Number Information}
3011 \label{datarep:linenumberinformation}
3013 The \addtoindexi{version number}{version number!line number information}
3014 in the line number program header is \versiondotdebugline{}
3015 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3017 The boolean values \doublequote{true} and \doublequote{false}
3018 used by the line number information program are encoded
3019 as a single byte containing the value 0
3020 for \doublequote{false,} and a non-zero value for \doublequote{true.}
3023 The encodings for the standard opcodes are given in
3024 \addtoindexx{line number opcodes!standard opcode encoding}
3025 Table \refersec{tab:linenumberstandardopcodeencodings}.
3028 \setlength{\extrarowheight}{0.1cm}
3029 \begin{longtable}{l|c}
3030 \caption{Line number standard opcode encodings} \label{tab:linenumberstandardopcodeencodings}\\
3031 \hline \bfseries Opcode name&\bfseries Value \\ \hline
3033 \bfseries Opcode name&\bfseries Value\\ \hline
3035 \hline \emph{Continued on next page}
3041 \DWLNSadvancepc&0x02 \\
3042 \DWLNSadvanceline&0x03 \\
3043 \DWLNSsetfile&0x04 \\
3044 \DWLNSsetcolumn&0x05 \\
3045 \DWLNSnegatestmt&0x06 \\
3046 \DWLNSsetbasicblock&0x07 \\
3047 \DWLNSconstaddpc&0x08 \\
3048 \DWLNSfixedadvancepc&0x09 \\
3049 \DWLNSsetprologueend&0x0a \\*
3050 \DWLNSsetepiloguebegin&0x0b \\*
3051 \DWLNSsetisa&0x0c \\*
3057 The encodings for the extended opcodes are given in
3058 \addtoindexx{line number opcodes!extended opcode encoding}
3059 Table \refersec{tab:linenumberextendedopcodeencodings}.
3062 \setlength{\extrarowheight}{0.1cm}
3063 \begin{longtable}{l|c}
3064 \caption{Line number extended opcode encodings} \label{tab:linenumberextendedopcodeencodings}\\
3065 \hline \bfseries Opcode name&\bfseries Value \\ \hline
3067 \bfseries Opcode name&\bfseries Value\\ \hline
3069 \hline \emph{Continued on next page}
3071 \hline %\ddag~\textit{New in DWARF Version 5}
3074 \DWLNEendsequence &0x01 \\
3075 \DWLNEsetaddress &0x02 \\
3076 \textit{Reserved} &0x03\footnote{Code 0x03 is reserved to allow backward compatible support of the
3077 DW\_LNE\_define\_file operation which was defined in \DWARFVersionIV{}
3079 \DWLNEsetdiscriminator &0x04 \\
3080 \DWLNElouser &0x80 \\
3081 \DWLNEhiuser &\xff \\
3087 The encodings for the line number header entry formats are given in
3088 \addtoindexx{line number opcodes!file entry format encoding}
3089 Table \refersec{tab:linenumberheaderentryformatencodings}.
3092 \setlength{\extrarowheight}{0.1cm}
3093 \begin{longtable}{l|c}
3094 \caption{Line number header entry format \mbox{encodings}} \label{tab:linenumberheaderentryformatencodings}\\
3095 \hline \bfseries Line number header entry format name&\bfseries Value \\ \hline
3097 \bfseries Line number header entry format name&\bfseries Value\\ \hline
3099 \hline \emph{Continued on next page}
3101 \hline \ddag~\textit{New in DWARF Version 5}
3103 \DWLNCTpath~\ddag & 0x1 \\
3104 \DWLNCTdirectoryindex~\ddag & 0x2 \\
3105 \DWLNCTtimestamp~\ddag & 0x3 \\
3106 \DWLNCTsize~\ddag & 0x4 \\
3107 \DWLNCTMDfive~\ddag & 0x5 \\
3108 \DWLNCTlouser~\ddag & 0x2000 \\
3109 \DWLNCThiuser~\ddag & \xiiifff \\
3114 \section{Macro Information}
3115 \label{datarep:macroinformation}
3116 The \addtoindexi{version number}{version number!macro information}
3117 in the macro information header is \versiondotdebugmacro{}
3118 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3120 The source line numbers and source file indices encoded in the
3121 macro information section are represented as
3122 unsigned LEB128\addtoindexx{LEB128!unsigned} numbers.
3125 The macro information entry type is encoded as a single unsigned byte.
3127 \addtoindexx{macro information entry types!encoding}
3129 Table \refersec{tab:macroinfoentrytypeencodings}.
3133 \setlength{\extrarowheight}{0.1cm}
3134 \begin{longtable}{l|c}
3135 \caption{Macro information entry type encodings} \label{tab:macroinfoentrytypeencodings}\\
3136 \hline \bfseries Macro information entry type name&\bfseries Value \\ \hline
3138 \bfseries Macro information entry type name&\bfseries Value\\ \hline
3140 \hline \emph{Continued on next page}
3142 \hline \ddag~\textit{New in DWARF Version 5}
3145 \DWMACROdefine~\ddag &0x01 \\
3146 \DWMACROundef~\ddag &0x02 \\
3147 \DWMACROstartfile~\ddag &0x03 \\
3148 \DWMACROendfile~\ddag &0x04 \\
3149 \DWMACROdefinestrp~\ddag &0x05 \\
3150 \DWMACROundefstrp~\ddag &0x06 \\
3151 \DWMACROimport~\ddag &0x07 \\
3152 \DWMACROdefinesup~\ddag &0x08 \\
3153 \DWMACROundefsup~\ddag &0x09 \\
3154 \DWMACROimportsup~\ddag &0x0a \\
3155 \DWMACROdefinestrx~\ddag &0x0b \\
3156 \DWMACROundefstrx~\ddag &0x0c \\
3157 \DWMACROlouser~\ddag &0xe0 \\
3158 \DWMACROhiuser~\ddag &\xff \\
3164 \section{Call Frame Information}
3165 \label{datarep:callframeinformation}
3167 In the \thirtytwobitdwarfformat, the value of the CIE id in the
3168 CIE header is \xffffffff; in the \sixtyfourbitdwarfformat, the
3169 value is \xffffffffffffffff.
3171 The value of the CIE \addtoindexi{version number}{version number!call frame information}
3172 is 4 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3174 Call frame instructions are encoded in one or more bytes. The
3175 primary opcode is encoded in the high order two bits of
3176 the first byte (that is, opcode = byte $\gg$ 6). An operand
3177 or extended opcode may be encoded in the low order 6
3178 bits. Additional operands are encoded in subsequent bytes.
3179 The instructions and their encodings are presented in
3180 Table \refersec{tab:callframeinstructionencodings}.
3183 \setlength{\extrarowheight}{0.1cm}
3184 \begin{longtable}{l|c|c|l|l}
3185 \caption{Call frame instruction encodings} \label{tab:callframeinstructionencodings} \\
3186 \hline &\bfseries High 2 &\bfseries Low 6 & & \\
3187 \bfseries Instruction&\bfseries Bits &\bfseries Bits &\bfseries Operand 1 &\bfseries Operand 2\\ \hline
3189 & \bfseries High 2 &\bfseries Low 6 & &\\
3190 \bfseries Instruction&\bfseries Bits &\bfseries Bits &\bfseries Operand 1 &\bfseries Operand 2\\ \hline
3192 \hline \emph{Continued on next page}
3197 \DWCFAadvanceloc&0x1&delta & \\
3198 \DWCFAoffset&0x2®ister&ULEB128 offset \\
3199 \DWCFArestore&0x3®ister & & \\
3200 \DWCFAnop&0&0 & & \\
3201 \DWCFAsetloc&0&0x01&address & \\
3202 \DWCFAadvancelocone&0&0x02&1-byte delta & \\
3203 \DWCFAadvanceloctwo&0&0x03&2-byte delta & \\
3204 \DWCFAadvancelocfour&0&0x04&4-byte delta & \\
3205 \DWCFAoffsetextended&0&0x05&ULEB128 register&ULEB128 offset \\
3206 \DWCFArestoreextended&0&0x06&ULEB128 register & \\
3207 \DWCFAundefined&0&0x07&ULEB128 register & \\
3208 \DWCFAsamevalue&0&0x08 &ULEB128 register & \\
3209 \DWCFAregister&0&0x09&ULEB128 register &ULEB128 offset \\
3210 \DWCFArememberstate&0&0x0a & & \\
3211 \DWCFArestorestate&0&0x0b & & \\
3212 \DWCFAdefcfa&0&0x0c &ULEB128 register&ULEB128 offset \\
3213 \DWCFAdefcfaregister&0&0x0d&ULEB128 register & \\
3214 \DWCFAdefcfaoffset&0&0x0e &ULEB128 offset & \\
3215 \DWCFAdefcfaexpression&0&0x0f &BLOCK \\
3216 \DWCFAexpression&0&0x10&ULEB128 register & BLOCK \\
3218 \DWCFAoffsetextendedsf&0&0x11&ULEB128 register&SLEB128 offset \\
3219 \DWCFAdefcfasf&0&0x12&ULEB128 register&SLEB128 offset \\
3220 \DWCFAdefcfaoffsetsf&0&0x13&SLEB128 offset & \\
3221 \DWCFAvaloffset&0&0x14&ULEB128&ULEB128 \\
3222 \DWCFAvaloffsetsf&0&0x15&ULEB128&SLEB128 \\
3223 \DWCFAvalexpression&0&0x16&ULEB128&BLOCK \\
3224 \DWCFAlouser&0&0x1c & & \\
3225 \DWCFAhiuser&0&\xiiif & & \\
3229 \section{Non-contiguous Address Ranges}
3230 \label{datarep:noncontiguousaddressranges}
3232 Each entry in a \addtoindex{range list}
3233 (see Section \refersec{chap:noncontiguousaddressranges})
3235 \addtoindexx{base address selection entry!in range list}
3237 \addtoindexx{range list}
3238 a base address selection entry, or an end-of-list entry.
3240 A \addtoindex{range list} entry consists of two relative addresses. The
3241 addresses are the same size as addresses on the target machine.
3244 A base address selection entry and an
3245 \addtoindexx{end-of-list entry!in range list}
3246 end-of-list entry each
3247 \addtoindexx{base address selection entry!in range list}
3248 consist of two (constant or relocated) addresses. The two
3249 addresses are the same size as addresses on the target machine.
3251 For a \addtoindex{range list} to be specified, the base address of the
3252 \addtoindexx{base address selection entry!in range list}
3253 corresponding compilation unit must be defined
3254 (see Section \refersec{chap:normalandpartialcompilationunitentries}).
3257 \section{String Offsets Table}
3258 \label{chap:stringoffsetstable}
3259 Each set of entries in the string offsets table contained in the
3260 \dotdebugstroffsets{} or \dotdebugstroffsetsdwo{}
3261 section begins with a header containing:
3262 \begin{enumerate}[1. ]
3263 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3264 \addttindexx{unit\_length}
3265 A 4-byte or 12-byte length containing the length of
3266 the set of entries for this compilation unit, not
3267 including the length field itself. In the 32-bit
3268 DWARF format, this is a 4-byte unsigned integer
3269 (which must be less than \xfffffffzero); in the 64-bit
3270 DWARF format, this consists of the 4-byte value
3271 \wffffffff followed by an 8-byte unsigned integer
3272 that gives the actual length (see
3273 Section \refersec{datarep:32bitand64bitdwarfformats}).
3276 \item \texttt{version} (\HFTuhalf) \\
3277 A 2-byte version identifier containing the value
3278 \versiondotdebugstroffsets{}
3279 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3281 \item \texttt{padding} (\HFTuhalf) \\
3284 This header is followed by a series of string table offsets
3285 that have the same representation as \DWFORMstrp.
3286 For the 32-bit DWARF format, each offset is 4 bytes long; for
3287 the 64-bit DWARF format, each offset is 8 bytes long.
3289 The \DWATstroffsetsbase{} attribute points to the first
3290 entry following the header. The entries are indexed
3291 sequentially from this base entry, starting from 0.
3293 \section{Address Table}
3294 \label{chap:addresstable}
3295 Each set of entries in the address table contained in the
3296 \dotdebugaddr{} section begins with a header containing:
3297 \begin{enumerate}[1. ]
3298 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3299 \addttindexx{unit\_length}
3300 A 4-byte or 12-byte length containing the length of
3301 the set of entries for this compilation unit, not
3302 including the length field itself. In the 32-bit
3303 DWARF format, this is a 4-byte unsigned integer
3304 (which must be less than \xfffffffzero); in the 64-bit
3305 DWARF format, this consists of the 4-byte value
3306 \wffffffff followed by an 8-byte unsigned integer
3307 that gives the actual length (see
3308 Section \refersec{datarep:32bitand64bitdwarfformats}).
3311 \item \texttt{version} (\HFTuhalf) \\
3312 A 2-byte version identifier containing the value
3313 \versiondotdebugaddr{}
3314 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3317 \item \texttt{address\_size} (\HFTubyte) \\
3318 A 1-byte unsigned integer containing the size in
3319 bytes of an address (or the offset portion of an
3320 address for segmented addressing) on the target
3324 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
3325 A 1-byte unsigned integer containing the size in
3326 bytes of a segment selector on the target system.
3329 This header is followed by a series of segment/address pairs.
3330 The segment size is given by the \HFNsegmentselectorsize{} field of the
3331 header, and the address size is given by the \addttindex{address\_size}
3332 field of the header. If the \HFNsegmentselectorsize{} field in the header
3333 is zero, the entries consist only of an addresses.
3335 The \DWATaddrbase{} attribute points to the first entry
3336 following the header. The entries are indexed sequentially
3337 from this base entry, starting from 0.
3340 \section{Range List Table}
3341 \label{app:rangelisttable}
3342 Each set of entries in the range list table contained in the
3343 \dotdebugranges{} section begins with a header containing:
3344 \begin{enumerate}[1. ]
3345 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3346 \addttindexx{unit\_length}
3347 A 4-byte or 12-byte length containing the length of
3348 the set of entries for this compilation unit, not
3349 including the length field itself. In the 32-bit
3350 DWARF format, this is a 4-byte unsigned integer
3351 (which must be less than \xfffffffzero); in the 64-bit
3352 DWARF format, this consists of the 4-byte value
3353 \wffffffff followed by an 8-byte unsigned integer
3354 that gives the actual length (see
3355 Section \refersec{datarep:32bitand64bitdwarfformats}).
3358 \item \texttt{version} (\HFTuhalf) \\
3359 A 2-byte version identifier containing the value
3360 \versiondotdebugranges{}
3361 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3364 \item \texttt{address\_size} (\HFTubyte) \\
3365 A 1-byte unsigned integer containing the size in
3366 bytes of an address (or the offset portion of an
3367 address for segmented addressing) on the target
3371 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
3372 A 1-byte unsigned integer containing the size in
3373 bytes of a segment selector on the target system.
3376 This header is followed by a series of range list entries as
3377 described in Section \refersec{chap:noncontiguousaddressranges}.
3378 The segment size is given by the
3379 \HFNsegmentselectorsize{} field of the header, and the address size is
3380 given by the \addttindex{address\_size} field of the header. If the
3381 \HFNsegmentselectorsize{} field in the header is zero, the segment
3382 selector is omitted from the range list entries.
3384 The \DWATrangesbase{} attribute points to the first entry
3385 following the header. The entries are referenced by a byte
3386 offset relative to this base address.
3389 \section{Location List Table}
3390 \label{datarep:locationlisttable}
3391 Each set of entries in the location list table contained in the
3392 \dotdebugloc{} or \dotdebuglocdwo{} sections begins with a header containing:
3393 \begin{enumerate}[1. ]
3394 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3395 \addttindexx{unit\_length}
3396 A 4-byte or 12-byte length containing the length of
3397 the set of entries for this compilation unit, not
3398 including the length field itself. In the 32-bit
3399 DWARF format, this is a 4-byte unsigned integer
3400 (which must be less than \xfffffffzero); in the 64-bit
3401 DWARF format, this consists of the 4-byte value
3402 \wffffffff followed by an 8-byte unsigned integer
3403 that gives the actual length (see
3404 Section \refersec{datarep:32bitand64bitdwarfformats}).
3407 \item \texttt{version} (\HFTuhalf) \\
3408 A 2-byte version identifier containing the value
3409 \versiondotdebugloc{}
3410 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3413 \item \texttt{address\_size} (\HFTubyte) \\
3414 A 1-byte unsigned integer containing the size in
3415 bytes of an address (or the offset portion of an
3416 address for segmented addressing) on the target
3420 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
3421 A 1-byte unsigned integer containing the size in
3422 bytes of a segment selector on the target system.
3425 This header is followed by a series of location list entries as
3426 described in Section \refersec{chap:locationlists}.
3427 The segment size is given by the
3428 \HFNsegmentselectorsize{} field of the header, and the address size is
3429 given by the \HFNaddresssize{} field of the header. If the
3430 \HFNsegmentselectorsize{} field in the header is zero, the segment
3431 selector is omitted from range list entries.
3433 The entries are referenced by a byte offset relative to the first
3434 location list following this header.
3437 \section{Dependencies and Constraints}
3438 \label{datarep:dependenciesandconstraints}
3439 The debugging information in this format is intended to
3440 exist in sections of an object file, or an equivalent
3441 separate file or database, having names beginning with
3442 the prefix ".debug\_" (see Appendix
3443 \refersec{app:dwarfsectionversionnumbersinformative}
3444 for a complete list of such names).
3445 Except as specifically specified, this information is not
3446 aligned on 2-, 4- or 8-byte boundaries. Consequently:
3449 \item For the \thirtytwobitdwarfformat{} and a target architecture with
3450 32-bit addresses, an assembler or compiler must provide a way
3451 to produce 2-byte and 4-byte quantities without alignment
3452 restrictions, and the linker must be able to relocate a
3454 \addtoindexx{section offset!alignment of}
3455 section offset that occurs at an arbitrary
3458 \item For the \thirtytwobitdwarfformat{} and a target architecture with
3459 64-bit addresses, an assembler or compiler must provide a
3460 way to produce 2-byte, 4-byte and 8-byte quantities without
3461 alignment restrictions, and the linker must be able to relocate
3462 an 8-byte address or 4-byte
3463 \addtoindexx{section offset!alignment of}
3464 section offset that occurs at an
3465 arbitrary alignment.
3467 \item For the \sixtyfourbitdwarfformat{} and a target architecture with
3468 32-bit addresses, an assembler or compiler must provide a
3469 way to produce 2-byte, 4-byte and 8-byte quantities without
3470 alignment restrictions, and the linker must be able to relocate
3471 a 4-byte address or 8-byte
3472 \addtoindexx{section offset!alignment of}
3473 section offset that occurs at an
3474 arbitrary alignment.
3476 \textit{It is expected that this will be required only for very large
3477 32-bit programs or by those architectures which support
3478 a mix of 32-bit and 64-bit code and data within the same
3481 \item For the \sixtyfourbitdwarfformat{} and a target architecture with
3482 64-bit addresses, an assembler or compiler must provide a
3483 way to produce 2-byte, 4-byte and 8-byte quantities without
3484 alignment restrictions, and the linker must be able to
3485 relocate an 8-byte address or
3486 \addtoindexx{section offset!alignment of}
3487 section offset that occurs at
3488 an arbitrary alignment.
3492 \section{Integer Representation Names}
3493 \label{datarep:integerrepresentationnames}
3494 The sizes of the integers used in the lookup by name, lookup
3495 by address, line number, call frame information and other sections
3497 Table \ref{tab:integerrepresentationnames}.
3501 \setlength{\extrarowheight}{0.1cm}
3502 \begin{longtable}{c|l}
3503 \caption{Integer representation names} \label{tab:integerrepresentationnames}\\
3504 \hline \bfseries Representation name&\bfseries Representation \\ \hline
3506 \bfseries Representation name&\bfseries Representation\\ \hline
3508 \hline \emph{Continued on next page}
3513 \HFTsbyte& signed, 1-byte integer \\
3514 \HFTubyte&unsigned, 1-byte integer \\
3515 \HFTuhalf&unsigned, 2-byte integer \\
3516 \HFTuword&unsigned, 4-byte integer \\
3522 \section{Type Signature Computation}
3523 \label{datarep:typesignaturecomputation}
3525 A \addtoindex{type signature} is used by a DWARF consumer
3526 to resolve type references to the type definitions that
3527 are contained in \addtoindex{type unit}s (see Section
3528 \refersec{chap:typeunitentries}).
3530 \textit{A type signature is computed only by a DWARF producer;
3531 \addtoindexx{type signature!computation} a consumer need
3532 compare two type signatures to check for equality.}
3535 The type signature for a type T0 is formed from the
3536 \MDfive{}\footnote{\livetarg{def:MDfive}{MD5} Message Digest Algorithm,
3537 R.L. Rivest, RFC 1321, April 1992}
3538 hash of a flattened description of the type. The flattened
3539 description of the type is a byte sequence derived from the
3540 DWARF encoding of the type as follows:
3541 \begin{enumerate}[1. ]
3543 \item Start with an empty sequence S and a list V of visited
3544 types, where V is initialized to a list containing the type
3545 T0 as its single element. Elements in V are indexed from 1,
3548 \item If the debugging information entry represents a type that
3549 is nested inside another type or a namespace, append to S
3550 the type\textquoteright s context as follows: For each surrounding type
3551 or namespace, beginning with the outermost such construct,
3552 append the letter 'C', the DWARF tag of the construct, and
3553 the name (taken from
3554 \addtoindexx{name attribute}
3555 the \DWATname{} attribute) of the type
3556 \addtoindexx{name attribute}
3557 or namespace (including its trailing null byte).
3559 \item Append to S the letter 'D', followed by the DWARF tag of
3560 the debugging information entry.
3562 \item For each of the attributes in
3563 Table \refersec{tab:attributesusedintypesignaturecomputation}
3565 the debugging information entry, in the order listed,
3566 append to S a marker letter (see below), the DWARF attribute
3567 code, and the attribute value.
3570 \caption{Attributes used in type signature computation}
3571 \label{tab:attributesusedintypesignaturecomputation}
3572 \simplerule[\textwidth]
3574 \autocols[0pt]{c}{2}{l}{
3590 \DWATcontainingtype,
3594 \DWATdatamemberlocation,
3615 \DWATrvaluereference,
3619 \DWATstringlengthbitsize,
3620 \DWATstringlengthbytesize,
3625 \DWATvariableparameter,
3628 \DWATvtableelemlocation
3631 \simplerule[\textwidth]
3634 Note that except for the initial
3635 \DWATname{} attribute,
3636 \addtoindexx{name attribute}
3637 attributes are appended in order according to the alphabetical
3638 spelling of their identifier.
3640 If an implementation defines any vendor-specific attributes,
3641 any such attributes that are essential to the definition of
3642 the type are also included at the end of the above list,
3643 in their own alphabetical suborder.
3645 An attribute that refers to another type entry T is processed
3646 as follows: (a) If T is in the list V at some V[x], use the
3647 letter 'R' as the marker and use the unsigned LEB128\addtoindexx{LEB128!unsigned}
3648 encoding of x as the attribute value; otherwise, (b) use the letter 'T'
3649 as the marker, process the type T recursively by performing
3650 Steps 2 through 7, and use the result as the attribute value.
3653 Other attribute values use the letter 'A' as the marker, and
3654 the value consists of the form code (encoded as an unsigned
3655 LEB128 value) followed by the encoding of the value according
3656 to the form code. To ensure reproducibility of the signature,
3657 the set of forms used in the signature computation is limited
3666 \item If the tag in Step 3 is one of \DWTAGpointertype,
3667 \DWTAGreferencetype,
3668 \DWTAGrvaluereferencetype,
3669 \DWTAGptrtomembertype,
3670 or \DWTAGfriend, and the referenced
3671 type (via the \DWATtype{} or
3672 \DWATfriend{} attribute) has a
3673 \DWATname{} attribute, append to S the letter 'N', the DWARF
3674 attribute code (\DWATtype{} or
3675 \DWATfriend), the context of
3676 the type (according to the method in Step 2), the letter 'E',
3677 and the name of the type. For \DWTAGfriend, if the referenced
3678 entry is a \DWTAGsubprogram, the context is omitted and the
3679 name to be used is the ABI-specific name of the subprogram
3680 (for example, the mangled linker name).
3683 \item If the tag in Step 3 is not one of \DWTAGpointertype,
3684 \DWTAGreferencetype,
3685 \DWTAGrvaluereferencetype,
3686 \DWTAGptrtomembertype, or
3687 \DWTAGfriend, but has
3688 a \DWATtype{} attribute, or if the referenced type (via
3690 \DWATfriend{} attribute) does not have a
3691 \DWATname{} attribute, the attribute is processed according to
3692 the method in Step 4 for an attribute that refers to another
3696 \item Visit each child C of the debugging information
3697 entry as follows: If C is a nested type entry or a member
3698 function entry, and has
3699 a \DWATname{} attribute, append to
3700 \addtoindexx{name attribute}
3701 S the letter 'S', the tag of C, and its name; otherwise,
3702 process C recursively by performing Steps 3 through 7,
3703 appending the result to S. Following the last child (or if
3704 there are no children), append a zero byte.
3709 For the purposes of this algorithm, if a debugging information
3711 \DWATspecification{}
3712 attribute that refers to
3713 another entry D (which has a
3716 then S inherits the attributes and children of D, and S is
3717 processed as if those attributes and children were present in
3718 the entry S. Exception: if a particular attribute is found in
3719 both S and D, the attribute in S is used and the corresponding
3720 one in D is ignored.
3723 DWARF tag and attribute codes are appended to the sequence
3724 as unsigned LEB128\addtoindexx{LEB128!unsigned} values,
3725 using the values defined earlier in this chapter.
3727 \textit{A grammar describing this computation may be found in
3728 Appendix \refersec{app:typesignaturecomputationgrammar}.
3731 \textit{An attribute that refers to another type entry is
3732 recursively processed or replaced with the name of the
3733 referent (in Step 4, 5 or 6). If neither treatment applies to
3734 an attribute that references another type entry, the entry
3735 that contains that attribute is not suitable for a
3736 separate \addtoindex{type unit}.}
3738 \textit{If a debugging information entry contains an attribute from
3739 the list above that would require an unsupported form, that
3740 entry is not suitable for a separate
3741 \addtoindex{type unit}.}
3743 \textit{A type is suitable for a separate
3744 \addtoindex{type unit} only
3745 if all of the type entries that it contains or refers to in
3746 Steps 6 and 7 are themselves suitable for a separate
3747 \addtoindex{type unit}.}
3750 Where the DWARF producer may reasonably choose two or more
3751 different forms for a given attribute, it should choose
3752 the simplest possible form in computing the signature. (For
3753 example, a constant value should be preferred to a location
3754 expression when possible.)
3756 Once the string S has been formed from the DWARF encoding,
3757 an \MDfive{} hash is computed for the string and the
3758 least significant 64 bits are taken as the type signature.
3760 \textit{The string S is intended to be a flattened representation of
3761 the type that uniquely identifies that type (that is, a different
3762 type is highly unlikely to produce the same string).}
3765 \textit{A debugging information entry is not be placed in a
3766 separate \addtoindex{type unit}
3767 if any of the following apply:}
3771 \item \textit{The entry has an attribute whose value is a location
3772 expression, and the location expression contains a reference to
3773 another debugging information entry (for example, a \DWOPcallref{}
3774 operator), as it is unlikely that the entry will remain
3775 identical across compilation units.}
3777 \item \textit{The entry has an attribute whose value refers
3778 to a code location or a \addtoindex{location list}.}
3780 \item \textit{The entry has an attribute whose value refers
3781 to another debugging information entry that does not represent
3787 \textit{Certain attributes are not included in the type signature:}
3790 \item \textit{The \DWATdeclaration{} attribute is not included because it
3791 indicates that the debugging information entry represents an
3792 incomplete declaration, and incomplete declarations should
3794 \addtoindexx{type unit}
3795 separate type units.}
3797 \item \textit{The \DWATdescription{} attribute is not included because
3798 it does not provide any information unique to the defining
3799 declaration of the type.}
3801 \item \textit{The \DWATdeclfile,
3803 \DWATdeclcolumn{} attributes are not included because they
3804 may vary from one source file to the next, and would prevent
3805 two otherwise identical type declarations from producing the
3806 same \MDfive{} hash.}
3808 \item \textit{The \DWATobjectpointer{} attribute is not included
3809 because the information it provides is not necessary for the
3810 computation of a unique type signature.}
3814 \textit{Nested types and some types referred to by a debugging
3815 information entry are encoded by name rather than by recursively
3816 encoding the type to allow for cases where a complete definition
3817 of the type might not be available in all compilation units.}
3820 \textit{If a type definition contains the definition of a member function,
3821 it cannot be moved as is into a type unit, because the member function
3822 contains attributes that are unique to that compilation unit.
3823 Such a type definition can be moved to a type unit by rewriting the DIE tree,
3824 moving the member function declaration into a separate declaration tree,
3825 and replacing the function definition in the type with a non-defining
3826 declaration of the function (as if the function had been defined out of
3829 An example that illustrates the computation of an \MDfive{} hash may be found in
3830 Appendix \refersec{app:usingtypeunits}.
3832 \section{Name Table Hash Function}
3833 \label{datarep:nametablehashfunction}
3834 The hash function used for hashing name strings in the accelerated
3835 access name index table (see Section \refersec{chap:acceleratedaccess})
3836 is defined in \addtoindex{C} as shown in
3837 Figure \referfol{fig:nametablehashfunctiondefinition}.\footnote{
3838 This hash function is sometimes informally known as the
3839 "\addtoindex{DJB hash function}" or the "\addtoindex{Berstein hash function}"
3841 \hrefself{http://en.wikipedia.org/wiki/List\_of\_hash\_functions} or
3842 \hrefself{http://stackoverflow.com/questions/10696223/reason-for-5381-number-in-djb-hash-function)}.}
3847 unsigned long \* must be a 32-bit integer type *\
3848 hash(unsigned char *str)
3850 unsigned long hash = 5381;
3854 hash = hash * 33 + c;
3860 \caption{Name Table Hash Function Definition}
3861 \label{fig:nametablehashfunctiondefinition}