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
414 (\DWATdwoid) for compilation units, or by type
415 signature for type units:
421 \subsubsection{The Compilation Unit (CU) Index Section}
422 The \dotdebugcuindex{} section is a hashed lookup table that maps a
427 to a set of contributions in the
428 various debug information sections. Each contribution is stored
429 as an offset within its corresponding section and a size.
431 Each \compunitset{} may contain contributions from the
434 \dotdebuginfodwo{} (required)
435 \dotdebugabbrevdwo{} (required)
438 \dotdebugstroffsetsdwo
442 \textit{Note that a \compunitset{} is not able to represent \dotdebugmacinfo{}
443 information from \DWARFVersionIV{} or earlier formats.}
445 \subsubsection{The Type Unit (TU) Index Section}
446 The \dotdebugtuindex{} section is a hashed lookup table that maps a
447 type signature to a set of offsets into the various debug
448 information sections. Each contribution is stored as an offset
449 within its corresponding section and a size.
451 Each \typeunitset{} may contain contributions from the following
454 \dotdebuginfodwo{} (required)
455 \dotdebugabbrevdwo{} (required)
457 \dotdebugstroffsetsdwo
460 \subsubsection{Format of the CU and TU Index Sections}
461 Both index sections have the same format, and serve to map an
462 8-byte signature to a set of contributions to the debug sections.
463 Each index section begins with a header, followed by a hash table of
464 signatures, a parallel table of indexes, a table of offsets, and
465 a table of sizes. The index sections are aligned at 8-byte
466 boundaries in the DWARF package file.
469 The index section header contains the following fields:
470 \begin{enumerate}[1. ]
471 \item \texttt{version} (\HFTuhalf) \\
473 \addtoindexx{version number!CU index information}
474 \addtoindexx{version number!TU index information}
475 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
476 This number is specific to the CU and TU index information
477 and is independent of the DWARF version number.
479 The version number is \versiondotdebugcuindex.
481 \item \textit{padding} (\HFTuhalf) \\
482 Reserved to DWARF (must be zero).
484 \item \texttt{column\_count} (\HFTuword) \\
485 The number of columns in the table of section counts that follows.
486 For brevity, the contents of this field is referred to as $C$ below.
488 \item \texttt{unit\_count} (\HFTuword) \\
489 The number of compilation units or type units in the index.
490 For brevity, the contents of this field is referred to as $U$ below.
492 \item \texttt{slot\_count} (\HFTuword) \\
493 The number of slots in the hash table.
494 For brevity, the contents of this field is referred to as $S$ below.
498 \textit{We assume that $U$ and $S$ do not exceed $2^{32}$.}
500 The size of the hash table, $S$, must be $2^k$ such that:
501 \hspace{0.3cm}$2^k\ \ >\ \ 3*U/2$
503 The hash table begins at offset 16 in the section, and consists
504 of an array of $S$ 8-byte slots. Each slot contains a 64-bit
506 % (using the \byteorder{} of the application binary).
508 The parallel table of indices begins immediately after the hash table
509 (at offset \mbox{$16 + 8 * S$} from the beginning of the section), and
510 consists of an array of $S$ 4-byte slots,
511 % (using the byte order of the application binary),
512 corresponding 1-1 with slots in the hash
513 table. Each entry in the parallel table contains a row index into
514 the tables of offsets and sizes.
516 Unused slots in the hash table have 0 in both the hash table
517 entry and the parallel table entry. While 0 is a valid hash
518 value, the row index in a used slot will always be non-zero.
521 Given an 8-byte compilation unit ID
523 or type signature $X$,
524 an entry in the hash table is located as follows:
525 \begin{enumerate}[1. ]
527 \item Define $REP(X)$ to be the value of $X$ interpreted as an
528 unsigned 64-bit integer in the target byte order.
530 \item Calculate a primary hash $H = REP(X)\ \&\ MASK(k)$, where
532 $MASK(k)$ is a mask with the low-order $k$ bits all set to 1.
534 \item Calculate a secondary hash $H' = (((REP(X)>>32)\ \&\ MASK(k))\ |\ 1)$.
537 \item If the hash table entry at index $H$ matches the signature, use
538 that entry. If the hash table entry at index $H$ is unused (all
539 zeroes), terminate the search: the signature is not present
542 \item Let $H = (H + H')\ modulo\ S$. Repeat at Step 4.
545 Because $S > U$, and $H'$ and $S$ are relatively prime, the search is
546 guaranteed to stop at an unused slot or find the match.
549 The table of offsets begins immediately following the parallel
550 table (at offset \mbox{$16 + 12 * S$} from the beginning of the section).
551 The table is a two-dimensional array of 4-byte words,
552 %(using the byte order of the application binary),
553 with $C$ columns and $U + 1$
554 rows, in row-major order. Each row in the array is indexed
555 starting from 0. The first row provides a key to the columns:
556 each column in this row provides a section identifier for a debug
557 section, and the offsets in the same column of subsequent rows
558 refer to that section. The section identifiers are shown in
559 Table \referfol{tab:dwarfpackagefilesectionidentifierencodings}.
563 \setlength{\extrarowheight}{0.1cm}
564 \begin{longtable}{l|c|l}
565 \caption{DWARF package file section identifier \mbox{encodings}}
566 \label{tab:dwarfpackagefilesectionidentifierencodings}
567 \addtoindexx{DWARF package files!section identifier encodings} \\
568 \hline \bfseries Section identifier &\bfseries Value &\bfseries Section \\ \hline
570 \bfseries Section identifier &\bfseries Value &\bfseries Section\\ \hline
572 \hline \emph{Continued on next page}
576 \DWSECTINFOTARG & 1 & \dotdebuginfodwo \\
577 \textit{Reserved} & 2 & \\
578 \DWSECTABBREVTARG & 3 & \dotdebugabbrevdwo \\
579 \DWSECTLINETARG & 4 & \dotdebuglinedwo \\
580 \DWSECTLOCTARG & 5 & \dotdebuglocdwo \\
581 \DWSECTSTROFFSETSTARG & 6 & \dotdebugstroffsetsdwo \\
582 %DWSECTMACINFO & & \dotdebugmacinfodwo \\
583 \DWSECTMACROTARG & 7 & \dotdebugmacrodwo \\
587 The offsets provided by the CU and TU index sections are the
588 base offsets for the contributions made by each CU or TU to the
589 corresponding section in the package file. Each CU and TU header
590 contains a \HFNdebugabbrevoffset{} field, used to find the abbreviations
591 table for that CU or TU within the contribution to the
592 \dotdebugabbrevdwo{} section for that CU or TU, and are
593 interpreted as relative to the base offset given in the index
594 section. Likewise, offsets into \dotdebuglinedwo{} from
595 \DWATstmtlist{} attributes are interpreted as relative to
596 the base offset for \dotdebuglinedwo{}, and offsets into other debug
597 sections obtained from DWARF attributes are also
598 interpreted as relative to the corresponding base offset.
600 The table of sizes begins immediately following the table of
601 offsets, and provides the sizes of the contributions made by each
602 CU or TU to the corresponding section in the package file. Like
603 the table of offsets, it is a two-dimensional array of 4-byte
604 words, with $C$ columns and $U$ rows, in row-major order. Each row in
605 the array is indexed starting from 1 (row 0 of the table of
606 offsets also serves as the key for the table of sizes).
608 \subsection{DWARF Supplementary Object Files}
609 \label{datarep:dwarfsupplemetaryobjectfiles}
610 In order to minimize the size of debugging information, it is possible
611 to move duplicate debug information entries, strings and macro entries from
612 several executables or shared object files into a separate
613 \addtoindexi{\textit{supplementary object file}}{supplementary object file} by some
614 post-linking utility; the moved entries and strings can be then referenced
615 from the debugging information of each of those executable or shared object files.
618 A DWARF \addtoindex{supplementary object file} is itself an object file,
619 using the same object
620 file format, \byteorder{}, and size as the corresponding application executables
621 or shared libraries. It consists only of a file header, section table, and
622 a number of DWARF debug information sections. Both the
623 \addtoindex{supplementary object file}
624 and all the executable or shared object files that reference entries or strings in that
625 file must contain a \dotdebugsup{} section that establishes the relationship.
627 The \dotdebugsup{} section contains:
628 \begin{enumerate}[1. ]
629 \item \texttt{version} (\HFTuhalf) \\
630 \addttindexx{version}
631 A 2-byte unsigned integer representing the version of the DWARF
632 information for the compilation unit (see Appendix G). The
633 value in this field is \versiondotdebugsup.
635 \item \texttt{is\_supplementary} (\HFTubyte) \\
636 \addttindexx{is\_supplementary}
637 A 1-byte unsigned integer, which contains the value 1 if it is
638 in the \addtoindex{supplementary object file} that other executable or
639 shared object files refer to, or 0 if it is an executable or shared object
640 referring to a \addtoindex{supplementary object file}.
643 \item \texttt{sup\_filename} (null terminated filename string) \\
644 \addttindexx{sup\_filename}
645 If \addttindex{is\_supplementary} is 0, this contains either an absolute
646 filename for the \addtoindex{supplementary object file}, or a filename
647 relative to the object file containing the \dotdebugsup{} section.
648 If \addttindex{is\_supplementary} is 1, then \addttindex{sup\_filename}
649 is not needed and must be an empty string (a single null byte).
652 \item \texttt{sup\_checksum\_len} (unsigned LEB128) \\
653 \addttindexx{sup\_checksum\_len}
654 Length of the following \addttindex{sup\_checksum} field;
655 his value can be 0 if no checksum is provided.
658 \item \texttt{sup\_checksum} (array of \HFTubyte) \\
659 \addttindexx{sup\_checksum}
660 Some checksum or cryptographic hash function of the \dotdebuginfo{},
661 \dotdebugstr{} and \dotdebugmacro{} sections of the
662 \addtoindex{supplementary object file}, or some unique identifier
663 which the implementation can choose to verify that the supplementary
664 section object file matches what the debug information in the executable
665 or shared object file expects.
668 Debug information entries that refer to an executable's or shared
669 object's addresses must \emph{not} be moved to supplementary files (the
670 addesses will likely not be the same). Similarly,
671 entries referenced from within location expressions or using loclistptr
672 form attributes must not be moved to a \addtoindex{supplementary object file}.
674 Executable or shared object file compilation units can use
675 \DWTAGimportedunit{} with \DWFORMrefsup{} form \DWATimport{} attribute
676 to import entries from the \addtoindex{supplementary object file}, other \DWFORMrefsup{}
677 attributes to refer to them and \DWFORMstrpsup{} form attributes to
678 refer to strings that are used by debug information of multiple
679 executables or shared object files. Within the \addtoindex{supplementary object file}'s
680 debugging sections, form \DWFORMrefsup{} or \DWFORMstrpsup{} are
681 not used, and all reference forms referring to some other sections
682 refer to the local sections in the \addtoindex{supplementary object file}.
684 In macro information, \DWMACROdefinesup{} or
685 \DWMACROundefsup{} opcodes can refer to strings in the
686 \dotdebugstr{} section of the \addtoindex{supplementary object file},
687 or \DWMACROimportsup{}
688 can refer to \dotdebugmacro{} section entries. Within the
689 \dotdebugmacro{} section of a \addtoindex{supplementary object file},
690 \DWMACROdefinestrp{} and \DWMACROundefstrp{}
691 opcodes refer to the local \dotdebugstr{} section in that
692 supplementary file, not the one in
693 the executable or shared object file.
697 \section{32-Bit and 64-Bit DWARF Formats}
698 \label{datarep:32bitand64bitdwarfformats}
699 \hypertarget{datarep:xxbitdwffmt}{}
700 \addtoindexx{32-bit DWARF format}
701 \addtoindexx{64-bit DWARF format}
702 There are two closely related file formats. In the 32-bit DWARF
703 format, all values that represent lengths of DWARF sections
704 and offsets relative to the beginning of DWARF sections are
705 represented using four bytes. In the 64-bit DWARF format, all
706 values that represent lengths of DWARF sections and offsets
707 relative to the beginning of DWARF sections are represented
708 using eight bytes. A special convention applies to the initial
709 length field of certain DWARF sections, as well as the CIE and
710 FDE structures, so that the 32-bit and 64-bit DWARF formats
711 can coexist and be distinguished within a single linked object.
713 The differences between the 32- and 64-bit DWARF formats are
714 detailed in the following:
715 \begin{enumerate}[1. ]
717 \item In the 32-bit DWARF format, an
718 \addtoindex{initial length} field (see
719 \addtoindexx{initial length!encoding}
720 Section \ref{datarep:initiallengthvalues} on page \pageref{datarep:initiallengthvalues})
721 is an unsigned 4-byte integer (which
722 must be less than \xfffffffzero); in the 64-bit DWARF format,
723 an \addtoindex{initial length} field is 12 bytes in size,
726 \item The first four bytes have the value \xffffffff.
728 \item The following eight bytes contain the actual length
729 represented as an unsigned 8-byte integer.
732 \textit{This representation allows a DWARF consumer to dynamically
733 detect that a DWARF section contribution is using the 64-bit
734 format and to adapt its processing accordingly.}
737 \item Section offset and section length
738 \hypertarget{datarep:sectionoffsetlength}{}
739 \addtoindexx{section length!use in headers}
741 \addtoindexx{section offset!use in headers}
742 in the headers of DWARF sections (other than initial length
743 \addtoindexx{initial length}
744 fields) are listed following. In the 32-bit DWARF format these
745 are 4-byte unsigned integer values; in the 64-bit DWARF format,
746 they are 8-byte unsigned integer values.
750 Section &Name & Role \\ \hline
751 \dotdebugaranges{} & \addttindex{debug\_info\_offset} & offset in \dotdebuginfo{} \\
752 \dotdebugframe{}/CIE & \addttindex{CIE\_id} & CIE distinguished value \\
753 \dotdebugframe{}/FDE & \addttindex{CIE\_pointer} & offset in \dotdebugframe{} \\
754 \dotdebuginfo{} & \addttindex{debug\_abbrev\_offset} & offset in \dotdebugabbrev{} \\
755 \dotdebugline{} & \addttindex{header\_length} & length of header itself \\
756 \dotdebugnames{} & entry in array of CUs & offset in \dotdebuginfo{} \\
762 The \texttt{CIE\_id} field in a CIE structure must be 64 bits because
763 it overlays the \texttt{CIE\_pointer} in a FDE structure; this implicit
764 union must be accessed to distinguish whether a CIE or FDE is
765 present, consequently, these two fields must exactly overlay
766 each other (both offset and size).
768 \item Within the body of the \dotdebuginfo{}
769 section, certain forms of attribute value depend on the choice
770 of DWARF format as follows. For the 32-bit DWARF format,
771 the value is a 4-byte unsigned integer; for the 64-bit DWARF
772 format, the value is an 8-byte unsigned integer.
774 \begin{tabular}{lp{6cm}}
775 Form & Role \\ \hline
776 \DWFORMlinestrp & offset in \dotdebuglinestr \\
777 \DWFORMrefaddr & offset in \dotdebuginfo{} \\
778 \DWFORMrefsup & offset in \dotdebuginfo{} section of a \mbox{supplementary} object file \\
779 \addtoindexx{supplementary object file}
780 \DWFORMsecoffset & offset in a section other than \\
781 & \dotdebuginfo{} or \dotdebugstr{} \\
782 \DWFORMstrp & offset in \dotdebugstr{} \\
783 \DWFORMstrpsup & offset in \dotdebugstr{} section of a \mbox{supplementary} object file \\
784 \DWOPcallref & offset in \dotdebuginfo{} \\
789 \item Within the body of the \dotdebugline{} section, certain forms of content
790 description depend on the choice of DWARF format as follows: for the
791 32-bit DWARF format, the value is a 4-byte unsigned integer; for the
792 64-bit DWARF format, the value is a 8-byte unsigned integer.
794 \begin{tabular}{lp{6cm}}
795 Form & Role \\ \hline
796 \DWFORMlinestrp & offset in \dotdebuglinestr
800 \item Within the body of the \dotdebugnames{}
801 sections, the representation of each entry in the array of
802 compilation units (CUs) and the array of local type units
803 (TUs), which represents an offset in the
805 section, depends on the DWARF format as follows: in the
806 32-bit DWARF format, each entry is a 4-byte unsigned integer;
807 in the 64-bit DWARF format, it is a 8-byte unsigned integer.
810 \item In the body of the \dotdebugstroffsets{} and \dotdebugstroffsetsdwo{}
811 sections, the size of entries in the body depend on the DWARF
812 format as follows: in the 32-bit DWARF format, entries are 4-byte
813 unsigned integer values; in the 64-bit DWARF format, they are
814 8-byte unsigned integers.
816 \item In the body of the \dotdebugaddr{}, \dotdebugloc{} and \dotdebugranges{}
817 sections, the contents of the address size fields depends on the
818 DWARF format as follows: in the 32-bit DWARF format, these fields
819 contain 4; in the 64-bit DWARF format these fields contain 8.
823 The 32-bit and 64-bit DWARF format conventions must \emph{not} be
824 intermixed within a single compilation unit.
826 \textit{Attribute values and section header fields that represent
827 addresses in the target program are not affected by these
830 A DWARF consumer that supports the 64-bit DWARF format must
831 support executables in which some compilation units use the
832 32-bit format and others use the 64-bit format provided that
833 the combination links correctly (that is, provided that there
834 are no link\dash time errors due to truncation or overflow). (An
835 implementation is not required to guarantee detection and
836 reporting of all such errors.)
838 \textit{It is expected that DWARF producing compilers will \emph{not} use
839 the 64-bit format \emph{by default}. In most cases, the division of
840 even very large applications into a number of executable and
841 shared object files will suffice to assure that the DWARF sections
842 within each individual linked object are less than 4 GBytes
843 in size. However, for those cases where needed, the 64-bit
844 format allows the unusual case to be handled as well. Even
845 in this case, it is expected that only application supplied
846 objects will need to be compiled using the 64-bit format;
847 separate 32-bit format versions of system supplied shared
848 executable libraries can still be used.}
852 \section{Format of Debugging Information}
853 \label{datarep:formatofdebugginginformation}
855 For each compilation unit compiled with a DWARF producer,
856 a contribution is made to the \dotdebuginfo{} section of
857 the object file. Each such contribution consists of a
858 compilation unit header
859 (see Section \refersec{datarep:compilationunitheader})
861 single \DWTAGcompileunit{} or
862 \DWTAGpartialunit{} debugging
863 information entry, together with its children.
865 For each type defined in a compilation unit, a separate
866 contribution may also be made to the
868 section of the object file. Each
869 such contribution consists of a
870 \addtoindex{type unit} header
871 (see Section \refersec{datarep:typeunitheader})
872 followed by a \DWTAGtypeunit{} entry, together with
875 Each debugging information entry begins with a code that
876 represents an entry in a separate
877 \addtoindex{abbreviations table}. This
878 code is followed directly by a series of attribute values.
880 The appropriate entry in the
881 \addtoindex{abbreviations table} guides the
882 interpretation of the information contained directly in the
883 \dotdebuginfo{} section.
886 Multiple debugging information entries may share the same
887 abbreviation table entry. Each compilation unit is associated
888 with a particular abbreviation table, but multiple compilation
889 units may share the same table.
891 \subsection{Unit Headers}
892 \label{datarep:unitheaders}
893 Unit headers contain a field, \addttindex{unit\_type}, whose value indicates the kind of
894 compilation unit that follows. The encodings for the unit type
895 enumeration are shown in Table \refersec{tab:unitheaderunitkindencodings}.
899 \setlength{\extrarowheight}{0.1cm}
900 \begin{longtable}{l|c}
901 \caption{Unit header unit type encodings}
902 \label{tab:unitheaderunitkindencodings}
903 \addtoindexx{unit header unit type encodings} \\
904 \hline \bfseries Unit header unit type encodings&\bfseries Value \\ \hline
906 \bfseries Unit header unit type encodings&\bfseries Value \\ \hline
908 \hline \emph{Continued on next page}
910 \hline \ddag\ \textit{New in DWARF Version 5}
912 \DWUTcompileTARG~\ddag &0x01 \\
913 \DWUTtypeTARG~\ddag &0x02 \\
914 \DWUTpartialTARG~\ddag &0x03 \\ \hline
919 \subsubsection{Compilation Unit Header}
920 \label{datarep:compilationunitheader}
921 \begin{enumerate}[1. ]
923 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
924 \addttindexx{unit\_length}
926 \addtoindexx{initial length}
927 unsigned integer representing the length
928 of the \dotdebuginfo{}
929 contribution for that compilation unit,
930 not including the length field itself. In the \thirtytwobitdwarfformat,
931 this is a 4-byte unsigned integer (which must be less
932 than \xfffffffzero); in the \sixtyfourbitdwarfformat, this consists
933 of the 4-byte value \wffffffff followed by an 8-byte unsigned
934 integer that gives the actual length
935 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
937 \item \texttt{version} (\HFTuhalf) \\
938 \addttindexx{version}
939 A 2-byte unsigned integer representing the version of the
940 DWARF information for the compilation unit \addtoindexx{version number!compilation unit}
941 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
942 The value in this field is \versiondotdebuginfo.
945 \item \texttt{unit\_type} (\HFTubyte) \\
946 \addttindexx{unit\_type}
947 A 1-byte unsigned integer identifying this unit as a compilation unit.
948 The value of this field is
949 \DWUTcompile{} for a full compilation unit or
950 \DWUTpartial{} for a partial compilation unit
951 (see Section \refersec{chap:fullandpartialcompilationunitentries}).
953 \textit{This field is new in \DWARFVersionV.}
956 \item \HFNdebugabbrevoffset{} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
958 \addtoindexx{section offset!in .debug\_info header}
959 4-byte or 8-byte unsigned offset into the
961 section. This offset associates the compilation unit with a
962 particular set of debugging information entry abbreviations. In
963 the \thirtytwobitdwarfformat, this is a 4-byte unsigned length;
964 in the \sixtyfourbitdwarfformat, this is an 8-byte unsigned length
965 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
967 \item \texttt{address\_size} (\HFTubyte) \\
968 \addttindexx{address\_size}
969 A 1-byte unsigned integer representing the size in bytes of
970 an address on the target architecture. If the system uses
971 \addtoindexx{address space!segmented}
972 segmented addressing, this value represents the size of the
973 offset portion of an address.
977 \subsubsection{Type Unit Header}
978 \label{datarep:typeunitheader}
980 The header for the series of debugging information entries
981 contributing to the description of a type that has been
982 placed in its own \addtoindex{type unit}, within the
983 \dotdebuginfo{} section,
984 consists of the following information:
985 \begin{enumerate}[1. ]
987 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
988 \addttindexx{unit\_length}
989 A 4-byte or 12-byte unsigned integer
990 \addtoindexx{initial length}
991 representing the length
992 of the \dotdebuginfo{} contribution for that type unit,
993 not including the length field itself. In the \thirtytwobitdwarfformat,
994 this is a 4-byte unsigned integer (which must be
995 less than \xfffffffzero); in the \sixtyfourbitdwarfformat, this
996 consists of the 4-byte value \wffffffff followed by an
997 8-byte unsigned integer that gives the actual length
998 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1001 \item \texttt{version} (\HFTuhalf) \\
1002 \addttindexx{version}
1003 A 2-byte unsigned integer representing the version of the
1004 DWARF information for the
1005 type unit\addtoindexx{version number!type unit}
1006 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
1007 The value in this field is \versiondotdebuginfo.
1009 \item \texttt{unit\_type} (\HFTubyte) \\
1010 \addttindexx{unit\_type}
1011 A 1-byte unsigned integer identifying this unit as a type unit.
1012 The value of this field is \DWUTtype{} for a type unit
1013 (see Section \refersec{chap:typeunitentries}).
1015 \textit{This field is new in \DWARFVersionV.}
1018 \item \HFNdebugabbrevoffset{} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
1020 \addtoindexx{section offset!in .debug\_info header}
1021 4-byte or 8-byte unsigned offset into the
1023 section. This offset associates the type unit with a
1024 particular set of debugging information entry abbreviations. In
1025 the \thirtytwobitdwarfformat, this is a 4-byte unsigned length;
1026 in the \sixtyfourbitdwarfformat, this is an 8-byte unsigned length
1027 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1030 \item \texttt{address\_size} (\HFTubyte) \\
1031 \addttindexx{address\_size}
1032 A 1-byte unsigned integer representing the size
1033 \addtoindexx{size of an address}
1035 an address on the target architecture. If the system uses
1036 \addtoindexx{address space!segmented}
1037 segmented addressing, this value represents the size of the
1038 offset portion of an address.
1040 \item \texttt{type\_signature} (8-byte unsigned integer) \\
1041 \addttindexx{type\_signature}
1042 \addtoindexx{type signature}
1043 A unique 8-byte signature (see Section
1044 \refersec{datarep:typesignaturecomputation})
1045 of the type described in this type
1048 \textit{An attribute that refers (using
1049 \DWFORMrefsigeight{}) to
1050 the primary type contained in this
1051 \addtoindex{type unit} uses this value.}
1053 \item \texttt{type\_offset} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
1054 \addttindexx{type\_offset}
1055 A 4-byte or 8-byte unsigned offset
1056 \addtoindexx{section offset!in .debug\_info header}
1057 relative to the beginning
1058 of the \addtoindex{type unit} header.
1059 This offset refers to the debugging
1060 information entry that describes the type. Because the type
1061 may be nested inside a namespace or other structures, and may
1062 contain references to other types that have not been placed in
1063 separate type units, it is not necessarily either the first or
1064 the only entry in the type unit. In the \thirtytwobitdwarfformat,
1065 this is a 4-byte unsigned length; in the \sixtyfourbitdwarfformat,
1066 this is an 8-byte unsigned length
1067 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1071 \subsection{Debugging Information Entry}
1072 \label{datarep:debugginginformationentry}
1074 Each debugging information entry begins with an
1075 unsigned LEB128\addtoindexx{LEB128!unsigned}
1076 number containing the abbreviation code for the entry. This
1077 code represents an entry within the abbreviations table
1078 associated with the compilation unit containing this entry. The
1079 abbreviation code is followed by a series of attribute values.
1081 On some architectures, there are alignment constraints on
1082 section boundaries. To make it easier to pad debugging
1083 information sections to satisfy such constraints, the
1084 abbreviation code 0 is reserved. Debugging information entries
1085 consisting of only the abbreviation code 0 are considered
1088 \subsection{Abbreviations Tables}
1089 \label{datarep:abbreviationstables}
1091 The abbreviations tables for all compilation units
1092 are contained in a separate object file section called
1094 As mentioned before, multiple compilation
1095 units may share the same abbreviations table.
1097 The abbreviations table for a single compilation unit consists
1098 of a series of abbreviation declarations. Each declaration
1099 specifies the tag and attributes for a particular form of
1100 debugging information entry. Each declaration begins with
1101 an unsigned LEB128\addtoindexx{LEB128!unsigned}
1102 number representing the abbreviation
1103 code itself. It is this code that appears at the beginning
1104 of a debugging information entry in the
1106 section. As described above, the abbreviation
1107 code 0 is reserved for null debugging information entries. The
1108 abbreviation code is followed by another unsigned LEB128\addtoindexx{LEB128!unsigned}
1109 number that encodes the entry\textquoteright s tag. The encodings for the
1110 tag names are given in
1111 Table \referfol{tab:tagencodings}.
1114 \setlength{\extrarowheight}{0.1cm}
1115 \begin{longtable}{l|c}
1116 \caption{Tag encodings} \label{tab:tagencodings} \\
1117 \hline \bfseries Tag name&\bfseries Value\\ \hline
1119 \bfseries Tag name&\bfseries Value \\ \hline
1121 \hline \emph{Continued on next page}
1123 \hline \ddag\ \textit{New in DWARF Version 5}
1125 \DWTAGarraytype{} &0x01 \\
1126 \DWTAGclasstype&0x02 \\
1127 \DWTAGentrypoint&0x03 \\
1128 \DWTAGenumerationtype&0x04 \\
1129 \DWTAGformalparameter&0x05 \\
1130 \DWTAGimporteddeclaration&0x08 \\
1132 \DWTAGlexicalblock&0x0b \\
1133 \DWTAGmember&0x0d \\
1134 \DWTAGpointertype&0x0f \\
1135 \DWTAGreferencetype&0x10 \\
1136 \DWTAGcompileunit&0x11 \\
1137 \DWTAGstringtype&0x12 \\
1138 \DWTAGstructuretype&0x13 \\
1139 \DWTAGsubroutinetype&0x15 \\
1140 \DWTAGtypedef&0x16 \\
1141 \DWTAGuniontype&0x17 \\
1142 \DWTAGunspecifiedparameters&0x18 \\
1143 \DWTAGvariant&0x19 \\
1144 \DWTAGcommonblock&0x1a \\
1145 \DWTAGcommoninclusion&0x1b \\
1146 \DWTAGinheritance&0x1c \\
1147 \DWTAGinlinedsubroutine&0x1d \\
1148 \DWTAGmodule&0x1e \\
1149 \DWTAGptrtomembertype&0x1f \\
1150 \DWTAGsettype&0x20 \\
1151 \DWTAGsubrangetype&0x21 \\
1152 \DWTAGwithstmt&0x22 \\
1153 \DWTAGaccessdeclaration&0x23 \\
1154 \DWTAGbasetype&0x24 \\
1155 \DWTAGcatchblock&0x25 \\
1156 \DWTAGconsttype&0x26 \\
1157 \DWTAGconstant&0x27 \\
1158 \DWTAGenumerator&0x28 \\
1159 \DWTAGfiletype&0x29 \\
1160 \DWTAGfriend&0x2a \\
1161 \DWTAGnamelist&0x2b \\
1162 \DWTAGnamelistitem&0x2c \\
1163 \DWTAGpackedtype&0x2d \\
1164 \DWTAGsubprogram&0x2e \\
1165 \DWTAGtemplatetypeparameter&0x2f \\
1166 \DWTAGtemplatevalueparameter&0x30 \\
1167 \DWTAGthrowntype&0x31 \\
1168 \DWTAGtryblock&0x32 \\
1169 \DWTAGvariantpart&0x33 \\
1170 \DWTAGvariable&0x34 \\
1171 \DWTAGvolatiletype&0x35 \\
1172 \DWTAGdwarfprocedure&0x36 \\
1173 \DWTAGrestricttype&0x37 \\
1174 \DWTAGinterfacetype&0x38 \\
1175 \DWTAGnamespace&0x39 \\
1176 \DWTAGimportedmodule&0x3a \\
1177 \DWTAGunspecifiedtype&0x3b \\
1178 \DWTAGpartialunit&0x3c \\
1179 \DWTAGimportedunit&0x3d \\
1180 \DWTAGcondition&\xiiif \\
1181 \DWTAGsharedtype&0x40 \\
1182 \DWTAGtypeunit & 0x41 \\
1183 \DWTAGrvaluereferencetype & 0x42 \\
1184 \DWTAGtemplatealias & 0x43 \\
1185 \DWTAGcoarraytype~\ddag & 0x44 \\
1186 \DWTAGgenericsubrange~\ddag & 0x45 \\
1187 \DWTAGdynamictype~\ddag & 0x46 \\
1188 \DWTAGatomictype~\ddag & 0x47 \\
1189 \DWTAGcallsite~\ddag & 0x48 \\
1190 \DWTAGcallsiteparameter~\ddag & 0x49 \\
1191 \DWTAGlouser&0x4080 \\
1192 \DWTAGhiuser&\xffff \\
1196 Following the tag encoding is a 1-byte value that determines
1197 whether a debugging information entry using this abbreviation
1198 has child entries or not. If the value is
1200 the next physically succeeding entry of any debugging
1201 information entry using this abbreviation is the first
1202 child of that entry. If the 1-byte value following the
1203 abbreviation\textquoteright s tag encoding is
1204 \DWCHILDRENnoTARG, the next
1205 physically succeeding entry of any debugging information entry
1206 using this abbreviation is a sibling of that entry. (Either
1207 the first child or sibling entries may be null entries). The
1208 encodings for the child determination byte are given in
1209 Table \refersec{tab:childdeterminationencodings}
1211 Section \refersec{chap:relationshipofdebugginginformationentries},
1212 each chain of sibling entries is terminated by a null entry.)
1216 \setlength{\extrarowheight}{0.1cm}
1217 \begin{longtable}{l|c}
1218 \caption{Child determination encodings}
1219 \label{tab:childdeterminationencodings}
1220 \addtoindexx{Child determination encodings} \\
1221 \hline \bfseries Children determination name&\bfseries Value \\ \hline
1223 \bfseries Children determination name&\bfseries Value \\ \hline
1225 \hline \emph{Continued on next page}
1229 \DWCHILDRENno&0x00 \\
1230 \DWCHILDRENyes&0x01 \\ \hline
1235 Finally, the child encoding is followed by a series of
1236 attribute specifications. Each attribute specification
1237 consists of two parts. The first part is an
1238 unsigned LEB128\addtoindexx{LEB128!unsigned}
1239 number representing the attribute\textquoteright s name.
1240 The second part is an
1241 unsigned LEB128\addtoindexx{LEB128!unsigned}
1242 number representing the attribute\textquoteright s form.
1243 The series of attribute specifications ends with an
1244 entry containing 0 for the name and 0 for the form.
1247 \DWFORMindirectTARG{} is a special case. For
1248 attributes with this form, the attribute value itself in the
1250 section begins with an unsigned
1251 LEB128 number that represents its form. This allows producers
1252 to choose forms for particular attributes
1253 \addtoindexx{abbreviations table!dynamic forms in}
1255 without having to add a new entry to the abbreviations table.
1257 The attribute form \DWFORMimplicitconstTARG{} is another special case.
1258 For attributes with this form, the attribute specification contains
1259 a third part, which is a signed LEB128\addtoindexx{LEB128!signed}
1260 number. The value of this number is used as the value of the
1261 attribute, and no value is stored in the \dotdebuginfo{} section.
1263 The abbreviations for a given compilation unit end with an
1264 entry consisting of a 0 byte for the abbreviation code.
1267 Appendix \refersec{app:compilationunitsandabbreviationstableexample}
1268 for a depiction of the organization of the
1269 debugging information.}
1272 \subsection{Attribute Encodings}
1273 \label{datarep:attributeencodings}
1275 The encodings for the attribute names are given in
1276 Table \referfol{tab:attributeencodings}.
1279 \setlength{\extrarowheight}{0.1cm}
1280 \begin{longtable}{l|c|l}
1281 \caption{Attribute encodings}
1282 \label{tab:attributeencodings}
1283 \addtoindexx{attribute encodings} \\
1284 \hline \bfseries Attribute name&\bfseries Value &\bfseries Classes \\ \hline
1286 \bfseries Attribute name&\bfseries Value &\bfseries Classes\\ \hline
1288 \hline \emph{Continued on next page}
1290 \hline \ddag\ \textit{New in DWARF Version 5}
1292 \DWATsibling&0x01&\livelink{chap:classreference}{reference}
1293 \addtoindexx{sibling attribute} \\
1294 \DWATlocation&0x02&\livelink{chap:classexprloc}{exprloc},
1295 \livelink{chap:classloclistptr}{loclistptr}
1296 \addtoindexx{location attribute} \\
1297 \DWATname&0x03&\livelink{chap:classstring}{string}
1298 \addtoindexx{name attribute} \\
1299 \DWATordering&0x09&\livelink{chap:classconstant}{constant}
1300 \addtoindexx{ordering attribute} \\
1301 \DWATbytesize&0x0b&\livelink{chap:classconstant}{constant},
1302 \livelink{chap:classexprloc}{exprloc},
1303 \livelink{chap:classreference}{reference}
1304 \addtoindexx{byte size attribute} \\
1305 \textit{Reserved}&0x0c\footnote{Code 0x0c is reserved to allow backward compatible support of the
1306 DW\_AT\_bit\_offset \mbox{attribute} which was
1307 defined in \DWARFVersionIII{} and earlier.}
1308 &\livelink{chap:classconstant}{constant},
1309 \livelink{chap:classexprloc}{exprloc},
1310 \livelink{chap:classreference}{reference}
1311 \addtoindexx{bit offset attribute (Version 3)}
1312 \addtoindexx{DW\_AT\_bit\_offset (deprecated)} \\
1313 \DWATbitsize&0x0d&\livelink{chap:classconstant}{constant},
1314 \livelink{chap:classexprloc}{exprloc},
1315 \livelink{chap:classreference}{reference}
1316 \addtoindexx{bit size attribute} \\
1317 \DWATstmtlist&0x10&\livelink{chap:classlineptr}{lineptr}
1318 \addtoindexx{statement list attribute} \\
1319 \DWATlowpc&0x11&\livelink{chap:classaddress}{address}
1320 \addtoindexx{low PC attribute} \\
1321 \DWAThighpc&0x12&\livelink{chap:classaddress}{address},
1322 \livelink{chap:classconstant}{constant}
1323 \addtoindexx{high PC attribute} \\
1324 \DWATlanguage&0x13&\livelink{chap:classconstant}{constant}
1325 \addtoindexx{language attribute} \\
1326 \DWATdiscr&0x15&\livelink{chap:classreference}{reference}
1327 \addtoindexx{discriminant attribute} \\
1328 \DWATdiscrvalue&0x16&\livelink{chap:classconstant}{constant}
1329 \addtoindexx{discriminant value attribute} \\
1330 \DWATvisibility&0x17&\livelink{chap:classconstant}{constant}
1331 \addtoindexx{visibility attribute} \\
1332 \DWATimport&0x18&\livelink{chap:classreference}{reference}
1333 \addtoindexx{import attribute} \\
1334 \DWATstringlength&0x19&\livelink{chap:classexprloc}{exprloc},
1335 \livelink{chap:classloclistptr}{loclistptr}
1336 \addtoindexx{string length attribute} \\
1337 \DWATcommonreference&0x1a&\livelink{chap:classreference}{reference}
1338 \addtoindexx{common reference attribute} \\
1339 \DWATcompdir&0x1b&\livelink{chap:classstring}{string}
1340 \addtoindexx{compilation directory attribute} \\
1341 \DWATconstvalue&0x1c&\livelink{chap:classblock}{block},
1342 \livelink{chap:classconstant}{constant},
1343 \livelink{chap:classstring}{string}
1344 \addtoindexx{constant value attribute} \\
1345 \DWATcontainingtype&0x1d&\livelink{chap:classreference}{reference}
1346 \addtoindexx{containing type attribute} \\
1347 \DWATdefaultvalue&0x1e&\livelink{chap:classconstant}{constant},
1348 \livelink{chap:classreference}{reference},
1349 \livelink{chap:classflag}{flag}
1350 \addtoindexx{default value attribute} \\
1351 \DWATinline&0x20&\livelink{chap:classconstant}{constant}
1352 \addtoindexx{inline attribute} \\
1353 \DWATisoptional&0x21&\livelink{chap:classflag}{flag}
1354 \addtoindexx{is optional attribute} \\
1355 \DWATlowerbound&0x22&\livelink{chap:classconstant}{constant},
1356 \livelink{chap:classexprloc}{exprloc},
1357 \livelink{chap:classreference}{reference}
1358 \addtoindexx{lower bound attribute} \\
1359 \DWATproducer&0x25&\livelink{chap:classstring}{string}
1360 \addtoindexx{producer attribute} \\
1361 \DWATprototyped&0x27&\livelink{chap:classflag}{flag}
1362 \addtoindexx{prototyped attribute} \\
1363 \DWATreturnaddr&0x2a&\livelink{chap:classexprloc}{exprloc},
1364 \livelink{chap:classloclistptr}{loclistptr}
1365 \addtoindexx{return address attribute} \\
1366 \DWATstartscope&0x2c&\livelink{chap:classconstant}{constant},
1367 \livelink{chap:classrangelistptr}{rangelistptr}
1368 \addtoindexx{start scope attribute} \\
1369 \DWATbitstride&0x2e&\livelink{chap:classconstant}{constant},
1370 \livelink{chap:classexprloc}{exprloc},
1371 \livelink{chap:classreference}{reference}
1372 \addtoindexx{bit stride attribute} \\
1373 \DWATupperbound&0x2f&\livelink{chap:classconstant}{constant},
1374 \livelink{chap:classexprloc}{exprloc},
1375 \livelink{chap:classreference}{reference}
1376 \addtoindexx{upper bound attribute} \\
1377 \DWATabstractorigin&0x31&\livelink{chap:classreference}{reference}
1378 \addtoindexx{abstract origin attribute} \\
1379 \DWATaccessibility&0x32&\livelink{chap:classconstant}{constant}
1380 \addtoindexx{accessibility attribute} \\
1381 \DWATaddressclass&0x33&\livelink{chap:classconstant}{constant}
1382 \addtoindexx{address class attribute} \\
1383 \DWATartificial&0x34&\livelink{chap:classflag}{flag}
1384 \addtoindexx{artificial attribute} \\
1385 \DWATbasetypes&0x35&\livelink{chap:classreference}{reference}
1386 \addtoindexx{base types attribute} \\
1387 \DWATcallingconvention&0x36&\livelink{chap:classconstant}{constant}
1388 \addtoindexx{calling convention attribute} \\
1389 \DWATcount&0x37&\livelink{chap:classconstant}{constant},
1390 \livelink{chap:classexprloc}{exprloc},
1391 \livelink{chap:classreference}{reference}
1392 \addtoindexx{count attribute} \\
1393 \DWATdatamemberlocation&0x38&\livelink{chap:classconstant}{constant},
1394 \livelink{chap:classexprloc}{exprloc},
1395 \livelink{chap:classloclistptr}{loclistptr}
1396 \addtoindexx{data member attribute} \\
1397 \DWATdeclcolumn&0x39&\livelink{chap:classconstant}{constant}
1398 \addtoindexx{declaration column attribute} \\
1399 \DWATdeclfile&0x3a&\livelink{chap:classconstant}{constant}
1400 \addtoindexx{declaration file attribute} \\
1401 \DWATdeclline&0x3b&\livelink{chap:classconstant}{constant}
1402 \addtoindexx{declaration line attribute} \\
1403 \DWATdeclaration&0x3c&\livelink{chap:classflag}{flag}
1404 \addtoindexx{declaration attribute} \\
1405 \DWATdiscrlist&0x3d&\livelink{chap:classblock}{block}
1406 \addtoindexx{discriminant list attribute} \\
1407 \DWATencoding&0x3e&\livelink{chap:classconstant}{constant}
1408 \addtoindexx{encoding attribute} \\
1409 \DWATexternal&\xiiif&\livelink{chap:classflag}{flag}
1410 \addtoindexx{external attribute} \\
1411 \DWATframebase&0x40&\livelink{chap:classexprloc}{exprloc},
1412 \livelink{chap:classloclistptr}{loclistptr}
1413 \addtoindexx{frame base attribute} \\
1414 \DWATfriend&0x41&\livelink{chap:classreference}{reference}
1415 \addtoindexx{friend attribute} \\
1416 \DWATidentifiercase&0x42&\livelink{chap:classconstant}{constant}
1417 \addtoindexx{identifier case attribute} \\
1418 \DWATmacroinfo\footnote{\raggedright Not used in \DWARFVersionV.
1419 Reserved for compatibility and coexistence
1420 with prior DWARF versions.}
1421 &0x43&\livelink{chap:classmacptr}{macptr}
1422 \addtoindexx{macro information attribute (legacy)!encoding} \\
1423 \DWATnamelistitem&0x44&\livelink{chap:classreference}{reference}
1424 \addtoindexx{name list item attribute} \\
1425 \DWATpriority&0x45&\livelink{chap:classreference}{reference}
1426 \addtoindexx{priority attribute} \\
1427 \DWATsegment&0x46&\livelink{chap:classexprloc}{exprloc},
1428 \livelink{chap:classloclistptr}{loclistptr}
1429 \addtoindexx{segment attribute} \\
1430 \DWATspecification&0x47&\livelink{chap:classreference}{reference}
1431 \addtoindexx{specification attribute} \\
1432 \DWATstaticlink&0x48&\livelink{chap:classexprloc}{exprloc},
1433 \livelink{chap:classloclistptr}{loclistptr}
1434 \addtoindexx{static link attribute} \\
1435 \DWATtype&0x49&\livelink{chap:classreference}{reference}
1436 \addtoindexx{type attribute} \\
1437 \DWATuselocation&0x4a&\livelink{chap:classexprloc}{exprloc},
1438 \livelink{chap:classloclistptr}{loclistptr}
1439 \addtoindexx{location list attribute} \\
1440 \DWATvariableparameter&0x4b&\livelink{chap:classflag}{flag}
1441 \addtoindexx{variable parameter attribute} \\
1442 \DWATvirtuality&0x4c&\livelink{chap:classconstant}{constant}
1443 \addtoindexx{virtuality attribute} \\
1444 \DWATvtableelemlocation&0x4d&\livelink{chap:classexprloc}{exprloc},
1445 \livelink{chap:classloclistptr}{loclistptr}
1446 \addtoindexx{vtable element location attribute} \\
1447 \DWATallocated&0x4e&\livelink{chap:classconstant}{constant},
1448 \livelink{chap:classexprloc}{exprloc},
1449 \livelink{chap:classreference}{reference}
1450 \addtoindexx{allocated attribute} \\
1451 \DWATassociated&0x4f&\livelink{chap:classconstant}{constant},
1452 \livelink{chap:classexprloc}{exprloc},
1453 \livelink{chap:classreference}{reference}
1454 \addtoindexx{associated attribute} \\
1455 \DWATdatalocation&0x50&\livelink{chap:classexprloc}{exprloc}
1456 \addtoindexx{data location attribute} \\
1457 \DWATbytestride&0x51&\livelink{chap:classconstant}{constant},
1458 \livelink{chap:classexprloc}{exprloc},
1459 \livelink{chap:classreference}{reference}
1460 \addtoindexx{byte stride attribute} \\
1461 \DWATentrypc&0x52&\livelink{chap:classaddress}{address},
1462 \livelink{chap:classconstant}{constant}
1463 \addtoindexx{entry PC attribute} \\
1464 \DWATuseUTFeight&0x53&\livelink{chap:classflag}{flag}
1465 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8} \\
1466 \DWATextension&0x54&\livelink{chap:classreference}{reference}
1467 \addtoindexx{extension attribute} \\
1468 \DWATranges&0x55&\livelink{chap:classrangelistptr}{rangelistptr}
1469 \addtoindexx{ranges attribute} \\
1470 \DWATtrampoline&0x56&\livelink{chap:classaddress}{address},
1471 \livelink{chap:classflag}{flag},
1472 \livelink{chap:classreference}{reference},
1473 \livelink{chap:classstring}{string}
1474 \addtoindexx{trampoline attribute} \\
1475 \DWATcallcolumn&0x57&\livelink{chap:classconstant}{constant}
1476 \addtoindexx{call column attribute} \\
1477 \DWATcallfile&0x58&\livelink{chap:classconstant}{constant}
1478 \addtoindexx{call file attribute} \\
1479 \DWATcallline&0x59&\livelink{chap:classconstant}{constant}
1480 \addtoindexx{call line attribute} \\
1481 \DWATdescription&0x5a&\livelink{chap:classstring}{string}
1482 \addtoindexx{description attribute} \\
1483 \DWATbinaryscale&0x5b&\livelink{chap:classconstant}{constant}
1484 \addtoindexx{binary scale attribute} \\
1485 \DWATdecimalscale&0x5c&\livelink{chap:classconstant}{constant}
1486 \addtoindexx{decimal scale attribute} \\
1487 \DWATsmall{} &0x5d&\livelink{chap:classreference}{reference}
1488 \addtoindexx{small attribute} \\
1489 \DWATdecimalsign&0x5e&\livelink{chap:classconstant}{constant}
1490 \addtoindexx{decimal scale attribute} \\
1491 \DWATdigitcount&0x5f&\livelink{chap:classconstant}{constant}
1492 \addtoindexx{digit count attribute} \\
1493 \DWATpicturestring&0x60&\livelink{chap:classstring}{string}
1494 \addtoindexx{picture string attribute} \\
1495 \DWATmutable&0x61&\livelink{chap:classflag}{flag}
1496 \addtoindexx{mutable attribute} \\
1497 \DWATthreadsscaled&0x62&\livelink{chap:classflag}{flag}
1498 \addtoindexx{thread scaled attribute} \\
1499 \DWATexplicit&0x63&\livelink{chap:classflag}{flag}
1500 \addtoindexx{explicit attribute} \\
1501 \DWATobjectpointer&0x64&\livelink{chap:classreference}{reference}
1502 \addtoindexx{object pointer attribute} \\
1503 \DWATendianity&0x65&\livelink{chap:classconstant}{constant}
1504 \addtoindexx{endianity attribute} \\
1505 \DWATelemental&0x66&\livelink{chap:classflag}{flag}
1506 \addtoindexx{elemental attribute} \\
1507 \DWATpure&0x67&\livelink{chap:classflag}{flag}
1508 \addtoindexx{pure attribute} \\
1509 \DWATrecursive&0x68&\livelink{chap:classflag}{flag}
1510 \addtoindexx{recursive attribute} \\
1511 \DWATsignature{} &0x69&\livelink{chap:classreference}{reference}
1512 \addtoindexx{signature attribute} \\
1513 \DWATmainsubprogram{} &0x6a&\livelink{chap:classflag}{flag}
1514 \addtoindexx{main subprogram attribute} \\
1515 \DWATdatabitoffset{} &0x6b&\livelink{chap:classconstant}{constant}
1516 \addtoindexx{data bit offset attribute} \\
1517 \DWATconstexpr{} &0x6c&\livelink{chap:classflag}{flag}
1518 \addtoindexx{constant expression attribute} \\
1519 \DWATenumclass{} &0x6d&\livelink{chap:classflag}{flag}
1520 \addtoindexx{enumeration class attribute} \\
1521 \DWATlinkagename{} &0x6e&\livelink{chap:classstring}{string}
1522 \addtoindexx{linkage name attribute} \\
1523 \DWATstringlengthbitsize{}~\ddag&0x6f&
1524 \livelink{chap:classconstant}{constant}
1525 \addtoindexx{string length attribute!size of length} \\
1526 \DWATstringlengthbytesize{}~\ddag&0x70&
1527 \livelink{chap:classconstant}{constant}
1528 \addtoindexx{string length attribute!size of length} \\
1529 \DWATrank~\ddag&0x71&
1530 \livelink{chap:classconstant}{constant},
1531 \livelink{chap:classexprloc}{exprloc}
1532 \addtoindexx{rank attribute} \\
1533 \DWATstroffsetsbase~\ddag&0x72&
1534 \livelinki{chap:classstroffsetsptr}{stroffsetsptr}{stroffsetsptr class}
1535 \addtoindexx{string offsets base!encoding} \\
1536 \DWATaddrbase~\ddag &0x73&
1537 \livelinki{chap:classaddrptr}{addrptr}{addrptr class}
1538 \addtoindexx{address table base!encoding} \\
1539 \DWATrangesbase~\ddag&0x74&
1540 \livelinki{chap:classrangelistptr}{rangelistptr}{rangelistptr class}
1541 \addtoindexx{ranges base!encoding} \\
1542 \DWATdwoid~\ddag &0x75&
1543 \livelink{chap:classconstant}{constant}
1544 \addtoindexx{split DWARF object file id!encoding} \\
1545 \DWATdwoname~\ddag &0x76&
1546 \livelink{chap:classstring}{string}
1547 \addtoindexx{split DWARF object file name!encoding} \\
1548 \DWATreference~\ddag &0x77&
1549 \livelink{chap:classflag}{flag} \\
1550 \DWATrvaluereference~\ddag &0x78&
1551 \livelink{chap:classflag}{flag} \\
1552 \DWATmacros~\ddag &0x79&\livelink{chap:classmacptr}{macptr}
1553 \addtoindexx{macro information attribute} \\
1554 \DWATcallallcalls~\ddag &0x7a&\CLASSflag
1555 \addtoindexx{all calls summary attribute} \\
1556 \DWATcallallsourcecalls~\ddag &0x7b &\CLASSflag
1557 \addtoindexx{all source calls summary attribute} \\
1558 \DWATcallalltailcalls~\ddag &0x7c&\CLASSflag
1559 \addtoindexx{all tail calls summary attribute} \\
1560 \DWATcallreturnpc~\ddag &0x7d &\CLASSaddress
1561 \addtoindexx{call return PC attribute} \\
1562 \DWATcallvalue~\ddag &0x7e &\CLASSexprloc
1563 \addtoindexx{call value attribute} \\
1564 \DWATcallorigin~\ddag &0x7f &\CLASSexprloc
1565 \addtoindexx{call origin attribute} \\
1566 \DWATcallparameter~\ddag &0x80 &\CLASSreference
1567 \addtoindexx{call parameter attribute} \\
1568 \DWATcallpc~\ddag &0x81 &\CLASSaddress
1569 \addtoindexx{call PC attribute} \\
1570 \DWATcalltailcall~\ddag &0x82 &\CLASSflag
1571 \addtoindexx{call tail call attribute} \\
1572 \DWATcalltarget~\ddag &0x83 &\CLASSexprloc
1573 \addtoindexx{call target attribute} \\
1574 \DWATcalltargetclobbered~\ddag &0x84 &\CLASSexprloc
1575 \addtoindexx{call target clobbered attribute} \\
1576 \DWATcalldatalocation~\ddag &0x85 &\CLASSexprloc
1577 \addtoindexx{call data location attribute} \\
1578 \DWATcalldatavalue~\ddag &0x86 &\CLASSexprloc
1579 \addtoindexx{call data value attribute} \\
1580 \DWATnoreturn~\ddag &0x87 &\CLASSflag
1581 \addtoindexx{noreturn attribute} \\
1582 \DWATalignment~\ddag &0x88 &\CLASSconstant
1583 \addtoindexx{alignment attribute} \\
1584 \DWATexportsymbols~\ddag &0x89 &\CLASSflag
1585 \addtoindexx{export symbols attribute} \\
1586 \DWATdeleted~\ddag &0x8a &\CLASSflag \addtoindexx{deleted attribute} \\
1587 \DWATdefaulted~\ddag &0x8b &\CLASSconstant \addtoindexx{defaulted attribute} \\
1588 \DWATlouser&0x2000 & --- \addtoindexx{low user attribute encoding} \\
1589 \DWAThiuser&\xiiifff& --- \addtoindexx{high user attribute encoding} \\
1594 The attribute form governs how the value of the attribute is
1595 encoded. There are nine classes of form, listed below. Each
1596 class is a set of forms which have related representations
1597 and which are given a common interpretation according to the
1598 attribute in which the form is used.
1600 Form \DWFORMsecoffsetTARG{}
1602 \addtoindexx{rangelistptr class}
1604 \addtoindexx{macptr class}
1606 \addtoindexx{loclistptr class}
1608 \addtoindexx{lineptr class}
1614 \CLASSrangelistptr{} or
1615 \CLASSstroffsetsptr;
1616 the list of classes allowed by the applicable attribute in
1617 Table \refersec{tab:attributeencodings}
1618 determines the class of the form.
1621 In the form descriptions that follow, some forms are said
1622 to depend in part on the value of an attribute of the
1623 \definition{\associatedcompilationunit}:
1626 In the case of a \splitDWARFobjectfile{}, the associated
1627 compilation unit is the skeleton compilation unit corresponding
1628 to the containing unit.
1629 \item Otherwise, the associated compilation unit
1630 is the containing unit.
1634 Each possible form belongs to one or more of the following classes
1635 (see Table \refersec{tab:classesofattributevalue} for a summary of
1636 the purpose and general usage of each class):
1639 \item \livelinki{chap:classaddress}{address}{address class} \\
1640 \livetarg{datarep:classaddress}{}
1641 Represented as either:
1643 \item An object of appropriate size to hold an
1644 address on the target machine
1646 The size is encoded in the compilation unit header
1647 (see Section \refersec{datarep:compilationunitheader}).
1648 This address is relocatable in a relocatable object file and
1649 is relocated in an executable file or shared object file.
1651 \item An indirect index into a table of addresses (as
1652 described in the previous bullet) in the
1653 \dotdebugaddr{} section (\DWFORMaddrxTARG).
1654 The representation of a \DWFORMaddrxNAME{} value is an unsigned
1655 \addtoindex{LEB128} value, which is interpreted as a zero-based
1656 index into an array of addresses in the \dotdebugaddr{} section.
1657 The index is relative to the value of the \DWATaddrbase{} attribute
1658 of the associated compilation unit.
1663 \item \livelink{chap:classaddrptr}{addrptr} \\
1664 \livetarg{datarep:classaddrptr}{}
1665 This is an offset into the \dotdebugaddr{} section (\DWFORMsecoffset). It
1666 consists of an offset from the beginning of the \dotdebugaddr{} section to the
1667 beginning of the list of machine addresses information for the
1668 referencing entity. It is relocatable in
1669 a relocatable object file, and relocated in an executable or
1670 shared object file. In the \thirtytwobitdwarfformat, this offset
1671 is a 4-byte unsigned value; in the 64-bit DWARF
1672 format, it is an 8-byte unsigned value (see Section
1673 \refersec{datarep:32bitand64bitdwarfformats}).
1675 \textit{This class is new in \DWARFVersionV.}
1678 \item \livelink{chap:classblock}{block} \\
1679 \livetarg{datarep:classblock}{}
1680 Blocks come in four forms:
1683 A 1-byte length followed by 0 to 255 contiguous information
1684 bytes (\DWFORMblockoneTARG).
1687 A 2-byte length followed by 0 to 65,535 contiguous information
1688 bytes (\DWFORMblocktwoTARG).
1691 A 4-byte length followed by 0 to 4,294,967,295 contiguous
1692 information bytes (\DWFORMblockfourTARG).
1695 An unsigned LEB128\addtoindexx{LEB128!unsigned}
1696 length followed by the number of bytes
1697 specified by the length (\DWFORMblockTARG).
1700 In all forms, the length is the number of information bytes
1701 that follow. The information bytes may contain any mixture
1702 of relocated (or relocatable) addresses, references to other
1703 debugging information entries or data bytes.
1705 \item \livelinki{chap:classconstant}{constant}{constant class} \\
1706 \livetarg{datarep:classconstant}{}
1707 There are eight forms of constants. There are fixed length
1708 constant data forms for one-, two-, four-, eight- and sixteen-byte values
1712 \DWFORMdatafourTARG,
1713 \DWFORMdataeightTARG{} and
1714 \DWFORMdatasixteenTARG).
1715 There are also variable length constant
1716 data forms encoded using LEB128 numbers (see below).
1717 Both signed (\DWFORMsdataTARG) and unsigned
1718 (\DWFORMudataTARG) variable length constants are available.
1719 There is also an implicit constant (\DWFORMimplicitconst),
1720 whose value is provided as part of the abbreviation
1724 The data in \DWFORMdataone,
1727 \DWFORMdataeight{} and
1728 \DWFORMdatasixteen{}
1729 can be anything. Depending on context, it may
1730 be a signed integer, an unsigned integer, a floating\dash point
1731 constant, or anything else. A consumer must use context to
1732 know how to interpret the bits, which if they are target
1733 machine data (such as an integer or floating-point constant)
1734 will be in target machine \byteorder.
1736 \textit{If one of the \DWFORMdataTARG\textless n\textgreater
1737 forms is used to represent a
1738 signed or unsigned integer, it can be hard for a consumer
1739 to discover the context necessary to determine which
1740 interpretation is intended. Producers are therefore strongly
1741 encouraged to use \DWFORMsdata{} or
1742 \DWFORMudata{} for signed and
1743 unsigned integers respectively, rather than
1744 \DWFORMdata\textless n\textgreater.}
1747 \item \livelinki{chap:classexprloc}{exprloc}{exprloc class} \\
1748 \livetarg{datarep:classexprloc}{}
1749 This is an unsigned LEB128\addtoindexx{LEB128!unsigned} length followed by the
1750 number of information bytes specified by the length
1751 (\DWFORMexprlocTARG).
1752 The information bytes contain a DWARF expression
1753 (see Section \refersec{chap:dwarfexpressions})
1754 or location description
1755 (see Section \refersec{chap:locationdescriptions}).
1758 \item \livelinki{chap:classflag}{flag}{flag class} \\
1759 \livetarg{datarep:classflag}{}
1760 A flag \addtoindexx{flag class}
1761 is represented explicitly as a single byte of data
1762 (\DWFORMflagTARG) or
1763 implicitly (\DWFORMflagpresentTARG).
1765 first case, if the \nolink{flag} has value zero, it indicates the
1766 absence of the attribute; if the \nolink{flag} has a non\dash zero value,
1767 it indicates the presence of the attribute. In the second
1768 case, the attribute is implicitly indicated as present, and
1769 no value is encoded in the debugging information entry itself.
1771 \item \livelinki{chap:classlineptr}{lineptr}{lineptr class} \\
1772 \livetarg{datarep:classlineptr}{}
1773 This is an offset into
1774 \addtoindexx{section offset!in class lineptr value}
1776 \dotdebugline{} or \dotdebuglinedwo{} section
1778 It consists of an offset from the beginning of the
1780 section to the first byte of
1781 the data making up the line number list for the compilation
1783 It is relocatable in a relocatable object file, and
1784 relocated in an executable or shared object file. In the
1785 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
1786 in the \sixtyfourbitdwarfformat, it is an 8-byte unsigned value
1787 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1790 \item \livelinki{chap:classloclistptr}{loclistptr}{loclistptr class} \\
1791 \livetarg{datarep:classloclistptr}{}
1792 This is an offset into the
1796 It consists of an offset from the
1797 \addtoindexx{section offset!in class loclistptr value}
1800 section to the first byte of
1801 the data making up the
1802 \addtoindex{location list} for the compilation unit.
1803 It is relocatable in a relocatable object file, and
1804 relocated in an executable or shared object file. In the
1805 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
1806 in the \sixtyfourbitdwarfformat, it is an 8-byte unsigned value
1807 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1810 \item \livelinki{chap:classmacptr}{macptr}{macptr class} \\
1811 \livetarg{datarep:classmacptr}{}
1813 \addtoindexx{section offset!in class macptr value}
1815 \dotdebugmacro{} or \dotdebugmacrodwo{} section
1817 It consists of an offset from the beginning of the
1818 \dotdebugmacro{} or \dotdebugmacrodwo{}
1819 section to the the header making up the
1820 macro information list for the compilation unit.
1821 It is relocatable in a relocatable object file, and
1822 relocated in an executable or shared object file. In the
1823 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
1824 in the \sixtyfourbitdwarfformat, it is an 8-byte unsigned value
1825 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1828 \item \livelinki{chap:classrangelistptr}{rangelistptr}{rangelistptr class} \\
1829 \livetarg{datarep:classrangelistptr}{}
1831 \addtoindexx{section offset!in class rangelistptr value}
1832 offset into the \dotdebugranges{} section
1835 offset from the beginning of the
1836 \dotdebugranges{} section
1837 to the beginning of the non\dash contiguous address ranges
1838 information for the referencing entity.
1839 It is relocatable in
1840 a relocatable object file, and relocated in an executable or
1842 However, if a \DWATrangesbase{} attribute applies, the offset
1843 is relative to the base offset given by \DWATrangesbase.
1844 In the \thirtytwobitdwarfformat, this offset
1845 is a 4-byte unsigned value; in the 64-bit DWARF
1846 format, it is an 8-byte unsigned value (see Section
1847 \refersec{datarep:32bitand64bitdwarfformats}).
1850 \textit{Because classes
1855 \CLASSrangelistptr{} and
1856 \CLASSstroffsetsptr{}
1857 share a common representation, it is not possible for an
1858 attribute to allow more than one of these classes}
1862 \item \livelinki{chap:classreference}{reference}{reference class} \\
1863 \livetarg{datarep:classreference}{}
1864 There are four types of reference.
1867 \addtoindexx{reference class}
1868 first type of reference can identify any debugging
1869 information entry within the containing unit.
1872 \addtoindexx{section offset!in class reference value}
1873 offset from the first byte of the compilation
1874 header for the compilation unit containing the reference. There
1875 are five forms for this type of reference. There are fixed
1876 length forms for one, two, four and eight byte offsets
1882 and \DWFORMrefeightTARG).
1883 There is also an unsigned variable
1884 length offset encoded form that uses
1885 unsigned LEB128\addtoindexx{LEB128!unsigned} numbers
1886 (\DWFORMrefudataTARG).
1887 Because this type of reference is within
1888 the containing compilation unit no relocation of the value
1891 The second type of reference can identify any debugging
1892 information entry within a
1893 \dotdebuginfo{} section; in particular,
1894 it may refer to an entry in a different compilation unit
1895 from the unit containing the reference, and may refer to an
1896 entry in a different shared object file. This type of reference
1897 (\DWFORMrefaddrTARG)
1898 is an offset from the beginning of the
1900 section of the target executable or shared object file, or, for
1901 references within a \addtoindex{supplementary object file},
1902 an offset from the beginning of the local \dotdebuginfo{} section;
1903 it is relocatable in a relocatable object file and frequently
1904 relocated in an executable or shared object file. For
1905 references from one shared object or static executable file
1906 to another, the relocation and identification of the target
1907 object must be performed by the consumer. In the
1908 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
1909 in the \sixtyfourbitdwarfformat, it is an 8-byte
1911 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1913 \textit{A debugging information entry that may be referenced by
1914 another compilation unit using
1915 \DWFORMrefaddr{} must have a global symbolic name.}
1917 \textit{For a reference from one executable or shared object file to
1918 another, the reference is resolved by the debugger to identify
1919 the executable or shared object file and the offset into that
1920 file\textquoteright s \dotdebuginfo{}
1921 section in the same fashion as the run
1922 time loader, either when the debug information is first read,
1923 or when the reference is used.}
1925 The third type of reference can identify any debugging
1926 information type entry that has been placed in its own
1927 \addtoindex{type unit}. This type of
1928 reference (\DWFORMrefsigeightTARG) is the
1929 \addtoindexx{type signature}
1930 8-byte type signature
1931 (see Section \refersec{datarep:typesignaturecomputation})
1932 that was computed for the type.
1934 The fourth type of reference is a reference from within the
1935 \dotdebuginfo{} section of the executable or shared object file to
1936 a debugging information entry in the \dotdebuginfo{} section of
1937 a \addtoindex{supplementary object file}.
1938 This type of reference (\DWFORMrefsupTARG) is an offset from the
1939 beginning of the \dotdebuginfo{} section in the
1940 \addtoindex{supplementary object file}.
1942 \textit{The use of compilation unit relative references will reduce the
1943 number of link\dash time relocations and so speed up linking. The
1944 use of the second, third and fourth type of reference allows for the
1945 sharing of information, such as types, across compilation
1946 units, while the fourth type further allows for sharing of information
1947 across compilation units from different executables or shared object files.}
1949 \textit{A reference to any kind of compilation unit identifies the
1950 debugging information entry for that unit, not the preceding
1954 \item \livelinki{chap:classstring}{string}{string class} \\
1955 \livetarg{datarep:classstring}{}
1956 A string is a sequence of contiguous non\dash null bytes followed by
1958 \addtoindexx{string class}
1959 A string may be represented:
1961 \setlength{\itemsep}{0em}
1962 \item immediately in the debugging information entry itself
1963 (\DWFORMstringTARG),
1966 \addtoindexx{section offset!in class string value}
1967 offset into a string table contained in
1968 the \dotdebugstr{} section of the object file (\DWFORMstrpTARG),
1969 the \dotdebuglinestr{} section of the object file (\DWFORMlinestrpTARG),
1970 or as an offset into a string table contained in the
1971 \dotdebugstr{} section of a \addtoindex{supplementary object file}
1972 (\DWFORMstrpsupTARG). \DWFORMstrpsupNAME{} offsets from the \dotdebuginfo{}
1973 section of a \addtoindex{supplementary object file}
1974 refer to the local \dotdebugstr{} section of that same file.
1975 In the \thirtytwobitdwarfformat, the representation of a
1976 \DWFORMstrpNAME{}, \DWFORMstrpNAME{} or \DWFORMstrpsupNAME{}
1977 value is a 4-byte unsigned offset; in the \sixtyfourbitdwarfformat,
1978 it is an 8-byte unsigned offset
1979 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1982 \item as an indirect offset into the string table using an
1983 index into a table of offsets contained in the
1984 \dotdebugstroffsets{} section of the object file (\DWFORMstrxTARG).
1985 The representation of a \DWFORMstrxNAME{} value is an unsigned
1986 \addtoindex{LEB128} value, which is interpreted as a zero-based
1987 index into an array of offsets in the \dotdebugstroffsets{} section.
1988 The offset entries in the \dotdebugstroffsets{} section have the
1989 same representation as \DWFORMstrp{} values.
1991 Any combination of these three forms may be used within a single compilation.
1993 If the \DWATuseUTFeight{}
1994 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8} attribute is specified for the
1995 compilation, partial, skeleton or type unit entry, string values are encoded using the
1996 UTF\dash 8 (\addtoindex{Unicode} Transformation Format\dash 8) from the Universal
1997 Character Set standard (ISO/IEC 10646\dash 1:1993).
1998 \addtoindexx{ISO 10646 character set standard}
1999 Otherwise, the string representation is unspecified.
2001 \textit{The \addtoindex{Unicode} Standard Version 3 is fully compatible with
2002 ISO/IEC 10646\dash 1:1993.
2003 \addtoindexx{ISO 10646 character set standard}
2004 It contains all the same characters
2005 and encoding points as ISO/IEC 10646, as well as additional
2006 information about the characters and their use.}
2008 \textit{Earlier versions of DWARF did not specify the representation
2009 of strings; for compatibility, this version also does
2010 not. However, the UTF\dash 8 representation is strongly recommended.}
2013 \item \livelinki{chap:classstroffsetsptr}{stroffsetsptr}{stroffsetsptr class} \\
2014 \livetarg{datarep:classstroffsetsptr}{}
2015 This is an offset into the \dotdebugstroffsets{} section
2016 (\DWFORMsecoffset). It consists of an offset from the beginning of the
2017 \dotdebugstroffsets{} section to the
2018 beginning of the string offsets information for the
2019 referencing entity. It is relocatable in
2020 a relocatable object file, and relocated in an executable or
2021 shared object file. In the \thirtytwobitdwarfformat, this offset
2022 is a 4-byte unsigned value; in the \sixtyfourbitdwarfformat,
2023 it is an 8-byte unsigned value (see Section
2024 \refersec{datarep:32bitand64bitdwarfformats}).
2026 \textit{This class is new in \DWARFVersionV.}
2030 In no case does an attribute use one of the classes
2035 \CLASSrangelistptr{} or
2036 \CLASSstroffsetsptr{}
2037 to point into either the
2038 \dotdebuginfo{} or \dotdebugstr{} section.
2040 The form encodings are listed in
2041 Table \referfol{tab:attributeformencodings}.
2045 \setlength{\extrarowheight}{0.1cm}
2046 \begin{longtable}{l|c|l}
2047 \caption{Attribute form encodings} \label{tab:attributeformencodings} \\
2048 \hline \bfseries Form name&\bfseries Value &\bfseries Classes \\ \hline
2050 \bfseries Form name&\bfseries Value &\bfseries Classes\\ \hline
2052 \hline \emph{Continued on next page}
2054 \hline \ddag\ \textit{New in DWARF Version 5}
2057 \DWFORMaddr &0x01&\livelink{chap:classaddress}{address} \\
2058 \textit{Reserved} &0x02& \\
2059 \DWFORMblocktwo &0x03&\livelink{chap:classblock}{block} \\
2060 \DWFORMblockfour &0x04&\livelink{chap:classblock}{block} \\
2061 \DWFORMdatatwo &0x05&\livelink{chap:classconstant}{constant} \\
2062 \DWFORMdatafour &0x06&\livelink{chap:classconstant}{constant} \\
2063 \DWFORMdataeight &0x07&\livelink{chap:classconstant}{constant} \\
2064 \DWFORMstring&0x08&\livelink{chap:classstring}{string} \\
2065 \DWFORMblock&0x09&\livelink{chap:classblock}{block} \\
2066 \DWFORMblockone &0x0a&\livelink{chap:classblock}{block} \\
2067 \DWFORMdataone &0x0b&\livelink{chap:classconstant}{constant} \\
2068 \DWFORMflag&0x0c&\livelink{chap:classflag}{flag} \\
2069 \DWFORMsdata&0x0d&\livelink{chap:classconstant}{constant} \\
2070 \DWFORMstrp&0x0e&\livelink{chap:classstring}{string} \\
2071 \DWFORMudata&0x0f&\livelink{chap:classconstant}{constant} \\
2072 \DWFORMrefaddr&0x10&\livelink{chap:classreference}{reference} \\
2073 \DWFORMrefone&0x11&\livelink{chap:classreference}{reference} \\
2074 \DWFORMreftwo&0x12&\livelink{chap:classreference}{reference} \\
2075 \DWFORMreffour&0x13&\livelink{chap:classreference}{reference} \\
2076 \DWFORMrefeight&0x14&\livelink{chap:classreference}{reference} \\
2077 \DWFORMrefudata&0x15&\livelink{chap:classreference}{reference} \\
2078 \DWFORMindirect&0x16&(see Section \refersec{datarep:abbreviationstables}) \\
2079 \DWFORMsecoffset{} &0x17& \CLASSaddrptr, \CLASSlineptr, \CLASSloclistptr, \\
2080 & & \CLASSmacptr, \CLASSrangelistptr, \CLASSstroffsetsptr \\
2081 \DWFORMexprloc{} &0x18&\livelink{chap:classexprloc}{exprloc} \\
2082 \DWFORMflagpresent{} &0x19&\livelink{chap:classflag}{flag} \\
2083 \DWFORMstrx{} \ddag &0x1a&\livelink{chap:classstring}{string} \\
2084 \DWFORMaddrx{} \ddag &0x1b&\livelink{chap:classaddress}{address} \\
2085 \DWFORMrefsup{}~\ddag &0x1c &\livelink{chap:classreference}{reference} \\
2086 \DWFORMstrpsup{}~\ddag &0x1d &\livelink{chap:classstring}{string} \\
2087 \DWFORMdatasixteen~\ddag &0x1e &\CLASSconstant \\
2088 \DWFORMlinestrp~\ddag &0x1f &\CLASSstring \\
2089 \DWFORMrefsigeight &0x20 &\livelink{chap:classreference}{reference} \\
2090 \DWFORMimplicitconst~\ddag &0x21 &\CLASSconstant \\
2096 \section{Variable Length Data}
2097 \label{datarep:variablelengthdata}
2098 \addtoindexx{variable length data|see {LEB128}}
2100 \addtoindexx{Little Endian Base 128|see{LEB128}}
2101 encoded using \doublequote{Little Endian Base 128}
2102 \addtoindexx{little-endian encoding|see{endian attribute}}
2104 \addtoindexx{LEB128}
2105 LEB128 is a scheme for encoding integers
2106 densely that exploits the assumption that most integers are
2109 \textit{This encoding is equally suitable whether the target machine
2110 architecture represents data in big-endian or little-endian
2111 \byteorder. It is \doublequote{little-endian} only in the sense that it
2112 avoids using space to represent the \doublequote{big} end of an
2113 unsigned integer, when the big end is all zeroes or sign
2116 Unsigned LEB128\addtoindexx{LEB128!unsigned} (\addtoindex{ULEB128})
2117 numbers are encoded as follows:
2118 \addtoindexx{LEB128!unsigned, encoding as}
2119 start at the low order end of an unsigned integer and chop
2120 it into 7-bit chunks. Place each chunk into the low order 7
2121 bits of a byte. Typically, several of the high order bytes
2122 will be zero; discard them. Emit the remaining bytes in a
2123 stream, starting with the low order byte; set the high order
2124 bit on each byte except the last emitted byte. The high bit
2125 of zero on the last byte indicates to the decoder that it
2126 has encountered the last byte.
2128 The integer zero is a special case, consisting of a single
2131 Table \refersec{tab:examplesofunsignedleb128encodings}
2132 gives some examples of unsigned LEB128\addtoindexx{LEB128!unsigned}
2134 0x80 in each case is the high order bit of the byte, indicating
2135 that an additional byte follows.
2138 The encoding for signed, two\textquoteright{s} complement LEB128
2139 (\addtoindex{SLEB128}) \addtoindexx{LEB128!signed, encoding as}
2140 numbers is similar, except that the criterion for discarding
2141 high order bytes is not whether they are zero, but whether
2142 they consist entirely of sign extension bits. Consider the
2143 4-byte integer -2. The three high level bytes of the number
2144 are sign extension, thus LEB128 would represent it as a single
2145 byte containing the low order 7 bits, with the high order
2146 bit cleared to indicate the end of the byte stream. Note
2147 that there is nothing within the LEB128 representation that
2148 indicates whether an encoded number is signed or unsigned. The
2149 decoder must know what type of number to expect.
2150 Table \refersec{tab:examplesofunsignedleb128encodings}
2151 gives some examples of unsigned LEB128\addtoindexx{LEB128!unsigned}
2152 numbers and Table \refersec{tab:examplesofsignedleb128encodings}
2153 gives some examples of signed LEB128\addtoindexx{LEB128!signed}
2156 \textit{Appendix \refersec{app:variablelengthdataencodingdecodinginformative}
2157 \addtoindexx{LEB128!examples}
2158 gives algorithms for encoding and decoding these forms.}
2162 \setlength{\extrarowheight}{0.1cm}
2163 \begin{longtable}{c|c|c}
2164 \caption{Examples of unsigned LEB128 encodings}
2165 \label{tab:examplesofunsignedleb128encodings}
2166 \addtoindexx{LEB128 encoding!examples}\addtoindexx{LEB128!unsigned} \\
2167 \hline \bfseries Number&\bfseries First byte &\bfseries Second byte \\ \hline
2169 \bfseries Number&\bfseries First Byte &\bfseries Second byte\\ \hline
2171 \hline \emph{Continued on next page}
2177 128& 0 + 0x80 & 1 \\
2178 129& 1 + 0x80 & 1 \\
2179 %130& 2 + 0x80 & 1 \\
2180 12857& 57 + 0x80 & 100 \\
2187 \setlength{\extrarowheight}{0.1cm}
2188 \begin{longtable}{c|c|c}
2189 \caption{Examples of signed LEB128 encodings}
2190 \label{tab:examplesofsignedleb128encodings}
2191 \addtoindexx{LEB128!signed} \\
2192 \hline \bfseries Number&\bfseries First byte &\bfseries Second byte \\ \hline
2194 \bfseries Number&\bfseries First Byte &\bfseries Second byte\\ \hline
2196 \hline \emph{Continued on next page}
2202 127& 127 + 0x80 & 0 \\
2203 -127& 1 + 0x80 & 0x7f \\
2204 128& 0 + 0x80 & 1 \\
2205 -128& 0 + 0x80 & 0x7f \\
2206 129& 1 + 0x80 & 1 \\
2207 -129& 0x7f + 0x80 & 0x7e \\
2214 \section{DWARF Expressions and Location Descriptions}
2215 \label{datarep:dwarfexpressionsandlocationdescriptions}
2216 \subsection{DWARF Expressions}
2217 \label{datarep:dwarfexpressions}
2220 \addtoindexx{DWARF expression!operator encoding}
2221 DWARF expression is stored in a \nolink{block} of contiguous
2222 bytes. The bytes form a sequence of operations. Each operation
2223 is a 1-byte code that identifies that operation, followed by
2224 zero or more bytes of additional data. The encodings for the
2225 operations are described in
2226 Table \refersec{tab:dwarfoperationencodings}.
2229 \setlength{\extrarowheight}{0.1cm}
2230 \begin{longtable}{l|c|c|l}
2231 \caption{DWARF operation encodings} \label{tab:dwarfoperationencodings} \\
2232 \hline & &\bfseries No. of &\\
2233 \bfseries Operation&\bfseries Code &\bfseries Operands &\bfseries Notes\\ \hline
2235 & &\bfseries No. of &\\
2236 \bfseries Operation&\bfseries Code &\bfseries Operands &\bfseries Notes\\ \hline
2238 \hline \emph{Continued on next page}
2240 \hline \ddag\ \textit{New in DWARF Version 5}
2243 \DWOPaddr&0x03&1 & constant address \\
2244 & & &(size is target specific) \\
2246 \DWOPderef&0x06&0 & \\
2248 \DWOPconstoneu&0x08&1&1-byte constant \\
2249 \DWOPconstones&0x09&1&1-byte constant \\
2250 \DWOPconsttwou&0x0a&1&2-byte constant \\
2251 \DWOPconsttwos&0x0b&1&2-byte constant \\
2252 \DWOPconstfouru&0x0c&1&4-byte constant \\
2253 \DWOPconstfours&0x0d&1&4-byte constant \\
2254 \DWOPconsteightu&0x0e&1&8-byte constant \\
2255 \DWOPconsteights&0x0f&1&8-byte constant \\
2256 \DWOPconstu&0x10&1&ULEB128 constant \\
2257 \DWOPconsts&0x11&1&SLEB128 constant \\
2258 \DWOPdup&0x12&0 & \\
2259 \DWOPdrop&0x13&0 & \\
2260 \DWOPover&0x14&0 & \\
2261 \DWOPpick&0x15&1&1-byte stack index \\
2262 \DWOPswap&0x16&0 & \\
2263 \DWOProt&0x17&0 & \\
2264 \DWOPxderef&0x18&0 & \\
2265 \DWOPabs&0x19&0 & \\
2266 \DWOPand&0x1a&0 & \\
2267 \DWOPdiv&0x1b&0 & \\
2268 \DWOPminus&0x1c&0 & \\
2269 \DWOPmod&0x1d&0 & \\
2270 \DWOPmul&0x1e&0 & \\
2271 \DWOPneg&0x1f&0 & \\
2272 \DWOPnot&0x20&0 & \\
2274 \DWOPplus&0x22&0 & \\
2275 \DWOPplusuconst&0x23&1&ULEB128 addend \\
2276 \DWOPshl&0x24&0 & \\
2277 \DWOPshr&0x25&0 & \\
2278 \DWOPshra&0x26&0 & \\
2279 \DWOPxor&0x27&0 & \\
2281 \DWOPbra&0x28&1 & signed 2-byte constant \\
2288 \DWOPskip&0x2f&1&signed 2-byte constant \\ \hline
2290 \DWOPlitzero & 0x30 & 0 & \\
2291 \DWOPlitone & 0x31 & 0& literals 0 .. 31 = \\
2292 \ldots & & &\hspace{0.3cm}(\DWOPlitzero{} + literal) \\
2293 \DWOPlitthirtyone & 0x4f & 0 & \\ \hline
2295 \DWOPregzero & 0x50 & 0 & \\*
2296 \DWOPregone & 0x51 & 0® 0 .. 31 = \\*
2297 \ldots & & &\hspace{0.3cm}(\DWOPregzero{} + regnum) \\*
2298 \DWOPregthirtyone & 0x6f & 0 & \\ \hline
2300 \DWOPbregzero & 0x70 &1 & SLEB128 offset \\*
2301 \DWOPbregone & 0x71 & 1 &base register 0 .. 31 = \\*
2302 ... & & &\hspace{0.3cm}(\DWOPbregzero{} + regnum) \\*
2303 \DWOPbregthirtyone & 0x8f & 1 & \\ \hline
2305 \DWOPregx{} & 0x90 &1&ULEB128 register \\
2306 \DWOPfbreg{} & 0x91&1&SLEB128 offset \\
2307 \DWOPbregx{} & 0x92&2 &ULEB128 register, \\*
2308 & & &SLEB128 offset \\
2309 \DWOPpiece{} & 0x93 &1& ULEB128 size of piece \\
2310 \DWOPderefsize{} & 0x94 &1& 1-byte size of data retrieved \\
2311 \DWOPxderefsize{} & 0x95&1&1-byte size of data retrieved \\
2312 \DWOPnop{} & 0x96 &0& \\
2314 \DWOPpushobjectaddress&0x97&0 & \\
2315 \DWOPcalltwo&0x98&1& 2-byte offset of DIE \\
2316 \DWOPcallfour&0x99&1& 4-byte offset of DIE \\
2317 \DWOPcallref&0x9a&1& 4\dash\ or 8-byte offset of DIE \\
2318 \DWOPformtlsaddress&0x9b &0& \\
2319 \DWOPcallframecfa{} &0x9c &0& \\
2320 \DWOPbitpiece&0x9d &2&ULEB128 size, \\*
2322 \DWOPimplicitvalue{} &0x9e &2&ULEB128 size, \\*
2323 &&&\nolink{block} of that size\\
2324 \DWOPstackvalue{} &0x9f &0& \\
2325 \DWOPimplicitpointer{}~\ddag &0xa0& 2 &4- or 8-byte offset of DIE, \\*
2326 &&&SLEB128 constant offset \\
2327 \DWOPaddrx~\ddag&0xa1&1&ULEB128 indirect address \\
2328 \DWOPconstx~\ddag&0xa2&1&ULEB128 indirect constant \\
2329 \DWOPentryvalue~\ddag&0xa3&2&ULEB128 size, \\*
2330 &&&\nolink{block} of that size\\
2331 \DWOPconsttype~\ddag & 0xa4 & 3 & ULEB128 type entry offset,\\*
2332 & & & 1-byte size, \\*
2333 & & & constant value \\
2334 \DWOPregvaltype~\ddag & 0xa5 & 2 & ULEB128 register number, \\*
2335 &&& ULEB128 constant offset \\
2336 \DWOPdereftype~\ddag & 0xa6 & 2 & 1-byte size, \\*
2337 &&& ULEB128 type entry offset \\
2338 \DWOPxdereftype~\ddag & 0xa7 & 2 & 1-byte size, \\*
2339 &&& ULEB128 type entry offset \\
2340 \DWOPconvert~\ddag & 0xa8 & 1 & ULEB128 type entry offset \\
2341 \DWOPreinterpret~\ddag & 0xa9 & 1 & ULEB128 type entry offset \\
2342 \DWOPlouser{} &0xe0 && \\
2343 \DWOPhiuser{} &\xff && \\
2349 \subsection{Location Descriptions}
2350 \label{datarep:locationdescriptions}
2352 A location description is used to compute the
2353 location of a variable or other entity.
2355 \subsection{Location Lists}
2356 \label{datarep:locationlists}
2358 Each entry in a \addtoindex{location list} is either a location list entry,
2359 a base address selection entry, or an
2360 \addtoindexx{end-of-list entry!in location list}
2364 \subsubsection{Location List Entries in Non-Split Objects}
2365 A \addtoindex{location list} entry consists of two address offsets followed
2366 by an unsigned 2-byte length, followed by a block of contiguous bytes
2367 that contains a DWARF location description. The length
2368 specifies the number of bytes in that block. The two offsets
2369 are the same size as an address on the target machine.
2372 A base address selection entry and an
2373 \addtoindexx{end-of-list entry!in location list}
2374 end-of-list entry each
2375 consist of two (constant or relocated) address offsets. The two
2376 offsets are the same size as an address on the target machine.
2378 For a \addtoindex{location list} to be specified, the base address of
2379 \addtoindexx{base address selection entry!in location list}
2380 the corresponding compilation unit must be defined
2381 (see Section \refersec{chap:normalandpartialcompilationunitentries}).
2383 \subsubsection{Location List Entries in Split Objects}
2384 \label{datarep:locationlistentriesinsplitobjects}
2385 An alternate form for location list entries is used in split objects.
2386 Each entry begins with an unsigned 1-byte code that indicates the kind of entry
2387 that follows. The encodings for these constants are given in
2388 Table \refersec{tab:locationlistentryencodingvalues}.
2392 \setlength{\extrarowheight}{0.1cm}
2393 \begin{longtable}{l|c}
2394 \caption{Location list entry encoding values} \label{tab:locationlistentryencodingvalues} \\
2395 \hline \bfseries Location list entry encoding name&\bfseries Value \\ \hline
2397 \bfseries Location list entry encoding name&\bfseries Value\\ \hline
2399 \hline \emph{Continued on next page}
2403 \DWLLEendoflistentry & 0x0 \\
2404 \DWLLEbaseaddressselectionentry & 0x01 \\
2405 \DWLLEstartendentry & 0x02 \\
2406 \DWLLEstartlengthentry & 0x03 \\
2407 \DWLLEoffsetpairentry & 0x04 \\
2411 \section{Base Type Attribute Encodings}
2412 \label{datarep:basetypeattributeencodings}
2414 The encodings of the
2415 \hypertarget{chap:DWATencodingencodingofbasetype}{}
2416 constants used in the
2417 \DWATencodingDEFN{} attribute\addtoindexx{encoding attribute}
2419 Table \refersec{tab:basetypeencodingvalues}
2422 \setlength{\extrarowheight}{0.1cm}
2423 \begin{longtable}{l|c}
2424 \caption{Base type encoding values} \label{tab:basetypeencodingvalues} \\
2425 \hline \bfseries Base type encoding name&\bfseries Value \\ \hline
2427 \bfseries Base type encoding name&\bfseries Value\\ \hline
2429 \hline \emph{Continued on next page}
2432 \ddag \ \textit{New in \DWARFVersionV}
2434 \DWATEaddress&0x01 \\
2435 \DWATEboolean&0x02 \\
2436 \DWATEcomplexfloat&0x03 \\
2438 \DWATEsigned&0x05 \\
2439 \DWATEsignedchar&0x06 \\
2440 \DWATEunsigned&0x07 \\
2441 \DWATEunsignedchar&0x08 \\
2442 \DWATEimaginaryfloat&0x09 \\
2443 \DWATEpackeddecimal&0x0a \\
2444 \DWATEnumericstring&0x0b \\
2445 \DWATEedited&0x0c \\
2446 \DWATEsignedfixed&0x0d \\
2447 \DWATEunsignedfixed&0x0e \\
2448 \DWATEdecimalfloat & 0x0f \\
2449 \DWATEUTF{} & 0x10 \\
2450 \DWATEUCS~\ddag & 0x11 \\
2451 \DWATEASCII~\ddag & 0x12 \\
2452 \DWATElouser{} & 0x80 \\
2453 \DWATEhiuser{} & \xff \\
2458 The encodings of the constants used in the
2459 \DWATdecimalsign{} attribute
2461 Table \refersec{tab:decimalsignencodings}.
2464 \setlength{\extrarowheight}{0.1cm}
2465 \begin{longtable}{l|c}
2466 \caption{Decimal sign encodings} \label{tab:decimalsignencodings} \\
2467 \hline \bfseries Decimal sign code name&\bfseries Value \\ \hline
2469 \bfseries Decimal sign code name&\bfseries Value\\ \hline
2471 \hline \emph{Continued on next page}
2476 \DWDSunsigned{} & 0x01 \\
2477 \DWDSleadingoverpunch{} & 0x02 \\
2478 \DWDStrailingoverpunch{} & 0x03 \\
2479 \DWDSleadingseparate{} & 0x04 \\
2480 \DWDStrailingseparate{} & 0x05 \\
2486 The encodings of the constants used in the
2487 \DWATendianity{} attribute are given in
2488 Table \refersec{tab:endianityencodings}.
2491 \setlength{\extrarowheight}{0.1cm}
2492 \begin{longtable}{l|c}
2493 \caption{Endianity encodings} \label{tab:endianityencodings}\\
2494 \hline \bfseries Endian code name&\bfseries Value \\ \hline
2496 \bfseries Endian code name&\bfseries Value\\ \hline
2498 \hline \emph{Continued on next page}
2503 \DWENDdefault{} & 0x00 \\
2504 \DWENDbig{} & 0x01 \\
2505 \DWENDlittle{} & 0x02 \\
2506 \DWENDlouser{} & 0x40 \\
2507 \DWENDhiuser{} & \xff \\
2513 \section{Accessibility Codes}
2514 \label{datarep:accessibilitycodes}
2515 The encodings of the constants used in the
2516 \DWATaccessibility{}
2518 \addtoindexx{accessibility attribute}
2520 Table \refersec{tab:accessibilityencodings}.
2523 \setlength{\extrarowheight}{0.1cm}
2524 \begin{longtable}{l|c}
2525 \caption{Accessibility encodings} \label{tab:accessibilityencodings}\\
2526 \hline \bfseries Accessibility code name&\bfseries Value \\ \hline
2528 \bfseries Accessibility code name&\bfseries Value\\ \hline
2530 \hline \emph{Continued on next page}
2535 \DWACCESSpublic&0x01 \\
2536 \DWACCESSprotected&0x02 \\
2537 \DWACCESSprivate&0x03 \\
2543 \section{Visibility Codes}
2544 \label{datarep:visibilitycodes}
2545 The encodings of the constants used in the
2546 \DWATvisibility{} attribute are given in
2547 Table \refersec{tab:visibilityencodings}.
2550 \setlength{\extrarowheight}{0.1cm}
2551 \begin{longtable}{l|c}
2552 \caption{Visibility encodings} \label{tab:visibilityencodings}\\
2553 \hline \bfseries Visibility code name&\bfseries Value \\ \hline
2555 \bfseries Visibility code name&\bfseries Value\\ \hline
2557 \hline \emph{Continued on next page}
2563 \DWVISexported&0x02 \\
2564 \DWVISqualified&0x03 \\
2569 \section{Virtuality Codes}
2570 \label{datarep:vitualitycodes}
2572 The encodings of the constants used in the
2573 \DWATvirtuality{} attribute are given in
2574 Table \refersec{tab:virtualityencodings}.
2577 \setlength{\extrarowheight}{0.1cm}
2578 \begin{longtable}{l|c}
2579 \caption{Virtuality encodings} \label{tab:virtualityencodings}\\
2580 \hline \bfseries Virtuality code name&\bfseries Value \\ \hline
2582 \bfseries Virtuality code name&\bfseries Value\\ \hline
2584 \hline \emph{Continued on next page}
2589 \DWVIRTUALITYnone&0x00 \\
2590 \DWVIRTUALITYvirtual&0x01 \\
2591 \DWVIRTUALITYpurevirtual&0x02 \\
2598 \DWVIRTUALITYnone{} is equivalent to the absence of the
2602 \section{Source Languages}
2603 \label{datarep:sourcelanguages}
2605 The encodings of the constants used
2606 \addtoindexx{language attribute, encoding}
2608 \addtoindexx{language name encoding}
2611 attribute are given in
2612 Table \refersec{tab:languageencodings}.
2614 % If we don't force a following space it looks odd
2616 and their associated values are reserved, but the
2617 languages they represent are not well supported.
2618 Table \refersec{tab:languageencodings}
2620 \addtoindexx{lower bound attribute!default}
2621 default lower bound, if any, assumed for
2622 an omitted \DWATlowerbound{} attribute in the context of a
2623 \DWTAGsubrangetype{} debugging information entry for each
2627 \setlength{\extrarowheight}{0.1cm}
2628 \begin{longtable}{l|c|c}
2629 \caption{Language encodings} \label{tab:languageencodings}\\
2630 \hline \bfseries Language name&\bfseries Value &\bfseries Default Lower Bound \\ \hline
2632 \bfseries Language name&\bfseries Value &\bfseries Default Lower Bound\\ \hline
2634 \hline \emph{Continued on next page}
2637 \dag \ \textit{See text} \\ \ddag \ \textit{New in \DWARFVersionV}
2639 \addtoindexx{ISO-defined language names}
2641 \DWLANGCeightynine &0x0001 &0 \addtoindexx{C:1989 (ISO)} \\
2642 \DWLANGC{} &0x0002 &0 \addtoindexx{C!non-standard} \\
2643 \DWLANGAdaeightythree{} \dag &0x0003 &1 \addtoindexx{Ada:1983 (ISO)} \\
2644 \DWLANGCplusplus{} &0x0004 &0 \addtoindexx{C++:1998 (ISO)} \\
2645 \DWLANGCobolseventyfour{} \dag &0x0005 &1 \addtoindexx{COBOL:1974 (ISO)} \\
2646 \DWLANGCoboleightyfive{} \dag &0x0006 &1 \addtoindexx{COBOL:1985 (ISO)} \\
2647 \DWLANGFortranseventyseven &0x0007 &1 \addtoindexx{FORTRAN:1977 (ISO)} \\
2648 \DWLANGFortranninety &0x0008 &1 \addtoindexx{Fortran:1990 (ISO)} \\
2649 \DWLANGPascaleightythree &0x0009 &1 \addtoindexx{Pascal:1983 (ISO)} \\
2650 \DWLANGModulatwo &0x000a &1 \addtoindexx{Modula-2:1996 (ISO)} \\
2651 \DWLANGJava &0x000b &0 \addtoindexx{Java} \\
2652 \DWLANGCninetynine &0x000c &0 \addtoindexx{C:1999 (ISO)} \\
2653 \DWLANGAdaninetyfive{} \dag &0x000d &1 \addtoindexx{Ada:1995 (ISO)} \\
2654 \DWLANGFortranninetyfive &0x000e &1 \addtoindexx{Fortran:1995 (ISO)} \\
2655 \DWLANGPLI{} \dag &0x000f &1 \addtoindexx{PL/I:1976 (ANSI)}\\
2656 \DWLANGObjC{} &0x0010 &0 \addtoindexx{Objective C}\\
2657 \DWLANGObjCplusplus{} &0x0011 &0 \addtoindexx{Objective C++}\\
2658 \DWLANGUPC{} &0x0012 &0 \addtoindexx{UPC}\\
2659 \DWLANGD{} &0x0013 &0 \addtoindexx{D language}\\
2660 \DWLANGPython{} \dag &0x0014 &0 \addtoindexx{Python}\\
2661 \DWLANGOpenCL{} \dag \ddag &0x0015 &0 \addtoindexx{OpenCL}\\
2662 \DWLANGGo{} \dag \ddag &0x0016 &0 \addtoindexx{Go}\\
2663 \DWLANGModulathree{} \dag \ddag &0x0017 &1 \addtoindexx{Modula-3}\\
2664 \DWLANGHaskell{} \dag \ddag &0x0018 &0 \addtoindexx{Haskell}\\
2665 \DWLANGCpluspluszerothree{} \ddag &0x0019 &0 \addtoindexx{C++:2003 (ISO)}\\
2666 \DWLANGCpluspluseleven{} \ddag &0x001a &0 \addtoindexx{C++:2011 (ISO)}\\
2667 \DWLANGOCaml{} \ddag &0x001b &0 \addtoindexx{OCaml}\\
2668 \DWLANGRust{} \ddag &0x001c &0 \addtoindexx{Rust}\\
2669 \DWLANGCeleven{} \ddag &0x001d &0 \addtoindexx{C:2011 (ISO)}\\
2670 \DWLANGSwift{} \ddag &0x001e &0 \addtoindexx{Swift} \\
2671 \DWLANGJulia{} \ddag &0x001f &1 \addtoindexx{Julia} \\
2672 \DWLANGDylan{} \ddag &0x0020 &0 \addtoindexx{Dylan} \\
2673 \DWLANGCplusplusfourteen{}~\ddag &0x0021 &0 \addtoindexx{C++:2014 (ISO)} \\
2674 \DWLANGFortranzerothree{}~\ddag &0x0022 &1 \addtoindexx{Fortran:2004 (ISO)} \\
2675 \DWLANGFortranzeroeight{}~\ddag &0x0023 &1 \addtoindexx{Fortran:2010 (ISO)} \\
2676 \DWLANGlouser{} &0x8000 & \\
2677 \DWLANGhiuser{} &\xffff & \\
2682 \section{Address Class Encodings}
2683 \label{datarep:addressclassencodings}
2685 The value of the common
2686 \addtoindex{address class} encoding
2690 \section{Identifier Case}
2691 \label{datarep:identifiercase}
2693 The encodings of the constants used in the
2694 \DWATidentifiercase{} attribute are given in
2695 Table \refersec{tab:identifiercaseencodings}.
2699 \setlength{\extrarowheight}{0.1cm}
2700 \begin{longtable}{l|c}
2701 \caption{Identifier case encodings} \label{tab:identifiercaseencodings}\\
2702 \hline \bfseries Identifier case name&\bfseries Value \\ \hline
2704 \bfseries Identifier case name&\bfseries Value\\ \hline
2706 \hline \emph{Continued on next page}
2710 \DWIDcasesensitive&0x00 \\
2712 \DWIDdowncase&0x02 \\
2713 \DWIDcaseinsensitive&0x03 \\
2717 \section{Calling Convention Encodings}
2718 \label{datarep:callingconventionencodings}
2719 The encodings of the constants used in the
2720 \DWATcallingconvention{} attribute are given in
2721 Table \refersec{tab:callingconventionencodings}.
2724 \setlength{\extrarowheight}{0.1cm}
2725 \begin{longtable}{l|c}
2726 \caption{Calling convention encodings} \label{tab:callingconventionencodings}\\
2727 \hline \bfseries Calling convention name&\bfseries Value \\ \hline
2729 \bfseries Calling convention name&\bfseries Value\\ \hline
2731 \hline \emph{Continued on next page}
2733 \hline \ddag\ \textit{New in DWARF Version 5}
2736 \DWCCnormal &0x01 \\
2737 \DWCCprogram&0x02 \\
2738 \DWCCnocall &0x03 \\
2739 \DWCCpassbyreference~\ddag &0x04 \\
2740 \DWCCpassbyvalue~\ddag &0x05 \\
2741 \DWCClouser &0x40 \\
2748 \section{Inline Codes}
2749 \label{datarep:inlinecodes}
2751 The encodings of the constants used in
2752 \addtoindexx{inline attribute}
2754 \DWATinline{} attribute are given in
2755 Table \refersec{tab:inlineencodings}.
2759 \setlength{\extrarowheight}{0.1cm}
2760 \begin{longtable}{l|c}
2761 \caption{Inline encodings} \label{tab:inlineencodings}\\
2762 \hline \bfseries Inline code name&\bfseries Value \\ \hline
2764 \bfseries Inline Code name&\bfseries Value\\ \hline
2766 \hline \emph{Continued on next page}
2771 \DWINLnotinlined&0x00 \\
2772 \DWINLinlined&0x01 \\
2773 \DWINLdeclarednotinlined&0x02 \\
2774 \DWINLdeclaredinlined&0x03 \\
2779 % this clearpage is ugly, but the following table came
2780 % out oddly without it.
2782 \section{Array Ordering}
2783 \label{datarep:arrayordering}
2785 The encodings of the constants used in the
2786 \DWATordering{} attribute are given in
2787 Table \refersec{tab:orderingencodings}.
2791 \setlength{\extrarowheight}{0.1cm}
2792 \begin{longtable}{l|c}
2793 \caption{Ordering encodings} \label{tab:orderingencodings}\\
2794 \hline \bfseries Ordering name&\bfseries Value \\ \hline
2796 \bfseries Ordering name&\bfseries Value\\ \hline
2798 \hline \emph{Continued on next page}
2803 \DWORDrowmajor&0x00 \\
2804 \DWORDcolmajor&0x01 \\
2810 \section{Discriminant Lists}
2811 \label{datarep:discriminantlists}
2813 The descriptors used in
2814 \addtoindexx{discriminant list attribute}
2816 \DWATdiscrlist{} attribute are
2817 encoded as 1-byte constants. The
2818 defined values are given in
2819 Table \refersec{tab:discriminantdescriptorencodings}.
2821 % Odd that the 'Name' field capitalized here, it is not caps elsewhere.
2823 \setlength{\extrarowheight}{0.1cm}
2824 \begin{longtable}{l|c}
2825 \caption{Discriminant descriptor encodings} \label{tab:discriminantdescriptorencodings}\\
2826 \hline \bfseries Descriptor name&\bfseries Value \\ \hline
2828 \bfseries Descriptor name&\bfseries Value\\ \hline
2830 \hline \emph{Continued on next page}
2842 \section{Name Index Table}
2843 \label{datarep:nameindextable}
2844 The \addtoindexi{version number}{version number!name index table}
2845 in the name index table header is \versiondotdebugnames{}
2846 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
2848 The name index attributes and their encodings are listed in Table \referfol{datarep:indexattributeencodings}.
2851 \setlength{\extrarowheight}{0.1cm}
2852 \begin{longtable}{l|c|l}
2853 \caption{Name index attribute encodings} \label{datarep:indexattributeencodings}\\
2854 \hline \bfseries Attribute name &\bfseries Value &\bfseries Form/Class \\ \hline
2856 \bfseries Attribute name &\bfseries Value &\bfseries Form/Class \\ \hline
2858 \hline \emph{Continued on next page}
2861 \ddag~\textit{New in \DWARFVersionV}
2863 \DWIDXcompileunit~\ddag & 1 & \CLASSconstant \\
2864 \DWIDXtypeunit~\ddag & 2 & \CLASSconstant \\
2865 \DWIDXdieoffset~\ddag & 3 & \CLASSreference \\
2866 \DWIDXparent~\ddag & 4 & \CLASSconstant \\
2867 \DWIDXtypehash~\ddag & 5 & \DWFORMdataeight \\
2868 \DWIDXlouser~\ddag & 0x2000 & \\
2869 \DWIDXhiuser~\ddag & \xiiifff & \\
2873 The abbreviations table ends with an entry consisting of a single 0
2874 byte for the abbreviation code. The size of the table given by
2875 \texttt{abbrev\_table\_size} may include optional padding following the
2878 \section{Defaulted Member Encodings}
2879 \hypertarget{datarep:defaultedmemberencodings}{}
2881 The encodings of the constants used in the \DWATdefaulted{} attribute
2882 are given in Table \referfol{datarep:defaultedattributeencodings}.
2885 \setlength{\extrarowheight}{0.1cm}
2886 \begin{longtable}{l|c}
2887 \caption{Defaulted attribute encodings} \label{datarep:defaultedattributeencodings} \\
2888 \hline \bfseries Defaulted name &\bfseries Value \\ \hline
2890 \bfseries Defaulted name &\bfseries Value \\ \hline
2892 \hline \emph{Continued on next page}
2895 \ddag~\textit{New in \DWARFVersionV}
2897 \DWDEFAULTEDno~\ddag & 0x00 \\
2898 \DWDEFAULTEDinclass~\ddag & 0x01 \\
2899 \DWDEFAULTEDoutofclass~\ddag & 0x02 \\
2904 \section{Address Range Table}
2905 \label{datarep:addrssrangetable}
2907 Each set of entries in the table of address ranges contained
2908 in the \dotdebugaranges{}
2909 section begins with a header containing:
2910 \begin{enumerate}[1. ]
2911 % FIXME The unit length text is not fully consistent across
2914 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
2915 \addttindexx{unit\_length}
2916 A 4-byte or 12-byte length containing the length of the
2917 \addtoindexx{initial length}
2918 set of entries for this compilation unit, not including the
2919 length field itself. In the \thirtytwobitdwarfformat, this is a
2920 4-byte unsigned integer (which must be less than \xfffffffzero);
2921 in the \sixtyfourbitdwarfformat, this consists of the 4-byte value
2922 \wffffffff followed by an 8-byte unsigned integer that gives
2924 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
2926 \item version (\HFTuhalf) \\
2927 A 2-byte version identifier representing the version of the
2928 DWARF information for the address range table
2929 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
2931 This value in this field \addtoindexx{version number!address range table} is 2.
2933 \item debug\_info\_offset (\livelink{datarep:sectionoffsetlength}{section offset}) \\
2935 \addtoindexx{section offset!in .debug\_aranges header}
2936 4-byte or 8-byte offset into the
2937 \dotdebuginfo{} section of
2938 the compilation unit header. In the \thirtytwobitdwarfformat,
2939 this is a 4-byte unsigned offset; in the \sixtyfourbitdwarfformat,
2940 this is an 8-byte unsigned offset
2941 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
2943 \item \texttt{address\_size} (\HFTubyte) \\
2944 A 1-byte unsigned integer containing the size in bytes of an
2945 \addttindexx{address\_size}
2947 \addtoindexx{size of an address}
2948 (or the offset portion of an address for segmented
2949 \addtoindexx{address space!segmented}
2950 addressing) on the target system.
2952 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
2953 A 1-byte unsigned integer containing the size in bytes of a
2954 segment selector on the target system.
2958 This header is followed by a series of tuples. Each tuple
2959 consists of a segment, an address and a length.
2960 The segment selector
2961 size is given by the \HFNsegmentselectorsize{} field of the header; the
2962 address and length size are each given by the \addttindex{address\_size}
2963 field of the header.
2964 The first tuple following the header in
2965 each set begins at an offset that is a multiple of the size
2966 of a single tuple (that is, the size of a segment selector
2967 plus twice the \addtoindex{size of an address}).
2968 The header is padded, if
2969 necessary, to that boundary. Each set of tuples is terminated
2970 by a 0 for the segment, a 0 for the address and 0 for the
2971 length. If the \HFNsegmentselectorsize{} field in the header is zero,
2972 the segment selectors are omitted from all tuples, including
2973 the terminating tuple.
2976 \section{Line Number Information}
2977 \label{datarep:linenumberinformation}
2979 The \addtoindexi{version number}{version number!line number information}
2980 in the line number program header is \versiondotdebugline{}
2981 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
2983 The boolean values \doublequote{true} and \doublequote{false}
2984 used by the line number information program are encoded
2985 as a single byte containing the value 0
2986 for \doublequote{false,} and a non-zero value for \doublequote{true.}
2989 The encodings for the standard opcodes are given in
2990 \addtoindexx{line number opcodes!standard opcode encoding}
2991 Table \refersec{tab:linenumberstandardopcodeencodings}.
2994 \setlength{\extrarowheight}{0.1cm}
2995 \begin{longtable}{l|c}
2996 \caption{Line number standard opcode encodings} \label{tab:linenumberstandardopcodeencodings}\\
2997 \hline \bfseries Opcode name&\bfseries Value \\ \hline
2999 \bfseries Opcode name&\bfseries Value\\ \hline
3001 \hline \emph{Continued on next page}
3007 \DWLNSadvancepc&0x02 \\
3008 \DWLNSadvanceline&0x03 \\
3009 \DWLNSsetfile&0x04 \\
3010 \DWLNSsetcolumn&0x05 \\
3011 \DWLNSnegatestmt&0x06 \\
3012 \DWLNSsetbasicblock&0x07 \\
3013 \DWLNSconstaddpc&0x08 \\
3014 \DWLNSfixedadvancepc&0x09 \\
3015 \DWLNSsetprologueend&0x0a \\*
3016 \DWLNSsetepiloguebegin&0x0b \\*
3017 \DWLNSsetisa&0x0c \\*
3023 The encodings for the extended opcodes are given in
3024 \addtoindexx{line number opcodes!extended opcode encoding}
3025 Table \refersec{tab:linenumberextendedopcodeencodings}.
3028 \setlength{\extrarowheight}{0.1cm}
3029 \begin{longtable}{l|c}
3030 \caption{Line number extended opcode encodings} \label{tab:linenumberextendedopcodeencodings}\\
3031 \hline \bfseries Opcode name&\bfseries Value \\ \hline
3033 \bfseries Opcode name&\bfseries Value\\ \hline
3035 \hline \emph{Continued on next page}
3037 \hline %\ddag~\textit{New in DWARF Version 5}
3040 \DWLNEendsequence &0x01 \\
3041 \DWLNEsetaddress &0x02 \\
3042 \textit{Reserved} &0x03\footnote{Code 0x03 is reserved to allow backward compatible support of the
3043 DW\_LNE\_define\_file operation which was defined in \DWARFVersionIV{}
3045 \DWLNEsetdiscriminator &0x04 \\
3046 \DWLNElouser &0x80 \\
3047 \DWLNEhiuser &\xff \\
3053 The encodings for the line number header entry formats are given in
3054 \addtoindexx{line number opcodes!file entry format encoding}
3055 Table \refersec{tab:linenumberheaderentryformatencodings}.
3058 \setlength{\extrarowheight}{0.1cm}
3059 \begin{longtable}{l|c}
3060 \caption{Line number header entry format \mbox{encodings}} \label{tab:linenumberheaderentryformatencodings}\\
3061 \hline \bfseries Line number header entry format name&\bfseries Value \\ \hline
3063 \bfseries Line number header entry format name&\bfseries Value\\ \hline
3065 \hline \emph{Continued on next page}
3067 \hline \ddag~\textit{New in DWARF Version 5}
3069 \DWLNCTpath~\ddag & 0x1 \\
3070 \DWLNCTdirectoryindex~\ddag & 0x2 \\
3071 \DWLNCTtimestamp~\ddag & 0x3 \\
3072 \DWLNCTsize~\ddag & 0x4 \\
3073 \DWLNCTMDfive~\ddag & 0x5 \\
3074 \DWLNCTlouser~\ddag & 0x2000 \\
3075 \DWLNCThiuser~\ddag & \xiiifff \\
3080 \section{Macro Information}
3081 \label{datarep:macroinformation}
3082 The \addtoindexi{version number}{version number!macro information}
3083 in the macro information header is \versiondotdebugmacro{}
3084 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3086 The source line numbers and source file indices encoded in the
3087 macro information section are represented as
3088 unsigned LEB128\addtoindexx{LEB128!unsigned} numbers.
3091 The macro information entry type is encoded as a single unsigned byte.
3093 \addtoindexx{macro information entry types!encoding}
3095 Table \refersec{tab:macroinfoentrytypeencodings}.
3099 \setlength{\extrarowheight}{0.1cm}
3100 \begin{longtable}{l|c}
3101 \caption{Macro information entry type encodings} \label{tab:macroinfoentrytypeencodings}\\
3102 \hline \bfseries Macro information entry type name&\bfseries Value \\ \hline
3104 \bfseries Macro information entry type name&\bfseries Value\\ \hline
3106 \hline \emph{Continued on next page}
3108 \hline \ddag~\textit{New in DWARF Version 5}
3111 \DWMACROdefine~\ddag &0x01 \\
3112 \DWMACROundef~\ddag &0x02 \\
3113 \DWMACROstartfile~\ddag &0x03 \\
3114 \DWMACROendfile~\ddag &0x04 \\
3115 \DWMACROdefinestrp~\ddag &0x05 \\
3116 \DWMACROundefstrp~\ddag &0x06 \\
3117 \DWMACROimport~\ddag &0x07 \\
3118 \DWMACROdefinesup~\ddag &0x08 \\
3119 \DWMACROundefsup~\ddag &0x09 \\
3120 \DWMACROimportsup~\ddag &0x0a \\
3121 \DWMACROdefinestrx~\ddag &0x0b \\
3122 \DWMACROundefstrx~\ddag &0x0c \\
3123 \DWMACROlouser~\ddag &0xe0 \\
3124 \DWMACROhiuser~\ddag &\xff \\
3130 \section{Call Frame Information}
3131 \label{datarep:callframeinformation}
3133 In the \thirtytwobitdwarfformat, the value of the CIE id in the
3134 CIE header is \xffffffff; in the \sixtyfourbitdwarfformat, the
3135 value is \xffffffffffffffff.
3137 The value of the CIE \addtoindexi{version number}{version number!call frame information}
3138 is 4 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3140 Call frame instructions are encoded in one or more bytes. The
3141 primary opcode is encoded in the high order two bits of
3142 the first byte (that is, opcode = byte $\gg$ 6). An operand
3143 or extended opcode may be encoded in the low order 6
3144 bits. Additional operands are encoded in subsequent bytes.
3145 The instructions and their encodings are presented in
3146 Table \refersec{tab:callframeinstructionencodings}.
3149 \setlength{\extrarowheight}{0.1cm}
3150 \begin{longtable}{l|c|c|l|l}
3151 \caption{Call frame instruction encodings} \label{tab:callframeinstructionencodings} \\
3152 \hline &\bfseries High 2 &\bfseries Low 6 & & \\
3153 \bfseries Instruction&\bfseries Bits &\bfseries Bits &\bfseries Operand 1 &\bfseries Operand 2\\ \hline
3155 & \bfseries High 2 &\bfseries Low 6 & &\\
3156 \bfseries Instruction&\bfseries Bits &\bfseries Bits &\bfseries Operand 1 &\bfseries Operand 2\\ \hline
3158 \hline \emph{Continued on next page}
3163 \DWCFAadvanceloc&0x1&delta & \\
3164 \DWCFAoffset&0x2®ister&ULEB128 offset \\
3165 \DWCFArestore&0x3®ister & & \\
3166 \DWCFAnop&0&0 & & \\
3167 \DWCFAsetloc&0&0x01&address & \\
3168 \DWCFAadvancelocone&0&0x02&1-byte delta & \\
3169 \DWCFAadvanceloctwo&0&0x03&2-byte delta & \\
3170 \DWCFAadvancelocfour&0&0x04&4-byte delta & \\
3171 \DWCFAoffsetextended&0&0x05&ULEB128 register&ULEB128 offset \\
3172 \DWCFArestoreextended&0&0x06&ULEB128 register & \\
3173 \DWCFAundefined&0&0x07&ULEB128 register & \\
3174 \DWCFAsamevalue&0&0x08 &ULEB128 register & \\
3175 \DWCFAregister&0&0x09&ULEB128 register &ULEB128 offset \\
3176 \DWCFArememberstate&0&0x0a & & \\
3177 \DWCFArestorestate&0&0x0b & & \\
3178 \DWCFAdefcfa&0&0x0c &ULEB128 register&ULEB128 offset \\
3179 \DWCFAdefcfaregister&0&0x0d&ULEB128 register & \\
3180 \DWCFAdefcfaoffset&0&0x0e &ULEB128 offset & \\
3181 \DWCFAdefcfaexpression&0&0x0f &BLOCK \\
3182 \DWCFAexpression&0&0x10&ULEB128 register & BLOCK \\
3184 \DWCFAoffsetextendedsf&0&0x11&ULEB128 register&SLEB128 offset \\
3185 \DWCFAdefcfasf&0&0x12&ULEB128 register&SLEB128 offset \\
3186 \DWCFAdefcfaoffsetsf&0&0x13&SLEB128 offset & \\
3187 \DWCFAvaloffset&0&0x14&ULEB128&ULEB128 \\
3188 \DWCFAvaloffsetsf&0&0x15&ULEB128&SLEB128 \\
3189 \DWCFAvalexpression&0&0x16&ULEB128&BLOCK \\
3190 \DWCFAlouser&0&0x1c & & \\
3191 \DWCFAhiuser&0&\xiiif & & \\
3195 \section{Non-contiguous Address Ranges}
3196 \label{datarep:noncontiguousaddressranges}
3198 Each entry in a \addtoindex{range list}
3199 (see Section \refersec{chap:noncontiguousaddressranges})
3201 \addtoindexx{base address selection entry!in range list}
3203 \addtoindexx{range list}
3204 a base address selection entry, or an end-of-list entry.
3206 A \addtoindex{range list} entry consists of two relative addresses. The
3207 addresses are the same size as addresses on the target machine.
3210 A base address selection entry and an
3211 \addtoindexx{end-of-list entry!in range list}
3212 end-of-list entry each
3213 \addtoindexx{base address selection entry!in range list}
3214 consist of two (constant or relocated) addresses. The two
3215 addresses are the same size as addresses on the target machine.
3217 For a \addtoindex{range list} to be specified, the base address of the
3218 \addtoindexx{base address selection entry!in range list}
3219 corresponding compilation unit must be defined
3220 (see Section \refersec{chap:normalandpartialcompilationunitentries}).
3223 \section{String Offsets Table}
3224 \label{chap:stringoffsetstable}
3225 Each set of entries in the string offsets table contained in the
3226 \dotdebugstroffsets{} or \dotdebugstroffsetsdwo{}
3227 section begins with a header containing:
3228 \begin{enumerate}[1. ]
3229 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3230 \addttindexx{unit\_length}
3231 A 4-byte or 12-byte length containing the length of
3232 the set of entries for this compilation unit, not
3233 including the length field itself. In the 32-bit
3234 DWARF format, this is a 4-byte unsigned integer
3235 (which must be less than \xfffffffzero); in the 64-bit
3236 DWARF format, this consists of the 4-byte value
3237 \wffffffff followed by an 8-byte unsigned integer
3238 that gives the actual length (see
3239 Section \refersec{datarep:32bitand64bitdwarfformats}).
3242 \item \texttt{version} (\HFTuhalf) \\
3243 A 2-byte version identifier containing the value
3244 \versiondotdebugstroffsets{}
3245 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3247 \item \texttt{padding} (\HFTuhalf) \\
3250 This header is followed by a series of string table offsets
3251 that have the same representation as \DWFORMstrp.
3252 For the 32-bit DWARF format, each offset is 4 bytes long; for
3253 the 64-bit DWARF format, each offset is 8 bytes long.
3255 The \DWATstroffsetsbase{} attribute points to the first
3256 entry following the header. The entries are indexed
3257 sequentially from this base entry, starting from 0.
3259 \section{Address Table}
3260 \label{chap:addresstable}
3261 Each set of entries in the address table contained in the
3262 \dotdebugaddr{} section begins with a header containing:
3263 \begin{enumerate}[1. ]
3264 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3265 \addttindexx{unit\_length}
3266 A 4-byte or 12-byte length containing the length of
3267 the set of entries for this compilation unit, not
3268 including the length field itself. In the 32-bit
3269 DWARF format, this is a 4-byte unsigned integer
3270 (which must be less than \xfffffffzero); in the 64-bit
3271 DWARF format, this consists of the 4-byte value
3272 \wffffffff followed by an 8-byte unsigned integer
3273 that gives the actual length (see
3274 Section \refersec{datarep:32bitand64bitdwarfformats}).
3277 \item \texttt{version} (\HFTuhalf) \\
3278 A 2-byte version identifier containing the value
3279 \versiondotdebugaddr{}
3280 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3283 \item \texttt{address\_size} (\HFTubyte) \\
3284 A 1-byte unsigned integer containing the size in
3285 bytes of an address (or the offset portion of an
3286 address for segmented addressing) on the target
3290 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
3291 A 1-byte unsigned integer containing the size in
3292 bytes of a segment selector on the target system.
3295 This header is followed by a series of segment/address pairs.
3296 The segment size is given by the \HFNsegmentselectorsize{} field of the
3297 header, and the address size is given by the \addttindex{address\_size}
3298 field of the header. If the \HFNsegmentselectorsize{} field in the header
3299 is zero, the entries consist only of an addresses.
3301 The \DWATaddrbase{} attribute points to the first entry
3302 following the header. The entries are indexed sequentially
3303 from this base entry, starting from 0.
3306 \section{Range List Table}
3307 \label{app:rangelisttable}
3308 Each set of entries in the range list table contained in the
3309 \dotdebugranges{} section begins with a header containing:
3310 \begin{enumerate}[1. ]
3311 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3312 \addttindexx{unit\_length}
3313 A 4-byte or 12-byte length containing the length of
3314 the set of entries for this compilation unit, not
3315 including the length field itself. In the 32-bit
3316 DWARF format, this is a 4-byte unsigned integer
3317 (which must be less than \xfffffffzero); in the 64-bit
3318 DWARF format, this consists of the 4-byte value
3319 \wffffffff followed by an 8-byte unsigned integer
3320 that gives the actual length (see
3321 Section \refersec{datarep:32bitand64bitdwarfformats}).
3324 \item \texttt{version} (\HFTuhalf) \\
3325 A 2-byte version identifier containing the value
3326 \versiondotdebugranges{}
3327 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3330 \item \texttt{address\_size} (\HFTubyte) \\
3331 A 1-byte unsigned integer containing the size in
3332 bytes of an address (or the offset portion of an
3333 address for segmented addressing) on the target
3337 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
3338 A 1-byte unsigned integer containing the size in
3339 bytes of a segment selector on the target system.
3342 This header is followed by a series of range list entries as
3343 described in Section \refersec{chap:noncontiguousaddressranges}.
3344 The segment size is given by the
3345 \HFNsegmentselectorsize{} field of the header, and the address size is
3346 given by the \addttindex{address\_size} field of the header. If the
3347 \HFNsegmentselectorsize{} field in the header is zero, the segment
3348 selector is omitted from the range list entries.
3350 The \DWATrangesbase{} attribute points to the first entry
3351 following the header. The entries are referenced by a byte
3352 offset relative to this base address.
3355 \section{Location List Table}
3356 \label{datarep:locationlisttable}
3357 Each set of entries in the location list table contained in the
3358 \dotdebugloc{} or \dotdebuglocdwo{} sections begins with a header containing:
3359 \begin{enumerate}[1. ]
3360 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3361 \addttindexx{unit\_length}
3362 A 4-byte or 12-byte length containing the length of
3363 the set of entries for this compilation unit, not
3364 including the length field itself. In the 32-bit
3365 DWARF format, this is a 4-byte unsigned integer
3366 (which must be less than \xfffffffzero); in the 64-bit
3367 DWARF format, this consists of the 4-byte value
3368 \wffffffff followed by an 8-byte unsigned integer
3369 that gives the actual length (see
3370 Section \refersec{datarep:32bitand64bitdwarfformats}).
3373 \item \texttt{version} (\HFTuhalf) \\
3374 A 2-byte version identifier containing the value
3375 \versiondotdebugloc{}
3376 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3379 \item \texttt{address\_size} (\HFTubyte) \\
3380 A 1-byte unsigned integer containing the size in
3381 bytes of an address (or the offset portion of an
3382 address for segmented addressing) on the target
3386 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
3387 A 1-byte unsigned integer containing the size in
3388 bytes of a segment selector on the target system.
3391 This header is followed by a series of location list entries as
3392 described in Section \refersec{chap:locationlists}.
3393 The segment size is given by the
3394 \HFNsegmentselectorsize{} field of the header, and the address size is
3395 given by the \HFNaddresssize{} field of the header. If the
3396 \HFNsegmentselectorsize{} field in the header is zero, the segment
3397 selector is omitted from range list entries.
3399 The entries are referenced by a byte offset relative to the first
3400 location list following this header.
3403 \section{Dependencies and Constraints}
3404 \label{datarep:dependenciesandconstraints}
3405 The debugging information in this format is intended to
3406 exist in sections of an object file, or an equivalent
3407 separate file or database, having names beginning with
3408 the prefix ".debug\_" (see Appendix
3409 \refersec{app:dwarfsectionversionnumbersinformative}
3410 for a complete list of such names).
3411 Except as specifically specified, this information is not
3412 aligned on 2-, 4- or 8-byte boundaries. Consequently:
3415 \item For the \thirtytwobitdwarfformat{} and a target architecture with
3416 32-bit addresses, an assembler or compiler must provide a way
3417 to produce 2-byte and 4-byte quantities without alignment
3418 restrictions, and the linker must be able to relocate a
3420 \addtoindexx{section offset!alignment of}
3421 section offset that occurs at an arbitrary
3424 \item For the \thirtytwobitdwarfformat{} and a target architecture with
3425 64-bit addresses, an assembler or compiler must provide a
3426 way to produce 2-byte, 4-byte and 8-byte quantities without
3427 alignment restrictions, and the linker must be able to relocate
3428 an 8-byte address or 4-byte
3429 \addtoindexx{section offset!alignment of}
3430 section offset that occurs at an
3431 arbitrary alignment.
3433 \item For the \sixtyfourbitdwarfformat{} and a target architecture with
3434 32-bit addresses, an assembler or compiler must provide a
3435 way to produce 2-byte, 4-byte and 8-byte quantities without
3436 alignment restrictions, and the linker must be able to relocate
3437 a 4-byte address or 8-byte
3438 \addtoindexx{section offset!alignment of}
3439 section offset that occurs at an
3440 arbitrary alignment.
3442 \textit{It is expected that this will be required only for very large
3443 32-bit programs or by those architectures which support
3444 a mix of 32-bit and 64-bit code and data within the same
3447 \item For the \sixtyfourbitdwarfformat{} and a target architecture with
3448 64-bit addresses, an assembler or compiler must provide a
3449 way to produce 2-byte, 4-byte and 8-byte quantities without
3450 alignment restrictions, and the linker must be able to
3451 relocate an 8-byte address or
3452 \addtoindexx{section offset!alignment of}
3453 section offset that occurs at
3454 an arbitrary alignment.
3458 \section{Integer Representation Names}
3459 \label{datarep:integerrepresentationnames}
3460 The sizes of the integers used in the lookup by name, lookup
3461 by address, line number, call frame information and other sections
3463 Table \ref{tab:integerrepresentationnames}.
3467 \setlength{\extrarowheight}{0.1cm}
3468 \begin{longtable}{c|l}
3469 \caption{Integer representation names} \label{tab:integerrepresentationnames}\\
3470 \hline \bfseries Representation name&\bfseries Representation \\ \hline
3472 \bfseries Representation name&\bfseries Representation\\ \hline
3474 \hline \emph{Continued on next page}
3479 \HFTsbyte& signed, 1-byte integer \\
3480 \HFTubyte&unsigned, 1-byte integer \\
3481 \HFTuhalf&unsigned, 2-byte integer \\
3482 \HFTuword&unsigned, 4-byte integer \\
3488 \section{Type Signature Computation}
3489 \label{datarep:typesignaturecomputation}
3491 A \addtoindex{type signature} is used by a DWARF consumer
3492 to resolve type references to the type definitions that
3493 are contained in \addtoindex{type unit}s (see Section
3494 \refersec{chap:typeunitentries}).
3496 \textit{A type signature is computed only by a DWARF producer;
3497 \addtoindexx{type signature!computation} a consumer need
3498 compare two type signatures to check for equality.}
3501 The type signature for a type T0 is formed from the
3502 \MDfive{}\footnote{\livetarg{def:MDfive}{MD5} Message Digest Algorithm,
3503 R.L. Rivest, RFC 1321, April 1992}
3504 digest of a flattened description of the type. The flattened
3505 description of the type is a byte sequence derived from the
3506 DWARF encoding of the type as follows:
3507 \begin{enumerate}[1. ]
3509 \item Start with an empty sequence S and a list V of visited
3510 types, where V is initialized to a list containing the type
3511 T0 as its single element. Elements in V are indexed from 1,
3514 \item If the debugging information entry represents a type that
3515 is nested inside another type or a namespace, append to S
3516 the type\textquoteright s context as follows: For each surrounding type
3517 or namespace, beginning with the outermost such construct,
3518 append the letter 'C', the DWARF tag of the construct, and
3519 the name (taken from
3520 \addtoindexx{name attribute}
3521 the \DWATname{} attribute) of the type
3522 \addtoindexx{name attribute}
3523 or namespace (including its trailing null byte).
3525 \item Append to S the letter 'D', followed by the DWARF tag of
3526 the debugging information entry.
3528 \item For each of the attributes in
3529 Table \refersec{tab:attributesusedintypesignaturecomputation}
3531 the debugging information entry, in the order listed,
3532 append to S a marker letter (see below), the DWARF attribute
3533 code, and the attribute value.
3536 \caption{Attributes used in type signature computation}
3537 \label{tab:attributesusedintypesignaturecomputation}
3538 \simplerule[\textwidth]
3540 \autocols[0pt]{c}{2}{l}{
3556 \DWATcontainingtype,
3560 \DWATdatamemberlocation,
3581 \DWATrvaluereference,
3585 \DWATstringlengthbitsize,
3586 \DWATstringlengthbytesize,
3591 \DWATvariableparameter,
3594 \DWATvtableelemlocation
3597 \simplerule[\textwidth]
3600 Note that except for the initial
3601 \DWATname{} attribute,
3602 \addtoindexx{name attribute}
3603 attributes are appended in order according to the alphabetical
3604 spelling of their identifier.
3606 If an implementation defines any vendor-specific attributes,
3607 any such attributes that are essential to the definition of
3608 the type are also included at the end of the above list,
3609 in their own alphabetical suborder.
3611 An attribute that refers to another type entry T is processed
3612 as follows: (a) If T is in the list V at some V[x], use the
3613 letter 'R' as the marker and use the unsigned LEB128\addtoindexx{LEB128!unsigned}
3614 encoding of x as the attribute value; otherwise, (b) use the letter 'T'
3615 as the marker, process the type T recursively by performing
3616 Steps 2 through 7, and use the result as the attribute value.
3619 Other attribute values use the letter 'A' as the marker, and
3620 the value consists of the form code (encoded as an unsigned
3621 LEB128 value) followed by the encoding of the value according
3622 to the form code. To ensure reproducibility of the signature,
3623 the set of forms used in the signature computation is limited
3632 \item If the tag in Step 3 is one of \DWTAGpointertype,
3633 \DWTAGreferencetype,
3634 \DWTAGrvaluereferencetype,
3635 \DWTAGptrtomembertype,
3636 or \DWTAGfriend, and the referenced
3637 type (via the \DWATtype{} or
3638 \DWATfriend{} attribute) has a
3639 \DWATname{} attribute, append to S the letter 'N', the DWARF
3640 attribute code (\DWATtype{} or
3641 \DWATfriend), the context of
3642 the type (according to the method in Step 2), the letter 'E',
3643 and the name of the type. For \DWTAGfriend, if the referenced
3644 entry is a \DWTAGsubprogram, the context is omitted and the
3645 name to be used is the ABI-specific name of the subprogram
3646 (for example, the mangled linker name).
3649 \item If the tag in Step 3 is not one of \DWTAGpointertype,
3650 \DWTAGreferencetype,
3651 \DWTAGrvaluereferencetype,
3652 \DWTAGptrtomembertype, or
3653 \DWTAGfriend, but has
3654 a \DWATtype{} attribute, or if the referenced type (via
3656 \DWATfriend{} attribute) does not have a
3657 \DWATname{} attribute, the attribute is processed according to
3658 the method in Step 4 for an attribute that refers to another
3662 \item Visit each child C of the debugging information
3663 entry as follows: If C is a nested type entry or a member
3664 function entry, and has
3665 a \DWATname{} attribute, append to
3666 \addtoindexx{name attribute}
3667 S the letter 'S', the tag of C, and its name; otherwise,
3668 process C recursively by performing Steps 3 through 7,
3669 appending the result to S. Following the last child (or if
3670 there are no children), append a zero byte.
3675 For the purposes of this algorithm, if a debugging information
3677 \DWATspecification{}
3678 attribute that refers to
3679 another entry D (which has a
3682 then S inherits the attributes and children of D, and S is
3683 processed as if those attributes and children were present in
3684 the entry S. Exception: if a particular attribute is found in
3685 both S and D, the attribute in S is used and the corresponding
3686 one in D is ignored.
3689 DWARF tag and attribute codes are appended to the sequence
3690 as unsigned LEB128\addtoindexx{LEB128!unsigned} values,
3691 using the values defined earlier in this chapter.
3693 \textit{A grammar describing this computation may be found in
3694 Appendix \refersec{app:typesignaturecomputationgrammar}.
3697 \textit{An attribute that refers to another type entry is
3698 recursively processed or replaced with the name of the
3699 referent (in Step 4, 5 or 6). If neither treatment applies to
3700 an attribute that references another type entry, the entry
3701 that contains that attribute is not suitable for a
3702 separate \addtoindex{type unit}.}
3704 \textit{If a debugging information entry contains an attribute from
3705 the list above that would require an unsupported form, that
3706 entry is not suitable for a separate
3707 \addtoindex{type unit}.}
3709 \textit{A type is suitable for a separate
3710 \addtoindex{type unit} only
3711 if all of the type entries that it contains or refers to in
3712 Steps 6 and 7 are themselves suitable for a separate
3713 \addtoindex{type unit}.}
3716 Where the DWARF producer may reasonably choose two or more
3717 different forms for a given attribute, it should choose
3718 the simplest possible form in computing the signature. (For
3719 example, a constant value should be preferred to a location
3720 expression when possible.)
3722 Once the string S has been formed from the DWARF encoding,
3723 an 16-byte \MDfive{} digest is computed for the string and the
3724 last eight bytes are taken as the type signature.
3726 \textit{The string S is intended to be a flattened representation of
3727 the type that uniquely identifies that type (that is, a different
3728 type is highly unlikely to produce the same string).}
3731 \textit{A debugging information entry is not be placed in a
3732 separate \addtoindex{type unit}
3733 if any of the following apply:}
3737 \item \textit{The entry has an attribute whose value is a location
3738 expression, and the location expression contains a reference to
3739 another debugging information entry (for example, a \DWOPcallref{}
3740 operator), as it is unlikely that the entry will remain
3741 identical across compilation units.}
3743 \item \textit{The entry has an attribute whose value refers
3744 to a code location or a \addtoindex{location list}.}
3746 \item \textit{The entry has an attribute whose value refers
3747 to another debugging information entry that does not represent
3753 \textit{Certain attributes are not included in the type signature:}
3756 \item \textit{The \DWATdeclaration{} attribute is not included because it
3757 indicates that the debugging information entry represents an
3758 incomplete declaration, and incomplete declarations should
3760 \addtoindexx{type unit}
3761 separate type units.}
3763 \item \textit{The \DWATdescription{} attribute is not included because
3764 it does not provide any information unique to the defining
3765 declaration of the type.}
3767 \item \textit{The \DWATdeclfile,
3769 \DWATdeclcolumn{} attributes are not included because they
3770 may vary from one source file to the next, and would prevent
3771 two otherwise identical type declarations from producing the
3772 same \MDfive{} digest.}
3774 \item \textit{The \DWATobjectpointer{} attribute is not included
3775 because the information it provides is not necessary for the
3776 computation of a unique type signature.}
3780 \textit{Nested types and some types referred to by a debugging
3781 information entry are encoded by name rather than by recursively
3782 encoding the type to allow for cases where a complete definition
3783 of the type might not be available in all compilation units.}
3786 \textit{If a type definition contains the definition of a member function,
3787 it cannot be moved as is into a type unit, because the member function
3788 contains attributes that are unique to that compilation unit.
3789 Such a type definition can be moved to a type unit by rewriting the DIE tree,
3790 moving the member function declaration into a separate declaration tree,
3791 and replacing the function definition in the type with a non-defining
3792 declaration of the function (as if the function had been defined out of
3795 An example that illustrates the computation of an \MDfive{} digest may be found in
3796 Appendix \refersec{app:usingtypeunits}.
3798 \section{Name Table Hash Function}
3799 \label{datarep:nametablehashfunction}
3800 The hash function used for hashing name strings in the accelerated
3801 access name index table (see Section \refersec{chap:acceleratedaccess})
3802 is defined in \addtoindex{C} as shown in
3803 Figure \referfol{fig:nametablehashfunctiondefinition}.\footnote{
3804 This hash function is sometimes informally known as the
3805 "\addtoindex{DJB hash function}" or the "\addtoindex{Berstein hash function}"
3807 \hrefself{http://en.wikipedia.org/wiki/List\_of\_hash\_functions} or
3808 \hrefself{http://stackoverflow.com/questions/10696223/reason-for-5381-number-in-djb-hash-function)}.}
3813 unsigned long \* must be a 32-bit integer type *\
3814 hash(unsigned char *str)
3816 unsigned long hash = 5381;
3820 hash = hash * 33 + c;
3826 \caption{Name Table Hash Function Definition}
3827 \label{fig:nametablehashfunctiondefinition}