1 \chapter{Data Representation}
2 \label{datarep:datarepresentation}
4 This section describes the binary representation of the
5 debugging information entry itself, of the attribute types
6 and of other fundamental elements described above.
8 \section{Vendor Extensibility}
9 \label{datarep:vendorextensibility}
10 \addtoindexx{vendor extensibility}
11 \addtoindexx{vendor specific extensions|see{vendor extensibility}}
14 \addtoindexx{extensibility|see{vendor extensibility}}
15 reserve a portion of the DWARF name space and ranges of
16 enumeration values for use for vendor specific extensions,
17 special labels are reserved for tag names, attribute names,
18 base type encodings, location operations, language names,
19 calling conventions and call frame instructions.
21 The labels denoting the beginning and end of the
22 \hypertarget{chap:DWXXXlohiuser}{reserved value range}
23 for vendor specific extensions consist of the
25 (\DWATlouserMARK{}\DWAThiuserMARK{}DW\_AT,
26 \DWATElouserMARK{}\DWATEhiuserMARK{} DW\_ATE,
27 \DWCClouserMARK{}\DWCChiuserMARK{} DW\_CC,
28 \DWCFAlouserMARK{}\DWCFAhiuserMARK{} DW\_CFA
29 \DWENDlouserMARK{}\DWENDhiuserMARK{} DW\_END,
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
126 Section \refersec{datarep:32bitand64bitdwarfformats});
128 the other values is reserved for possible future extensions.
132 \section{Relocatable, Split, Executable, Shared and Package Object Files}
133 \label{datarep:executableobjectsandsharedobjects}
135 \subsection{Relocatable Object Files}
136 \label{datarep:relocatableobjectfiles}
137 A DWARF producer (for example, a compiler) typically generates its
138 debugging information as part of a relocatable object file.
139 Relocatable object files are then combined by a linker to form an
140 executable file. During the linking process, the linker resolves
141 (binds) symbolic references between the various object files, and
142 relocates the contents of each object file into a combined virtual
145 The DWARF debugging information is placed in several sections (see
146 Appendix \refersec{app:debugsectionrelationshipsinformative}), and
147 requires an object file format capable of
148 representing these separate sections. There are symbolic references
149 between these sections, and also between the debugging information
150 sections and the other sections that contain the text and data of the
151 program itself. Many of these references require relocation, and the
152 producer must emit the relocation information appropriate to the
153 object file format and the target processor architecture. These
154 references include the following:
157 \item The compilation unit header (see Section
158 \refersec{datarep:unitheaders}) in the \dotdebuginfo{}
159 section contains a reference to the \dotdebugabbrev{} table. This
160 reference requires a relocation so that after linking, it refers to
161 that contribution to the combined \dotdebugabbrev{} section in the
164 \item Debugging information entries may have attributes with the form
165 \DWFORMaddr{} (see Section \refersec{datarep:attributeencodings}).
166 These attributes represent locations
167 within the virtual address space of the program, and require
170 \item A DWARF expression may contain a \DWOPaddr{} (see Section
171 \refersec{chap:literalencodings}) which contains a location within
172 the virtual address space of the program, and require relocation.
175 \item Debugging information entries may have attributes with the form
176 \DWFORMsecoffset{} (see Section \refersec{datarep:attributeencodings}).
177 These attributes refer to
178 debugging information in other debugging information sections within
179 the object file, and must be relocated during the linking process.
181 However, if a \DWATrangesbase{} attribute is present, the offset in
182 a \DWATranges{} attribute (which uses form \DWFORMsecoffset) is
183 relative to the given base offset--no relocation is involved.
185 \item Debugging information entries may have attributes with the form
186 \DWFORMrefaddr{} (see Section \refersec{datarep:attributeencodings}).
187 These attributes refer to
188 debugging information entries that may be outside the current
189 compilation unit. These values require both symbolic binding and
192 \item Debugging information entries may have attributes with the form
193 \DWFORMstrp{} (see Section \refersec{datarep:attributeencodings}).
194 These attributes refer to strings in
195 the \dotdebugstr{} section. These values require relocation.
197 \item Entries in the \dotdebugaddr, \dotdebugloc{}, \dotdebugranges{}
198 and \dotdebugaranges{}
199 sections contain references to locations within the virtual address
200 space of the program, and require relocation.
202 \item In the \dotdebugline{} section, the operand of the \DWLNEsetaddress{}
203 opcode is a reference to a location within the virtual address space
204 of the program, and requires relocation.
206 \item The \dotdebugstroffsets{} section contains a list of string offsets,
207 each of which is an offset of a string in the \dotdebugstr{} section. Each
208 of these offsets requires relocation. Depending on the implementation,
209 these relocations may be implicit (that is, the producer may not need to
210 emit any explicit relocation information for these offsets).
212 \item The \HFNdebuginfooffset{} field in the \dotdebugaranges{} header and
213 the list of compilation units following the \dotdebugnames{} header contain
214 references to the \dotdebuginfo{} section. These references require relocation
215 so that after linking they refer to the correct contribution in the combined
216 \dotdebuginfo{} section in the executable file.
218 \item Frame descriptor entries in the \dotdebugframe{} section
219 (see Section \refersec{chap:structureofcallframeinformation}) contain an
220 \HFNinitiallocation{} field value within the virtual address
221 space of the program and require relocation.
226 \textit{Note that operands of classes \CLASSblock, \CLASSconstant{} and
227 \CLASSflag{} do not require relocation. Attribute operands that use
228 form \DWFORMstring{} also do not require relocation. Further,
229 attribute operands that use form
230 \DWFORMrefone, \DWFORMreftwo, \DWFORMreffour, \DWFORMrefeight, or
231 \DWFORMrefudata{} do not need relocation.}
233 \subsection{Split DWARF Object Files}
234 \label{datarep:splitdwarfobjectfiles}
235 \addtoindexx{split DWARF object file}
236 A DWARF producer may partition the debugging
237 information such that the majority of the debugging
238 information can remain in individual object files without
239 being processed by the linker.
242 \subsubsection{First Partition (with Skeleton Unit)}
243 The first partition contains
244 debugging information that must still be processed by the linker,
245 and includes the following:
248 The line number tables, range tables, frame tables, and
249 accelerated access tables, in the usual sections:
250 \dotdebugline, \dotdebuglinestr, \dotdebugranges, \dotdebugframe,
251 \dotdebugnames{} and \dotdebugaranges,
255 An address table, in the \dotdebugaddr{} section. This table
256 contains all addresses and constants that require
257 link-time relocation, and items in the table can be
258 referenced indirectly from the debugging information via
259 the \DWFORMaddrx{} form, and by the \DWOPaddrx{} and
260 \DWOPconstx{} operators.
262 A skeleton compilation unit, as described in Section
263 \refersec{chap:skeletoncompilationunitentries},
264 in the \dotdebuginfo{} section.
266 An abbreviations table for the skeleton compilation unit,
267 in the \dotdebugabbrev{} section.
269 A string table, in the \dotdebugstr{} section. The string
270 table is necessary only if the skeleton compilation unit
271 uses either indirect string form, \DWFORMstrp{} or
274 A string offsets table, in the \dotdebugstroffsets{}
275 section. The string offsets table is necessary only if
276 the skeleton compilation unit uses the \DWFORMstrx{} form.
278 The attributes contained in the skeleton compilation
279 unit can be used by a DWARF consumer to find the split or
280 hybrid DWARF object file that contains the second partition.
282 \subsubsection{Second Partition (Unlinked or In \texttt{.dwo} File)}
283 The second partition contains the debugging information that
284 does not need to be processed by the linker. These sections
285 may be left in the object files and ignored by the linker
286 (that is, not combined and copied to the executable object file), or
287 they may be placed by the producer in a separate DWARF object
288 file. This partition includes the following:
291 The full compilation unit, in the \dotdebuginfodwo{} section.
294 The full compilation unit entry includes a \DWATdwoid{}
295 attribute whose form and value is the same as that of the \DWATdwoid{}
296 attribute of the associated skeleton unit.
299 Attributes contained in the full compilation unit
300 may refer to machine addresses indirectly using the \DWFORMaddrx{}
301 form, which accesses the table of addresses specified by the
302 \DWATaddrbase{} attribute in the associated skeleton unit.
303 Location expressions may similarly do so using the \DWOPaddrx{} and
304 \DWOPconstx{} operations.
306 \DWATranges{} attributes contained in the full compilation unit
307 may refer to range table entries with a \DWFORMsecoffset{} offset
308 relative to the base offset specified by the \DWATrangesbase{}
309 attribute in the associated skeleton unit.
311 \item Separate type units, in the \dotdebuginfodwo{} section.
314 Abbreviations table(s) for the compilation unit and type
315 units, in the \dotdebugabbrevdwo{} section.
317 \item Location lists, in the \dotdebuglocdwo{} section.
320 A \addtoindex{specialized line number table} (for the type units),
321 in the \dotdebuglinedwo{} section. This table
322 contains only the directory and filename lists needed to
323 interpret \DWATdeclfile{} attributes in the debugging
326 \item Macro information, in the \dotdebugmacrodwo{} section.
328 \item A string table, in the \dotdebugstrdwo{} section.
330 \item A string offsets table, in the \dotdebugstroffsetsdwo{}
334 Except where noted otherwise, all references in this document
335 to a debugging information section (for example, \dotdebuginfo),
336 applies also to the corresponding split DWARF section (for example,
340 Split DWARF object files do not get linked with any other files,
341 therefore references between sections must not make use of
342 normal object file relocation information. As a result, symbolic
343 references within or between sections are not possible.
345 \subsection{Executable Objects}
346 \label{chap:executableobjects}
347 The relocated addresses in the debugging information for an
348 executable object are virtual addresses.
351 \subsection{Shared Object Files}
352 \label{datarep:sharedobjectfiles}
354 addresses in the debugging information for a shared object file
355 are offsets relative to the start of the lowest region of
356 memory loaded from that shared object file.
359 \textit{This requirement makes the debugging information for
360 shared object files position independent. Virtual addresses in a
361 shared object file may be calculated by adding the offset to the
362 base address at which the object file was attached. This offset
363 is available in the run\dash time linker\textquoteright s data structures.}
365 \subsection{DWARF Package Files}
366 \label{datarep:dwarfpackagefiles}
367 \textit{Using \splitDWARFobjectfile{s} allows the developer to compile,
368 link, and debug an application quickly with less link-time overhead,
369 but a more convenient format is needed for saving the debug
370 information for later debugging of a deployed application. A
371 DWARF package file can be used to collect the debugging
372 information from the object (or separate DWARF object) files
373 produced during the compilation of an application.}
375 \textit{The package file is typically placed in the same directory as the
376 application, and is given the same name with a \doublequote{\texttt{.dwp}}
377 extension.\addtoindexx{\texttt{.dwp} file extension}}
379 A DWARF package file is itself an object file, using the
380 \addtoindexx{package files}
381 \addtoindexx{DWARF package files}
382 same object file format (including \byteorder) as the
383 corresponding application binary. It consists only of a file
384 header, a section table, a number of DWARF debug information
385 sections, and two index sections.
388 Each DWARF package file contains no more than one of each of the
389 following sections, copied from a set of object or DWARF object
390 files, and combined, section by section:
396 \dotdebugstroffsetsdwo
401 The string table section in \dotdebugstrdwo{} contains all the
402 strings referenced from DWARF attributes using the form
403 \DWFORMstrx. Any attribute in a compilation unit or a type
404 unit using this form refers to an entry in that unit's
405 contribution to the \dotdebugstroffsetsdwo{} section, which in turn
406 provides the offset of a string in the \dotdebugstrdwo{}
409 The DWARF package file also contains two index sections that
410 provide a fast way to locate debug information by compilation
411 unit ID (\DWATdwoid) for compilation units, or by type
412 signature for type units:
418 \subsubsection{The Compilation Unit (CU) Index Section}
419 The \dotdebugcuindex{} section is a hashed lookup table that maps a
420 compilation unit ID to a set of contributions in the
421 various debug information sections. Each contribution is stored
422 as an offset within its corresponding section and a size.
424 Each \compunitset{} may contain contributions from the
427 \dotdebuginfodwo{} (required)
428 \dotdebugabbrevdwo{} (required)
431 \dotdebugstroffsetsdwo
435 \textit{Note that a \compunitset{} is not able to represent \dotdebugmacinfo{}
436 information from \DWARFVersionIV{} or earlier formats.}
438 \subsubsection{The Type Unit (TU) Index Section}
439 The \dotdebugtuindex{} section is a hashed lookup table that maps a
440 type signature to a set of offsets into the various debug
441 information sections. Each contribution is stored as an offset
442 within its corresponding section and a size.
444 Each \typeunitset{} may contain contributions from the following
447 \dotdebuginfodwo{} (required)
448 \dotdebugabbrevdwo{} (required)
450 \dotdebugstroffsetsdwo
453 \subsubsection{Format of the CU and TU Index Sections}
454 Both index sections have the same format, and serve to map an
455 8-byte signature to a set of contributions to the debug sections.
456 Each index section begins with a header, followed by a hash table of
457 signatures, a parallel table of indexes, a table of offsets, and
458 a table of sizes. The index sections are aligned at 8-byte
459 boundaries in the DWARF package file.
462 The index section header contains the following fields:
463 \begin{enumerate}[1. ]
464 \item \texttt{version} (\HFTuhalf) \\
466 \addtoindexx{version number!CU index information}
467 \addtoindexx{version number!TU index information}
468 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
469 This number is specific to the CU and TU index information
470 and is independent of the DWARF version number.
472 The version number is \versiondotdebugcuindex.
474 \item \textit{padding} (\HFTuhalf) \\
475 Reserved to DWARF (must be zero).
477 \item \texttt{column\_count} (\HFTuword) \\
478 The number of columns in the table of section counts that follows.
479 For brevity, the contents of this field is referred to as $C$ below.
481 \item \texttt{unit\_count} (\HFTuword) \\
482 The number of compilation units or type units in the index.
483 For brevity, the contents of this field is referred to as $U$ below.
485 \item \texttt{slot\_count} (\HFTuword) \\
486 The number of slots in the hash table.
487 For brevity, the contents of this field is referred to as $S$ below.
491 \textit{We assume that $U$ and $S$ do not exceed $2^{32}$.}
493 The size of the hash table, $S$, must be $2^k$ such that:
494 \hspace{0.3cm}$2^k\ \ >\ \ 3*U/2$
496 The hash table begins at offset 16 in the section, and consists
497 of an array of $S$ 8-byte slots. Each slot contains a 64-bit
499 % (using the \byteorder{} of the application binary).
501 The parallel table of indices begins immediately after the hash table
502 (at offset \mbox{$16 + 8 * S$} from the beginning of the section), and
503 consists of an array of $S$ 4-byte slots,
504 % (using the byte order of the application binary),
505 corresponding 1-1 with slots in the hash
506 table. Each entry in the parallel table contains a row index into
507 the tables of offsets and sizes.
509 Unused slots in the hash table have 0 in both the hash table
510 entry and the parallel table entry. While 0 is a valid hash
511 value, the row index in a used slot will always be non-zero.
513 Given an 8-byte compilation unit ID or type signature $X$,
514 an entry in the hash table is located as follows:
515 \begin{enumerate}[1. ]
516 \item Define $REP(X)$ to be the value of $X$ interpreted as an
517 unsigned 64-bit integer in the target byte order.
518 \item Calculate a primary hash $H = REP(X)\ \&\ MASK(k)$, where
519 $MASK(k)$ is a mask with the low-order $k$ bits all set to 1.
520 \item Calculate a secondary hash $H' = (((REP(X)>>32)\ \&\ MASK(k))\ |\ 1)$.
521 \item If the hash table entry at index $H$ matches the signature, use
522 that entry. If the hash table entry at index $H$ is unused (all
523 zeroes), terminate the search: the signature is not present
525 \item Let $H = (H + H')\ modulo\ S$. Repeat at Step 4.
528 Because $S > U$, and $H'$ and $S$ are relatively prime, the search is
529 guaranteed to stop at an unused slot or find the match.
532 The table of offsets begins immediately following the parallel
533 table (at offset \mbox{$16 + 12 * S$} from the beginning of the section).
534 The table is a two-dimensional array of 4-byte words,
535 %(using the byte order of the application binary),
536 with $C$ columns and $U + 1$
537 rows, in row-major order. Each row in the array is indexed
538 starting from 0. The first row provides a key to the columns:
539 each column in this row provides a section identifier for a debug
540 section, and the offsets in the same column of subsequent rows
541 refer to that section. The section identifiers are shown in
542 Table \referfol{tab:dwarfpackagefilesectionidentifierencodings}.
546 \setlength{\extrarowheight}{0.1cm}
547 \begin{longtable}{l|c|l}
548 \caption{DWARF package file section identifier \mbox{encodings}}
549 \label{tab:dwarfpackagefilesectionidentifierencodings}
550 \addtoindexx{DWARF package files!section identifier encodings} \\
551 \hline \bfseries Section identifier &\bfseries Value &\bfseries Section \\ \hline
553 \bfseries Section identifier &\bfseries Value &\bfseries Section\\ \hline
555 \hline \emph{Continued on next page}
559 \DWSECTINFOTARG & 1 & \dotdebuginfodwo \\
560 \textit{Reserved} & 2 & \\
561 \DWSECTABBREVTARG & 3 & \dotdebugabbrevdwo \\
562 \DWSECTLINETARG & 4 & \dotdebuglinedwo \\
563 \DWSECTLOCTARG & 5 & \dotdebuglocdwo \\
564 \DWSECTSTROFFSETSTARG & 6 & \dotdebugstroffsetsdwo \\
565 %DWSECTMACINFO & & \dotdebugmacinfodwo \\
566 \DWSECTMACROTARG & 7 & \dotdebugmacrodwo \\
570 The offsets provided by the CU and TU index sections are the
571 base offsets for the contributions made by each CU or TU to the
572 corresponding section in the package file. Each CU and TU header
573 contains a \HFNdebugabbrevoffset{} field, used to find the abbreviations
574 table for that CU or TU within the contribution to the
575 \dotdebugabbrevdwo{} section for that CU or TU, and are
576 interpreted as relative to the base offset given in the index
577 section. Likewise, offsets into \dotdebuglinedwo{} from
578 \DWATstmtlist{} attributes are interpreted as relative to
579 the base offset for \dotdebuglinedwo{}, and offsets into other debug
580 sections obtained from DWARF attributes are also
581 interpreted as relative to the corresponding base offset.
583 The table of sizes begins immediately following the table of
584 offsets, and provides the sizes of the contributions made by each
585 CU or TU to the corresponding section in the package file. Like
586 the table of offsets, it is a two-dimensional array of 4-byte
587 words, with $C$ columns and $U$ rows, in row-major order. Each row in
588 the array is indexed starting from 1 (row 0 of the table of
589 offsets also serves as the key for the table of sizes).
591 \subsection{DWARF Supplementary Object Files}
592 \label{datarep:dwarfsupplemetaryobjectfiles}
593 In order to minimize the size of debugging information, it is possible
594 to move duplicate debug information entries, strings and macro entries from
595 several executables or shared object files into a separate
596 \addtoindexi{\textit{supplementary object file}}{supplementary object file} by some
597 post-linking utility; the moved entries and strings can be then referenced
598 from the debugging information of each of those executable or shared object files.
601 A DWARF \addtoindex{supplementary object file} is itself an object file,
602 using the same object
603 file format, \byteorder{}, and size as the corresponding application executables
604 or shared libraries. It consists only of a file header, section table, and
605 a number of DWARF debug information sections. Both the
606 \addtoindex{supplementary object file}
607 and all the executable or shared object files that reference entries or strings in that
608 file must contain a \dotdebugsup{} section that establishes the relationship.
610 The \dotdebugsup{} section contains:
611 \begin{enumerate}[1. ]
612 \item \texttt{version} (\HFTuhalf) \\
613 \addttindexx{version}
614 A 2-byte unsigned integer representing the version of the DWARF
615 information for the compilation unit (see Appendix G). The
616 value in this field is \versiondotdebugsup.
618 \item \texttt{is\_supplementary} (\HFTubyte) \\
619 \addttindexx{is\_supplementary}
620 A 1-byte unsigned integer, which contains the value 1 if it is
621 in the \addtoindex{supplementary object file} that other executable or
622 shared object files refer to, or 0 if it is an executable or shared object
623 referring to a \addtoindex{supplementary object file}.
626 \item \texttt{sup\_filename} (null terminated filename string) \\
627 \addttindexx{sup\_filename}
628 If \addttindex{is\_supplementary} is 0, this contains either an absolute
629 filename for the \addtoindex{supplementary object file}, or a filename
630 relative to the object file containing the \dotdebugsup{} section.
631 If \addttindex{is\_supplementary} is 1, then \addttindex{sup\_filename}
632 is not needed and must be an empty string (a single null byte).
635 \item \texttt{sup\_checksum\_len} (unsigned LEB128) \\
636 \addttindexx{sup\_checksum\_len}
637 Length of the following \addttindex{sup\_checksum} field;
638 his value can be 0 if no checksum is provided.
641 \item \texttt{sup\_checksum} (array of \HFTubyte) \\
642 \addttindexx{sup\_checksum}
643 Some checksum or cryptographic hash function of the \dotdebuginfo{},
644 \dotdebugstr{} and \dotdebugmacro{} sections of the
645 \addtoindex{supplementary object file}, or some unique identifier
646 which the implementation can choose to verify that the supplementary
647 section object file matches what the debug information in the executable
648 or shared object file expects.
651 Debug information entries that refer to an executable's or shared
652 object's addresses must \emph{not} be moved to supplementary files (the
653 addesses will likely not be the same). Similarly,
654 entries referenced from within location expressions or using loclistptr
655 form attributes must not be moved to a \addtoindex{supplementary object file}.
657 Executable or shared object file compilation units can use
658 \DWTAGimportedunit{} with \DWFORMrefsup{} form \DWATimport{} attribute
659 to import entries from the \addtoindex{supplementary object file}, other \DWFORMrefsup{}
660 attributes to refer to them and \DWFORMstrpsup{} form attributes to
661 refer to strings that are used by debug information of multiple
662 executables or shared object files. Within the \addtoindex{supplementary object file}'s
663 debugging sections, form \DWFORMrefsup{} or \DWFORMstrpsup{} are
664 not used, and all reference forms referring to some other sections
665 refer to the local sections in the \addtoindex{supplementary object file}.
667 In macro information, \DWMACROdefinesup{} or
668 \DWMACROundefsup{} opcodes can refer to strings in the
669 \dotdebugstr{} section of the \addtoindex{supplementary object file},
670 or \DWMACROimportsup{}
671 can refer to \dotdebugmacro{} section entries. Within the
672 \dotdebugmacro{} section of a \addtoindex{supplementary object file},
673 \DWMACROdefinestrp{} and \DWMACROundefstrp{}
674 opcodes refer to the local \dotdebugstr{} section in that
675 supplementary file, not the one in
676 the executable or shared object file.
680 \section{32-Bit and 64-Bit DWARF Formats}
681 \label{datarep:32bitand64bitdwarfformats}
682 \hypertarget{datarep:xxbitdwffmt}{}
683 \addtoindexx{32-bit DWARF format}
684 \addtoindexx{64-bit DWARF format}
685 There are two closely related file formats. In the 32-bit DWARF
686 format, all values that represent lengths of DWARF sections
687 and offsets relative to the beginning of DWARF sections are
688 represented using four bytes. In the 64-bit DWARF format, all
689 values that represent lengths of DWARF sections and offsets
690 relative to the beginning of DWARF sections are represented
691 using eight bytes. A special convention applies to the initial
692 length field of certain DWARF sections, as well as the CIE and
693 FDE structures, so that the 32-bit and 64-bit DWARF formats
694 can coexist and be distinguished within a single linked object.
696 The differences between the 32- and 64-bit DWARF formats are
697 detailed in the following:
698 \begin{enumerate}[1. ]
700 \item In the 32-bit DWARF format, an
701 \addtoindex{initial length} field (see
702 \addtoindexx{initial length!encoding}
703 Section \ref{datarep:initiallengthvalues} on page \pageref{datarep:initiallengthvalues})
704 is an unsigned 4-byte integer (which
705 must be less than \xfffffffzero); in the 64-bit DWARF format,
706 an \addtoindex{initial length} field is 12 bytes in size,
709 \item The first four bytes have the value \xffffffff.
711 \item The following eight bytes contain the actual length
712 represented as an unsigned 8-byte integer.
715 \textit{This representation allows a DWARF consumer to dynamically
716 detect that a DWARF section contribution is using the 64-bit
717 format and to adapt its processing accordingly.}
720 \item \hypertarget{datarep:sectionoffsetlength}{}
721 Section offset and section length
722 \addtoindexx{section length!use in headers}
724 \addtoindexx{section offset!use in headers}
725 in the headers of DWARF sections (other than initial length
726 \addtoindexx{initial length}
727 fields) are listed following. In the 32-bit DWARF format these
728 are 4-byte unsigned integer values; in the 64-bit DWARF format,
729 they are 8-byte unsigned integer values.
733 Section &Name & Role \\ \hline
734 \dotdebugaranges{} & \addttindex{debug\_info\_offset} & offset in \dotdebuginfo{} \\
735 \dotdebugframe{}/CIE & \addttindex{CIE\_id} & CIE distinguished value \\
736 \dotdebugframe{}/FDE & \addttindex{CIE\_pointer} & offset in \dotdebugframe{} \\
737 \dotdebuginfo{} & \addttindex{debug\_abbrev\_offset} & offset in \dotdebugabbrev{} \\
738 \dotdebugline{} & \addttindex{header\_length} & length of header itself \\
739 \dotdebugnames{} & entry in array of CUs & offset in \dotdebuginfo{} \\
745 The \texttt{CIE\_id} field in a CIE structure must be 64 bits because
746 it overlays the \texttt{CIE\_pointer} in a FDE structure; this implicit
747 union must be accessed to distinguish whether a CIE or FDE is
748 present, consequently, these two fields must exactly overlay
749 each other (both offset and size).
751 \item Within the body of the \dotdebuginfo{}
752 section, certain forms of attribute value depend on the choice
753 of DWARF format as follows. For the 32-bit DWARF format,
754 the value is a 4-byte unsigned integer; for the 64-bit DWARF
755 format, the value is an 8-byte unsigned integer.
757 \begin{tabular}{lp{6cm}}
758 Form & Role \\ \hline
759 \DWFORMlinestrp & offset in \dotdebuglinestr \\
760 \DWFORMrefaddr & offset in \dotdebuginfo{} \\
761 \DWFORMrefsup & offset in \dotdebuginfo{} section of a \mbox{supplementary} object file \\
762 \addtoindexx{supplementary object file}
763 \DWFORMsecoffset & offset in a section other than \\
764 & \dotdebuginfo{} or \dotdebugstr{} \\
765 \DWFORMstrp & offset in \dotdebugstr{} \\
766 \DWFORMstrpsup & offset in \dotdebugstr{} section of a \mbox{supplementary} object file \\
767 \DWOPcallref & offset in \dotdebuginfo{} \\
772 \item Within the body of the \dotdebugline{} section, certain forms of content
773 description depend on the choice of DWARF format as follows: for the
774 32-bit DWARF format, the value is a 4-byte unsigned integer; for the
775 64-bit DWARF format, the value is a 8-byte unsigned integer.
777 \begin{tabular}{lp{6cm}}
778 Form & Role \\ \hline
779 \DWFORMlinestrp & offset in \dotdebuglinestr
783 \item Within the body of the \dotdebugnames{}
784 sections, the representation of each entry in the array of
785 compilation units (CUs) and the array of local type units
786 (TUs), which represents an offset in the
788 section, depends on the DWARF format as follows: in the
789 32-bit DWARF format, each entry is a 4-byte unsigned integer;
790 in the 64-bit DWARF format, it is a 8-byte unsigned integer.
793 \item In the body of the \dotdebugstroffsets{} and \dotdebugstroffsetsdwo{}
794 sections, the size of entries in the body depend on the DWARF
795 format as follows: in the 32-bit DWARF format, entries are 4-byte
796 unsigned integer values; in the 64-bit DWARF format, they are
797 8-byte unsigned integers.
799 \item In the body of the \dotdebugaddr{}, \dotdebugloc{} and \dotdebugranges{}
800 sections, the contents of the address size fields depends on the
801 DWARF format as follows: in the 32-bit DWARF format, these fields
802 contain 4; in the 64-bit DWARF format these fields contain 8.
806 The 32-bit and 64-bit DWARF format conventions must \emph{not} be
807 intermixed within a single compilation unit.
809 \textit{Attribute values and section header fields that represent
810 addresses in the target program are not affected by these
813 A DWARF consumer that supports the 64-bit DWARF format must
814 support executables in which some compilation units use the
815 32-bit format and others use the 64-bit format provided that
816 the combination links correctly (that is, provided that there
817 are no link\dash time errors due to truncation or overflow). (An
818 implementation is not required to guarantee detection and
819 reporting of all such errors.)
821 \textit{It is expected that DWARF producing compilers will \emph{not} use
822 the 64-bit format \emph{by default}. In most cases, the division of
823 even very large applications into a number of executable and
824 shared object files will suffice to assure that the DWARF sections
825 within each individual linked object are less than 4 GBytes
826 in size. However, for those cases where needed, the 64-bit
827 format allows the unusual case to be handled as well. Even
828 in this case, it is expected that only application supplied
829 objects will need to be compiled using the 64-bit format;
830 separate 32-bit format versions of system supplied shared
831 executable libraries can still be used.}
835 \section{Format of Debugging Information}
836 \label{datarep:formatofdebugginginformation}
838 For each compilation unit compiled with a DWARF producer,
839 a contribution is made to the \dotdebuginfo{} section of
840 the object file. Each such contribution consists of a
841 compilation unit header
842 (see Section \refersec{datarep:compilationunitheader})
844 single \DWTAGcompileunit{} or
845 \DWTAGpartialunit{} debugging
846 information entry, together with its children.
848 For each type defined in a compilation unit, a separate
849 contribution may also be made to the
851 section of the object file. Each
852 such contribution consists of a
853 \addtoindex{type unit} header
854 (see Section \refersec{datarep:typeunitheader})
855 followed by a \DWTAGtypeunit{} entry, together with
858 Each debugging information entry begins with a code that
859 represents an entry in a separate
860 \addtoindex{abbreviations table}. This
861 code is followed directly by a series of attribute values.
863 The appropriate entry in the
864 \addtoindex{abbreviations table} guides the
865 interpretation of the information contained directly in the
866 \dotdebuginfo{} section.
869 Multiple debugging information entries may share the same
870 abbreviation table entry. Each compilation unit is associated
871 with a particular abbreviation table, but multiple compilation
872 units may share the same table.
874 \subsection{Unit Headers}
875 \label{datarep:unitheaders}
876 Unit headers contain a field, \addttindex{unit\_type}, whose value indicates the kind of
877 compilation unit that follows. The encodings for the unit type
878 enumeration are shown in Table \refersec{tab:unitheaderunitkindencodings}.
882 \setlength{\extrarowheight}{0.1cm}
883 \begin{longtable}{l|c}
884 \caption{Unit header unit type encodings}
885 \label{tab:unitheaderunitkindencodings}
886 \addtoindexx{unit header unit type encodings} \\
887 \hline \bfseries Unit header unit type encodings&\bfseries Value \\ \hline
889 \bfseries Unit header unit type encodings&\bfseries Value \\ \hline
891 \hline \emph{Continued on next page}
893 \hline \ddag\ \textit{New in DWARF Version 5}
895 \DWUTcompileTARG~\ddag &0x01 \\
896 \DWUTtypeTARG~\ddag &0x02 \\
897 \DWUTpartialTARG~\ddag &0x03 \\ \hline
902 \subsubsection{Compilation Unit Header}
903 \label{datarep:compilationunitheader}
904 \begin{enumerate}[1. ]
906 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
907 \addttindexx{unit\_length}
909 \addtoindexx{initial length}
910 unsigned integer representing the length
911 of the \dotdebuginfo{}
912 contribution for that compilation unit,
913 not including the length field itself. In the \thirtytwobitdwarfformat,
914 this is a 4-byte unsigned integer (which must be less
915 than \xfffffffzero); in the \sixtyfourbitdwarfformat, this consists
916 of the 4-byte value \wffffffff followed by an 8-byte unsigned
917 integer that gives the actual length
918 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
920 \item \texttt{version} (\HFTuhalf) \\
921 \addttindexx{version}
922 A 2-byte unsigned integer representing the version of the
923 DWARF information for the compilation unit \addtoindexx{version number!compilation unit}
924 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
925 The value in this field is \versiondotdebuginfo.
928 \item \texttt{unit\_type} (\HFTubyte) \\
929 \addttindexx{unit\_type}
930 A 1-byte unsigned integer identifying this unit as a compilation unit.
931 The value of this field is
932 \DWUTcompile{} for a full compilation unit or
933 \DWUTpartial{} for a partial compilation unit
934 (see Section \refersec{chap:fullandpartialcompilationunitentries}).
936 \textit{This field is new in \DWARFVersionV.}
939 \item \HFNdebugabbrevoffset{} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
941 \addtoindexx{section offset!in .debug\_info header}
942 4-byte or 8-byte unsigned offset into the
944 section. This offset associates the compilation unit with a
945 particular set of debugging information entry abbreviations. In
946 the \thirtytwobitdwarfformat, this is a 4-byte unsigned length;
947 in the \sixtyfourbitdwarfformat, this is an 8-byte unsigned length
948 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
950 \item \texttt{address\_size} (\HFTubyte) \\
951 \addttindexx{address\_size}
952 A 1-byte unsigned integer representing the size in bytes of
953 an address on the target architecture. If the system uses
954 \addtoindexx{address space!segmented}
955 segmented addressing, this value represents the size of the
956 offset portion of an address.
960 \subsubsection{Type Unit Header}
961 \label{datarep:typeunitheader}
963 The header for the series of debugging information entries
964 contributing to the description of a type that has been
965 placed in its own \addtoindex{type unit}, within the
966 \dotdebuginfo{} section,
967 consists of the following information:
968 \begin{enumerate}[1. ]
970 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
971 \addttindexx{unit\_length}
972 A 4-byte or 12-byte unsigned integer
973 \addtoindexx{initial length}
974 representing the length
975 of the \dotdebuginfo{} contribution for that type unit,
976 not including the length field itself. In the \thirtytwobitdwarfformat,
977 this is a 4-byte unsigned integer (which must be
978 less than \xfffffffzero); in the \sixtyfourbitdwarfformat, this
979 consists of the 4-byte value \wffffffff followed by an
980 8-byte unsigned integer that gives the actual length
981 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
984 \item \texttt{version} (\HFTuhalf) \\
985 \addttindexx{version}
986 A 2-byte unsigned integer representing the version of the
987 DWARF information for the
988 type unit\addtoindexx{version number!type unit}
989 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
990 The value in this field is \versiondotdebuginfo.
992 \item \texttt{unit\_type} (\HFTubyte) \\
993 \addttindexx{unit\_type}
994 A 1-byte unsigned integer identifying this unit as a type unit.
995 The value of this field is \DWUTtype{} for a type unit
996 (see Section \refersec{chap:typeunitentries}).
998 \textit{This field is new in \DWARFVersionV.}
1001 \item \HFNdebugabbrevoffset{} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
1003 \addtoindexx{section offset!in .debug\_info header}
1004 4-byte or 8-byte unsigned offset into the
1006 section. This offset associates the type unit with a
1007 particular set of debugging information entry abbreviations. In
1008 the \thirtytwobitdwarfformat, this is a 4-byte unsigned length;
1009 in the \sixtyfourbitdwarfformat, this is an 8-byte unsigned length
1010 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1013 \item \texttt{address\_size} (\HFTubyte) \\
1014 \addttindexx{address\_size}
1015 A 1-byte unsigned integer representing the size
1016 \addtoindexx{size of an address}
1018 an address on the target architecture. If the system uses
1019 \addtoindexx{address space!segmented}
1020 segmented addressing, this value represents the size of the
1021 offset portion of an address.
1023 \item \texttt{type\_signature} (8-byte unsigned integer) \\
1024 \addttindexx{type\_signature}
1025 \addtoindexx{type signature}
1026 A unique 8-byte signature (see Section
1027 \refersec{datarep:typesignaturecomputation})
1028 of the type described in this type
1031 \textit{An attribute that refers (using
1032 \DWFORMrefsigeight{}) to
1033 the primary type contained in this
1034 \addtoindex{type unit} uses this value.}
1036 \item \texttt{type\_offset} (\livelink{datarep:sectionoffsetlength}{section offset}) \\
1037 \addttindexx{type\_offset}
1038 A 4-byte or 8-byte unsigned offset
1039 \addtoindexx{section offset!in .debug\_info header}
1040 relative to the beginning
1041 of the \addtoindex{type unit} header.
1042 This offset refers to the debugging
1043 information entry that describes the type. Because the type
1044 may be nested inside a namespace or other structures, and may
1045 contain references to other types that have not been placed in
1046 separate type units, it is not necessarily either the first or
1047 the only entry in the type unit. In the \thirtytwobitdwarfformat,
1048 this is a 4-byte unsigned length; in the \sixtyfourbitdwarfformat,
1049 this is an 8-byte unsigned length
1050 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1054 \subsection{Debugging Information Entry}
1055 \label{datarep:debugginginformationentry}
1057 Each debugging information entry begins with an
1058 unsigned LEB128\addtoindexx{LEB128!unsigned}
1059 number containing the abbreviation code for the entry. This
1060 code represents an entry within the abbreviations table
1061 associated with the compilation unit containing this entry. The
1062 abbreviation code is followed by a series of attribute values.
1064 On some architectures, there are alignment constraints on
1065 section boundaries. To make it easier to pad debugging
1066 information sections to satisfy such constraints, the
1067 abbreviation code 0 is reserved. Debugging information entries
1068 consisting of only the abbreviation code 0 are considered
1071 \subsection{Abbreviations Tables}
1072 \label{datarep:abbreviationstables}
1074 The abbreviations tables for all compilation units
1075 are contained in a separate object file section called
1077 As mentioned before, multiple compilation
1078 units may share the same abbreviations table.
1080 The abbreviations table for a single compilation unit consists
1081 of a series of abbreviation declarations. Each declaration
1082 specifies the tag and attributes for a particular form of
1083 debugging information entry. Each declaration begins with
1084 an unsigned LEB128\addtoindexx{LEB128!unsigned}
1085 number representing the abbreviation
1086 code itself. It is this code that appears at the beginning
1087 of a debugging information entry in the
1089 section. As described above, the abbreviation
1090 code 0 is reserved for null debugging information entries. The
1091 abbreviation code is followed by another unsigned LEB128\addtoindexx{LEB128!unsigned}
1092 number that encodes the entry\textquoteright s tag. The encodings for the
1093 tag names are given in
1094 Table \referfol{tab:tagencodings}.
1097 \setlength{\extrarowheight}{0.1cm}
1098 \begin{longtable}{l|c}
1099 \caption{Tag encodings} \label{tab:tagencodings} \\
1100 \hline \bfseries Tag name&\bfseries Value\\ \hline
1102 \bfseries Tag name&\bfseries Value \\ \hline
1104 \hline \emph{Continued on next page}
1106 \hline \ddag\ \textit{New in DWARF Version 5}
1108 \DWTAGarraytype{} &0x01 \\
1109 \DWTAGclasstype&0x02 \\
1110 \DWTAGentrypoint&0x03 \\
1111 \DWTAGenumerationtype&0x04 \\
1112 \DWTAGformalparameter&0x05 \\
1113 \DWTAGimporteddeclaration&0x08 \\
1115 \DWTAGlexicalblock&0x0b \\
1116 \DWTAGmember&0x0d \\
1117 \DWTAGpointertype&0x0f \\
1118 \DWTAGreferencetype&0x10 \\
1119 \DWTAGcompileunit&0x11 \\
1120 \DWTAGstringtype&0x12 \\
1121 \DWTAGstructuretype&0x13 \\
1122 \DWTAGsubroutinetype&0x15 \\
1123 \DWTAGtypedef&0x16 \\
1124 \DWTAGuniontype&0x17 \\
1125 \DWTAGunspecifiedparameters&0x18 \\
1126 \DWTAGvariant&0x19 \\
1127 \DWTAGcommonblock&0x1a \\
1128 \DWTAGcommoninclusion&0x1b \\
1129 \DWTAGinheritance&0x1c \\
1130 \DWTAGinlinedsubroutine&0x1d \\
1131 \DWTAGmodule&0x1e \\
1132 \DWTAGptrtomembertype&0x1f \\
1133 \DWTAGsettype&0x20 \\
1134 \DWTAGsubrangetype&0x21 \\
1135 \DWTAGwithstmt&0x22 \\
1136 \DWTAGaccessdeclaration&0x23 \\
1137 \DWTAGbasetype&0x24 \\
1138 \DWTAGcatchblock&0x25 \\
1139 \DWTAGconsttype&0x26 \\
1140 \DWTAGconstant&0x27 \\
1141 \DWTAGenumerator&0x28 \\
1142 \DWTAGfiletype&0x29 \\
1143 \DWTAGfriend&0x2a \\
1144 \DWTAGnamelist&0x2b \\
1145 \DWTAGnamelistitem&0x2c \\
1146 \DWTAGpackedtype&0x2d \\
1147 \DWTAGsubprogram&0x2e \\
1148 \DWTAGtemplatetypeparameter&0x2f \\
1149 \DWTAGtemplatevalueparameter&0x30 \\
1150 \DWTAGthrowntype&0x31 \\
1151 \DWTAGtryblock&0x32 \\
1152 \DWTAGvariantpart&0x33 \\
1153 \DWTAGvariable&0x34 \\
1154 \DWTAGvolatiletype&0x35 \\
1155 \DWTAGdwarfprocedure&0x36 \\
1156 \DWTAGrestricttype&0x37 \\
1157 \DWTAGinterfacetype&0x38 \\
1158 \DWTAGnamespace&0x39 \\
1159 \DWTAGimportedmodule&0x3a \\
1160 \DWTAGunspecifiedtype&0x3b \\
1161 \DWTAGpartialunit&0x3c \\
1162 \DWTAGimportedunit&0x3d \\
1163 \DWTAGcondition&\xiiif \\
1164 \DWTAGsharedtype&0x40 \\
1165 \DWTAGtypeunit & 0x41 \\
1166 \DWTAGrvaluereferencetype & 0x42 \\
1167 \DWTAGtemplatealias & 0x43 \\
1168 \DWTAGcoarraytype~\ddag & 0x44 \\
1169 \DWTAGgenericsubrange~\ddag & 0x45 \\
1170 \DWTAGdynamictype~\ddag & 0x46 \\
1171 \DWTAGatomictype~\ddag & 0x47 \\
1172 \DWTAGcallsite~\ddag & 0x48 \\
1173 \DWTAGcallsiteparameter~\ddag & 0x49 \\
1174 \DWTAGlouser&0x4080 \\
1175 \DWTAGhiuser&\xffff \\
1180 Following the tag encoding is a 1-byte value that determines
1181 whether a debugging information entry using this abbreviation
1182 has child entries or not. If the value is
1184 the next physically succeeding entry of any debugging
1185 information entry using this abbreviation is the first
1186 child of that entry. If the 1-byte value following the
1187 abbreviation\textquoteright s tag encoding is
1188 \DWCHILDRENnoTARG, the next
1189 physically succeeding entry of any debugging information entry
1190 using this abbreviation is a sibling of that entry. (Either
1191 the first child or sibling entries may be null entries). The
1192 encodings for the child determination byte are given in
1193 Table \refersec{tab:childdeterminationencodings}
1195 Section \refersec{chap:relationshipofdebugginginformationentries},
1196 each chain of sibling entries is terminated by a null entry.)
1200 \setlength{\extrarowheight}{0.1cm}
1201 \begin{longtable}{l|c}
1202 \caption{Child determination encodings}
1203 \label{tab:childdeterminationencodings}
1204 \addtoindexx{Child determination encodings} \\
1205 \hline \bfseries Children determination name&\bfseries Value \\ \hline
1207 \bfseries Children determination name&\bfseries Value \\ \hline
1209 \hline \emph{Continued on next page}
1213 \DWCHILDRENno&0x00 \\
1214 \DWCHILDRENyes&0x01 \\ \hline
1219 Finally, the child encoding is followed by a series of
1220 attribute specifications. Each attribute specification
1221 consists of two parts. The first part is an
1222 unsigned LEB128\addtoindexx{LEB128!unsigned}
1223 number representing the attribute\textquoteright s name.
1224 The second part is an
1225 unsigned LEB128\addtoindexx{LEB128!unsigned}
1226 number representing the attribute\textquoteright s form.
1227 The series of attribute specifications ends with an
1228 entry containing 0 for the name and 0 for the form.
1231 \DWFORMindirectTARG{} is a special case. For
1232 attributes with this form, the attribute value itself in the
1234 section begins with an unsigned
1235 LEB128 number that represents its form. This allows producers
1236 to choose forms for particular attributes
1237 \addtoindexx{abbreviations table!dynamic forms in}
1239 without having to add a new entry to the abbreviations table.
1241 The attribute form \DWFORMimplicitconstTARG{} is another special case.
1242 For attributes with this form, the attribute specification contains
1243 a third part, which is a signed LEB128\addtoindexx{LEB128!signed}
1244 number. The value of this number is used as the value of the
1245 attribute, and no value is stored in the \dotdebuginfo{} section.
1247 The abbreviations for a given compilation unit end with an
1248 entry consisting of a 0 byte for the abbreviation code.
1251 Appendix \refersec{app:compilationunitsandabbreviationstableexample}
1252 for a depiction of the organization of the
1253 debugging information.}
1256 \subsection{Attribute Encodings}
1257 \label{datarep:attributeencodings}
1259 The encodings for the attribute names are given in
1260 Table \referfol{tab:attributeencodings}.
1263 \setlength{\extrarowheight}{0.1cm}
1264 \begin{longtable}{l|c|l}
1265 \caption{Attribute encodings}
1266 \label{tab:attributeencodings}
1267 \addtoindexx{attribute encodings} \\
1268 \hline \bfseries Attribute name&\bfseries Value &\bfseries Classes \\ \hline
1270 \bfseries Attribute name&\bfseries Value &\bfseries Classes\\ \hline
1272 \hline \emph{Continued on next page}
1274 \hline \ddag\ \textit{New in DWARF Version 5}
1276 \DWATsibling&0x01&\livelink{chap:classreference}{reference}
1277 \addtoindexx{sibling attribute} \\
1278 \DWATlocation&0x02&\livelink{chap:classexprloc}{exprloc},
1279 \livelink{chap:classloclistptr}{loclistptr}
1280 \addtoindexx{location attribute} \\
1281 \DWATname&0x03&\livelink{chap:classstring}{string}
1282 \addtoindexx{name attribute} \\
1283 \DWATordering&0x09&\livelink{chap:classconstant}{constant}
1284 \addtoindexx{ordering attribute} \\
1285 \DWATbytesize&0x0b&\livelink{chap:classconstant}{constant},
1286 \livelink{chap:classexprloc}{exprloc},
1287 \livelink{chap:classreference}{reference}
1288 \addtoindexx{byte size attribute} \\
1289 \textit{Reserved}&0x0c\footnote{Code 0x0c is reserved to allow backward compatible support of the
1290 DW\_AT\_bit\_offset \mbox{attribute} which was
1291 defined in \DWARFVersionIII{} and earlier.}
1292 &\livelink{chap:classconstant}{constant},
1293 \livelink{chap:classexprloc}{exprloc},
1294 \livelink{chap:classreference}{reference}
1295 \addtoindexx{bit offset attribute (Version 3)}
1296 \addtoindexx{DW\_AT\_bit\_offset (deprecated)} \\
1297 \DWATbitsize&0x0d&\livelink{chap:classconstant}{constant},
1298 \livelink{chap:classexprloc}{exprloc},
1299 \livelink{chap:classreference}{reference}
1300 \addtoindexx{bit size attribute} \\
1301 \DWATstmtlist&0x10&\livelink{chap:classlineptr}{lineptr}
1302 \addtoindexx{statement list attribute} \\
1303 \DWATlowpc&0x11&\livelink{chap:classaddress}{address}
1304 \addtoindexx{low PC attribute} \\
1305 \DWAThighpc&0x12&\livelink{chap:classaddress}{address},
1306 \livelink{chap:classconstant}{constant}
1307 \addtoindexx{high PC attribute} \\
1308 \DWATlanguage&0x13&\livelink{chap:classconstant}{constant}
1309 \addtoindexx{language attribute} \\
1310 \DWATdiscr&0x15&\livelink{chap:classreference}{reference}
1311 \addtoindexx{discriminant attribute} \\
1312 \DWATdiscrvalue&0x16&\livelink{chap:classconstant}{constant}
1313 \addtoindexx{discriminant value attribute} \\
1314 \DWATvisibility&0x17&\livelink{chap:classconstant}{constant}
1315 \addtoindexx{visibility attribute} \\
1316 \DWATimport&0x18&\livelink{chap:classreference}{reference}
1317 \addtoindexx{import attribute} \\
1318 \DWATstringlength&0x19&\livelink{chap:classexprloc}{exprloc},
1319 \livelink{chap:classloclistptr}{loclistptr}
1320 \addtoindexx{string length attribute} \\
1321 \DWATcommonreference&0x1a&\livelink{chap:classreference}{reference}
1322 \addtoindexx{common reference attribute} \\
1323 \DWATcompdir&0x1b&\livelink{chap:classstring}{string}
1324 \addtoindexx{compilation directory attribute} \\
1325 \DWATconstvalue&0x1c&\livelink{chap:classblock}{block},
1326 \livelink{chap:classconstant}{constant},
1327 \livelink{chap:classstring}{string}
1328 \addtoindexx{constant value attribute} \\
1329 \DWATcontainingtype&0x1d&\livelink{chap:classreference}{reference}
1330 \addtoindexx{containing type attribute} \\
1331 \DWATdefaultvalue&0x1e&\livelink{chap:classconstant}{constant},
1332 \livelink{chap:classreference}{reference},
1333 \livelink{chap:classflag}{flag}
1334 \addtoindexx{default value attribute} \\
1335 \DWATinline&0x20&\livelink{chap:classconstant}{constant}
1336 \addtoindexx{inline attribute} \\
1337 \DWATisoptional&0x21&\livelink{chap:classflag}{flag}
1338 \addtoindexx{is optional attribute} \\
1339 \DWATlowerbound&0x22&\livelink{chap:classconstant}{constant},
1340 \livelink{chap:classexprloc}{exprloc},
1341 \livelink{chap:classreference}{reference}
1342 \addtoindexx{lower bound attribute} \\
1343 \DWATproducer&0x25&\livelink{chap:classstring}{string}
1344 \addtoindexx{producer attribute} \\
1345 \DWATprototyped&0x27&\livelink{chap:classflag}{flag}
1346 \addtoindexx{prototyped attribute} \\
1347 \DWATreturnaddr&0x2a&\livelink{chap:classexprloc}{exprloc},
1348 \livelink{chap:classloclistptr}{loclistptr}
1349 \addtoindexx{return address attribute} \\
1350 \DWATstartscope&0x2c&\livelink{chap:classconstant}{constant},
1351 \livelink{chap:classrangelistptr}{rangelistptr}
1352 \addtoindexx{start scope attribute} \\
1353 \DWATbitstride&0x2e&\livelink{chap:classconstant}{constant},
1354 \livelink{chap:classexprloc}{exprloc},
1355 \livelink{chap:classreference}{reference}
1356 \addtoindexx{bit stride attribute} \\
1357 \DWATupperbound&0x2f&\livelink{chap:classconstant}{constant},
1358 \livelink{chap:classexprloc}{exprloc},
1359 \livelink{chap:classreference}{reference}
1360 \addtoindexx{upper bound attribute} \\
1361 \DWATabstractorigin&0x31&\livelink{chap:classreference}{reference}
1362 \addtoindexx{abstract origin attribute} \\
1363 \DWATaccessibility&0x32&\livelink{chap:classconstant}{constant}
1364 \addtoindexx{accessibility attribute} \\
1365 \DWATaddressclass&0x33&\livelink{chap:classconstant}{constant}
1366 \addtoindexx{address class attribute} \\
1367 \DWATartificial&0x34&\livelink{chap:classflag}{flag}
1368 \addtoindexx{artificial attribute} \\
1369 \DWATbasetypes&0x35&\livelink{chap:classreference}{reference}
1370 \addtoindexx{base types attribute} \\
1371 \DWATcallingconvention&0x36&\livelink{chap:classconstant}{constant}
1372 \addtoindexx{calling convention attribute} \\
1373 \DWATcount&0x37&\livelink{chap:classconstant}{constant},
1374 \livelink{chap:classexprloc}{exprloc},
1375 \livelink{chap:classreference}{reference}
1376 \addtoindexx{count attribute} \\
1377 \DWATdatamemberlocation&0x38&\livelink{chap:classconstant}{constant},
1378 \livelink{chap:classexprloc}{exprloc},
1379 \livelink{chap:classloclistptr}{loclistptr}
1380 \addtoindexx{data member attribute} \\
1381 \DWATdeclcolumn&0x39&\livelink{chap:classconstant}{constant}
1382 \addtoindexx{declaration column attribute} \\
1383 \DWATdeclfile&0x3a&\livelink{chap:classconstant}{constant}
1384 \addtoindexx{declaration file attribute} \\
1385 \DWATdeclline&0x3b&\livelink{chap:classconstant}{constant}
1386 \addtoindexx{declaration line attribute} \\
1387 \DWATdeclaration&0x3c&\livelink{chap:classflag}{flag}
1388 \addtoindexx{declaration attribute} \\
1389 \DWATdiscrlist&0x3d&\livelink{chap:classblock}{block}
1390 \addtoindexx{discriminant list attribute} \\
1391 \DWATencoding&0x3e&\livelink{chap:classconstant}{constant}
1392 \addtoindexx{encoding attribute} \\
1393 \DWATexternal&\xiiif&\livelink{chap:classflag}{flag}
1394 \addtoindexx{external attribute} \\
1395 \DWATframebase&0x40&\livelink{chap:classexprloc}{exprloc},
1396 \livelink{chap:classloclistptr}{loclistptr}
1397 \addtoindexx{frame base attribute} \\
1398 \DWATfriend&0x41&\livelink{chap:classreference}{reference}
1399 \addtoindexx{friend attribute} \\
1400 \DWATidentifiercase&0x42&\livelink{chap:classconstant}{constant}
1401 \addtoindexx{identifier case attribute} \\
1402 \DWATmacroinfo\footnote{\raggedright Not used in \DWARFVersionV.
1403 Reserved for compatibility and coexistence
1404 with prior DWARF versions.}
1405 &0x43&\livelink{chap:classmacptr}{macptr}
1406 \addtoindexx{macro information attribute (legacy)!encoding} \\
1407 \DWATnamelistitem&0x44&\livelink{chap:classreference}{reference}
1408 \addtoindexx{name list item attribute} \\
1409 \DWATpriority&0x45&\livelink{chap:classreference}{reference}
1410 \addtoindexx{priority attribute} \\
1411 \DWATsegment&0x46&\livelink{chap:classexprloc}{exprloc},
1412 \livelink{chap:classloclistptr}{loclistptr}
1413 \addtoindexx{segment attribute} \\
1414 \DWATspecification&0x47&\livelink{chap:classreference}{reference}
1415 \addtoindexx{specification attribute} \\
1416 \DWATstaticlink&0x48&\livelink{chap:classexprloc}{exprloc},
1417 \livelink{chap:classloclistptr}{loclistptr}
1418 \addtoindexx{static link attribute} \\
1419 \DWATtype&0x49&\livelink{chap:classreference}{reference}
1420 \addtoindexx{type attribute} \\
1421 \DWATuselocation&0x4a&\livelink{chap:classexprloc}{exprloc},
1422 \livelink{chap:classloclistptr}{loclistptr}
1423 \addtoindexx{location list attribute} \\
1424 \DWATvariableparameter&0x4b&\livelink{chap:classflag}{flag}
1425 \addtoindexx{variable parameter attribute} \\
1426 \DWATvirtuality&0x4c&\livelink{chap:classconstant}{constant}
1427 \addtoindexx{virtuality attribute} \\
1428 \DWATvtableelemlocation&0x4d&\livelink{chap:classexprloc}{exprloc},
1429 \livelink{chap:classloclistptr}{loclistptr}
1430 \addtoindexx{vtable element location attribute} \\
1431 \DWATallocated&0x4e&\livelink{chap:classconstant}{constant},
1432 \livelink{chap:classexprloc}{exprloc},
1433 \livelink{chap:classreference}{reference}
1434 \addtoindexx{allocated attribute} \\
1435 \DWATassociated&0x4f&\livelink{chap:classconstant}{constant},
1436 \livelink{chap:classexprloc}{exprloc},
1437 \livelink{chap:classreference}{reference}
1438 \addtoindexx{associated attribute} \\
1439 \DWATdatalocation&0x50&\livelink{chap:classexprloc}{exprloc}
1440 \addtoindexx{data location attribute} \\
1441 \DWATbytestride&0x51&\livelink{chap:classconstant}{constant},
1442 \livelink{chap:classexprloc}{exprloc},
1443 \livelink{chap:classreference}{reference}
1444 \addtoindexx{byte stride attribute} \\
1445 \DWATentrypc&0x52&\livelink{chap:classaddress}{address},
1446 \livelink{chap:classconstant}{constant}
1447 \addtoindexx{entry PC attribute} \\
1448 \DWATuseUTFeight&0x53&\livelink{chap:classflag}{flag}
1449 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8} \\
1450 \DWATextension&0x54&\livelink{chap:classreference}{reference}
1451 \addtoindexx{extension attribute} \\
1452 \DWATranges&0x55&\livelink{chap:classrangelistptr}{rangelistptr}
1453 \addtoindexx{ranges attribute} \\
1454 \DWATtrampoline&0x56&\livelink{chap:classaddress}{address},
1455 \livelink{chap:classflag}{flag},
1456 \livelink{chap:classreference}{reference},
1457 \livelink{chap:classstring}{string}
1458 \addtoindexx{trampoline attribute} \\
1459 \DWATcallcolumn&0x57&\livelink{chap:classconstant}{constant}
1460 \addtoindexx{call column attribute} \\
1461 \DWATcallfile&0x58&\livelink{chap:classconstant}{constant}
1462 \addtoindexx{call file attribute} \\
1463 \DWATcallline&0x59&\livelink{chap:classconstant}{constant}
1464 \addtoindexx{call line attribute} \\
1465 \DWATdescription&0x5a&\livelink{chap:classstring}{string}
1466 \addtoindexx{description attribute} \\
1467 \DWATbinaryscale&0x5b&\livelink{chap:classconstant}{constant}
1468 \addtoindexx{binary scale attribute} \\
1469 \DWATdecimalscale&0x5c&\livelink{chap:classconstant}{constant}
1470 \addtoindexx{decimal scale attribute} \\
1471 \DWATsmall{} &0x5d&\livelink{chap:classreference}{reference}
1472 \addtoindexx{small attribute} \\
1473 \DWATdecimalsign&0x5e&\livelink{chap:classconstant}{constant}
1474 \addtoindexx{decimal scale attribute} \\
1475 \DWATdigitcount&0x5f&\livelink{chap:classconstant}{constant}
1476 \addtoindexx{digit count attribute} \\
1477 \DWATpicturestring&0x60&\livelink{chap:classstring}{string}
1478 \addtoindexx{picture string attribute} \\
1479 \DWATmutable&0x61&\livelink{chap:classflag}{flag}
1480 \addtoindexx{mutable attribute} \\
1481 \DWATthreadsscaled&0x62&\livelink{chap:classflag}{flag}
1482 \addtoindexx{thread scaled attribute} \\
1483 \DWATexplicit&0x63&\livelink{chap:classflag}{flag}
1484 \addtoindexx{explicit attribute} \\
1485 \DWATobjectpointer&0x64&\livelink{chap:classreference}{reference}
1486 \addtoindexx{object pointer attribute} \\
1487 \DWATendianity&0x65&\livelink{chap:classconstant}{constant}
1488 \addtoindexx{endianity attribute} \\
1489 \DWATelemental&0x66&\livelink{chap:classflag}{flag}
1490 \addtoindexx{elemental attribute} \\
1491 \DWATpure&0x67&\livelink{chap:classflag}{flag}
1492 \addtoindexx{pure attribute} \\
1493 \DWATrecursive&0x68&\livelink{chap:classflag}{flag}
1494 \addtoindexx{recursive attribute} \\
1495 \DWATsignature{} &0x69&\livelink{chap:classreference}{reference}
1496 \addtoindexx{signature attribute} \\
1497 \DWATmainsubprogram{} &0x6a&\livelink{chap:classflag}{flag}
1498 \addtoindexx{main subprogram attribute} \\
1499 \DWATdatabitoffset{} &0x6b&\livelink{chap:classconstant}{constant}
1500 \addtoindexx{data bit offset attribute} \\
1501 \DWATconstexpr{} &0x6c&\livelink{chap:classflag}{flag}
1502 \addtoindexx{constant expression attribute} \\
1503 \DWATenumclass{} &0x6d&\livelink{chap:classflag}{flag}
1504 \addtoindexx{enumeration class attribute} \\
1505 \DWATlinkagename{} &0x6e&\livelink{chap:classstring}{string}
1506 \addtoindexx{linkage name attribute} \\
1507 \DWATstringlengthbitsize{}~\ddag&0x6f&
1508 \livelink{chap:classconstant}{constant}
1509 \addtoindexx{string length attribute!size of length} \\
1510 \DWATstringlengthbytesize{}~\ddag&0x70&
1511 \livelink{chap:classconstant}{constant}
1512 \addtoindexx{string length attribute!size of length} \\
1513 \DWATrank~\ddag&0x71&
1514 \livelink{chap:classconstant}{constant},
1515 \livelink{chap:classexprloc}{exprloc}
1516 \addtoindexx{rank attribute} \\
1517 \DWATstroffsetsbase~\ddag&0x72&
1518 \livelinki{chap:classstroffsetsptr}{stroffsetsptr}{stroffsetsptr class}
1519 \addtoindexx{string offsets base!encoding} \\
1520 \DWATaddrbase~\ddag &0x73&
1521 \livelinki{chap:classaddrptr}{addrptr}{addrptr class}
1522 \addtoindexx{address table base!encoding} \\
1523 \DWATrangesbase~\ddag&0x74&
1524 \livelinki{chap:classrangelistptr}{rangelistptr}{rangelistptr class}
1525 \addtoindexx{ranges base!encoding} \\
1526 \DWATdwoid~\ddag &0x75&
1527 \livelink{chap:classconstant}{constant}
1528 \addtoindexx{split DWARF object file id!encoding} \\
1529 \DWATdwoname~\ddag &0x76&
1530 \livelink{chap:classstring}{string}
1531 \addtoindexx{split DWARF object file name!encoding} \\
1532 \DWATreference~\ddag &0x77&
1533 \livelink{chap:classflag}{flag} \\
1534 \DWATrvaluereference~\ddag &0x78&
1535 \livelink{chap:classflag}{flag} \\
1536 \DWATmacros~\ddag &0x79&\livelink{chap:classmacptr}{macptr}
1537 \addtoindexx{macro information attribute} \\
1538 \DWATcallallcalls~\ddag &0x7a&\CLASSflag
1539 \addtoindexx{all calls summary attribute} \\
1540 \DWATcallallsourcecalls~\ddag &0x7b &\CLASSflag
1541 \addtoindexx{all source calls summary attribute} \\
1542 \DWATcallalltailcalls~\ddag &0x7c&\CLASSflag
1543 \addtoindexx{all tail calls summary attribute} \\
1544 \DWATcallreturnpc~\ddag &0x7d &\CLASSaddress
1545 \addtoindexx{call return PC attribute} \\
1546 \DWATcallvalue~\ddag &0x7e &\CLASSexprloc
1547 \addtoindexx{call value attribute} \\
1548 \DWATcallorigin~\ddag &0x7f &\CLASSexprloc
1549 \addtoindexx{call origin attribute} \\
1550 \DWATcallparameter~\ddag &0x80 &\CLASSreference
1551 \addtoindexx{call parameter attribute} \\
1552 \DWATcallpc~\ddag &0x81 &\CLASSaddress
1553 \addtoindexx{call PC attribute} \\
1554 \DWATcalltailcall~\ddag &0x82 &\CLASSflag
1555 \addtoindexx{call tail call attribute} \\
1556 \DWATcalltarget~\ddag &0x83 &\CLASSexprloc
1557 \addtoindexx{call target attribute} \\
1558 \DWATcalltargetclobbered~\ddag &0x84 &\CLASSexprloc
1559 \addtoindexx{call target clobbered attribute} \\
1560 \DWATcalldatalocation~\ddag &0x85 &\CLASSexprloc
1561 \addtoindexx{call data location attribute} \\
1562 \DWATcalldatavalue~\ddag &0x86 &\CLASSexprloc
1563 \addtoindexx{call data value attribute} \\
1564 \DWATnoreturn~\ddag &0x87 &\CLASSflag
1565 \addtoindexx{noreturn attribute} \\
1566 \DWATalignment~\ddag &0x88 &\CLASSconstant
1567 \addtoindexx{alignment attribute} \\
1568 \DWATexportsymbols~\ddag &0x89 &\CLASSflag
1569 \addtoindexx{export symbols attribute} \\
1570 \DWATdeleted~\ddag &0x8a &\CLASSflag \addtoindexx{deleted attribute} \\
1571 \DWATdefaulted~\ddag &0x8b &\CLASSconstant \addtoindexx{defaulted attribute} \\
1572 \DWATlouser&0x2000 & --- \addtoindexx{low user attribute encoding} \\
1573 \DWAThiuser&\xiiifff& --- \addtoindexx{high user attribute encoding} \\
1578 The attribute form governs how the value of the attribute is
1579 encoded. There are nine classes of form, listed below. Each
1580 class is a set of forms which have related representations
1581 and which are given a common interpretation according to the
1582 attribute in which the form is used.
1584 Form \DWFORMsecoffsetTARG{}
1586 \addtoindexx{rangelistptr class}
1588 \addtoindexx{macptr class}
1590 \addtoindexx{loclistptr class}
1592 \addtoindexx{lineptr class}
1598 \CLASSrangelistptr{} or
1599 \CLASSstroffsetsptr;
1600 the list of classes allowed by the applicable attribute in
1601 Table \refersec{tab:attributeencodings}
1602 determines the class of the form.
1605 In the form descriptions that follow, some forms are said
1606 to depend in part on the value of an attribute of the
1607 \definition{\associatedcompilationunit}:
1610 In the case of a \splitDWARFobjectfile{}, the associated
1611 compilation unit is the skeleton compilation unit corresponding
1612 to the containing unit.
1613 \item Otherwise, the associated compilation unit
1614 is the containing unit.
1618 Each possible form belongs to one or more of the following classes
1619 (see Table \refersec{tab:classesofattributevalue} for a summary of
1620 the purpose and general usage of each class):
1623 \item \livelinki{chap:classaddress}{address}{address class} \\
1624 \livetarg{datarep:classaddress}{}
1625 Represented as either:
1627 \item An object of appropriate size to hold an
1628 address on the target machine
1630 The size is encoded in the compilation unit header
1631 (see Section \refersec{datarep:compilationunitheader}).
1632 This address is relocatable in a relocatable object file and
1633 is relocated in an executable file or shared object file.
1635 \item An indirect index into a table of addresses (as
1636 described in the previous bullet) in the
1637 \dotdebugaddr{} section (\DWFORMaddrxTARG).
1638 The representation of a \DWFORMaddrxNAME{} value is an unsigned
1639 \addtoindex{LEB128} value, which is interpreted as a zero-based
1640 index into an array of addresses in the \dotdebugaddr{} section.
1641 The index is relative to the value of the \DWATaddrbase{} attribute
1642 of the associated compilation unit.
1647 \item \livelink{chap:classaddrptr}{addrptr} \\
1648 \livetarg{datarep:classaddrptr}{}
1649 This is an offset into the \dotdebugaddr{} section (\DWFORMsecoffset). It
1650 consists of an offset from the beginning of the \dotdebugaddr{} section to the
1651 beginning of the list of machine addresses information for the
1652 referencing entity. It is relocatable in
1653 a relocatable object file, and relocated in an executable or
1654 shared object file. In the \thirtytwobitdwarfformat, this offset
1655 is a 4-byte unsigned value; in the 64-bit DWARF
1656 format, it is an 8-byte unsigned value (see Section
1657 \refersec{datarep:32bitand64bitdwarfformats}).
1659 \textit{This class is new in \DWARFVersionV.}
1662 \item \livelink{chap:classblock}{block} \\
1663 \livetarg{datarep:classblock}{}
1664 Blocks come in four forms:
1667 A 1-byte length followed by 0 to 255 contiguous information
1668 bytes (\DWFORMblockoneTARG).
1671 A 2-byte length followed by 0 to 65,535 contiguous information
1672 bytes (\DWFORMblocktwoTARG).
1675 A 4-byte length followed by 0 to 4,294,967,295 contiguous
1676 information bytes (\DWFORMblockfourTARG).
1679 An unsigned LEB128\addtoindexx{LEB128!unsigned}
1680 length followed by the number of bytes
1681 specified by the length (\DWFORMblockTARG).
1684 In all forms, the length is the number of information bytes
1685 that follow. The information bytes may contain any mixture
1686 of relocated (or relocatable) addresses, references to other
1687 debugging information entries or data bytes.
1689 \item \livelinki{chap:classconstant}{constant}{constant class} \\
1690 \livetarg{datarep:classconstant}{}
1691 There are eight forms of constants. There are fixed length
1692 constant data forms for one-, two-, four-, eight- and sixteen-byte values
1696 \DWFORMdatafourTARG,
1697 \DWFORMdataeightTARG{} and
1698 \DWFORMdatasixteenTARG).
1699 There are variable length constant
1700 data forms encoded using
1702 signed LEB128 numbers (\DWFORMsdataTARG) and unsigned
1703 LEB128 numbers (\DWFORMudataTARG).
1705 There is also an implicit constant (\DWFORMimplicitconst),
1706 whose value is provided as part of the abbreviation
1710 The data in \DWFORMdataone,
1713 \DWFORMdataeight{} and
1714 \DWFORMdatasixteen{}
1715 can be anything. Depending on context, it may
1716 be a signed integer, an unsigned integer, a floating\dash point
1717 constant, or anything else. A consumer must use context to
1718 know how to interpret the bits, which if they are target
1719 machine data (such as an integer or floating-point constant)
1720 will be in target machine \byteorder.
1722 \textit{If one of the \DWFORMdataTARG\textless n\textgreater
1723 forms is used to represent a
1724 signed or unsigned integer, it can be hard for a consumer
1725 to discover the context necessary to determine which
1726 interpretation is intended. Producers are therefore strongly
1727 encouraged to use \DWFORMsdata{} or
1728 \DWFORMudata{} for signed and
1729 unsigned integers respectively, rather than
1730 \DWFORMdata\textless n\textgreater.}
1733 \item \livelinki{chap:classexprloc}{exprloc}{exprloc class} \\
1734 \livetarg{datarep:classexprloc}{}
1735 This is an unsigned LEB128\addtoindexx{LEB128!unsigned} length followed by the
1736 number of information bytes specified by the length
1737 (\DWFORMexprlocTARG).
1738 The information bytes contain a DWARF expression
1739 (see Section \refersec{chap:dwarfexpressions})
1740 or location description
1741 (see Section \refersec{chap:locationdescriptions}).
1744 \item \livelinki{chap:classflag}{flag}{flag class} \\
1745 \livetarg{datarep:classflag}{}
1746 A flag \addtoindexx{flag class}
1747 is represented explicitly as a single byte of data
1748 (\DWFORMflagTARG) or
1749 implicitly (\DWFORMflagpresentTARG).
1751 first case, if the \nolink{flag} has value zero, it indicates the
1752 absence of the attribute; if the \nolink{flag} has a non-zero value,
1753 it indicates the presence of the attribute. In the second
1754 case, the attribute is implicitly indicated as present, and
1755 no value is encoded in the debugging information entry itself.
1757 \item \livelinki{chap:classlineptr}{lineptr}{lineptr class} \\
1758 \livetarg{datarep:classlineptr}{}
1759 This is an offset into
1760 \addtoindexx{section offset!in class lineptr value}
1762 \dotdebugline{} or \dotdebuglinedwo{} section
1764 It consists of an offset from the beginning of the
1766 section to the first byte of
1767 the data making up the line number list for the compilation
1769 It is relocatable in a relocatable object file, and
1770 relocated in an executable or shared object file. In the
1771 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
1772 in the \sixtyfourbitdwarfformat, it is an 8-byte unsigned value
1773 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1776 \item \livelinki{chap:classloclistptr}{loclistptr}{loclistptr class} \\
1777 \livetarg{datarep:classloclistptr}{}
1778 This is an offset into the
1782 It consists of an offset from the
1783 \addtoindexx{section offset!in class loclistptr value}
1786 section to the first byte of
1787 the data making up the
1788 \addtoindex{location list} for the compilation unit.
1789 It is relocatable in a relocatable object file, and
1790 relocated in an executable or shared object file. In the
1791 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
1792 in the \sixtyfourbitdwarfformat, it is an 8-byte unsigned value
1793 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1796 \item \livelinki{chap:classmacptr}{macptr}{macptr class} \\
1797 \livetarg{datarep:classmacptr}{}
1799 \addtoindexx{section offset!in class macptr value}
1801 \dotdebugmacro{} or \dotdebugmacrodwo{} section
1803 It consists of an offset from the beginning of the
1804 \dotdebugmacro{} or \dotdebugmacrodwo{}
1805 section to the the header making up the
1806 macro information list for the compilation unit.
1807 It is relocatable in a relocatable object file, and
1808 relocated in an executable or shared object file. In the
1809 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
1810 in the \sixtyfourbitdwarfformat, it is an 8-byte unsigned value
1811 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1814 \item \livelinki{chap:classrangelistptr}{rangelistptr}{rangelistptr class} \\
1815 \livetarg{datarep:classrangelistptr}{}
1817 \addtoindexx{section offset!in class rangelistptr value}
1818 offset into the \dotdebugranges{} section
1821 offset from the beginning of the
1822 \dotdebugranges{} section
1823 to the beginning of the non-contiguous address ranges
1824 information for the referencing entity.
1825 It is relocatable in
1826 a relocatable object file, and relocated in an executable or
1828 However, if a \DWATrangesbase{} attribute applies, the offset
1829 is relative to the base offset given by \DWATrangesbase.
1830 In the \thirtytwobitdwarfformat, this offset
1831 is a 4-byte unsigned value; in the 64-bit DWARF
1832 format, it is an 8-byte unsigned value (see Section
1833 \refersec{datarep:32bitand64bitdwarfformats}).
1836 \textit{Because classes
1841 \CLASSrangelistptr{} and
1842 \CLASSstroffsetsptr{}
1843 share a common representation, it is not possible for an
1844 attribute to allow more than one of these classes}
1848 \item \livelinki{chap:classreference}{reference}{reference class} \\
1849 \livetarg{datarep:classreference}{}
1850 There are four types of reference.
1853 \addtoindexx{reference class}
1854 first type of reference can identify any debugging
1855 information entry within the containing unit.
1858 \addtoindexx{section offset!in class reference value}
1859 offset from the first byte of the compilation
1860 header for the compilation unit containing the reference. There
1861 are five forms for this type of reference. There are fixed
1862 length forms for one, two, four and eight byte offsets
1868 and \DWFORMrefeightTARG).
1869 There is also an unsigned variable
1870 length offset encoded form that uses
1871 unsigned LEB128\addtoindexx{LEB128!unsigned} numbers
1872 (\DWFORMrefudataTARG).
1873 Because this type of reference is within
1874 the containing compilation unit no relocation of the value
1877 The second type of reference can identify any debugging
1878 information entry within a
1879 \dotdebuginfo{} section; in particular,
1880 it may refer to an entry in a different compilation unit
1881 from the unit containing the reference, and may refer to an
1882 entry in a different shared object file. This type of reference
1883 (\DWFORMrefaddrTARG)
1884 is an offset from the beginning of the
1886 section of the target executable or shared object file, or, for
1887 references within a \addtoindex{supplementary object file},
1888 an offset from the beginning of the local \dotdebuginfo{} section;
1889 it is relocatable in a relocatable object file and frequently
1890 relocated in an executable or shared object file. For
1891 references from one shared object or static executable file
1892 to another, the relocation and identification of the target
1893 object must be performed by the consumer. In the
1894 \thirtytwobitdwarfformat, this offset is a 4-byte unsigned value;
1895 in the \sixtyfourbitdwarfformat, it is an 8-byte
1897 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1899 \textit{A debugging information entry that may be referenced by
1900 another compilation unit using
1901 \DWFORMrefaddr{} must have a global symbolic name.}
1903 \textit{For a reference from one executable or shared object file to
1904 another, the reference is resolved by the debugger to identify
1905 the executable or shared object file and the offset into that
1906 file\textquoteright s \dotdebuginfo{}
1907 section in the same fashion as the run
1908 time loader, either when the debug information is first read,
1909 or when the reference is used.}
1911 The third type of reference can identify any debugging
1912 information type entry that has been placed in its own
1913 \addtoindex{type unit}. This type of
1914 reference (\DWFORMrefsigeightTARG) is the
1915 \addtoindexx{type signature}
1916 8-byte type signature
1917 (see Section \refersec{datarep:typesignaturecomputation})
1918 that was computed for the type.
1920 The fourth type of reference is a reference from within the
1921 \dotdebuginfo{} section of the executable or shared object file to
1922 a debugging information entry in the \dotdebuginfo{} section of
1923 a \addtoindex{supplementary object file}.
1924 This type of reference (\DWFORMrefsupTARG) is an offset from the
1925 beginning of the \dotdebuginfo{} section in the
1926 \addtoindex{supplementary object file}.
1928 \textit{The use of compilation unit relative references will reduce the
1929 number of link\dash time relocations and so speed up linking. The
1930 use of the second, third and fourth type of reference allows for the
1931 sharing of information, such as types, across compilation
1932 units, while the fourth type further allows for sharing of information
1933 across compilation units from different executables or shared object files.}
1935 \textit{A reference to any kind of compilation unit identifies the
1936 debugging information entry for that unit, not the preceding
1940 \item \livelinki{chap:classstring}{string}{string class} \\
1941 \livetarg{datarep:classstring}{}
1942 A string is a sequence of contiguous non\dash null bytes followed by
1944 \addtoindexx{string class}
1945 A string may be represented:
1947 \setlength{\itemsep}{0em}
1948 \item immediately in the debugging information entry itself
1949 (\DWFORMstringTARG),
1952 \addtoindexx{section offset!in class string value}
1953 offset into a string table contained in
1954 the \dotdebugstr{} section of the object file (\DWFORMstrpTARG),
1955 the \dotdebuglinestr{} section of the object file (\DWFORMlinestrpTARG),
1956 or as an offset into a string table contained in the
1957 \dotdebugstr{} section of a \addtoindex{supplementary object file}
1958 (\DWFORMstrpsupTARG). \DWFORMstrpsupNAME{} offsets from the \dotdebuginfo{}
1959 section of a \addtoindex{supplementary object file}
1960 refer to the local \dotdebugstr{} section of that same file.
1961 In the \thirtytwobitdwarfformat, the representation of a
1962 \DWFORMstrpNAME{}, \DWFORMstrpNAME{} or \DWFORMstrpsupNAME{}
1963 value is a 4-byte unsigned offset; in the \sixtyfourbitdwarfformat,
1964 it is an 8-byte unsigned offset
1965 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1968 \item as an indirect offset into the string table using an
1969 index into a table of offsets contained in the
1970 \dotdebugstroffsets{} section of the object file (\DWFORMstrxTARG).
1971 The representation of a \DWFORMstrxNAME{} value is an unsigned
1972 \addtoindex{LEB128} value, which is interpreted as a zero-based
1973 index into an array of offsets in the \dotdebugstroffsets{} section.
1974 The offset entries in the \dotdebugstroffsets{} section have the
1975 same representation as \DWFORMstrp{} values.
1977 Any combination of these three forms may be used within a single compilation.
1979 If the \DWATuseUTFeight{}
1980 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8} attribute is specified for the
1981 compilation, partial, skeleton or type unit entry, string values are encoded using the
1982 UTF\dash 8 (\addtoindex{Unicode} Transformation Format\dash 8) from the Universal
1983 Character Set standard (ISO/IEC 10646\dash 1:1993).
1984 \addtoindexx{ISO 10646 character set standard}
1985 Otherwise, the string representation is unspecified.
1987 \textit{The \addtoindex{Unicode} Standard Version 3 is fully compatible with
1988 ISO/IEC 10646\dash 1:1993.
1989 \addtoindexx{ISO 10646 character set standard}
1990 It contains all the same characters
1991 and encoding points as ISO/IEC 10646, as well as additional
1992 information about the characters and their use.}
1994 \textit{Earlier versions of DWARF did not specify the representation
1995 of strings; for compatibility, this version also does
1996 not. However, the UTF\dash 8 representation is strongly recommended.}
1999 \item \livelinki{chap:classstroffsetsptr}{stroffsetsptr}{stroffsetsptr class} \\
2000 \livetarg{datarep:classstroffsetsptr}{}
2001 This is an offset into the \dotdebugstroffsets{} section
2002 (\DWFORMsecoffset). It consists of an offset from the beginning of the
2003 \dotdebugstroffsets{} section to the
2004 beginning of the string offsets information for the
2005 referencing entity. It is relocatable in
2006 a relocatable object file, and relocated in an executable or
2007 shared object file. In the \thirtytwobitdwarfformat, this offset
2008 is a 4-byte unsigned value; in the \sixtyfourbitdwarfformat,
2009 it is an 8-byte unsigned value (see Section
2010 \refersec{datarep:32bitand64bitdwarfformats}).
2012 \textit{This class is new in \DWARFVersionV.}
2016 In no case does an attribute use one of the classes
2021 \CLASSrangelistptr{} or
2022 \CLASSstroffsetsptr{}
2023 to point into either the
2024 \dotdebuginfo{} or \dotdebugstr{} section.
2026 The form encodings are listed in
2027 Table \referfol{tab:attributeformencodings}.
2031 \setlength{\extrarowheight}{0.1cm}
2032 \begin{longtable}{l|c|l}
2033 \caption{Attribute form encodings} \label{tab:attributeformencodings} \\
2034 \hline \bfseries Form name&\bfseries Value &\bfseries Classes \\ \hline
2036 \bfseries Form name&\bfseries Value &\bfseries Classes\\ \hline
2038 \hline \emph{Continued on next page}
2040 \hline \ddag\ \textit{New in DWARF Version 5}
2043 \DWFORMaddr &0x01&\livelink{chap:classaddress}{address} \\
2044 \textit{Reserved} &0x02& \\
2045 \DWFORMblocktwo &0x03&\livelink{chap:classblock}{block} \\
2046 \DWFORMblockfour &0x04&\livelink{chap:classblock}{block} \\
2047 \DWFORMdatatwo &0x05&\livelink{chap:classconstant}{constant} \\
2048 \DWFORMdatafour &0x06&\livelink{chap:classconstant}{constant} \\
2049 \DWFORMdataeight &0x07&\livelink{chap:classconstant}{constant} \\
2050 \DWFORMstring&0x08&\livelink{chap:classstring}{string} \\
2051 \DWFORMblock&0x09&\livelink{chap:classblock}{block} \\
2052 \DWFORMblockone &0x0a&\livelink{chap:classblock}{block} \\
2053 \DWFORMdataone &0x0b&\livelink{chap:classconstant}{constant} \\
2054 \DWFORMflag&0x0c&\livelink{chap:classflag}{flag} \\
2055 \DWFORMsdata&0x0d&\livelink{chap:classconstant}{constant} \\
2056 \DWFORMstrp&0x0e&\livelink{chap:classstring}{string} \\
2057 \DWFORMudata&0x0f&\livelink{chap:classconstant}{constant} \\
2058 \DWFORMrefaddr&0x10&\livelink{chap:classreference}{reference} \\
2059 \DWFORMrefone&0x11&\livelink{chap:classreference}{reference} \\
2060 \DWFORMreftwo&0x12&\livelink{chap:classreference}{reference} \\
2061 \DWFORMreffour&0x13&\livelink{chap:classreference}{reference} \\
2062 \DWFORMrefeight&0x14&\livelink{chap:classreference}{reference} \\
2063 \DWFORMrefudata&0x15&\livelink{chap:classreference}{reference} \\
2064 \DWFORMindirect&0x16&(see Section \refersec{datarep:abbreviationstables}) \\
2065 \DWFORMsecoffset{} &0x17& \CLASSaddrptr, \CLASSlineptr, \CLASSloclistptr, \\
2066 & & \CLASSmacptr, \CLASSrangelistptr, \CLASSstroffsetsptr \\
2067 \DWFORMexprloc{} &0x18&\livelink{chap:classexprloc}{exprloc} \\
2068 \DWFORMflagpresent{} &0x19&\livelink{chap:classflag}{flag} \\
2069 \DWFORMstrx{} \ddag &0x1a&\livelink{chap:classstring}{string} \\
2070 \DWFORMaddrx{} \ddag &0x1b&\livelink{chap:classaddress}{address} \\
2071 \DWFORMrefsup{}~\ddag &0x1c &\livelink{chap:classreference}{reference} \\
2072 \DWFORMstrpsup{}~\ddag &0x1d &\livelink{chap:classstring}{string} \\
2073 \DWFORMdatasixteen~\ddag &0x1e &\CLASSconstant \\
2074 \DWFORMlinestrp~\ddag &0x1f &\CLASSstring \\
2075 \DWFORMrefsigeight &0x20 &\livelink{chap:classreference}{reference} \\
2076 \DWFORMimplicitconst~\ddag &0x21 &\CLASSconstant \\
2082 \section{Variable Length Data}
2083 \label{datarep:variablelengthdata}
2084 \addtoindexx{variable length data|see {LEB128}}
2086 \addtoindexx{Little-Endian Base 128|see{LEB128}}
2087 encoded using \doublequote{Little-Endian Base 128}
2088 \addtoindexx{little-endian encoding|see{endian attribute}}
2090 \addtoindexx{LEB128}
2091 LEB128 is a scheme for encoding integers
2092 densely that exploits the assumption that most integers are
2095 \textit{This encoding is equally suitable whether the target machine
2096 architecture represents data in big-endian or little-endian
2097 \byteorder. It is \doublequote{little-endian} only in the sense that it
2098 avoids using space to represent the \doublequote{big} end of an
2099 unsigned integer, when the big end is all zeroes or sign
2102 Unsigned LEB128\addtoindexx{LEB128!unsigned} (\addtoindex{ULEB128})
2103 numbers are encoded as follows:
2104 \addtoindexx{LEB128!unsigned, encoding as}
2105 start at the low order end of an unsigned integer and chop
2106 it into 7-bit chunks. Place each chunk into the low order 7
2107 bits of a byte. Typically, several of the high order bytes
2108 will be zero; discard them. Emit the remaining bytes in a
2109 stream, starting with the low order byte; set the high order
2110 bit on each byte except the last emitted byte. The high bit
2111 of zero on the last byte indicates to the decoder that it
2112 has encountered the last byte.
2114 The integer zero is a special case, consisting of a single
2117 Table \refersec{tab:examplesofunsignedleb128encodings}
2118 gives some examples of unsigned LEB128\addtoindexx{LEB128!unsigned}
2120 0x80 in each case is the high order bit of the byte, indicating
2121 that an additional byte follows.
2124 The encoding for signed, two\textquoteright{s} complement LEB128
2125 (\addtoindex{SLEB128}) \addtoindexx{LEB128!signed, encoding as}
2126 numbers is similar, except that the criterion for discarding
2127 high order bytes is not whether they are zero, but whether
2128 they consist entirely of sign extension bits. Consider the
2129 4-byte integer -2. The three high level bytes of the number
2130 are sign extension, thus LEB128 would represent it as a single
2131 byte containing the low order 7 bits, with the high order
2132 bit cleared to indicate the end of the byte stream. Note
2133 that there is nothing within the LEB128 representation that
2134 indicates whether an encoded number is signed or unsigned. The
2135 decoder must know what type of number to expect.
2136 Table \refersec{tab:examplesofunsignedleb128encodings}
2137 gives some examples of unsigned LEB128\addtoindexx{LEB128!unsigned}
2138 numbers and Table \refersec{tab:examplesofsignedleb128encodings}
2139 gives some examples of signed LEB128\addtoindexx{LEB128!signed}
2142 \textit{Appendix \refersec{app:variablelengthdataencodingdecodinginformative}
2143 \addtoindexx{LEB128!examples}
2144 gives algorithms for encoding and decoding these forms.}
2148 \setlength{\extrarowheight}{0.1cm}
2149 \begin{longtable}{c|c|c}
2150 \caption{Examples of unsigned LEB128 encodings}
2151 \label{tab:examplesofunsignedleb128encodings}
2152 \addtoindexx{LEB128 encoding!examples}\addtoindexx{LEB128!unsigned} \\
2153 \hline \bfseries Number&\bfseries First byte &\bfseries Second byte \\ \hline
2155 \bfseries Number&\bfseries First Byte &\bfseries Second byte\\ \hline
2157 \hline \emph{Continued on next page}
2163 128& 0 + 0x80 & 1 \\
2164 129& 1 + 0x80 & 1 \\
2165 %130& 2 + 0x80 & 1 \\
2166 12857& 57 + 0x80 & 100 \\
2173 \setlength{\extrarowheight}{0.1cm}
2174 \begin{longtable}{c|c|c}
2175 \caption{Examples of signed LEB128 encodings}
2176 \label{tab:examplesofsignedleb128encodings}
2177 \addtoindexx{LEB128!signed} \\
2178 \hline \bfseries Number&\bfseries First byte &\bfseries Second byte \\ \hline
2180 \bfseries Number&\bfseries First Byte &\bfseries Second byte\\ \hline
2182 \hline \emph{Continued on next page}
2188 127& 127 + 0x80 & 0 \\
2189 -127& 1 + 0x80 & 0x7f \\
2190 128& 0 + 0x80 & 1 \\
2191 -128& 0 + 0x80 & 0x7f \\
2192 129& 1 + 0x80 & 1 \\
2193 -129& 0x7f + 0x80 & 0x7e \\
2200 \section{DWARF Expressions and Location Descriptions}
2201 \label{datarep:dwarfexpressionsandlocationdescriptions}
2202 \subsection{DWARF Expressions}
2203 \label{datarep:dwarfexpressions}
2206 \addtoindexx{DWARF expression!operator encoding}
2207 DWARF expression is stored in a \nolink{block} of contiguous
2208 bytes. The bytes form a sequence of operations. Each operation
2209 is a 1-byte code that identifies that operation, followed by
2210 zero or more bytes of additional data. The encodings for the
2211 operations are described in
2212 Table \refersec{tab:dwarfoperationencodings}.
2215 \setlength{\extrarowheight}{0.1cm}
2216 \begin{longtable}{l|c|c|l}
2217 \caption{DWARF operation encodings} \label{tab:dwarfoperationencodings} \\
2218 \hline & &\bfseries No. of &\\
2219 \bfseries Operation&\bfseries Code &\bfseries Operands &\bfseries Notes\\ \hline
2221 & &\bfseries No. of &\\
2222 \bfseries Operation&\bfseries Code &\bfseries Operands &\bfseries Notes\\ \hline
2224 \hline \emph{Continued on next page}
2226 \hline \ddag\ \textit{New in DWARF Version 5}
2229 \DWOPaddr&0x03&1 & constant address \\
2230 & & &(size is target specific) \\
2232 \DWOPderef&0x06&0 & \\
2234 \DWOPconstoneu&0x08&1&1-byte constant \\
2235 \DWOPconstones&0x09&1&1-byte constant \\
2236 \DWOPconsttwou&0x0a&1&2-byte constant \\
2237 \DWOPconsttwos&0x0b&1&2-byte constant \\
2238 \DWOPconstfouru&0x0c&1&4-byte constant \\
2239 \DWOPconstfours&0x0d&1&4-byte constant \\
2240 \DWOPconsteightu&0x0e&1&8-byte constant \\
2241 \DWOPconsteights&0x0f&1&8-byte constant \\
2242 \DWOPconstu&0x10&1&ULEB128 constant \\
2243 \DWOPconsts&0x11&1&SLEB128 constant \\
2244 \DWOPdup&0x12&0 & \\
2245 \DWOPdrop&0x13&0 & \\
2246 \DWOPover&0x14&0 & \\
2247 \DWOPpick&0x15&1&1-byte stack index \\
2248 \DWOPswap&0x16&0 & \\
2249 \DWOProt&0x17&0 & \\
2250 \DWOPxderef&0x18&0 & \\
2251 \DWOPabs&0x19&0 & \\
2252 \DWOPand&0x1a&0 & \\
2253 \DWOPdiv&0x1b&0 & \\
2254 \DWOPminus&0x1c&0 & \\
2255 \DWOPmod&0x1d&0 & \\
2256 \DWOPmul&0x1e&0 & \\
2257 \DWOPneg&0x1f&0 & \\
2258 \DWOPnot&0x20&0 & \\
2260 \DWOPplus&0x22&0 & \\
2261 \DWOPplusuconst&0x23&1&ULEB128 addend \\
2262 \DWOPshl&0x24&0 & \\
2263 \DWOPshr&0x25&0 & \\
2264 \DWOPshra&0x26&0 & \\
2265 \DWOPxor&0x27&0 & \\
2267 \DWOPbra&0x28&1 & signed 2-byte constant \\
2274 \DWOPskip&0x2f&1&signed 2-byte constant \\ \hline
2276 \DWOPlitzero & 0x30 & 0 & \\
2277 \DWOPlitone & 0x31 & 0& literals 0 .. 31 = \\
2278 \ldots & & &\hspace{0.3cm}(\DWOPlitzero{} + literal) \\
2279 \DWOPlitthirtyone & 0x4f & 0 & \\ \hline
2281 \DWOPregzero & 0x50 & 0 & \\*
2282 \DWOPregone & 0x51 & 0® 0 .. 31 = \\*
2283 \ldots & & &\hspace{0.3cm}(\DWOPregzero{} + regnum) \\*
2284 \DWOPregthirtyone & 0x6f & 0 & \\ \hline
2286 \DWOPbregzero & 0x70 &1 & SLEB128 offset \\*
2287 \DWOPbregone & 0x71 & 1 &base register 0 .. 31 = \\*
2288 ... & & &\hspace{0.3cm}(\DWOPbregzero{} + regnum) \\*
2289 \DWOPbregthirtyone & 0x8f & 1 & \\ \hline
2291 \DWOPregx{} & 0x90 &1&ULEB128 register \\
2292 \DWOPfbreg{} & 0x91&1&SLEB128 offset \\
2293 \DWOPbregx{} & 0x92&2 &ULEB128 register, \\*
2294 & & &SLEB128 offset \\
2295 \DWOPpiece{} & 0x93 &1& ULEB128 size of piece \\
2296 \DWOPderefsize{} & 0x94 &1& 1-byte size of data retrieved \\
2297 \DWOPxderefsize{} & 0x95&1&1-byte size of data retrieved \\
2298 \DWOPnop{} & 0x96 &0& \\
2300 \DWOPpushobjectaddress&0x97&0 & \\
2301 \DWOPcalltwo&0x98&1& 2-byte offset of DIE \\
2302 \DWOPcallfour&0x99&1& 4-byte offset of DIE \\
2303 \DWOPcallref&0x9a&1& 4\dash\ or 8-byte offset of DIE \\
2304 \DWOPformtlsaddress&0x9b &0& \\
2305 \DWOPcallframecfa{} &0x9c &0& \\
2306 \DWOPbitpiece&0x9d &2&ULEB128 size, \\*
2308 \DWOPimplicitvalue{} &0x9e &2&ULEB128 size, \\*
2309 &&&\nolink{block} of that size\\
2310 \DWOPstackvalue{} &0x9f &0& \\
2311 \DWOPimplicitpointer{}~\ddag &0xa0& 2 &4- or 8-byte offset of DIE, \\*
2312 &&&SLEB128 constant offset \\
2313 \DWOPaddrx~\ddag&0xa1&1&ULEB128 indirect address \\
2314 \DWOPconstx~\ddag&0xa2&1&ULEB128 indirect constant \\
2315 \DWOPentryvalue~\ddag&0xa3&2&ULEB128 size, \\*
2316 &&&\nolink{block} of that size\\
2317 \DWOPconsttype~\ddag & 0xa4 & 3 & ULEB128 type entry offset,\\*
2318 & & & 1-byte size, \\*
2319 & & & constant value \\
2320 \DWOPregvaltype~\ddag & 0xa5 & 2 & ULEB128 register number, \\*
2321 &&& ULEB128 constant offset \\
2322 \DWOPdereftype~\ddag & 0xa6 & 2 & 1-byte size, \\*
2323 &&& ULEB128 type entry offset \\
2324 \DWOPxdereftype~\ddag & 0xa7 & 2 & 1-byte size, \\*
2325 &&& ULEB128 type entry offset \\
2326 \DWOPconvert~\ddag & 0xa8 & 1 & ULEB128 type entry offset \\
2327 \DWOPreinterpret~\ddag & 0xa9 & 1 & ULEB128 type entry offset \\
2328 \DWOPlouser{} &0xe0 && \\
2329 \DWOPhiuser{} &\xff && \\
2335 \subsection{Location Descriptions}
2336 \label{datarep:locationdescriptions}
2338 A location description is used to compute the
2339 location of a variable or other entity.
2341 \subsection{Location Lists}
2342 \label{datarep:locationlists}
2344 Each entry in a \addtoindex{location list} is either a location list entry,
2345 a base address selection entry, or an
2346 \addtoindexx{end-of-list entry!in location list}
2350 \subsubsection{Location List Entries in Non-Split Objects}
2351 A \addtoindex{location list} entry consists of two address offsets followed
2352 by an unsigned 2-byte length, followed by a block of contiguous bytes
2353 that contains a DWARF location description. The length
2354 specifies the number of bytes in that block. The two offsets
2355 are the same size as an address on the target machine.
2358 A base address selection entry and an
2359 \addtoindexx{end-of-list entry!in location list}
2360 end-of-list entry each
2361 consist of two (constant or relocated) address offsets. The two
2362 offsets are the same size as an address on the target machine.
2364 For a \addtoindex{location list} to be specified, the base address of
2365 \addtoindexx{base address selection entry!in location list}
2366 the corresponding compilation unit must be defined
2367 (see Section \refersec{chap:fullandpartialcompilationunitentries}).
2369 \subsubsection{Location List Entries in Split Objects}
2370 \label{datarep:locationlistentriesinsplitobjects}
2371 An alternate form for location list entries is used in split objects.
2372 Each entry begins with an unsigned 1-byte code that indicates the kind of entry
2373 that follows. The encodings for these constants are given in
2374 Table \refersec{tab:locationlistentryencodingvalues}.
2378 \setlength{\extrarowheight}{0.1cm}
2379 \begin{longtable}{l|c}
2380 \caption{Location list entry encoding values} \label{tab:locationlistentryencodingvalues} \\
2381 \hline \bfseries Location list entry encoding name&\bfseries Value \\ \hline
2383 \bfseries Location list entry encoding name&\bfseries Value\\ \hline
2385 \hline \emph{Continued on next page}
2389 \DWLLEendoflistentry & 0x0 \\
2390 \DWLLEbaseaddressselectionentry & 0x01 \\
2391 \DWLLEstartendentry & 0x02 \\
2392 \DWLLEstartlengthentry & 0x03 \\
2393 \DWLLEoffsetpairentry & 0x04 \\
2397 \section{Base Type Attribute Encodings}
2398 \label{datarep:basetypeattributeencodings}
2400 The\hypertarget{chap:DWATencodingencodingofbasetype}{}
2401 encodings of the constants used in the
2402 \DWATencodingDEFN{} attribute\addtoindexx{encoding attribute}
2404 Table \refersec{tab:basetypeencodingvalues}
2407 \setlength{\extrarowheight}{0.1cm}
2408 \begin{longtable}{l|c}
2409 \caption{Base type encoding values} \label{tab:basetypeencodingvalues} \\
2410 \hline \bfseries Base type encoding name&\bfseries Value \\ \hline
2412 \bfseries Base type encoding name&\bfseries Value\\ \hline
2414 \hline \emph{Continued on next page}
2417 \ddag \ \textit{New in \DWARFVersionV}
2419 \DWATEaddress&0x01 \\
2420 \DWATEboolean&0x02 \\
2421 \DWATEcomplexfloat&0x03 \\
2423 \DWATEsigned&0x05 \\
2424 \DWATEsignedchar&0x06 \\
2425 \DWATEunsigned&0x07 \\
2426 \DWATEunsignedchar&0x08 \\
2427 \DWATEimaginaryfloat&0x09 \\
2428 \DWATEpackeddecimal&0x0a \\
2429 \DWATEnumericstring&0x0b \\
2430 \DWATEedited&0x0c \\
2431 \DWATEsignedfixed&0x0d \\
2432 \DWATEunsignedfixed&0x0e \\
2433 \DWATEdecimalfloat & 0x0f \\
2434 \DWATEUTF{} & 0x10 \\
2435 \DWATEUCS~\ddag & 0x11 \\
2436 \DWATEASCII~\ddag & 0x12 \\
2437 \DWATElouser{} & 0x80 \\
2438 \DWATEhiuser{} & \xff \\
2443 The encodings of the constants used in the
2444 \DWATdecimalsign{} attribute
2446 Table \refersec{tab:decimalsignencodings}.
2449 \setlength{\extrarowheight}{0.1cm}
2450 \begin{longtable}{l|c}
2451 \caption{Decimal sign encodings} \label{tab:decimalsignencodings} \\
2452 \hline \bfseries Decimal sign code name&\bfseries Value \\ \hline
2454 \bfseries Decimal sign code name&\bfseries Value\\ \hline
2456 % \hline \emph{Continued on next page}
2460 \DWDSunsigned{} & 0x01 \\
2461 \DWDSleadingoverpunch{} & 0x02 \\
2462 \DWDStrailingoverpunch{} & 0x03 \\
2463 \DWDSleadingseparate{} & 0x04 \\
2464 \DWDStrailingseparate{} & 0x05 \\
2469 The encodings of the constants used in the
2470 \DWATendianity{} attribute are given in
2471 Table \refersec{tab:endianityencodings}.
2474 \setlength{\extrarowheight}{0.1cm}
2475 \begin{longtable}{l|c}
2476 \caption{Endianity encodings} \label{tab:endianityencodings}\\
2477 \hline \bfseries Endian code name&\bfseries Value \\ \hline
2479 \bfseries Endian code name&\bfseries Value\\ \hline
2481 \hline \emph{Continued on next page}
2486 \DWENDdefault{} & 0x00 \\
2487 \DWENDbig{} & 0x01 \\
2488 \DWENDlittle{} & 0x02 \\
2489 \DWENDlouser{} & 0x40 \\
2490 \DWENDhiuser{} & \xff \\
2496 \section{Accessibility Codes}
2497 \label{datarep:accessibilitycodes}
2498 The encodings of the constants used in the
2499 \DWATaccessibility{}
2501 \addtoindexx{accessibility attribute}
2503 Table \refersec{tab:accessibilityencodings}.
2506 \setlength{\extrarowheight}{0.1cm}
2507 \begin{longtable}{l|c}
2508 \caption{Accessibility encodings} \label{tab:accessibilityencodings}\\
2509 \hline \bfseries Accessibility code name&\bfseries Value \\ \hline
2511 \bfseries Accessibility code name&\bfseries Value\\ \hline
2513 \hline \emph{Continued on next page}
2518 \DWACCESSpublic&0x01 \\
2519 \DWACCESSprotected&0x02 \\
2520 \DWACCESSprivate&0x03 \\
2526 \section{Visibility Codes}
2527 \label{datarep:visibilitycodes}
2528 The encodings of the constants used in the
2529 \DWATvisibility{} attribute are given in
2530 Table \refersec{tab:visibilityencodings}.
2533 \setlength{\extrarowheight}{0.1cm}
2534 \begin{longtable}{l|c}
2535 \caption{Visibility encodings} \label{tab:visibilityencodings}\\
2536 \hline \bfseries Visibility code name&\bfseries Value \\ \hline
2538 \bfseries Visibility code name&\bfseries Value\\ \hline
2540 \hline \emph{Continued on next page}
2546 \DWVISexported&0x02 \\
2547 \DWVISqualified&0x03 \\
2552 \section{Virtuality Codes}
2553 \label{datarep:vitualitycodes}
2555 The encodings of the constants used in the
2556 \DWATvirtuality{} attribute are given in
2557 Table \refersec{tab:virtualityencodings}.
2560 \setlength{\extrarowheight}{0.1cm}
2561 \begin{longtable}{l|c}
2562 \caption{Virtuality encodings} \label{tab:virtualityencodings}\\
2563 \hline \bfseries Virtuality code name&\bfseries Value \\ \hline
2565 \bfseries Virtuality code name&\bfseries Value\\ \hline
2567 \hline \emph{Continued on next page}
2572 \DWVIRTUALITYnone&0x00 \\
2573 \DWVIRTUALITYvirtual&0x01 \\
2574 \DWVIRTUALITYpurevirtual&0x02 \\
2581 \DWVIRTUALITYnone{} is equivalent to the absence of the
2585 \section{Source Languages}
2586 \label{datarep:sourcelanguages}
2588 The encodings of the constants used
2589 \addtoindexx{language attribute, encoding}
2591 \addtoindexx{language name encoding}
2594 attribute are given in
2595 Table \refersec{tab:languageencodings}.
2597 % If we don't force a following space it looks odd
2599 and their associated values are reserved, but the
2600 languages they represent are not well supported.
2601 Table \refersec{tab:languageencodings}
2603 \addtoindexx{lower bound attribute!default}
2604 default lower bound, if any, assumed for
2605 an omitted \DWATlowerbound{} attribute in the context of a
2606 \DWTAGsubrangetype{} debugging information entry for each
2610 \setlength{\extrarowheight}{0.1cm}
2611 \begin{longtable}{l|c|c}
2612 \caption{Language encodings} \label{tab:languageencodings}\\
2613 \hline \bfseries Language name&\bfseries Value &\bfseries Default Lower Bound \\ \hline
2615 \bfseries Language name&\bfseries Value &\bfseries Default Lower Bound\\ \hline
2617 \hline \emph{Continued on next page}
2620 \dag \ \textit{See text} \\ \ddag \ \textit{New in \DWARFVersionV}
2622 \addtoindexx{ISO-defined language names}
2624 \DWLANGCeightynine &0x0001 &0 \addtoindexx{C:1989 (ISO)} \\
2625 \DWLANGC{} &0x0002 &0 \addtoindexx{C!non-standard} \\
2626 \DWLANGAdaeightythree{} \dag &0x0003 &1 \addtoindexx{Ada:1983 (ISO)} \\
2628 \DWLANGCplusplus{} &0x0004 &0 \addtoindexx{C++98 (ISO)}
2631 \DWLANGCobolseventyfour{} \dag &0x0005 &1 \addtoindexx{COBOL:1974 (ISO)} \\
2632 \DWLANGCoboleightyfive{} \dag &0x0006 &1 \addtoindexx{COBOL:1985 (ISO)} \\
2633 \DWLANGFortranseventyseven &0x0007 &1 \addtoindexx{FORTRAN:1977 (ISO)} \\
2634 \DWLANGFortranninety &0x0008 &1 \addtoindexx{Fortran:1990 (ISO)} \\
2635 \DWLANGPascaleightythree &0x0009 &1 \addtoindexx{Pascal:1983 (ISO)} \\
2636 \DWLANGModulatwo &0x000a &1 \addtoindexx{Modula-2:1996 (ISO)} \\
2637 \DWLANGJava &0x000b &0 \addtoindexx{Java} \\
2638 \DWLANGCninetynine &0x000c &0 \addtoindexx{C:1999 (ISO)} \\
2639 \DWLANGAdaninetyfive{} \dag &0x000d &1 \addtoindexx{Ada:1995 (ISO)} \\
2640 \DWLANGFortranninetyfive &0x000e &1 \addtoindexx{Fortran:1995 (ISO)} \\
2641 \DWLANGPLI{} \dag &0x000f &1 \addtoindexx{PL/I:1976 (ANSI)}\\
2642 \DWLANGObjC{} &0x0010 &0 \addtoindexx{Objective C}\\
2643 \DWLANGObjCplusplus{} &0x0011 &0 \addtoindexx{Objective C++}\\
2644 \DWLANGUPC{} &0x0012 &0 \addtoindexx{UPC}\\
2645 \DWLANGD{} &0x0013 &0 \addtoindexx{D language}\\
2646 \DWLANGPython{} \dag &0x0014 &0 \addtoindexx{Python}\\
2647 \DWLANGOpenCL{} \dag \ddag &0x0015 &0 \addtoindexx{OpenCL}\\
2648 \DWLANGGo{} \dag \ddag &0x0016 &0 \addtoindexx{Go}\\
2649 \DWLANGModulathree{} \dag \ddag &0x0017 &1 \addtoindexx{Modula-3}\\
2650 \DWLANGHaskell{} \dag \ddag &0x0018 &0 \addtoindexx{Haskell}\\
2652 \DWLANGCpluspluszerothree{} \ddag &0x0019 &0 \addtoindexx{C++03 (ISO)}\\
2653 \DWLANGCpluspluseleven{} \ddag &0x001a &0 \addtoindexx{C++11 (ISO)}
2656 \DWLANGOCaml{} \ddag &0x001b &0 \addtoindexx{OCaml}\\
2657 \DWLANGRust{} \ddag &0x001c &0 \addtoindexx{Rust}\\
2658 \DWLANGCeleven{} \ddag &0x001d &0 \addtoindexx{C:2011 (ISO)}\\
2659 \DWLANGSwift{} \ddag &0x001e &0 \addtoindexx{Swift} \\
2660 \DWLANGJulia{} \ddag &0x001f &1 \addtoindexx{Julia} \\
2661 \DWLANGDylan{} \ddag &0x0020 &0 \addtoindexx{Dylan} \\
2663 \DWLANGCplusplusfourteen{}~\ddag &0x0021 &0 \addtoindexx{C++14 (ISO)}
2666 \DWLANGFortranzerothree{}~\ddag &0x0022 &1 \addtoindexx{Fortran:2004 (ISO)} \\
2667 \DWLANGFortranzeroeight{}~\ddag &0x0023 &1 \addtoindexx{Fortran:2010 (ISO)} \\
2668 \DWLANGlouser{} &0x8000 & \\
2669 \DWLANGhiuser{} &\xffff & \\
2674 \section{Address Class Encodings}
2675 \label{datarep:addressclassencodings}
2677 The value of the common
2678 \addtoindex{address class} encoding
2682 \section{Identifier Case}
2683 \label{datarep:identifiercase}
2685 The encodings of the constants used in the
2686 \DWATidentifiercase{} attribute are given in
2687 Table \refersec{tab:identifiercaseencodings}.
2691 \setlength{\extrarowheight}{0.1cm}
2692 \begin{longtable}{l|c}
2693 \caption{Identifier case encodings} \label{tab:identifiercaseencodings}\\
2694 \hline \bfseries Identifier case name&\bfseries Value \\ \hline
2696 \bfseries Identifier case name&\bfseries Value\\ \hline
2698 \hline \emph{Continued on next page}
2702 \DWIDcasesensitive&0x00 \\
2704 \DWIDdowncase&0x02 \\
2705 \DWIDcaseinsensitive&0x03 \\
2709 \section{Calling Convention Encodings}
2710 \label{datarep:callingconventionencodings}
2711 The encodings of the constants used in the
2712 \DWATcallingconvention{} attribute are given in
2713 Table \refersec{tab:callingconventionencodings}.
2716 \setlength{\extrarowheight}{0.1cm}
2717 \begin{longtable}{l|c}
2718 \caption{Calling convention encodings} \label{tab:callingconventionencodings}\\
2719 \hline \bfseries Calling convention name&\bfseries Value \\ \hline
2721 \bfseries Calling convention name&\bfseries Value\\ \hline
2723 \hline \emph{Continued on next page}
2725 \hline \ddag\ \textit{New in DWARF Version 5}
2728 \DWCCnormal &0x01 \\
2729 \DWCCprogram&0x02 \\
2730 \DWCCnocall &0x03 \\
2731 \DWCCpassbyreference~\ddag &0x04 \\
2732 \DWCCpassbyvalue~\ddag &0x05 \\
2733 \DWCClouser &0x40 \\
2740 \section{Inline Codes}
2741 \label{datarep:inlinecodes}
2743 The encodings of the constants used in
2744 \addtoindexx{inline attribute}
2746 \DWATinline{} attribute are given in
2747 Table \refersec{tab:inlineencodings}.
2751 \setlength{\extrarowheight}{0.1cm}
2752 \begin{longtable}{l|c}
2753 \caption{Inline encodings} \label{tab:inlineencodings}\\
2754 \hline \bfseries Inline code name&\bfseries Value \\ \hline
2756 \bfseries Inline Code name&\bfseries Value\\ \hline
2758 \hline \emph{Continued on next page}
2763 \DWINLnotinlined&0x00 \\
2764 \DWINLinlined&0x01 \\
2765 \DWINLdeclarednotinlined&0x02 \\
2766 \DWINLdeclaredinlined&0x03 \\
2771 % this clearpage is ugly, but the following table came
2772 % out oddly without it.
2774 \section{Array Ordering}
2775 \label{datarep:arrayordering}
2777 The encodings of the constants used in the
2778 \DWATordering{} attribute are given in
2779 Table \refersec{tab:orderingencodings}.
2783 \setlength{\extrarowheight}{0.1cm}
2784 \begin{longtable}{l|c}
2785 \caption{Ordering encodings} \label{tab:orderingencodings}\\
2786 \hline \bfseries Ordering name&\bfseries Value \\ \hline
2788 \bfseries Ordering name&\bfseries Value\\ \hline
2790 \hline \emph{Continued on next page}
2795 \DWORDrowmajor&0x00 \\
2796 \DWORDcolmajor&0x01 \\
2802 \section{Discriminant Lists}
2803 \label{datarep:discriminantlists}
2805 The descriptors used in
2806 \addtoindexx{discriminant list attribute}
2808 \DWATdiscrlist{} attribute are
2809 encoded as 1-byte constants. The
2810 defined values are given in
2811 Table \refersec{tab:discriminantdescriptorencodings}.
2813 % Odd that the 'Name' field capitalized here, it is not caps elsewhere.
2815 \setlength{\extrarowheight}{0.1cm}
2816 \begin{longtable}{l|c}
2817 \caption{Discriminant descriptor encodings} \label{tab:discriminantdescriptorencodings}\\
2818 \hline \bfseries Descriptor name&\bfseries Value \\ \hline
2820 \bfseries Descriptor name&\bfseries Value\\ \hline
2822 \hline \emph{Continued on next page}
2834 \section{Name Index Table}
2835 \label{datarep:nameindextable}
2836 The \addtoindexi{version number}{version number!name index table}
2837 in the name index table header is \versiondotdebugnames{}
2838 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
2840 The name index attributes and their encodings are listed in Table \referfol{datarep:indexattributeencodings}.
2843 \setlength{\extrarowheight}{0.1cm}
2844 \begin{longtable}{l|c|l}
2845 \caption{Name index attribute encodings} \label{datarep:indexattributeencodings}\\
2846 \hline \bfseries Attribute name &\bfseries Value &\bfseries Form/Class \\ \hline
2848 \bfseries Attribute name &\bfseries Value &\bfseries Form/Class \\ \hline
2850 \hline \emph{Continued on next page}
2853 \ddag~\textit{New in \DWARFVersionV}
2855 \DWIDXcompileunit~\ddag & 1 & \CLASSconstant \\
2856 \DWIDXtypeunit~\ddag & 2 & \CLASSconstant \\
2857 \DWIDXdieoffset~\ddag & 3 & \CLASSreference \\
2858 \DWIDXparent~\ddag & 4 & \CLASSconstant \\
2859 \DWIDXtypehash~\ddag & 5 & \DWFORMdataeight \\
2860 \DWIDXlouser~\ddag & 0x2000 & \\
2861 \DWIDXhiuser~\ddag & \xiiifff & \\
2865 The abbreviations table ends with an entry consisting of a single 0
2866 byte for the abbreviation code. The size of the table given by
2867 \texttt{abbrev\_table\_size} may include optional padding following the
2870 \section{Defaulted Member Encodings}
2871 \hypertarget{datarep:defaultedmemberencodings}{}
2873 The encodings of the constants used in the \DWATdefaulted{} attribute
2874 are given in Table \referfol{datarep:defaultedattributeencodings}.
2877 \setlength{\extrarowheight}{0.1cm}
2878 \begin{longtable}{l|c}
2879 \caption{Defaulted attribute encodings} \label{datarep:defaultedattributeencodings} \\
2880 \hline \bfseries Defaulted name &\bfseries Value \\ \hline
2882 \bfseries Defaulted name &\bfseries Value \\ \hline
2884 \hline \emph{Continued on next page}
2887 \ddag~\textit{New in \DWARFVersionV}
2889 \DWDEFAULTEDno~\ddag & 0x00 \\
2890 \DWDEFAULTEDinclass~\ddag & 0x01 \\
2891 \DWDEFAULTEDoutofclass~\ddag & 0x02 \\
2896 \section{Address Range Table}
2897 \label{datarep:addrssrangetable}
2899 Each set of entries in the table of address ranges contained
2900 in the \dotdebugaranges{}
2901 section begins with a header containing:
2902 \begin{enumerate}[1. ]
2903 % FIXME The unit length text is not fully consistent across
2906 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
2907 \addttindexx{unit\_length}
2908 A 4-byte or 12-byte length containing the length of the
2909 \addtoindexx{initial length}
2910 set of entries for this compilation unit, not including the
2911 length field itself. In the \thirtytwobitdwarfformat, this is a
2912 4-byte unsigned integer (which must be less than \xfffffffzero);
2913 in the \sixtyfourbitdwarfformat, this consists of the 4-byte value
2914 \wffffffff followed by an 8-byte unsigned integer that gives
2916 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
2918 \item version (\HFTuhalf) \\
2919 A 2-byte version identifier representing the version of the
2920 DWARF information for the address range table
2921 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
2923 This value in this field \addtoindexx{version number!address range table} is 2.
2925 \item debug\_info\_offset (\livelink{datarep:sectionoffsetlength}{section offset}) \\
2927 \addtoindexx{section offset!in .debug\_aranges header}
2928 4-byte or 8-byte offset into the
2929 \dotdebuginfo{} section of
2930 the compilation unit header. In the \thirtytwobitdwarfformat,
2931 this is a 4-byte unsigned offset; in the \sixtyfourbitdwarfformat,
2932 this is an 8-byte unsigned offset
2933 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
2935 \item \texttt{address\_size} (\HFTubyte) \\
2936 A 1-byte unsigned integer containing the size in bytes of an
2937 \addttindexx{address\_size}
2939 \addtoindexx{size of an address}
2940 (or the offset portion of an address for segmented
2941 \addtoindexx{address space!segmented}
2942 addressing) on the target system.
2944 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
2945 A 1-byte unsigned integer containing the size in bytes of a
2946 segment selector on the target system.
2950 This header is followed by a series of tuples. Each tuple
2951 consists of a segment, an address and a length.
2952 The segment selector
2953 size is given by the \HFNsegmentselectorsize{} field of the header; the
2954 address and length size are each given by the \addttindex{address\_size}
2955 field of the header.
2956 The first tuple following the header in
2957 each set begins at an offset that is a multiple of the size
2958 of a single tuple (that is, the size of a segment selector
2959 plus twice the \addtoindex{size of an address}).
2960 The header is padded, if
2961 necessary, to that boundary. Each set of tuples is terminated
2962 by a 0 for the segment, a 0 for the address and 0 for the
2963 length. If the \HFNsegmentselectorsize{} field in the header is zero,
2964 the segment selectors are omitted from all tuples, including
2965 the terminating tuple.
2968 \section{Line Number Information}
2969 \label{datarep:linenumberinformation}
2971 The \addtoindexi{version number}{version number!line number information}
2972 in the line number program header is \versiondotdebugline{}
2973 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
2975 The boolean values \doublequote{true} and \doublequote{false}
2976 used by the line number information program are encoded
2977 as a single byte containing the value 0
2978 for \doublequote{false,} and a non-zero value for \doublequote{true.}
2981 The encodings for the standard opcodes are given in
2982 \addtoindexx{line number opcodes!standard opcode encoding}
2983 Table \refersec{tab:linenumberstandardopcodeencodings}.
2986 \setlength{\extrarowheight}{0.1cm}
2987 \begin{longtable}{l|c}
2988 \caption{Line number standard opcode encodings} \label{tab:linenumberstandardopcodeencodings}\\
2989 \hline \bfseries Opcode name&\bfseries Value \\ \hline
2991 \bfseries Opcode name&\bfseries Value\\ \hline
2993 \hline \emph{Continued on next page}
2999 \DWLNSadvancepc&0x02 \\
3000 \DWLNSadvanceline&0x03 \\
3001 \DWLNSsetfile&0x04 \\
3002 \DWLNSsetcolumn&0x05 \\
3003 \DWLNSnegatestmt&0x06 \\
3004 \DWLNSsetbasicblock&0x07 \\
3005 \DWLNSconstaddpc&0x08 \\
3006 \DWLNSfixedadvancepc&0x09 \\
3007 \DWLNSsetprologueend&0x0a \\*
3008 \DWLNSsetepiloguebegin&0x0b \\*
3009 \DWLNSsetisa&0x0c \\*
3015 The encodings for the extended opcodes are given in
3016 \addtoindexx{line number opcodes!extended opcode encoding}
3017 Table \refersec{tab:linenumberextendedopcodeencodings}.
3020 \setlength{\extrarowheight}{0.1cm}
3021 \begin{longtable}{l|c}
3022 \caption{Line number extended opcode encodings} \label{tab:linenumberextendedopcodeencodings}\\
3023 \hline \bfseries Opcode name&\bfseries Value \\ \hline
3025 \bfseries Opcode name&\bfseries Value\\ \hline
3027 \hline \emph{Continued on next page}
3029 \hline %\ddag~\textit{New in DWARF Version 5}
3032 \DWLNEendsequence &0x01 \\
3033 \DWLNEsetaddress &0x02 \\
3034 \textit{Reserved} &0x03\footnote{Code 0x03 is reserved to allow backward compatible support of the
3035 DW\_LNE\_define\_file operation which was defined in \DWARFVersionIV{}
3037 \DWLNEsetdiscriminator &0x04 \\
3038 \DWLNElouser &0x80 \\
3039 \DWLNEhiuser &\xff \\
3045 The encodings for the line number header entry formats are given in
3046 \addtoindexx{line number opcodes!file entry format encoding}
3047 Table \refersec{tab:linenumberheaderentryformatencodings}.
3050 \setlength{\extrarowheight}{0.1cm}
3051 \begin{longtable}{l|c}
3052 \caption{Line number header entry format \mbox{encodings}} \label{tab:linenumberheaderentryformatencodings}\\
3053 \hline \bfseries Line number header entry format name&\bfseries Value \\ \hline
3055 \bfseries Line number header entry format name&\bfseries Value\\ \hline
3057 \hline \emph{Continued on next page}
3059 \hline \ddag~\textit{New in DWARF Version 5}
3061 \DWLNCTpath~\ddag & 0x1 \\
3062 \DWLNCTdirectoryindex~\ddag & 0x2 \\
3063 \DWLNCTtimestamp~\ddag & 0x3 \\
3064 \DWLNCTsize~\ddag & 0x4 \\
3065 \DWLNCTMDfive~\ddag & 0x5 \\
3066 \DWLNCTlouser~\ddag & 0x2000 \\
3067 \DWLNCThiuser~\ddag & \xiiifff \\
3072 \section{Macro Information}
3073 \label{datarep:macroinformation}
3074 The \addtoindexi{version number}{version number!macro information}
3075 in the macro information header is \versiondotdebugmacro{}
3076 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3078 The source line numbers and source file indices encoded in the
3079 macro information section are represented as
3080 unsigned LEB128\addtoindexx{LEB128!unsigned} numbers.
3083 The macro information entry type is encoded as a single unsigned byte.
3085 \addtoindexx{macro information entry types!encoding}
3087 Table \refersec{tab:macroinfoentrytypeencodings}.
3091 \setlength{\extrarowheight}{0.1cm}
3092 \begin{longtable}{l|c}
3093 \caption{Macro information entry type encodings} \label{tab:macroinfoentrytypeencodings}\\
3094 \hline \bfseries Macro information entry type name&\bfseries Value \\ \hline
3096 \bfseries Macro information entry type name&\bfseries Value\\ \hline
3098 \hline \emph{Continued on next page}
3100 \hline \ddag~\textit{New in DWARF Version 5}
3103 \DWMACROdefine~\ddag &0x01 \\
3104 \DWMACROundef~\ddag &0x02 \\
3105 \DWMACROstartfile~\ddag &0x03 \\
3106 \DWMACROendfile~\ddag &0x04 \\
3107 \DWMACROdefinestrp~\ddag &0x05 \\
3108 \DWMACROundefstrp~\ddag &0x06 \\
3109 \DWMACROimport~\ddag &0x07 \\
3110 \DWMACROdefinesup~\ddag &0x08 \\
3111 \DWMACROundefsup~\ddag &0x09 \\
3112 \DWMACROimportsup~\ddag &0x0a \\
3113 \DWMACROdefinestrx~\ddag &0x0b \\
3114 \DWMACROundefstrx~\ddag &0x0c \\
3115 \DWMACROlouser~\ddag &0xe0 \\
3116 \DWMACROhiuser~\ddag &\xff \\
3122 \section{Call Frame Information}
3123 \label{datarep:callframeinformation}
3125 In the \thirtytwobitdwarfformat, the value of the CIE id in the
3126 CIE header is \xffffffff; in the \sixtyfourbitdwarfformat, the
3127 value is \xffffffffffffffff.
3129 The value of the CIE \addtoindexi{version number}{version number!call frame information}
3130 is 4 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3132 Call frame instructions are encoded in one or more bytes. The
3133 primary opcode is encoded in the high order two bits of
3134 the first byte (that is, opcode = byte $\gg$ 6). An operand
3135 or extended opcode may be encoded in the low order 6
3136 bits. Additional operands are encoded in subsequent bytes.
3137 The instructions and their encodings are presented in
3138 Table \refersec{tab:callframeinstructionencodings}.
3141 \setlength{\extrarowheight}{0.1cm}
3142 \begin{longtable}{l|c|c|l|l}
3143 \caption{Call frame instruction encodings} \label{tab:callframeinstructionencodings} \\
3144 \hline &\bfseries High 2 &\bfseries Low 6 & & \\
3145 \bfseries Instruction&\bfseries Bits &\bfseries Bits &\bfseries Operand 1 &\bfseries Operand 2\\ \hline
3147 & \bfseries High 2 &\bfseries Low 6 & &\\
3148 \bfseries Instruction&\bfseries Bits &\bfseries Bits &\bfseries Operand 1 &\bfseries Operand 2\\ \hline
3150 \hline \emph{Continued on next page}
3155 \DWCFAadvanceloc&0x1&delta & \\
3156 \DWCFAoffset&0x2®ister&ULEB128 offset \\
3157 \DWCFArestore&0x3®ister & & \\
3158 \DWCFAnop&0&0 & & \\
3159 \DWCFAsetloc&0&0x01&address & \\
3160 \DWCFAadvancelocone&0&0x02&1-byte delta & \\
3161 \DWCFAadvanceloctwo&0&0x03&2-byte delta & \\
3162 \DWCFAadvancelocfour&0&0x04&4-byte delta & \\
3163 \DWCFAoffsetextended&0&0x05&ULEB128 register&ULEB128 offset \\
3164 \DWCFArestoreextended&0&0x06&ULEB128 register & \\
3165 \DWCFAundefined&0&0x07&ULEB128 register & \\
3166 \DWCFAsamevalue&0&0x08 &ULEB128 register & \\
3167 \DWCFAregister&0&0x09&ULEB128 register &ULEB128 offset \\
3168 \DWCFArememberstate&0&0x0a & & \\
3169 \DWCFArestorestate&0&0x0b & & \\
3170 \DWCFAdefcfa&0&0x0c &ULEB128 register&ULEB128 offset \\
3171 \DWCFAdefcfaregister&0&0x0d&ULEB128 register & \\
3172 \DWCFAdefcfaoffset&0&0x0e &ULEB128 offset & \\
3173 \DWCFAdefcfaexpression&0&0x0f &BLOCK \\
3174 \DWCFAexpression&0&0x10&ULEB128 register & BLOCK \\
3176 \DWCFAoffsetextendedsf&0&0x11&ULEB128 register&SLEB128 offset \\
3177 \DWCFAdefcfasf&0&0x12&ULEB128 register&SLEB128 offset \\
3178 \DWCFAdefcfaoffsetsf&0&0x13&SLEB128 offset & \\
3179 \DWCFAvaloffset&0&0x14&ULEB128&ULEB128 \\
3180 \DWCFAvaloffsetsf&0&0x15&ULEB128&SLEB128 \\
3181 \DWCFAvalexpression&0&0x16&ULEB128&BLOCK \\
3182 \DWCFAlouser&0&0x1c & & \\
3183 \DWCFAhiuser&0&\xiiif & & \\
3187 \section{Non-contiguous Address Ranges}
3188 \label{datarep:noncontiguousaddressranges}
3190 Each entry in a \addtoindex{range list}
3191 (see Section \refersec{chap:noncontiguousaddressranges})
3193 \addtoindexx{base address selection entry!in range list}
3195 \addtoindexx{range list}
3196 a base address selection entry, or an end-of-list entry.
3198 A \addtoindex{range list} entry consists of two relative addresses. The
3199 addresses are the same size as addresses on the target machine.
3202 A base address selection entry and an
3203 \addtoindexx{end-of-list entry!in range list}
3204 end-of-list entry each
3205 \addtoindexx{base address selection entry!in range list}
3206 consist of two (constant or relocated) addresses. The two
3207 addresses are the same size as addresses on the target machine.
3209 For a \addtoindex{range list} to be specified, the base address of the
3210 \addtoindexx{base address selection entry!in range list}
3211 corresponding compilation unit must be defined
3212 (see Section \refersec{chap:fullandpartialcompilationunitentries}).
3215 \section{String Offsets Table}
3216 \label{chap:stringoffsetstable}
3217 Each set of entries in the string offsets table contained in the
3218 \dotdebugstroffsets{} or \dotdebugstroffsetsdwo{}
3219 section begins with a header containing:
3220 \begin{enumerate}[1. ]
3221 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3222 \addttindexx{unit\_length}
3223 A 4-byte or 12-byte length containing the length of
3224 the set of entries for this compilation unit, not
3225 including the length field itself. In the 32-bit
3226 DWARF format, this is a 4-byte unsigned integer
3227 (which must be less than \xfffffffzero); in the 64-bit
3228 DWARF format, this consists of the 4-byte value
3229 \wffffffff followed by an 8-byte unsigned integer
3230 that gives the actual length (see
3231 Section \refersec{datarep:32bitand64bitdwarfformats}).
3234 \item \texttt{version} (\HFTuhalf) \\
3235 A 2-byte version identifier containing the value
3236 \versiondotdebugstroffsets{}
3237 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3239 \item \texttt{padding} (\HFTuhalf) \\
3242 This header is followed by a series of string table offsets
3243 that have the same representation as \DWFORMstrp.
3244 For the 32-bit DWARF format, each offset is 4 bytes long; for
3245 the 64-bit DWARF format, each offset is 8 bytes long.
3247 The \DWATstroffsetsbase{} attribute points to the first
3248 entry following the header. The entries are indexed
3249 sequentially from this base entry, starting from 0.
3251 \section{Address Table}
3252 \label{chap:addresstable}
3253 Each set of entries in the address table contained in the
3254 \dotdebugaddr{} section begins with a header containing:
3255 \begin{enumerate}[1. ]
3256 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3257 \addttindexx{unit\_length}
3258 A 4-byte or 12-byte length containing the length of
3259 the set of entries for this compilation unit, not
3260 including the length field itself. In the 32-bit
3261 DWARF format, this is a 4-byte unsigned integer
3262 (which must be less than \xfffffffzero); in the 64-bit
3263 DWARF format, this consists of the 4-byte value
3264 \wffffffff followed by an 8-byte unsigned integer
3265 that gives the actual length (see
3266 Section \refersec{datarep:32bitand64bitdwarfformats}).
3269 \item \texttt{version} (\HFTuhalf) \\
3270 A 2-byte version identifier containing the value
3271 \versiondotdebugaddr{}
3272 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3275 \item \texttt{address\_size} (\HFTubyte) \\
3276 A 1-byte unsigned integer containing the size in
3277 bytes of an address (or the offset portion of an
3278 address for segmented addressing) on the target
3282 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
3283 A 1-byte unsigned integer containing the size in
3284 bytes of a segment selector on the target system.
3287 This header is followed by a series of segment/address pairs.
3288 The segment size is given by the \HFNsegmentselectorsize{} field of the
3289 header, and the address size is given by the \addttindex{address\_size}
3290 field of the header. If the \HFNsegmentselectorsize{} field in the header
3291 is zero, the entries consist only of an addresses.
3293 The \DWATaddrbase{} attribute points to the first entry
3294 following the header. The entries are indexed sequentially
3295 from this base entry, starting from 0.
3298 \section{Range List Table}
3299 \label{app:rangelisttable}
3300 Each set of entries in the range list table contained in the
3301 \dotdebugranges{} section begins with a header containing:
3302 \begin{enumerate}[1. ]
3303 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3304 \addttindexx{unit\_length}
3305 A 4-byte or 12-byte length containing the length of
3306 the set of entries for this compilation unit, not
3307 including the length field itself. In the 32-bit
3308 DWARF format, this is a 4-byte unsigned integer
3309 (which must be less than \xfffffffzero); in the 64-bit
3310 DWARF format, this consists of the 4-byte value
3311 \wffffffff followed by an 8-byte unsigned integer
3312 that gives the actual length (see
3313 Section \refersec{datarep:32bitand64bitdwarfformats}).
3316 \item \texttt{version} (\HFTuhalf) \\
3317 A 2-byte version identifier containing the value
3318 \versiondotdebugranges{}
3319 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3322 \item \texttt{address\_size} (\HFTubyte) \\
3323 A 1-byte unsigned integer containing the size in
3324 bytes of an address (or the offset portion of an
3325 address for segmented addressing) on the target
3329 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
3330 A 1-byte unsigned integer containing the size in
3331 bytes of a segment selector on the target system.
3334 This header is followed by a series of range list entries as
3335 described in Section \refersec{chap:noncontiguousaddressranges}.
3336 The segment size is given by the
3337 \HFNsegmentselectorsize{} field of the header, and the address size is
3338 given by the \addttindex{address\_size} field of the header. If the
3339 \HFNsegmentselectorsize{} field in the header is zero, the segment
3340 selector is omitted from the range list entries.
3342 The \DWATrangesbase{} attribute points to the first entry
3343 following the header. The entries are referenced by a byte
3344 offset relative to this base address.
3347 \section{Location List Table}
3348 \label{datarep:locationlisttable}
3349 Each set of entries in the location list table contained in the
3350 \dotdebugloc{} or \dotdebuglocdwo{} sections begins with a header containing:
3351 \begin{enumerate}[1. ]
3352 \item \texttt{unit\_length} (\livelink{datarep:initiallengthvalues}{initial length}) \\
3353 \addttindexx{unit\_length}
3354 A 4-byte or 12-byte length containing the length of
3355 the set of entries for this compilation unit, not
3356 including the length field itself. In the 32-bit
3357 DWARF format, this is a 4-byte unsigned integer
3358 (which must be less than \xfffffffzero); in the 64-bit
3359 DWARF format, this consists of the 4-byte value
3360 \wffffffff followed by an 8-byte unsigned integer
3361 that gives the actual length (see
3362 Section \refersec{datarep:32bitand64bitdwarfformats}).
3365 \item \texttt{version} (\HFTuhalf) \\
3366 A 2-byte version identifier containing the value
3367 \versiondotdebugloc{}
3368 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
3371 \item \texttt{address\_size} (\HFTubyte) \\
3372 A 1-byte unsigned integer containing the size in
3373 bytes of an address (or the offset portion of an
3374 address for segmented addressing) on the target
3378 \item \HFNsegmentselectorsize{} (\HFTubyte) \\
3379 A 1-byte unsigned integer containing the size in
3380 bytes of a segment selector on the target system.
3383 This header is followed by a series of location list entries as
3384 described in Section \refersec{chap:locationlists}.
3385 The segment size is given by the
3386 \HFNsegmentselectorsize{} field of the header, and the address size is
3387 given by the \HFNaddresssize{} field of the header. If the
3388 \HFNsegmentselectorsize{} field in the header is zero, the segment
3389 selector is omitted from range list entries.
3391 The entries are referenced by a byte offset relative to the first
3392 location list following this header.
3395 \section{Dependencies and Constraints}
3396 \label{datarep:dependenciesandconstraints}
3397 The debugging information in this format is intended to
3398 exist in sections of an object file, or an equivalent
3399 separate file or database, having names beginning with
3400 the prefix ".debug\_" (see Appendix
3401 \refersec{app:dwarfsectionversionnumbersinformative}
3402 for a complete list of such names).
3403 Except as specifically specified, this information is not
3404 aligned on 2-, 4- or 8-byte boundaries. Consequently:
3407 \item For the \thirtytwobitdwarfformat{} and a target architecture with
3408 32-bit addresses, an assembler or compiler must provide a way
3409 to produce 2-byte and 4-byte quantities without alignment
3410 restrictions, and the linker must be able to relocate a
3412 \addtoindexx{section offset!alignment of}
3413 section offset that occurs at an arbitrary
3416 \item For the \thirtytwobitdwarfformat{} and a target architecture with
3417 64-bit addresses, an assembler or compiler must provide a
3418 way to produce 2-byte, 4-byte and 8-byte quantities without
3419 alignment restrictions, and the linker must be able to relocate
3420 an 8-byte address or 4-byte
3421 \addtoindexx{section offset!alignment of}
3422 section offset that occurs at an
3423 arbitrary alignment.
3425 \item For the \sixtyfourbitdwarfformat{} and a target architecture with
3426 32-bit addresses, an assembler or compiler must provide a
3427 way to produce 2-byte, 4-byte and 8-byte quantities without
3428 alignment restrictions, and the linker must be able to relocate
3429 a 4-byte address or 8-byte
3430 \addtoindexx{section offset!alignment of}
3431 section offset that occurs at an
3432 arbitrary alignment.
3434 \textit{It is expected that this will be required only for very large
3435 32-bit programs or by those architectures which support
3436 a mix of 32-bit and 64-bit code and data within the same
3439 \item For the \sixtyfourbitdwarfformat{} and a target architecture with
3440 64-bit addresses, an assembler or compiler must provide a
3441 way to produce 2-byte, 4-byte and 8-byte quantities without
3442 alignment restrictions, and the linker must be able to
3443 relocate an 8-byte address or
3444 \addtoindexx{section offset!alignment of}
3445 section offset that occurs at
3446 an arbitrary alignment.
3450 \section{Integer Representation Names}
3451 \label{datarep:integerrepresentationnames}
3452 The sizes of the integers used in the lookup by name, lookup
3453 by address, line number, call frame information and other sections
3455 Table \ref{tab:integerrepresentationnames}.
3459 \setlength{\extrarowheight}{0.1cm}
3460 \begin{longtable}{c|l}
3461 \caption{Integer representation names} \label{tab:integerrepresentationnames}\\
3462 \hline \bfseries Representation name&\bfseries Representation \\ \hline
3464 \bfseries Representation name&\bfseries Representation\\ \hline
3466 \hline \emph{Continued on next page}
3471 \HFTsbyte& signed, 1-byte integer \\
3472 \HFTubyte&unsigned, 1-byte integer \\
3473 \HFTuhalf&unsigned, 2-byte integer \\
3474 \HFTuword&unsigned, 4-byte integer \\
3480 \section{Type Signature Computation}
3481 \label{datarep:typesignaturecomputation}
3483 A \addtoindex{type signature} is used by a DWARF consumer
3484 to resolve type references to the type definitions that
3485 are contained in \addtoindex{type unit}s (see Section
3486 \refersec{chap:typeunitentries}).
3488 \textit{A type signature is computed only by a DWARF producer;
3489 \addtoindexx{type signature!computation} a consumer need
3490 compare two type signatures to check for equality.}
3493 The type signature for a type T0 is formed from the
3494 \MDfive{}\footnote{\livetarg{def:MDfive}{MD5} Message Digest Algorithm,
3495 R.L. Rivest, RFC 1321, April 1992}
3496 digest of a flattened description of the type. The flattened
3497 description of the type is a byte sequence derived from the
3498 DWARF encoding of the type as follows:
3499 \begin{enumerate}[1. ]
3501 \item Start with an empty sequence S and a list V of visited
3502 types, where V is initialized to a list containing the type
3503 T0 as its single element. Elements in V are indexed from 1,
3506 \item If the debugging information entry represents a type that
3507 is nested inside another type or a namespace, append to S
3508 the type\textquoteright s context as follows: For each surrounding type
3509 or namespace, beginning with the outermost such construct,
3510 append the letter 'C', the DWARF tag of the construct, and
3511 the name (taken from
3512 \addtoindexx{name attribute}
3513 the \DWATname{} attribute) of the type
3514 \addtoindexx{name attribute}
3515 or namespace (including its trailing null byte).
3517 \item Append to S the letter 'D', followed by the DWARF tag of
3518 the debugging information entry.
3520 \item For each of the attributes in
3521 Table \refersec{tab:attributesusedintypesignaturecomputation}
3523 the debugging information entry, in the order listed,
3524 append to S a marker letter (see below), the DWARF attribute
3525 code, and the attribute value.
3528 \caption{Attributes used in type signature computation}
3529 \label{tab:attributesusedintypesignaturecomputation}
3530 \simplerule[\textwidth]
3532 \autocols[0pt]{c}{2}{l}{
3548 \DWATcontainingtype,
3552 \DWATdatamemberlocation,
3573 \DWATrvaluereference,
3577 \DWATstringlengthbitsize,
3578 \DWATstringlengthbytesize,
3583 \DWATvariableparameter,
3586 \DWATvtableelemlocation
3589 \simplerule[\textwidth]
3592 Note that except for the initial
3593 \DWATname{} attribute,
3594 \addtoindexx{name attribute}
3595 attributes are appended in order according to the alphabetical
3596 spelling of their identifier.
3598 If an implementation defines any vendor-specific attributes,
3599 any such attributes that are essential to the definition of
3600 the type are also included at the end of the above list,
3601 in their own alphabetical suborder.
3603 An attribute that refers to another type entry T is processed
3604 as follows: (a) If T is in the list V at some V[x], use the
3605 letter 'R' as the marker and use the unsigned LEB128\addtoindexx{LEB128!unsigned}
3606 encoding of x as the attribute value; otherwise, (b) use the letter 'T'
3607 as the marker, process the type T recursively by performing
3608 Steps 2 through 7, and use the result as the attribute value.
3611 Other attribute values use the letter 'A' as the marker, and
3612 the value consists of the form code (encoded as an unsigned
3613 LEB128 value) followed by the encoding of the value according
3614 to the form code. To ensure reproducibility of the signature,
3615 the set of forms used in the signature computation is limited
3624 \item If the tag in Step 3 is one of \DWTAGpointertype,
3625 \DWTAGreferencetype,
3626 \DWTAGrvaluereferencetype,
3627 \DWTAGptrtomembertype,
3628 or \DWTAGfriend, and the referenced
3629 type (via the \DWATtype{} or
3630 \DWATfriend{} attribute) has a
3631 \DWATname{} attribute, append to S the letter 'N', the DWARF
3632 attribute code (\DWATtype{} or
3633 \DWATfriend), the context of
3634 the type (according to the method in Step 2), the letter 'E',
3635 and the name of the type. For \DWTAGfriend, if the referenced
3636 entry is a \DWTAGsubprogram, the context is omitted and the
3637 name to be used is the ABI-specific name of the subprogram
3638 (for example, the mangled linker name).
3641 \item If the tag in Step 3 is not one of \DWTAGpointertype,
3642 \DWTAGreferencetype,
3643 \DWTAGrvaluereferencetype,
3644 \DWTAGptrtomembertype, or
3645 \DWTAGfriend, but has
3646 a \DWATtype{} attribute, or if the referenced type (via
3648 \DWATfriend{} attribute) does not have a
3649 \DWATname{} attribute, the attribute is processed according to
3650 the method in Step 4 for an attribute that refers to another
3654 \item Visit each child C of the debugging information
3655 entry as follows: If C is a nested type entry or a member
3656 function entry, and has
3657 a \DWATname{} attribute, append to
3658 \addtoindexx{name attribute}
3659 S the letter 'S', the tag of C, and its name; otherwise,
3660 process C recursively by performing Steps 3 through 7,
3661 appending the result to S. Following the last child (or if
3662 there are no children), append a zero byte.
3667 For the purposes of this algorithm, if a debugging information
3669 \DWATspecification{}
3670 attribute that refers to
3671 another entry D (which has a
3674 then S inherits the attributes and children of D, and S is
3675 processed as if those attributes and children were present in
3676 the entry S. Exception: if a particular attribute is found in
3677 both S and D, the attribute in S is used and the corresponding
3678 one in D is ignored.
3681 DWARF tag and attribute codes are appended to the sequence
3682 as unsigned LEB128\addtoindexx{LEB128!unsigned} values,
3683 using the values defined earlier in this chapter.
3685 \textit{A grammar describing this computation may be found in
3686 Appendix \refersec{app:typesignaturecomputationgrammar}.
3689 \textit{An attribute that refers to another type entry is
3690 recursively processed or replaced with the name of the
3691 referent (in Step 4, 5 or 6). If neither treatment applies to
3692 an attribute that references another type entry, the entry
3693 that contains that attribute is not suitable for a
3694 separate \addtoindex{type unit}.}
3696 \textit{If a debugging information entry contains an attribute from
3697 the list above that would require an unsupported form, that
3698 entry is not suitable for a separate
3699 \addtoindex{type unit}.}
3701 \textit{A type is suitable for a separate
3702 \addtoindex{type unit} only
3703 if all of the type entries that it contains or refers to in
3704 Steps 6 and 7 are themselves suitable for a separate
3705 \addtoindex{type unit}.}
3708 Where the DWARF producer may reasonably choose two or more
3709 different forms for a given attribute, it should choose
3710 the simplest possible form in computing the signature. (For
3711 example, a constant value should be preferred to a location
3712 expression when possible.)
3714 Once the string S has been formed from the DWARF encoding,
3715 an 16-byte \MDfive{} digest is computed for the string and the
3716 last eight bytes are taken as the type signature.
3718 \textit{The string S is intended to be a flattened representation of
3719 the type that uniquely identifies that type (that is, a different
3720 type is highly unlikely to produce the same string).}
3723 \textit{A debugging information entry is not be placed in a
3724 separate \addtoindex{type unit}
3725 if any of the following apply:}
3729 \item \textit{The entry has an attribute whose value is a location
3730 expression, and the location expression contains a reference to
3731 another debugging information entry (for example, a \DWOPcallref{}
3732 operator), as it is unlikely that the entry will remain
3733 identical across compilation units.}
3735 \item \textit{The entry has an attribute whose value refers
3736 to a code location or a \addtoindex{location list}.}
3738 \item \textit{The entry has an attribute whose value refers
3739 to another debugging information entry that does not represent
3745 \textit{Certain attributes are not included in the type signature:}
3748 \item \textit{The \DWATdeclaration{} attribute is not included because it
3749 indicates that the debugging information entry represents an
3750 incomplete declaration, and incomplete declarations should
3752 \addtoindexx{type unit}
3753 separate type units.}
3755 \item \textit{The \DWATdescription{} attribute is not included because
3756 it does not provide any information unique to the defining
3757 declaration of the type.}
3759 \item \textit{The \DWATdeclfile,
3761 \DWATdeclcolumn{} attributes are not included because they
3762 may vary from one source file to the next, and would prevent
3763 two otherwise identical type declarations from producing the
3764 same \MDfive{} digest.}
3766 \item \textit{The \DWATobjectpointer{} attribute is not included
3767 because the information it provides is not necessary for the
3768 computation of a unique type signature.}
3772 \textit{Nested types and some types referred to by a debugging
3773 information entry are encoded by name rather than by recursively
3774 encoding the type to allow for cases where a complete definition
3775 of the type might not be available in all compilation units.}
3778 \textit{If a type definition contains the definition of a member function,
3779 it cannot be moved as is into a type unit, because the member function
3780 contains attributes that are unique to that compilation unit.
3781 Such a type definition can be moved to a type unit by rewriting the DIE tree,
3782 moving the member function declaration into a separate declaration tree,
3783 and replacing the function definition in the type with a non-defining
3784 declaration of the function (as if the function had been defined out of
3787 An example that illustrates the computation of an \MDfive{} digest may be found in
3788 Appendix \refersec{app:usingtypeunits}.
3790 \section{Name Table Hash Function}
3791 \label{datarep:nametablehashfunction}
3792 The hash function used for hashing name strings in the accelerated
3793 access name index table (see Section \refersec{chap:acceleratedaccess})
3794 is defined in \addtoindex{C} as shown in
3795 Figure \referfol{fig:nametablehashfunctiondefinition}.\footnote{
3796 This hash function is sometimes informally known as the
3797 "\addtoindex{DJB hash function}" or the "\addtoindex{Berstein hash function}"
3799 \hrefself{http://en.wikipedia.org/wiki/List\_of\_hash\_functions} or
3800 \hrefself{http://stackoverflow.com/questions/10696223/reason-for-5381-number-in-djb-hash-function)}.}
3805 unsigned long \* must be a 32-bit integer type *\
3806 hash(unsigned char *str)
3808 unsigned long hash = 5381;
3812 hash = hash * 33 + c;
3818 \caption{Name Table Hash Function Definition}
3819 \label{fig:nametablehashfunctiondefinition}