1 \chapter{Data Representation}
2 \label{datarep:datarepresentation}
4 This section describes the binary representation of the
5 debugging information entry itself, of the attribute types
6 and of other fundamental elements described above.
9 \section{Vendor Extensibility}
10 \label{datarep:vendorextensibility}
12 To reserve a portion of the DWARF name space and ranges of
13 enumeration values for use for vendor specific extensions,
14 special labels are reserved for tag names, attribute names,
15 base type encodings, location operations, language names,
16 calling conventions and call frame instructions.
18 The labels denoting the beginning and end of the reserved
19 value range for vendor specific extensions consist of the
20 appropriate prefix (DW\_TAG, DW\_AT, DW\_END, DW\_ATE, DW\_OP,
21 DW\_LANG, DW\_LNE, DW\_CC or DW\_CFA respectively) followed by
22 \_lo\_user or \_hi\_user.
23 \textit{For example, for entry tags, the special
24 labels are DW\_TAG\_lo\_user and DW\_TAG\_hi\_user.}
26 range between prefix\_lo\_user and prefix\_hi\_user inclusive,
27 are reserved for vendor specific extensions. Vendors may
28 use values in this range without conflicting with current or
29 future system\dash defined values. All other values are reserved
30 for use by the system.
32 \textit{There may also be codes for vendor specific extensions
33 between the number of standard line number opcodes and
34 the first special line number opcode. However, since the
35 number of standard opcodes varies with the DWARF version,
36 the range for extensions is also version dependent. Thus,
37 DW\_LNS\_lo\_user and DW\_LNS\_hi\_user symbols are not defined.}
39 Vendor defined tags, attributes, base type encodings, location
40 atoms, language names, line number actions, calling conventions
41 and call frame instructions, conventionally use the form
42 prefix\_vendor\_id\_name, where vendor\_id is some identifying
43 character sequence chosen so as to avoid conflicts with
46 To ensure that extensions added by one vendor may be safely
47 ignored by consumers that do not understand those extensions,
48 the following rules should be followed:
51 \item New attributes should be added in such a way that a
52 debugger may recognize the format of a new attribute value
53 without knowing the content of that attribute value.
55 \item The semantics of any new attributes should not alter
56 the semantics of previously existing attributes.
58 \item The semantics of any new tags should not conflict with
59 the semantics of previously existing tags.
61 \item Do not add any new forms of attribute value.
66 \section{Reserved Values}
67 \label{datarep:reservedvalues}
68 \subsection{Error Values}
69 \label{datarep:errorvalues}
71 As a convenience for consumers of DWARF information, the value
72 0 is reserved in the encodings for attribute names, attribute
73 forms, base type encodings, location operations, languages,
74 line number program opcodes, macro information entries and tag
75 names to represent an error condition or unknown value. DWARF
76 does not specify names for these reserved values, since they
77 do not represent valid encodings for the given type and should
78 not appear in DWARF debugging information.
81 \subsection{Initial Length Values}
82 \label{datarep:initiallengthvalues}
84 An initial length field is one of the length fields that occur
85 at the beginning of those DWARF sections that have a header
86 (.debug\_aranges, .debug\_info, .debug\_types, .debug\_line,
87 .debug\_pubnames, and .debug\_pubtypes) or the length field
88 that occurs at the beginning of the CIE and FDE structures
89 in the .debug\_frame section.
91 In an initial length field, the values 0xfffffff0 through
92 0xffffffff are reserved by DWARF to indicate some form of
93 extension relative to DWARF Version 2; such values must not
94 be interpreted as a length field. The use of one such value,
95 0xffffffff, is defined below
96 (see Section \refersec{datarep:32bitand64bitdwarfformats});
98 the other values is reserved for possible future extensions.
102 \section{Executable Objects and Shared Objects}
103 \label{datarep:executableobjectsandsharedobjects}
105 The relocated addresses in the debugging information for an
106 executable object are virtual addresses and the relocated
107 addresses in the debugging information for a shared object
108 are offsets relative to the start of the lowest region of
109 memory loaded from that shared object.
111 \textit{This requirement makes the debugging information for
112 shared objects position independent. Virtual addresses in a
113 shared object may be calculated by adding the offset to the
114 base address at which the object was attached. This offset
115 is available in the run\dash time linker’s data structures.}
119 \section{32-Bit and 64-Bit DWARF Formats}
120 \label{datarep:32bitand64bitdwarfformats}
122 There are two closely related file formats. In the 32\dash bit DWARF
123 format, all values that represent lengths of DWARF sections
124 and offsets relative to the beginning of DWARF sections are
125 represented using 32\dash bits. In the 64\dash bit DWARF format, all
126 values that represent lengths of DWARF sections and offsets
127 relative to the beginning of DWARF sections are represented
128 using 64\dash bits. A special convention applies to the initial
129 length field of certain DWARF sections, as well as the CIE and
130 FDE structures, so that the 32\dash bit and 64\dash bit DWARF formats
131 can coexist and be distinguished within a single linked object.
133 The differences between the 32\dash\ and 64\dash bit
135 detailed in the following:
138 \begin{enumerate}[1.]
140 \item In the 32\dash bit DWARF format, an initial length field
141 (see Section \refersec{datarep:initiallengthvalues})
142 is an unsigned 32\dash bit integer (which
143 must be less than 0xfffffff0); in the 64\dash bit DWARF format,
144 an initial length field is 96 bits in size, and has two parts:
146 \item The first 32\dash bits have the value 0xffffffff.
148 \item The following 64\dash bits contain the actual length
149 represented as an unsigned 64\dash bit integer.
152 \textit{This representation allows a DWARF consumer to dynamically
153 detect that a DWARF section contribution is using the 64\dash bit
154 format and to adapt its processing accordingly.}
156 \item Section offset and section length fields that occur
157 in the headers of DWARF sections (other than initial length
158 fields) are listed following. In the 32\dash bit DWARF format these
159 are 32\dash bit unsigned integer values; in the 64\dash bit DWARF format,
160 they are 64\dash bit unsigned integer values.
164 Section &Name & Role \\ \hline
165 .debug\_ranges & debug\_info\_offset & offset in .debug\_info \\
166 .debug\_frame/CIE & CIE\_id & CIE distinguished value \\
167 .debug\_frame/FDE & CIE\_pointer & offset in .debug\_frame \\
168 .debug\_info & debug\_abbrev\_offset & offset in .debug\_abbrev \\
169 .debug\_line & header\_length & length of header itself \\
170 .debug\_pubnames & debug\_info\_offset & offset in .debug\_info \\
171 & debug\_info\_length & length of .debug\_info \\
173 .debug\_pubtypes & debug\_info\_offset & offset in .debug\_info \\
174 & debug\_info\_length & length of .debug\_info \\
176 .debug\_types & debug\_abbrev\_offset & offset in .debug\_info \\
177 & type\_offset & offset in of .debug\_types \\
182 \textit{The CIE\_id field in a CIE structure must be 64 bits because
183 it overlays the CIE\_pointer in a FDE structure; this implicit
184 union must be accessed to distinguish whether a CIE or FDE is
185 present, consequently, these two fields must exactly overlay
186 each other (both offset and size).}
188 \item Within the body of the .debug\_info or .debug\_types
189 section, certain forms of attribute value depend on the choice
190 of DWARF format as follows. For the 32\dash bit DWARF format,
191 the value is a 32\dash bit unsigned integer; for the 64\dash bit DWARF
192 format, the value is a 64\dash bit unsigned integer.
195 Form & Role \\ \hline
196 DW\_FORM\_ref\_addr& offset in .debug\_info \\
197 DW\_FORM\_sec\_offset& offset in a section other than .debug\_info or .debug\_str \\
198 DW\_FORM\_strp&offset in .debug\_str \\
199 DW\_OP\_call\_ref&offset in .debug\_info \\
203 \item Within the body of the .debug\_pubnames and
204 .debug\_pubtypes sections, the representation of the first field
205 of each tuple (which represents an offset in the .debug\_info
206 section) depends on the DWARF format as follows: in the
207 32\dash bit DWARF format, this field is a 32\dash bit unsigned integer;
208 in the 64\dash bit DWARF format, it is a 64\dash bit unsigned integer.
213 The 32\dash bit and 64\dash bit DWARF format conventions must not be
214 intermixed within a single compilation unit.
216 \textit{Attribute values and section header fields that represent
217 addresses in the target program are not affected by these
220 A DWARF consumer that supports the 64\dash bit DWARF format must
221 support executables in which some compilation units use the
222 32\dash bit format and others use the 64\dash bit format provided that
223 the combination links correctly (that is, provided that there
224 are no link\dash time errors due to truncation or overflow). (An
225 implementation is not required to guarantee detection and
226 reporting of all such errors.)
228 \textit{It is expected that DWARF producing compilers will not use
229 the 64\dash bit format by default. In most cases, the division of
230 even very large applications into a number of executable and
231 shared objects will suffice to assure that the DWARF sections
232 within each individual linked object are less than 4 GBytes
233 in size. However, for those cases where needed, the 64\dash bit
234 format allows the unusual case to be handled as well. Even
235 in this case, it is expected that only application supplied
236 objects will need to be compiled using the 64\dash bit format;
237 separate 32\dash bit format versions of system supplied shared
238 executable libraries can still be used.}
242 \section{Format of Debugging Information}
243 \label{datarep:formatofdebugginginformation}
245 For each compilation unit compiled with a DWARF producer,
246 a contribution is made to the .debug\_info section of
247 the object file. Each such contribution consists of a
248 compilation unit header
249 (see Section \refersec{datarep:compilationunitheader})
251 single DW\_TAG\_compile\_unit or DW\_TAG\_partial\_unit debugging
252 information entry, together with its children.
254 For each type defined in a compilation unit, a contribution may
255 be made to the .debug\_types section of the object file. Each
256 such contribution consists of a type unit header
257 (see Section \refersec{datarep:typeunitheader})
258 followed by a DW\_TAG\_type\_unit entry, together with
261 Each debugging information entry begins with a code that
262 represents an entry in a separate abbreviations table. This
263 code is followed directly by a series of attribute values.
265 The appropriate entry in the abbreviations table guides the
266 interpretation of the information contained directly in the
267 .debug\_info or .debug\_types section.
269 Multiple debugging information entries may share the same
270 abbreviation table entry. Each compilation unit is associated
271 with a particular abbreviation table, but multiple compilation
272 units may share the same table.
273 \subsection{Unit Headers}
274 \label{datarep:unitheaders}
276 \subsubsection{Compilation Unit Header}
277 \label{datarep:compilationunitheader}
279 \begin{enumerate}[1.]
281 \item unit\_length (initial length) \\
282 A 4\dash byte or 12\dash byte unsigned integer representing the length
283 of the .debug\_info contribution for that compilation unit,
284 not including the length field itself. In the 32\dash bit DWARF
285 format, this is a 4\dash byte unsigned integer (which must be less
286 than 0xfffffff0); in the 64\dash bit DWARF format, this consists
287 of the 4\dash byte value 0xffffffff followed by an 8\dash byte unsigned
288 integer that gives the actual length
289 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
291 \item version (uhalf)
292 A 2\dash byte unsigned integer representing the version of the
293 DWARF information for the compilation unit
294 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
295 The value in this field is 4.
297 \item debug\_abbrev\_offset (section offset) \\
298 A 4\dash byte or 8\dash byte unsigned offset into the .debug\_abbrev
299 section. This offset associates the compilation unit with a
300 particular set of debugging information entry abbreviations. In
301 the 32\dash bit DWARF format, this is a 4\dash byte unsigned length;
302 in the 64\dash bit DWARF format, this is an 8\dash byte unsigned length
303 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
305 \item address\_size (ubyte) \\
306 A 1\dash byte unsigned integer representing the size in bytes of
307 an address on the target architecture. If the system uses
308 segmented addressing, this value represents the size of the
309 offset portion of an address.
316 \subsubsection{Type Unit Header}
317 \label{datarep:typeunitheader}
319 The header for the series of debugging information entries
320 contributing to the description of a type that has been
321 placed in its own type unit, within the .debug\_types section,
322 consists of the following information:
324 \begin{enumerate}[1.]
326 \item unit\_length (initial length) \\
327 A 4\dash byte or 12\dash byte unsigned integer representing the length
328 of the .debug\_types contribution for that compilation unit,
329 not including the length field itself. In the 32\dash bit DWARF
330 format, this is a 4\dash byte unsigned integer (which must be
331 less than 0xfffffff0); in the 64\dash bit DWARF format, this
332 consists of the 4\dash byte value 0xffffffff followed by an
333 8\dash byte unsigned integer that gives the actual length
334 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
336 \item version (uhalf)
337 A 2\dash byte unsigned integer representing the version of the
338 DWARF information for the compilation unit
339 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
340 The value in this field is 4.
342 \item debug\_abbrev\_offset (section offset) \\
343 A 4\dash byte or 8\dash byte unsigned offset into the .debug\_abbrev
344 section. This offset associates the compilation unit with a
345 particular set of debugging information entry abbreviations. In
346 the 32\dash bit DWARF format, this is a 4\dash byte unsigned length;
347 in the 64\dash bit DWARF format, this is an 8\dash byte unsigned length
348 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
350 \item address\_size (ubyte) \\
351 A 1\dash byte unsigned integer representing the size in bytes of
352 an address on the target architecture. If the system uses
353 segmented addressing, this value represents the size of the
354 offset portion of an address.
357 \item type\_signature (8\dash byte unsigned integer) \\
358 A 64\dash bit unique signature of the type described in this type
361 \textit{An attribute that refers(using DW\_FORM\_ref\_sig8) to
362 the primary type contained in this type unit uses this value.}
365 \item type\_offset (section offset) \\
366 A 4\dash byte or 8\dash byte unsigned offset relative to the beginning
367 of the type unit header. This offset refers to the debugging
368 information entry that describes the type. Because the type
369 may be nested inside a namespace or other structures, and may
370 contain references to other types that have not been placed in
371 separate type units, it is not necessarily either the first or
372 the only entry in the type unit. In the 32\dash bit DWARF format,
373 this is a 4\dash byte unsigned length; in the 64\dash bit DWARF format,
374 this is an 8\dash byte unsigned length
375 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
379 \subsection{Debugging Information Entry}
380 \label{datarep:debugginginformationentry}
382 Each debugging information entry begins with an unsigned LEB128
383 number containing the abbreviation code for the entry. This
384 code represents an entry within the abbreviations table
385 associated with the compilation unit containing this entry. The
386 abbreviation code is followed by a series of attribute values.
388 On some architectures, there are alignment constraints on
389 section boundaries. To make it easier to pad debugging
390 information sections to satisfy such constraints, the
391 abbreviation code 0 is reserved. Debugging information entries
392 consisting of only the abbreviation code 0 are considered
395 \subsection{Abbreviations Tables}
396 \label{datarep:abbreviationstables}
398 The abbreviations tables for all compilation units
399 are contained in a separate object file section called
400 .debug\_abbrev. As mentioned before, multiple compilation
401 units may share the same abbreviations table.
403 The abbreviations table for a single compilation unit consists
404 of a series of abbreviation declarations. Each declaration
405 specifies the tag and attributes for a particular form of
406 debugging information entry. Each declaration begins with
407 an unsigned LEB128 number representing the abbreviation
408 code itself. It is this code that appears at the beginning
409 of a debugging information entry in the .debug\_info or
410 .debug\_types section. As described above, the abbreviation
411 code 0 is reserved for null debugging information entries. The
412 abbreviation code is followed by another unsigned LEB128
413 number that encodes the entry’s tag. The encodings for the
414 tag names are given in
415 Table \refersec{tab:tagencodings}.
417 Following the tag encoding is a 1\dash byte value that determines
418 whether a debugging information entry using this abbreviation
419 has child entries or not. If the value is DW\_CHILDREN\_yes,
420 the next physically succeeding entry of any debugging
421 information entry using this abbreviation is the first
422 child of that entry. If the 1\dash byte value following the
423 abbreviation’s tag encoding is DW\_CHILDREN\_no, the next
424 physically succeeding entry of any debugging information entry
425 using this abbreviation is a sibling of that entry. (Either
426 the first child or sibling entries may be null entries). The
427 encodings for the child determination byte are given in
428 Table \refersec{tab:childdeterminationencodings}
430 Section \refersec{chap:relationshipofdebugginginformationentries},
432 sibling entries is terminated by a null entry.)
434 Finally, the child encoding is followed by a series of
435 attribute specifications. Each attribute specification
436 consists of two parts. The first part is an unsigned LEB128
437 number representing the attribute’s name. The second part
438 is an unsigned LEB128 number representing the attribute’s
439 form. The series of attribute specifications ends with an
440 entry containing 0 for the name and 0 for the form.
442 The attribute form DW\_FORM\_indirect is a special case. For
443 attributes with this form, the attribute value itself in the
444 .debug\_info or .debug\_types section begins with an unsigned
445 LEB128 number that represents its form. This allows producers
446 to choose forms for particular attributes dynamically,
447 without having to add a new entry to the abbreviations table.
449 The abbreviations for a given compilation unit end with an
450 entry consisting of a 0 byte for the abbreviation code.
453 Appendix \refersec{app:compilationunitsandabbreviationstableexample}
454 for a depiction of the organization of the
455 debugging information.
457 \subsection{Attribute Encodings}
458 \label{datarep:attributeencodings}
460 The encodings for the attribute names are given in
461 Table \refersec{tab:attributeencodings}.
463 The attribute form governs how the value of the attribute is
464 encoded. There are nine classes of form, listed below. Each
465 class is a set of forms which have related representations
466 and which are given a common interpretation according to the
467 attribute in which the form is used.
469 Form DW\_FORM\_sec\_offset is a member of more than one class,
470 namely lineptr, loclistptr, macptr or rangelistptr; the list
471 of classes allowed by the applicable attribute in
472 Table \refersec{tab:attributeencodings}
473 determines the class of the form.
475 \textit{In DWARF V3 the forms DW\_FORM\_data4 and DW\_FORM\_data8 were
476 members of either class constant or one of the classes lineptr,
477 loclistptr, macptr or rangelistptr, depending on context. In
478 DWARF V4 DW\_FORM\_data4 and DW\_FORM\_data8 are members of class
479 constant in all cases. The new DW\_FORM\_sec\_offset replaces
480 their usage for the other classes.}
482 Each possible form belongs to one or more of the following classes:
486 Represented as an object of appropriate size to hold an
487 address on the target machine (DW\_FORM\_addr). The size is
488 encoded in the compilation unit header
489 (see Section \refersec{datarep:compilationunitheader}).
490 This address is relocatable in a relocatable object file and
491 is relocated in an executable file or shared object.
494 Blocks come in four forms:
496 \begin{myindentpara}{1cm}
497 A 1\dash byte length followed by 0 to 255 contiguous information
498 bytes (DW\_FORM\_block1).
501 \begin{myindentpara}{1cm}
502 A 2\dash byte length followed by 0 to 65,535 contiguous information
503 bytes (DW\_FORM\_block2).
507 \begin{myindentpara}{1cm}
508 A 4\dash byte length followed by 0 to 4,294,967,295 contiguous
509 information bytes (DW\_FORM\_block4).
513 \begin{myindentpara}{1cm}
514 An unsigned LEB128 length followed by the number of bytes
515 specified by the length (DW\_FORM\_block).
518 In all forms, the length is the number of information bytes
519 that follow. The information bytes may contain any mixture
520 of relocated (or relocatable) addresses, references to other
521 debugging information entries or data bytes.
524 There are six forms of constants. There are fixed length
525 constant data forms for one, two, four and eight byte values
526 (respectively, DW\_FORM\_data1, DW\_FORM\_data2, DW\_FORM\_data4,
527 and DW\_FORM\_data8). There are also variable length constant
528 data forms encoded using LEB128 numbers (see below). Both
529 signed (DW\_FORM\_sdata) and unsigned (DW\_FORM\_udata) variable
530 length constants are available
532 The data in DW\_FORM\_data1, DW\_FORM\_data2, DW\_FORM\_data4 and
533 DW\_FORM\_data8 can be anything. Depending on context, it may
534 be a signed integer, an unsigned integer, a floating\dash point
535 constant, or anything else. A consumer must use context to
536 know how to interpret the bits, which if they are target
537 machine data (such as an integer or floating point constant)
538 will be in target machine byte\dash order.
540 \textit{If one of the DW\_FORM\_data<n> forms is used to represent a
541 signed or unsigned integer, it can be hard for a consumer
542 to discover the context necessary to determine which
543 interpretation is intended. Producers are therefore strongly
544 encouraged to use DW\_FORM\_sdata or DW\_FORM\_udata for signed and
545 unsigned integers respectively, rather than
546 DW\_FORM\_data\textless n \textgreater.}
550 This is an unsigned LEB128 length followed by the
551 number of information bytes specified by the length
552 (DW\_FORM\_exprloc). The information bytes contain a DWARF
554 (see Section \refersec{chap:dwarfexpressions})
555 or location description
556 (see Section \refersec{chap:locationdescriptions}).
559 A flag is represented explicitly as a single byte of data
560 (DW\_FORM\_flag) or implicitly (DW\_FORM\_flag\_present). In the
561 first case, if the flag has value zero, it indicates the
562 absence of the attribute; if the flag has a non\dash zero value,
563 it indicates the presence of the attribute. In the second
564 case, the attribute is implicitly indicated as present, and
565 no value is encoded in the debugging information entry itself.
568 This is an offset into the .debug\_line section
569 (DW\_FORM\_sec\_offset). It consists of an offset from the
570 beginning of the .debug\_line section to the first byte of
571 the data making up the line number list for the compilation
573 It is relocatable in a relocatable object file, and
574 relocated in an executable or shared object. In the 32\dash bit
575 DWARF format, this offset is a 4\dash byte unsigned value;
576 in the 64\dash bit DWARF format, it is an 8\dash byte unsigned value
577 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
581 This is an offset into the .debug\_loc section
582 (DW\_FORM\_sec\_offset). It consists of an offset from the
583 beginning of the .debug\_loc section to the first byte of
584 the data making up the location list for the compilation
586 It is relocatable in a relocatable object file, and
587 relocated in an executable or shared object. In the 32\dash bit
588 DWARF format, this offset is a 4\dash byte unsigned value;
589 in the 64\dash bit DWARF format, it is an 8\dash byte unsigned value
590 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
594 This is an offset into the .debug\_macinfo section
595 (DW\_FORM\_sec\_offset). It consists of an offset from the
596 beginning of the .debug\_macinfo section to the first byte of
597 the data making up the macro information list for the compilation
599 It is relocatable in a relocatable object file, and
600 relocated in an executable or shared object. In the 32\dash bit
601 DWARF format, this offset is a 4\dash byte unsigned value;
602 in the 64\dash bit DWARF format, it is an 8\dash byte unsigned value
603 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
605 \item rangelistptr \\
606 This is an offset into the .debug\_ranges section
607 (DW\_FORM\_sec\_offset).
609 offset from the beginning of the .debug\_ranges section
610 to the beginning of the non\dash contiguous address ranges
611 information for the referencing entity.
613 a relocatable object file, and relocated in an executable or
614 shared object. In the 32\dash bit DWARF format, this offset
615 is a 4\dash byte unsigned value; in the 64\dash bit DWARF
616 format, it is an 8\dash byte unsigned value (see Section
617 \refersec{datarep:32bitand64bitdwarfformats}).
620 \textit{Because classes lineptr, loclistptr, macptr and rangelistptr
621 share a common representation, it is not possible for an
622 attribute to allow more than one of these classes}
627 There are three types of reference.
629 The first type of reference can identify any debugging
630 information entry within the containing unit. This type of
631 reference is an offset from the first byte of the compilation
632 header for the compilation unit containing the reference. There
633 are five forms for this type of reference. There are fixed
634 length forms for one, two, four and eight byte offsets
635 (respectively, DW\_FORM\_ref1, DW\_FORM\_ref2, DW\_FORM\_ref4,
636 and DW\_FORM\_ref8). There is also an unsigned variable
637 length offset encoded form that uses unsigned LEB128 numbers
638 (DW\_FORM\_ref\_udata). Because this type of reference is within
639 the containing compilation unit no relocation of the value
642 The second type of reference can identify any debugging
643 information entry within a .debug\_info section; in particular,
644 it may refer to an entry in a different compilation unit
645 from the unit containing the reference, and may refer to an
646 entry in a different shared object. This type of reference
647 (DW\_FORM\_ref\_addr) is an offset from the beginning of the
648 .debug\_info section of the target executable or shared object;
649 it is relocatable in a relocatable object file and frequently
650 relocated in an executable file or shared object. For
651 references from one shared object or static executable file
652 to another, the relocation and identification of the target
653 object must be performed by the consumer. In the 32\dash bit DWARF
654 format, this offset is a 4\dash byte unsigned value;
655 in the 64\dash bit DWARF format, it is an 8\dash byte
657 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
659 A debugging information entry that may be referenced by
660 another compilation unit using DW\_FORM\_ref\_addr must have a
661 global symbolic name.
663 For a reference from one executable or shared object to
664 another, the reference is resolved by the debugger to identify
665 the shared object or executable and the offset into that
666 object’s .debug\_info section in the same fashion as the run
667 time loader, either when the debug information is first read,
668 or when the reference is used.
670 The third type of reference can identify any debugging
671 information type entry that has been placed in its own
672 type unit. This type of reference (DW\_FORM\_ref\_sig8) is the
673 64\dash bit type signature
674 (see Section \refersec{datarep:typesignaturecomputation})
678 The use of compilation unit relative references will reduce the
679 number of link\dash time relocations and so speed up linking. The
680 use of the second and third type of reference allows for the
681 sharing of information, such as types, across compilation
684 A reference to any kind of compilation unit identifies the
685 debugging information entry for that unit, not the preceding
689 A string is a sequence of contiguous non\dash null bytes followed by
690 one null byte. A string may be represented immediately in the
691 debugging information entry itself (DW\_FORM\_string), or may
692 be represented as an offset into a string table contained in
693 the .debug\_str section of the object file (DW\_FORM\_strp). In
694 the 32\dash bit DWARF format, the representation of a DW\_FORM\_strp
695 value is a 4\dash byte unsigned offset; in the 64\dash bit DWARF format,
696 it is an 8\dash byte unsigned offset
697 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
699 If the DW\_AT\_use\_UTF8 attribute is specified for the
700 compilation unit entry, string values are encoded using the
701 UTF\dash 8 (Unicode Transformation Format\dash 8) from the Universal
702 Character Set standard (ISO/IEC 10646\dash 1:1993). Otherwise,
703 the string representation is unspecified.
705 The Unicode Standard Version 3 is fully compatible with
706 ISO/IEC 10646\dash 1:1993. It contains all the same characters
707 and encoding points as ISO/IEC 10646, as well as additional
708 information about the characters and their use.
710 Earlier versions of DWARF did not specify the representation
711 of strings; for compatibility, this version also does
712 not. However, the UTF\dash 8 representation is strongly recommended.
716 In no case does an attribute use one of the classes lineptr,
717 loclistptr, macptr or rangelistptr to point into either the
718 .debug\_info or .debug\_str section.
720 The form encodings are listed in
721 Table \refersec{tab:attributeformencodings}.
724 \setlength{\extrarowheight}{0.1cm}
725 \begin{longtable}{l|l}
726 \caption{Tag encodings} \label{tab:tagencodings} \\
727 \hline \\ \bfseries Tag name&\bfseries Value\\ \hline
729 \bfseries Tag name&\bfseries Value \\ \hline
731 \hline \emph{Continued on next page}
735 DW\_TAG\_array\_type &0x01 \\
736 DW\_TAG\_class\_type&0x02 \\
737 DW\_TAG\_entry\_point&0x03 \\
738 DW\_TAG\_enumeration\_type&0x04 \\
739 DW\_TAG\_formal\_parameter&0x05 \\
740 DW\_TAG\_imported\_declaration&0x08 \\
741 DW\_TAG\_label&0x0a \\
742 DW\_TAG\_lexical\_block&0x0b \\
743 DW\_TAG\_member&0x0d \\
744 DW\_TAG\_pointer\_type&0x0f \\
745 DW\_TAG\_reference\_type&0x10 \\
746 DW\_TAG\_compile\_unit&0x11 \\
747 DW\_TAG\_string\_type&0x12 \\
748 DW\_TAG\_structure\_type&0x13 \\
749 DW\_TAG\_subroutine\_type&0x15 \\
750 DW\_TAG\_typedef&0x16 \\
751 DW\_TAG\_union\_type&0x17 \\
752 DW\_TAG\_unspecified\_parameters&0x18 \\
753 DW\_TAG\_variant&0x19 \\
754 DW\_TAG\_common\_block&0x1a \\
755 DW\_TAG\_common\_inclusion&0x1b \\
756 DW\_TAG\_inheritance&0x1c \\
757 DW\_TAG\_inlined\_subroutine&0x1d \\
758 DW\_TAG\_module&0x1e \\
759 DW\_TAG\_ptr\_to\_member\_type&0x1f \\
760 DW\_TAG\_set\_type&0x20 \\
761 DW\_TAG\_subrange\_type&0x21 \\
762 DW\_TAG\_with\_stmt&0x22 \\
763 DW\_TAG\_access\_declaration&0x23 \\
764 DW\_TAG\_base\_type&0x24 \\
765 DW\_TAG\_catch\_block&0x25 \\
766 DW\_TAG\_const\_type&0x26 \\
767 DW\_TAG\_constant&0x27 \\
768 DW\_TAG\_enumerator&0x28 \\
769 DW\_TAG\_file\_type&0x29 \\
770 DW\_TAG\_friend&0x2a \\
771 DW\_TAG\_namelist&0x2b \\
772 DW\_TAG\_namelist\_item&0x2c \\
773 DW\_TAG\_packed\_type&0x2d \\
774 DW\_TAG\_subprogram&0x2e \\
775 DW\_TAG\_template\_type\_parameter&0x2f \\
776 DW\_TAG\_template\_value\_parameter&0x30 \\
777 DW\_TAG\_thrown\_type&0x31 \\
778 DW\_TAG\_try\_block&0x32 \\
779 DW\_TAG\_variant\_part&0x33 \\
780 DW\_TAG\_variable&0x34 \\
781 DW\_TAG\_volatile\_type&0x35 \\
782 DW\_TAG\_dwarf\_procedure&0x36 \\
783 DW\_TAG\_restrict\_type&0x37 \\
784 DW\_TAG\_interface\_type&0x38 \\
785 DW\_TAG\_namespace&0x39 \\
786 DW\_TAG\_imported\_module&0x3a \\
787 DW\_TAG\_unspecified\_type&0x3b \\
788 DW\_TAG\_partial\_unit&0x3c \\
789 DW\_TAG\_imported\_unit&0x3d \\
790 DW\_TAG\_condition&0x3f \\
791 DW\_TAG\_shared\_type&0x40 \\
792 DW\_TAG\_type\_unit \ddag &0x41 \\
793 DW\_TAG\_rvalue\_reference\_type \ddag &0x42 \\
794 DW\_TAG\_template\_alias \ddag &0x43 \\
795 DW\_TAG\_lo\_user&0x4080 \\
796 DW\_TAG\_hi\_user&0xffff \\
798 \ddag TAG new in DWARF Version 4
804 \setlength{\extrarowheight}{0.1cm}
805 \caption{Child determination encodings}
806 \label{tab:childdeterminationencodings}
807 \begin{tabular}{l|l} \hline
808 Child determination name& Value\\ \hline
809 DW\_CHILDREN\_no&0x00 \\
810 DW\_CHILDREN\_yes&0x01 \\ \hline
816 \setlength{\extrarowheight}{0.1cm}
817 \begin{longtable}{l|l|l}
818 \caption{Attribute encodings} \label{tab:attributeencodings} \\
819 \hline \\ \bfseries Attribute name&\bfseries Value &\bfseries Classes \\ \hline
821 \bfseries Attribute name&\bfseries Value &\bfseries Classes\\ \hline
823 \hline \emph{Continued on next page}
827 DW\_AT\_sibling&0x01&reference \\
828 DW\_AT\_location&0x02&exprloc, loclistptr \\
829 DW\_AT\_name&0x03&string \\
830 DW\_AT\_ordering&0x09&constant \\
831 DW\_AT\_byte\_size&0x0b&constant, exprloc, reference \\
832 DW\_AT\_bit\_offset&0x0c&constant, exprloc, reference \\
833 DW\_AT\_bit\_size&0x0d&constant, exprloc, reference \\
834 DW\_AT\_stmt\_list&0x10&lineptr \\
835 DW\_AT\_low\_pc&0x11&address \\
836 DW\_AT\_high\_pc&0x12&address, constant \\
837 DW\_AT\_language&0x13&constant \\
838 DW\_AT\_discr&0x15&reference \\
839 DW\_AT\_discr\_value&0x16&constant \\
840 DW\_AT\_visibility&0x17&constant \\
841 DW\_AT\_import&0x18&reference \\
842 DW\_AT\_string\_length&0x19&exprloc, loclistptr \\
843 DW\_AT\_common\_reference&0x1a&reference \\
844 DW\_AT\_comp\_dir&0x1b&string \\
845 DW\_AT\_const\_value&0x1c&block, constant, string \\
846 DW\_AT\_containing\_type&0x1d&reference \\
847 DW\_AT\_default\_value&0x1e&reference \\
848 DW\_AT\_inline&0x20&constant \\
849 DW\_AT\_is\_optional&0x21&flag \\
850 DW\_AT\_lower\_bound&0x22&constant, exprloc, reference \\
851 DW\_AT\_producer&0x25&string \\
852 DW\_AT\_prototyped&0x27&flag \\
853 DW\_AT\_return\_addr&0x2a&exprloc, loclistptr \\
854 % FIXME: lower case , not Constant
855 DW\_AT\_start\_scope&0x2c&Constant, rangelistptr \\
856 DW\_AT\_bit\_stride&0x2e&constant, exprloc, reference \\
857 DW\_AT\_upper\_bound&0x2f&constant, exprloc, reference \\
858 DW\_AT\_abstract\_origin&0x31&reference \\
859 DW\_AT\_accessibility&0x32&constant \\
860 DW\_AT\_address\_class&0x33&constant \\
861 DW\_AT\_artificial&0x34&flag \\
862 DW\_AT\_base\_types&0x35&reference \\
863 DW\_AT\_calling\_convention&0x36&constant \\
864 DW\_AT\_count&0x37&constant, exprloc, reference \\
865 DW\_AT\_data\_member\_location&0x38&constant, exprloc, loclistptr \\
866 DW\_AT\_decl\_column&0x39&constant \\
867 DW\_AT\_decl\_file&0x3a&constant \\
868 DW\_AT\_decl\_line&0x3b&constant \\
869 DW\_AT\_declaration&0x3c&flag \\
870 DW\_AT\_discr\_list&0x3d&block \\
871 DW\_AT\_encoding&0x3e&constant \\
872 DW\_AT\_external&0x3f&flag \\
873 DW\_AT\_frame\_base&0x40&exprloc, loclistptr \\
874 DW\_AT\_friend&0x41&reference \\
875 DW\_AT\_identifier\_case&0x42&constant \\
876 DW\_AT\_macro\_info&0x43&macptr \\
877 DW\_AT\_namelist\_item&0x44&reference \\
878 DW\_AT\_priority&0x45&reference \\
879 DW\_AT\_segment&0x46&exprloc, loclistptr \\
880 DW\_AT\_specification&0x47&reference \\
881 DW\_AT\_static\_link&0x48&exprloc, loclistptr \\
882 DW\_AT\_type&0x49&reference \\
883 DW\_AT\_use\_location&0x4a&exprloc, loclistptr \\
884 DW\_AT\_variable\_parameter&0x4b&flag \\
885 DW\_AT\_virtuality&0x4c&constant \\
886 DW\_AT\_vtable\_elem\_location&0x4d&exprloc, loclistptr \\
889 DW\_AT\_allocated&0x4e&constant, exprloc, reference \\
890 DW\_AT\_associated&0x4f&constant, exprloc, reference \\
891 DW\_AT\_data\_location&0x50&exprloc \\
892 DW\_AT\_byte\_stride&0x51&constant, exprloc, reference \\
893 DW\_AT\_entry\_pc&0x52&address \\
894 DW\_AT\_use\_UTF8&0x53&flag \\
895 DW\_AT\_extension&0x54&reference \\
896 DW\_AT\_ranges&0x55&rangelistptr \\
897 DW\_AT\_trampoline&0x56&address, flag, reference, string \\
898 DW\_AT\_call\_column&0x57&constant \\
899 DW\_AT\_call\_file&0x58&constant \\
900 DW\_AT\_call\_line&0x59&constant \\
901 DW\_AT\_description&0x5a&string \\
902 DW\_AT\_binary\_scale&0x5b&constant \\
903 DW\_AT\_decimal\_scale&0x5c&constant \\
904 DW\_AT\_small &0x5d&reference \\
905 DW\_AT\_decimal\_sign&0x5e&constant \\
906 DW\_AT\_digit\_count&0x5f&constant \\
907 DW\_AT\_picture\_string&0x60&string \\
908 DW\_AT\_mutable&0x61&flag \\
911 DW\_AT\_threads\_scaled&0x62&flag \\
912 DW\_AT\_explicit&0x63&flag \\
913 DW\_AT\_object\_pointer&0x64&reference \\
914 DW\_AT\_endianity&0x65&constant \\
915 DW\_AT\_elemental&0x66&flag \\
916 DW\_AT\_pure&0x67&flag \\
917 DW\_AT\_recursive&0x68&flag \\
918 DW\_AT\_signature \ddag &0x69&reference \\
919 DW\_AT\_main\_subprogram \ddag &0x6a&flag \\
920 DW\_AT\_data\_bit\_offset \ddag &0x6b&constant \\
921 DW\_AT\_const\_expr \ddag &0x6c&flag \\
922 DW\_AT\_enum\_class \ddag &0x6d&flag \\
923 DW\_AT\_linkage\_name \ddag &0x6e&string \\
924 DW\_AT\_lo\_user&0x2000 & --- \\
925 DW\_AT\_hi\_user&0x3fff& --- \\
928 \ddag Attribute new in DWARF Version 4
932 \setlength{\extrarowheight}{0.1cm}
933 \begin{longtable}{l|l|l}
934 \caption{Attribute form encodings} \label{tab:attributeformencodings} \\
935 \hline \\ \bfseries Form name&\bfseries Value &\bfseries Classes \\ \hline
937 \bfseries Form name&\bfseries Value &\bfseries Classes\\ \hline
939 \hline \emph{Continued on next page}
943 DW\_FORM\_addr&0x01&address \\
944 DW\_FORM\_block2&0x03&block \\
945 DW\_FORM\_block4&0x04&block \\
946 DW\_FORM\_data2&0x05&constant \\
947 DW\_FORM\_data4&0x06&constant \\
948 DW\_FORM\_data8&0x07&constant \\
949 DW\_FORM\_string&0x08&string \\
950 DW\_FORM\_block&0x09&block \\
951 DW\_FORM\_block1&0x0a&block \\
952 DW\_FORM\_data1&0x0b&constant \\
953 DW\_FORM\_flag&0x0c&flag \\
954 DW\_FORM\_sdata&0x0d&constant \\
955 DW\_FORM\_strp&0x0e&string \\
956 DW\_FORM\_udata&0x0f&constant \\
957 DW\_FORM\_ref\_addr&0x10&reference \\
958 DW\_FORM\_ref1&0x11&reference \\
959 DW\_FORM\_ref2&0x12&reference \\
960 DW\_FORM\_ref4&0x13&reference \\
961 DW\_FORM\_ref8&0x14&reference \\
962 DW\_FORM\_ref\_udata&0x15&reference \\
963 DW\_FORM\_indirect&0x16&(see Section \refersec{datarep:abbreviationstables}) \\
964 DW\_FORM\_sec\_offset \ddag &0x17&lineptr, loclistptr, macptr, rangelistptr \\
965 DW\_FORM\_exprloc \ddag &0x18&exprloc \\
966 DW\_FORM\_flag\_present \ddag &0x19&flag \\
967 DW\_FORM\_ref\_sig8 \ddag &0x20&reference \\
970 \ddag FORM new in DWARF Version 4
973 \section{Variable Length Data}
974 \label{datarep:variablelengthdata}
975 Integers may be encoded using ``Little Endian Base 128''
976 (LEB128) numbers. LEB128 is a scheme for encoding integers
977 densely that exploits the assumption that most integers are
980 This encoding is equally suitable whether the target machine
981 architecture represents data in big\dash\ endian or little\dash endian
982 order. It is ``little\dash endian'' only in the sense that it
983 avoids using space to represent the ``big'' end of an
984 unsigned integer, when the big end is all zeroes or sign
987 Unsigned LEB128 (ULEB128) numbers are encoded as follows:
988 start at the low order end of an unsigned integer and chop
989 it into 7\dash bit chunks. Place each chunk into the low order 7
990 bits of a byte. Typically, several of the high order bytes
991 will be zero; discard them. Emit the remaining bytes in a
992 stream, starting with the low order byte; set the high order
993 bit on each byte except the last emitted byte. The high bit
994 of zero on the last byte indicates to the decoder that it
995 has encountered the last byte.
997 The integer zero is a special case, consisting of a single
1000 Table \refersec{tab:examplesofunsignedleb128encodings}
1001 gives some examples of unsigned LEB128 numbers. The
1002 0x80 in each case is the high order bit of the byte, indicating
1003 that an additional byte follows.
1006 The encoding for signed, two’s complement LEB128 (SLEB128)
1007 numbers is similar, except that the criterion for discarding
1008 high order bytes is not whether they are zero, but whether
1009 they consist entirely of sign extension bits. Consider the
1010 32\dash bit integer -2. The three high level bytes of the number
1011 are sign extension, thus LEB128 would represent it as a single
1012 byte containing the low order 7 bits, with the high order
1013 bit cleared to indicate the end of the byte stream. Note
1014 that there is nothing within the LEB128 representation that
1015 indicates whether an encoded number is signed or unsigned. The
1016 decoder must know what type of number to expect.
1017 Table \refersec{tab:examplesofunsignedleb128encodings}
1018 gives some examples of unsigned LEB128 numbers and
1019 Table \refersec{tab:examplesofsignedleb128encodings}
1020 gives some examples of signed LEB128 numbers.
1022 Appendix \refersec{app:variablelengthdataencodingdecodinginformative}
1023 gives algorithms for encoding and decoding these forms.
1027 \setlength{\extrarowheight}{0.1cm}
1028 \begin{longtable}{l|l|l}
1029 \caption{Examples of unsigned LEB32 encodings} \label{tab:examplesofunsignedleb128encodings} \\
1030 \hline \\ \bfseries Number&\bfseries First byte &\bfseries Second byte \\ \hline
1032 \bfseries Number&\bfseries First Byte &\bfseries Second byte\\ \hline
1034 \hline \emph{Continued on next page}
1040 128& 0 + 0x80 & 1 \\
1041 129& 1 + 0x80 & 1 \\
1042 130& 2 + 0x80 & 1 \\
1043 12857& 57 + 0x80 & 100 \\
1051 \setlength{\extrarowheight}{0.1cm}
1052 \begin{longtable}{l|l|l}
1053 \caption{Examples of signed LEB32 encodings} \label{tab:examplesofsignedleb128encodings} \\
1054 \hline \\ \bfseries Number&\bfseries First byte &\bfseries Second byte \\ \hline
1056 \bfseries Number&\bfseries First Byte &\bfseries Second byte\\ \hline
1058 \hline \emph{Continued on next page}
1064 127& 127 + 0x80 & 0 \\
1065 -127& 1 + 0x80 & 0x7f \\
1066 128& 0 + 0x80 & 1 \\
1067 -128& 0 + 0x80 & 0x7f \\
1068 129& 1 + 0x80 & 1 \\
1069 -129& -x7f + 0x80 & 0xtc \\
1076 \section{DWARF Expressions and Location Descriptions}
1077 \label{datarep:dwarfexpressionsandlocationdescriptions}
1078 \subsection{DWARF Expressions}
1079 \label{datarep:dwarfexpressions}
1081 A DWARF expression is stored in a block of contiguous
1082 bytes. The bytes form a sequence of operations. Each operation
1083 is a 1\dash byte code that identifies that operation, followed by
1084 zero or more bytes of additional data. The encodings for the
1085 operations are described in
1086 Table \refersec{tab:dwarfoperationencodings}.
1089 \setlength{\extrarowheight}{0.1cm}
1090 \begin{longtable}{l|l|l|l}
1091 \caption{DWARF operation encodings} \label{tab:dwarfoperationencodings} \\
1092 \hline \\ & &\bfseries No. of &\\
1093 \bfseries Operation&\bfseries Code &\bfseries Operands &\bfseries Notes\\ \hline
1095 & &\bfseries No. of &\\
1096 \bfseries Operation&\bfseries Code &\bfseries Operands &\bfseries Notes\\ \hline
1098 \hline \emph{Continued on next page}
1103 DW\_OP\_addr&0x03&1 & constant address \\
1104 & & &(size target specific) \\
1106 DW\_OP\_deref&0x06&0 & \\
1109 DW\_OP\_const1u&0x08&1&1\dash byte constant \\
1110 DW\_OP\_const1s&0x09&1&1\dash byte constant \\
1111 DW\_OP\_const2u&0x0a&1&2\dash byte constant \\
1112 DW\_OP\_const2s&0x0b&1&2\dash byte constant \\
1113 DW\_OP\_const4u&0x0c&1&4\dash byte constant \\
1114 DW\_OP\_const4s&0x0d&1&4\dash byte constant \\
1115 DW\_OP\_const8u&0x0e&1&8\dash byte constant \\
1116 DW\_OP\_const8s&0x0f&1&8\dash byte constant \\
1117 DW\_OP\_constu&0x10&1&ULEB128 constant \\
1118 DW\_OP\_consts&0x11&1&SLEB128 constant \\
1119 DW\_OP\_dup&0x12&0 & \\
1120 DW\_OP\_drop&0x13&0 & \\
1121 DW\_OP\_over&0x14&0 & \\
1122 DW\_OP\_pick&0x15&1&1\dash byte stack index \\
1123 DW\_OP\_swap&0x16&0 & \\
1124 DW\_OP\_rot&0x17&0 & \\
1125 DW\_OP\_xderef&0x18&0 & \\
1126 DW\_OP\_abs&0x19&0 & \\
1127 DW\_OP\_and&0x1a&0 & \\
1128 DW\_OP\_div&0x1b&0 & \\
1132 DW\_OP\_minus&0x1c&0 & \\
1133 DW\_OP\_mod&0x1d&0 & \\
1134 DW\_OP\_mul&0x1e&0 & \\
1135 DW\_OP\_neg&0x1f&0 & \\
1136 DW\_OP\_not&0x20&0 & \\
1137 DW\_OP\_or&0x21&0 & \\
1138 DW\_OP\_plus&0x22&0 & \\
1139 DW\_OP\_plus\_uconst&0x23&1&ULEB128 addend \\
1140 DW\_OP\_shl&0x24&0 & \\
1141 DW\_OP\_shr&0x25&0 & \\
1142 DW\_OP\_shra&0x26&0 & \\
1143 DW\_OP\_xor&0x27&0 & \\
1144 DW\_OP\_skip&0x2f&1&signed 2\dash byte constant \\
1145 DW\_OP\_bra&0x28&1 & signed 2\dash byte constant \\
1146 DW\_OP\_eq&0x29&0 & \\
1147 DW\_OP\_ge&0x2a&0 & \\
1148 DW\_OP\_gt&0x2b&0 & \\
1149 DW\_OP\_le&0x2c&0 & \\
1150 DW\_OP\_lt&0x2d&0 & \\
1151 DW\_OP\_ne&0x2e&0 & \\ \hline
1155 DW\_OP\_lit0&0x30 & 0 & \\
1157 DW\_OP\_lit1&0x31 & 0& literals 0 .. 31 = \\
1158 \ldots & & & (DW\_OP\_lit0 + literal) \\
1159 DW\_OP\_lit31&0x4f & 0 & \\ \hline
1161 DW\_OP\_reg0 & 0x50 & 0 & \\
1162 DW\_OP\_reg1 & 0x51 & 0® 0 .. 31 = \\
1163 \ldots & & & (DW\_OP\_reg0 + regnum) \\
1164 DW\_OP\_reg31 & 0x6f & 0 & \\ \hline
1166 DW\_OP\_breg0 & 0x70 &1 & SLEB128 offset \\
1167 DW\_OP\_breg1 & 0x71 & 1 &base register 0 .. 31 = \\
1168 ... & & &(DW\_OP\_breg0 + regnum) \\
1169 DW\_OP\_breg31 & 0x8f & 1 & \\ \hline
1171 DW\_OP\_regx & 0x90 &1&ULEB128 register \\
1172 DW\_OP\_fbreg & 0x91&1&SLEB128 offset \\
1173 DW\_OP\_bregx & 0x92&2 &ULEB128 register followed \\
1174 & & & by SLEB128 offset \\
1175 DW\_OP\_piece & 0x93 &1& ULEB128 size of piece addressed \\
1176 DW\_OP\_deref\_size & 0x94 &1& 1-byte size of data retrieved \\
1177 DW\_OP\_xderef\_size & 0x95&1&1-byte size of data retrieved \\
1178 DW\_OP\_nop & 0x96 &0& \\
1181 DW\_OP\_push\_object\_address&0x97&0 & \\
1182 DW\_OP\_call2&0x98&1& 2\dash byte offset of DIE \\
1183 DW\_OP\_call4&0x99&1& 4\dash byte offset of DIE \\
1184 DW\_OP\_call\_ref&0x9a&1& 4\dash\ or 8\dash byte\\
1185 &&& offset of DIE \\
1186 DW\_OP\_form\_tls\_address&0x9b &0& \\
1187 DW\_OP\_call\_frame\_cfa &0x9c &0& \\
1188 DW\_OP\_bit\_piece&0x9d &2&ULEB128 size followed by \\
1190 DW\_OP\_implicit\_value&0x9e &2&ULEB128 size followed by \\
1191 &&&block of that size\\
1192 DW\_OP\_stack\_value\_cfa &0x9f &0& \\
1193 DW\_OP\_lo\_user\_cfa &0xe0 && \\
1194 DW\_OP\_hi\_user\_cfa &0xff && \\
1200 \subsection{Location Descriptions}
1201 \label{datarep:locationdescriptions}
1203 A location description is used to compute the
1204 location of a variable or other entity.
1206 \subsection{Location Lists}
1207 \label{datarep:locationlists}
1209 Each entry in a location list is either a location list entry,
1210 a base address selection entry, or an end of list entry.
1212 A location list entry consists of two address offsets followed
1213 by a 2\dash byte length, followed by a block of contiguous bytes
1214 that contains a DWARF location description. The length
1215 specifies the number of bytes in that block. The two offsets
1216 are the same size as an address on the target machine.
1218 A base address selection entry and an end of list entry each
1219 consist of two (constant or relocated) address offsets. The two
1220 offsets are the same size as an address on the target machine.
1222 For a location list to be specified, the base address of
1223 the corresponding compilation unit must be defined
1224 (see Section \refersec{chap:normalandpartialcompilationunitentries}).
1226 \section{Base Type Attribute Encodings}
1227 \label{datarep:basetypeattributeencodings}
1229 The encodings of the constants used in the DW\_AT\_encoding
1230 attribute are given in
1231 Table \refersec{tab:basetypeencodingvalues}
1234 \setlength{\extrarowheight}{0.1cm}
1235 \begin{longtable}{l|c}
1236 \caption{Base type encoding values} \label{tab:basetypeencodingvalues} \\
1237 \hline \\ \bfseries Base type encoding code name&\bfseries Value \\ \hline
1239 \bfseries Base type encoding code name&\bfseries Value\\ \hline
1241 \hline \emph{Continued on next page}
1246 DW\_ATE\_address&0x01 \\
1247 DW\_ATE\_boolean&0x02 \\
1248 DW\_ATE\_complex\_float&0x03 \\
1249 DW\_ATE\_float&0x04 \\
1250 DW\_ATE\_signed&0x05 \\
1251 DW\_ATE\_signed\_char&0x06 \\
1252 DW\_ATE\_unsigned&0x07 \\
1253 DW\_ATE\_unsigned\_char&0x08 \\
1254 DW\_ATE\_imaginary\_float&0x09 \\
1255 DW\_ATE\_packed\_decimal&0x0a \\
1256 DW\_ATE\_numeric\_string&0x0b \\
1257 DW\_ATE\_edited&0x0c \\
1258 DW\_ATE\_signed\_fixed&0x0d \\
1259 DW\_ATE\_unsigned\_fixed&0x0e \\
1260 DW\_ATE\_decimal\_float & 0x0f \\
1261 DW\_ATE\_UTF \ddag & 0x10 \\
1262 DW\_ATE\_lo\_user & 0x80 \\
1263 DW\_ATE\_hi\_user & 0xff \\
1266 \ddag Base type encoding new in DWARF Version 4
1270 The encodings of the constants used in the
1271 DW\_AT\_decimal\_sign attribute
1273 Table \refersec{tab:decimalsignencodings}.
1277 \setlength{\extrarowheight}{0.1cm}
1278 \begin{longtable}{l|c}
1279 \caption{Decimal sign encodings} \label{tab:decimalsignencodings} \\
1280 \hline \\ \bfseries Decimal sign code name&\bfseries Value \\ \hline
1282 \bfseries Decimal sign code name&\bfseries Value\\ \hline
1284 \hline \emph{Continued on next page}
1289 DW\_DS\_unsigned & 0x01 \\
1290 DW\_DS\_leading\_overpunch & 0x02 \\
1291 DW\_DS\_trailing\_overpunch & 0x03 \\
1292 DW\_DS\_leading\_separate & 0x04 \\
1293 DW\_DS\_trailing\_separate & 0x05 \\
1298 The encodings of the constants used in the
1299 DW\_AT\_endianity attribute are given in
1300 Table \refersec{tab:endianityencodings}.
1303 \setlength{\extrarowheight}{0.1cm}
1304 \begin{longtable}{l|c}
1305 \caption{Endianity encodings} \label{tab:endianityencodings}\\
1306 \hline \\ \bfseries Endian code name&\bfseries Value \\ \hline
1308 \bfseries Endian code name&\bfseries Value\\ \hline
1310 \hline \emph{Continued on next page}
1315 DW\_END\_default & 0x00 \\
1316 DW\_END\_big & 0x01 \\
1317 DW\_END\_little & 0x02 \\
1318 DW\_END\_lo\_user & 0x40 \\
1319 DW\_END\_hi\_user & 0xff \\
1324 \section{Accessibility Codes}
1325 \label{datarep:accessibilitycodes}
1326 The encodings of the constants used in the DW\_AT\_accessibility
1327 attribute are given in
1328 Table \refersec{tab:accessibilityencodings}.
1331 \setlength{\extrarowheight}{0.1cm}
1332 \begin{longtable}{l|c}
1333 \caption{Accessibility encodings} \label{tab:accessibilityencodings}\\
1334 \hline \\ \bfseries Accessibility code name&\bfseries Value \\ \hline
1336 \bfseries Accessibility code name&\bfseries Value\\ \hline
1338 \hline \emph{Continued on next page}
1343 DW\_ACCESS\_public&0x01 \\
1344 DW\_ACCESS\_protected&0x02 \\
1345 DW\_ACCESS\_private&0x03 \\
1351 \section{Visibility Codes}
1352 \label{datarep:visibilitycodes}
1353 The encodings of the constants used in the
1354 DW\_AT\_visibility attribute are given in
1355 Table \refersec{tab:visibilityencodings}.
1358 \setlength{\extrarowheight}{0.1cm}
1359 \begin{longtable}{l|c}
1360 \caption{Visibility encodings} \label{tab:visibilityencodings}\\
1361 \hline \\ \bfseries Visiibility code name&\bfseries Value \\ \hline
1363 \bfseries Visibility code name&\bfseries Value\\ \hline
1365 \hline \emph{Continued on next page}
1370 DW\_VIS\_local&0x01 \\
1371 DW\_VIS\_exported&0x02 \\
1372 DW\_VIS\_qualified&0x03 \\
1377 \section{Virtuality Codes}
1378 \label{datarep:vitualitycodes}
1380 The encodings of the constants used in the
1381 DW\_AT\_virtuality attribute are given in
1382 Table \refersec{tab:virtualityencodings}.
1385 \setlength{\extrarowheight}{0.1cm}
1386 \begin{longtable}{l|c}
1387 \caption{Virtuality encodings} \label{tab:virtualityencodings}\\
1388 \hline \\ \bfseries Virtuality code name&\bfseries Value \\ \hline
1390 \bfseries Virtuality code name&\bfseries Value\\ \hline
1392 \hline \emph{Continued on next page}
1397 DW\_VIRTUALITY\_none&0x00 \\
1398 DW\_VIRTUALITY\_virtual&0x01 \\
1399 DW\_VIRTUALITY\_pure\_virtual&0x02 \\
1407 DW\_VIRTUALITY\_none is equivalent to the absence of the
1411 \section{Source Languages}
1412 \label{datarep:sourcelanguages}
1414 The encodings of the constants used in the DW\_AT\_language
1415 attribute are given in
1416 Table \refersec{tab:languageencodings}.
1418 % If we don't force a following space it looks odd
1420 and their associated values are reserved, but the
1421 languages they represent are not well supported.
1422 Table \refersec{tab:languageencodings}
1423 also shows the default lower bound, if any, assumed for
1424 an omitted DW\_AT\_lower\_bound attribute in the context of a
1425 DW\_TAG\_subrange\_type debugging information entry for each
1429 \setlength{\extrarowheight}{0.1cm}
1430 \begin{longtable}{l|c|c}
1431 \caption{Language encodings} \label{tab:languageencodings}\\
1432 \hline \\ \bfseries Language name&\bfseries Value &\bfseries Default Lower Bound \\ \hline
1434 \bfseries Language name&\bfseries Value &\bfseries Default Lower Bound\\ \hline
1436 \hline \emph{Continued on next page}
1441 DW\_LANG\_C89&0x0001&0 \\
1442 DW\_LANG\_C&0x0002&0 \\
1443 DW\_LANG\_Ada83 \dag &0x0003&1 \\
1444 DW\_LANG\_C\_plus\_plus &0x0004&0 \\
1445 DW\_LANG\_Cobol74 \dag &0x0005&1 \\
1446 DW\_LANG\_Cobol85 \dag &0x0006&1 \\
1447 DW\_LANG\_Fortran77&0x0007&1 \\
1448 DW\_LANG\_Fortran90&0x0008&1 \\
1449 DW\_LANG\_Pascal83&0x0009&1 \\
1450 DW\_LANG\_Modula2&0x000a&1 \\
1451 DW\_LANG\_Java&0x000b&0 \\
1452 DW\_LANG\_C99&0x000c&0 \\
1453 DW\_LANG\_Ada95 \dag &0x000d&1 \\
1454 DW\_LANG\_Fortran95 &0x000e&1 \\
1455 DW\_LANG\_PLI \dag &0x000f&1 \\
1456 DW\_LANG\_ObjC&0x0010&0 \\
1457 DW\_LANG\_ObjC\_plus\_plus&0x0011&0 \\
1458 DW\_LANG\_UPC&0x0012&0 \\
1459 DW\_LANG\_D&0x0013&0 \\
1460 DW\_LANG\_Python \dag &0x0014&0 \\
1461 DW\_LANG\_lo\_user&0x8000 & \\
1462 DW\_LANG\_hi\_user&0xffff & \\
1468 \section{Address Class Encodings}
1469 \label{datarep:addressclassencodings}
1471 The value of the common address class encoding
1472 DW\_ADDR\_none is 0.
1475 \section{Identifier Case}
1476 \label{datarep:identifiercase}
1478 The encodings of the constants used in the
1479 DW\_AT\_identifier\_case attribute are given in
1480 Table \refersec{tab:identifiercaseencodings}.
1483 \setlength{\extrarowheight}{0.1cm}
1484 \begin{longtable}{l|c}
1485 \caption{Identifier case encodings} \label{tab:identifiercaseencodings}\\
1486 \hline \\ \bfseries Identifier case name&\bfseries Value \\ \hline
1488 \bfseries Identifier case name&\bfseries Value\\ \hline
1490 \hline \emph{Continued on next page}
1494 DW\_ID\_case\_sensitive&0x00 \\
1495 DW\_ID\_up\_case&0x01 \\
1496 DW\_ID\_down\_case&0x02 \\
1497 DW\_ID\_case\_insensitive&0x03 \\
1501 \section{Calling Convention Encodings}
1502 \label{datarep:callingconventionencodings}
1503 The encodings of the constants used in the
1504 DW\_AT\_calling\_convention attribute are given in
1505 Table \refersec{tab:callingconventionencodings}.
1508 \setlength{\extrarowheight}{0.1cm}
1509 \begin{longtable}{l|c}
1510 \caption{Calling convention encodings} \label{tab:callingconventionencodings}\\
1511 \hline \\ \bfseries Calling Convention name&\bfseries Value \\ \hline
1513 \bfseries Calling Convention name&\bfseries Value\\ \hline
1515 \hline \emph{Continued on next page}
1520 DW\_CC\_normal&0x01 \\
1521 DW\_CC\_program&0x02 \\
1522 DW\_CC\_nocall&0x03 \\
1523 DW\_CC\_lo\_user&0x40 \\
1524 DW\_CC\_hi\_user&0xff \\
1529 \section{Inline Codes}
1530 \label{datarep:inlinecodes}
1532 The encodings of the constants used in the
1533 DW\_AT\_inline attribute are given in
1534 Table \refersec{tab:inlineencodings}.
1537 \setlength{\extrarowheight}{0.1cm}
1538 \begin{longtable}{l|c}
1539 \caption{Inline encodings} \label{tab:inlineencodings}\\
1540 \hline \\ \bfseries Iline Code name&\bfseries Value \\ \hline
1542 \bfseries Iline Code name&\bfseries Value\\ \hline
1544 \hline \emph{Continued on next page}
1549 DW\_INL\_not\_inlined&0x00 \\
1550 DW\_INL\_inlined&0x01 \\
1551 DW\_INL\_declared\_not\_inlined&0x02 \\
1552 DW\_INL\_declared\_inlined&0x03 \\
1557 % this clearpage is ugly, but the following table came
1558 % out oddly without it.
1560 \section{Array Ordering}
1561 \label{datarep:arrayordering}
1563 The encodings of the constants used in the
1564 DW\_AT\_ordering attribute are given in
1565 Table \refersec{tab:orderingencodings}.
1568 \setlength{\extrarowheight}{0.1cm}
1569 \begin{longtable}{l|c}
1570 \caption{Ordering encodings} \label{tab:orderingencodings}\\
1571 \hline \\ \bfseries Ordering name&\bfseries Value \\ \hline
1573 \bfseries Ordering name&\bfseries Value\\ \hline
1575 \hline \emph{Continued on next page}
1580 DW\_ORD\_row\_major&0x00 \\
1581 DW\_ORD\_col\_major&0x01 \\
1587 \section{Discriminant Lists}
1588 \label{datarep:discriminantlists}
1590 The descriptors used in the
1591 DW\_AT\_discr\_list attribute are
1592 encoded as 1\dash byte constants. The
1593 defined values are given in
1594 Table \refersec{tab:discriminantdescriptorencodings}.
1596 % Odd that the 'Name' field captalized here, it is not caps elsewhere.
1598 \setlength{\extrarowheight}{0.1cm}
1599 \begin{longtable}{l|c}
1600 \caption{Discriminant descriptor encodings} \label{tab:discriminantdescriptorencodings}\\
1601 \hline \\ \bfseries Descriptor Name&\bfseries Value \\ \hline
1603 \bfseries Descriptor Name&\bfseries Value\\ \hline
1605 \hline \emph{Continued on next page}
1610 DW\_DSC\_label&0x00 \\
1611 DW\_DSC\_range&0x01 \\
1616 \section{Name Lookup Tables}
1617 \label{datarep:namelookuptables}
1619 Each set of entries in the table of global names contained
1620 in the .debug\_pubnames and .debug\_pubtypes sections begins
1621 with a header consisting of:
1624 \begin{enumerate}[1.]
1625 \item unit\_length (initial length) \\
1626 A 4\dash byte or 12\dash byte unsigned integer representing the length
1627 of the .debug\_info contribution for that compilation unit,
1628 not including the length field itself. In the 32\dash bit DWARF
1629 format, this is a 4\dash byte unsigned integer (which must be less
1630 than 0xfffffff0); in the 64\dash bit DWARF format, this consists
1631 of the 4\dash byte value 0xffffffff followed by an 8\dash byte unsigned
1632 integer that gives the actual length
1633 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1635 \item version (uhalf)
1636 A 2\dash byte unsigned integer representing the version of the
1637 DWARF information for the compilation unit
1638 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
1639 The value in this field is 4.
1641 % Some say unsigned offset this just says offset: FIXME
1642 \item debug\_info\_offset (section offset) \\
1643 A 4\dash byte or 8\dash byte offset into the .debug\_info
1644 section of the compilation unit header.
1646 the 32\dash bit DWARF format, this is a 4\dash byte unsigned offset;
1647 in the 64\dash bit DWARF format, this is an 8\dash byte unsigned offsets
1648 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1650 \item debug\_info\_length (section length) \\
1651 A 4\dash byte or 8\dash byte length containing the size in bytes of the
1652 contents of the .debug\_info section generated to represent
1653 this compilation unit. In the 32\dash bit DWARF format, this is
1654 a 4\dash byte unsigned length; in the 64\dash bit DWARF format, this
1655 is an 8-byte unsigned length
1656 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1661 This header is followed by a series of tuples. Each tuple
1662 consists of a 4\dash byte or 8\dash byte offset followed by a string
1663 of non\dash null bytes terminated by one null byte.
1665 DWARF format, this is a 4\dash byte offset; in the 64\dash bit DWARF
1666 format, it is an 8\dash byte offset.
1667 Each set is terminated by an
1668 offset containing the value 0.
1671 \section{Address Range Table}
1672 \label{datarep:addrssrangetable}
1674 Each set of entries in the table of address ranges contained
1675 in the .debug\_aranges section begins with a header containing:
1677 \begin{enumerate}[1.]
1678 % FIXME The unit length text is not fully consistent across
1681 \item unit\_length (initial length) \\
1682 A 4-byte or 12-byte length containing the length of the
1683 set of entries for this compilation unit, not including the
1684 length field itself. In the 32-bit DWARF format, this is a
1685 4-byte unsigned integer (which must be less than 0xfffffff0);
1686 in the 64-bit DWARF format, this consists of the 4-byte value
1687 0xffffffff followed by an 8-byte unsigned integer that gives
1689 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1691 \item version (uhalf) \\
1692 A 2\dash byte version identifier containing the value 2
1693 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
1695 \item debug\_info\_offset (section offset) \\
1696 A 4\dash byte or 8\dash byte offset into the .debug\_info section of
1697 the compilation unit header. In the 32\dash bit DWARF format,
1698 this is a 4\dash byte unsigned offset; in the 64\dash bit DWARF format,
1699 this is an 8\dash byte unsigned offset
1700 (see Section \refersec{datarep:32bitand64bitdwarfformats}).
1702 \item address\_size (ubyte) \\
1703 A 1\dash byte unsigned integer containing the size in bytes of an
1704 address (or the offset portion of an address for segmented
1705 addressing) on the target system.
1707 \item segment\_size (ubyte) \\
1708 A 1\dash byte unsigned integer containing the size in bytes of a
1709 segment selector on the target system.
1713 This header is followed by a series of tuples. Each tuple
1714 consists of a segment, an address and a length.
1716 size is given by the segment\_size field of the header; the
1717 address and length size are each given by the address\_size
1718 field of the header.
1719 The first tuple following the header in
1720 each set begins at an offset that is a multiple of the size
1721 of a single tuple (that is, the size of a segment selector
1722 plus twice the size of an address).
1723 The header is padded, if
1724 necessary, to that boundary. Each set of tuples is terminated
1725 by a 0 for the segment, a 0 for the address and 0 for the
1726 length. If the segment\_size field in the header is zero,
1727 the segment selectors are omitted from all tuples, including
1728 the terminating tuple.
1731 \section{Line Number Information}
1732 \label{datarep:linenumberinformation}
1734 The version number in the line number program header is 4
1735 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
1737 The boolean values ``true'' and ``false''
1738 used by the line number information program are encoded
1739 as a single byte containing the value 0
1740 for ``false,'' and a non-zero value for ``true.''
1742 The encodings for the standard opcodes are given in
1743 Table \refersec{tab:linenumberstandardopcodeencodings}.
1745 % Odd that the 'Name' field captalized here, it is not caps elsewhere.
1747 \setlength{\extrarowheight}{0.1cm}
1748 \begin{longtable}{l|c}
1749 \caption{Line Number Standard Opcode encodings} \label{tab:linenumberstandardopcodeencodings}\\
1750 \hline \\ \bfseries Opcode Name&\bfseries Value \\ \hline
1752 \bfseries Opcode Name&\bfseries Value\\ \hline
1754 \hline \emph{Continued on next page}
1759 DW\_LNS\_copy&0x01 \\
1760 DW\_LNS\_advance\_pc&0x02 \\
1761 DW\_LNS\_advance\_line&0x03 \\
1762 DW\_LNS\_set\_file&0x04 \\
1763 DW\_LNS\_set\_column&0x05 \\
1764 DW\_LNS\_negate\_stmt&0x06 \\
1765 DW\_LNS\_set\_basic\_block&0x07 \\
1766 DW\_LNS\_const\_add\_pc*0x08 \\
1767 DW\_LNS\_fixed\_advance\_pc&0x09 \\
1768 DW\_LNS\_set\_prologue\_end&0x0a \\
1769 DW\_LNS\_set\_epilogue\_begin&0x0b \\
1770 DW\_LNS\_set\_isa&0x0c \\
1776 The encodings for the extended opcodes are given in
1777 Table \refersec{tab:linenumberextendedopcodeencodings}.
1780 \setlength{\extrarowheight}{0.1cm}
1781 \begin{longtable}{l|c}
1782 \caption{Line Number Extended Opcode encodings} \label{tab:linenumberextendedopcodeencodings}\\
1783 \hline \\ \bfseries Opcode Name&\bfseries Value \\ \hline
1785 \bfseries Opcode Name&\bfseries Value\\ \hline
1787 \hline \emph{Continued on next page}
1792 DW\_LNE\_end\_sequence&0x01 \\
1793 DW\_LNE\_set\_address&0x02\\
1794 DW\_LNE\_define\_file&0x03\\
1795 DW\_LNE\_set\_discriminator \ddag &0x04 \\
1796 DW\_LNE\_lo\_user&0x80 \\
1797 DW\_LNE\_hi\_user&0xff \\
1800 \ddag Extended opcode new in DWARF Version 4.
1803 \section{Macro Information}
1804 \label{datarep:macroinformation}
1806 The source line numbers and source file indices encoded in the
1807 macro information section are represented as unsigned LEB128
1808 numbers as are the constants in a DW\_MACINFO\_vendor\_ext entry.
1810 The macinfo type is encoded as a single byte.
1811 The encodings are given in
1812 Table \refersec{tab:macinfotypeencodings}.
1816 \setlength{\extrarowheight}{0.1cm}
1817 \begin{longtable}{l|c}
1818 \caption{Macinfo Type Encodings} \label{tab:macinfotypeencodings}\\
1819 \hline \\ \bfseries Macinfo Type Name&\bfseries Value \\ \hline
1821 \bfseries Macinfo Type Name&\bfseries Value\\ \hline
1823 \hline \emph{Continued on next page}
1828 DW\_MACINFO\_define&0x01 \\
1829 DW\_MACINFO\_undef&0x02 \\
1830 DW\_MACINFO\_start\_file&0x03 \\
1831 DW\_MACINFO\_end\_file&0x04 \\
1832 DW\_MACINFO\_vendor\_ext&0xff \\
1837 \section{Call Frame Information}
1838 \label{datarep:callframeinformation}
1840 In the 32\dash bit DWARF format, the value of the CIE id in the
1841 CIE header is 0xffffffff; in the 64\dash bit DWARF format, the
1842 value is 0xffffffffffffffff.
1844 The value of the CIE version number is 4
1845 (see Appendix \refersec{app:dwarfsectionversionnumbersinformative}).
1847 Call frame instructions are encoded in one or more bytes. The
1848 primary opcode is encoded in the high order two bits of
1849 the first byte (that is, opcode = byte >> 6). An operand
1850 or extended opcode may be encoded in the low order 6
1851 bits. Additional operands are encoded in subsequent bytes.
1852 The instructions and their encodings are presented in
1853 Table \refersec{tab:callframeinstructionencodings}.
1856 \setlength{\extrarowheight}{0.1cm}
1857 \begin{longtable}{l|c|c|l|l}
1858 \caption{Call frame instruction encodings} \label{tab:callframeinstructionencodings} \\
1859 \hline \\ &\bfseries High 2 &\bfseries Low 6 & & \\
1860 \bfseries Instruction&\bfseries Bits &\bfseries Bits &\bfseries Operand 1 &\bfseries Operand 2\\ \hline
1862 & \bfseries High 2 &\bfseries Low 6 & &\\
1863 \bfseries Instruction&\bfseries Bits &\bfseries Bits &\bfseries Operand 1 &\bfseries Operand 2\\ \hline
1865 \hline \emph{Continued on next page}
1870 DW\_CFA\_advance\_loc&0x1&delta & \\
1871 DW\_CFA\_offset&0x2®ister&ULEB128 offset \\
1872 DW\_CFA\_restore&0x3®ister & & \\
1873 DW\_CFA\_nop&0&0 & & \\
1874 DW\_CFA\_set\_loc&0&0x01&address & \\
1875 DW\_CFA\_advance\_loc1&0&0x02&1\dash byte delta & \\
1876 DW\_CFA\_advance\_loc2&0&0x03&2\dash byte delta & \\
1877 DW\_CFA\_advance\_loc4&0&0x04&4\dash byte delta & \\
1878 DW\_CFA\_offset\_extended&0&0x05&ULEB128 register&ULEB128 offset \\
1879 DW\_CFA\_restore\_extended&0&0x06&ULEB128 register & \\
1880 DW\_CFA\_undefined&0&0x07&ULEB128 register & \\
1881 DW\_CFA\_same\_value&0&0x08 &ULEB128 register & \\
1882 DW\_CFA\_register&0&0x09&ULEB128 register &ULEB128 offset \\
1883 DW\_CFA\_remember\_state&0&0x0a & & \\
1884 DW\_CFA\_restore\_state&0&0x0b & & \\
1885 DW\_CFA\_def\_cfa&0&0x0c &ULEB128 register&ULEB128 offset \\
1886 DW\_CFA\_def\_cfa\_register&0&0x0d&ULEB128 register & \\
1887 DW\_CFA\_def\_cfa\_offset&0&0x0e &ULEB128 offset & \\
1888 DW\_CFA\_def\_cfa\_expression&0&0x0f &BLOCK \\
1889 DW\_CFA\_expression&0&0x10&ULEB128 register & BLOCK \\
1891 DW\_CFA\_offset\_extended\_sf&0&0x11&ULEB128 register&SLEB128 offset \\
1892 DW\_CFA\_def\_cfa\_sf&0&0x12&ULEB128 register&SLEB128 offset \\
1893 DW\_CFA\_def\_cfa\_offset\_sf&0&0x13&SLEB128 offset & \\
1894 DW\_CFA\_val\_offset&0&0x14&ULEB128&ULEB128 \\
1895 DW\_CFA\_val\_offset\_sf&0&0x15&ULEB128&SLEB128 \\
1896 DW\_CFA\_val\_expression&0&0x16&ULEB128&BLOCK \\
1897 DW\_CFA\_lo\_user&0&0x1c & & \\
1898 DW\_CFA\_hi\_user&0&0x3f & & \\
1902 \section{Non-continguous Address Ranges}
1903 \label{datarep:noncontiguousaddressranges}
1905 Each entry in a range list
1906 (see Section \refersec{chap:noncontiguousaddressranges})
1908 range list entry, a base address selection entry, or an end
1911 A range list entry consists of two relative addresses. The
1912 addresses are the same size as addresses on the target machine.
1914 A base address selection entry and an end of list entry each
1915 consist of two (constant or relocated) addresses. The two
1916 addresses are the same size as addresses on the target machine.
1918 For a range list to be specified, the base address of the
1919 corresponding compilation unit must be defined
1920 (see Section \refersec{chap:normalandpartialcompilationunitentries}).
1923 \section{Dependencies and Constraints}
1924 \label{datarep:dependenciesandconstraints}
1926 The debugging information in this format is intended to
1927 exist in the .debug\_abbrev, .debug\_aranges, .debug\_frame,
1928 .debug\_info, .debug\_line, .debug\_loc, .debug\_macinfo,
1929 .debug\_pubnames, .debug\_pubtypes, .debug\_ranges, .debug\_str
1930 and .debug\_types sections of an object file, or equivalent
1931 separate file or database. The information is not
1932 word\dash aligned. Consequently: •
1935 \item For the 32\dash bit DWARF format and a target architecture with
1936 32\dash bit addresses, an assembler or compiler must provide a way
1937 to produce 2\dash byte and 4\dash byte quantities without alignment
1938 restrictions, and the linker must be able to relocate a
1939 4\dash byte address or section offset that occurs at an arbitrary
1942 \item For the 32\dash bit DWARF format and a target architecture with
1943 64\dash bit addresses, an assembler or compiler must provide a
1944 way to produce 2\dash byte, 4\dash byte and 8\dash byte quantities without
1945 alignment restrictions, and the linker must be able to relocate
1946 an 8\dash byte address or 4\dash byte section offset that occurs at an
1947 arbitrary alignment.
1949 \item For the 64\dash bit DWARF format and a target architecture with
1950 32\dash bit addresses, an assembler or compiler must provide a
1951 way to produce 2\dash byte, 4\dash byte and 8\dash byte quantities without
1952 alignment restrictions, and the linker must be able to relocate
1953 a 4\dash byte address or 8\dash byte section offset that occurs at an
1954 arbitrary alignment.
1956 \textit{It is expected that this will be required only for very large
1957 32\dash bit programs or by those architectures which support
1958 a mix of 32\dash bit and 64\dash bit code and data within the same
1961 \item For the 64\dash bit DWARF format and a target architecture with
1962 64\dash bit addresses, an assembler or compiler must provide a
1963 way to produce 2\dash byte, 4\dash byte and 8\dash byte quantities without
1964 alignment restrictions, and the linker must be able to
1965 relocate an 8\dash byte address or section offset that occurs at
1966 an arbitrary alignment.
1969 \section{Integer Representation Names}
1970 \label{datarep:integerrepresentationnames}
1972 The sizes of the integers used in the lookup by name, lookup
1973 by address, line number and call frame information sections
1975 Table 41 \refersec{tab:integerrepresentationnames}.
1978 \setlength{\extrarowheight}{0.1cm}
1979 \begin{longtable}{c|l}
1980 \caption{Integer Representation Names} \label{tab:integerrepresentationnames}\\
1981 \hline \\ \bfseries Representation Name&\bfseries Representation \\ \hline
1983 \bfseries Representation Name&\bfseries Representation\\ \hline
1985 \hline \emph{Continued on next page}
1990 sbyte& signed, 1\dash byte integer \\
1991 ubyte&unsigned, 1\dash byte integer \\
1992 uhalf&unsigned, 2\dash byte integer \\
1993 uword&unsigned, 4\dash byte integer \\
1998 \section{Type Signature Computation}
1999 \label{datarep:typesignaturecomputation}
2001 A type signature is computed only by the DWARF producer;
2002 it is used by a DWARF consumer to resolve type references to
2003 the type definitions that are contained in type units.
2005 The type signature for a type T0 is formed from the MD5
2006 hash of a flattened description of the type. The flattened
2007 description of the type is a byte sequence derived from the
2008 DWARF encoding of the type as follows:
2010 \begin{enumerate}[1.]
2012 \item Start with an empty sequence S and a list V of visited
2013 types, where V is initialized to a list containing the type
2014 T0 as its single element. Elements in V are indexed from 1,
2017 \item If the debugging information entry represents a type that
2018 is nested inside another type or a namespace, append to S
2019 the type’s context as follows: For each surrounding type
2020 or namespace, beginning with the outermost such construct,
2021 append the letter 'C', the DWARF tag of the construct, and
2022 the name (taken from the DW\_AT\_name attribute) of the type
2023 or namespace (including its trailing null byte).
2025 \item Append to S the letter 'D', followed by the DWARF tag of
2026 the debugging information entry.
2028 \item For each of the following attributes that are present in
2029 the debugging information entry, in the order listed below,
2030 append to S a marker letter (see below), the DWARF attribute
2031 code, and the attribute value.
2035 \item DW\_AT\_accessibility
2036 \item DW\_AT\_address\_class
2037 \item DW\_AT\_allocated
2038 \item DW\_AT\_artificial
2039 \item DW\_AT\_associated
2040 \item DW\_AT\_binary\_scale
2041 \item DW\_AT\_bit\_offset
2042 \item DW\_AT\_bit\_size
2043 \item DW\_AT\_bit\_stride
2044 \item DW\_AT\_byte\_size
2045 \item DW\_AT\_byte\_stride
2046 \item DW\_AT\_const\_expr
2047 \item DW\_AT\_const\_value
2048 \item DW\_AT\_containing\_type
2050 \item DW\_AT\_data\_bit\_offset
2051 \item DW\_AT\_data\_location
2052 \item DW\_AT\_data\_member\_location
2053 \item DW\_AT\_decimal\_scale
2054 \item DW\_AT\_decimal\_sign
2055 \item DW\_AT\_default\_value
2056 \item DW\_AT\_digit\_count
2058 \item DW\_AT\_discr\_list
2059 \item DW\_AT\_discr\_value
2060 \item DW\_AT\_encoding
2061 \item DW\_AT\_enum\_class
2062 \item DW\_AT\_endianity
2063 \item DW\_AT\_explicit
2064 \item DW\_AT\_is\_optional
2065 \item DW\_AT\_location
2066 \item DW\_AT\_lower\_bound
2067 \item DW\_AT\_mutable
2068 \item DW\_AT\_ordering
2069 \item DW\_AT\_picture\_string
2070 \item DW\_AT\_prototyped
2072 \item DW\_AT\_segment
2073 \item DW\_AT\_string\_length
2074 \item DW\_AT\_threads\_scaled
2075 \item DW\_AT\_upper\_bound
2076 \item DW\_AT\_use\_location
2077 \item DW\_AT\_use\_UTF8
2078 \item DW\_AT\_variable\_parameter
2079 \item DW\_AT\_virtuality
2080 \item DW\_AT\_visibility
2081 \item DW\_AT\_vtable\_elem\_location
2084 Note that except for the initial DW\_AT\_name attribute,
2085 attributes are appended in order according to the alphabetical
2086 spelling of their identifier.
2088 If an implementation defines any vendor-specific attributes,
2089 any such attributes that are essential to the definition of
2090 the type should also be included at the end of the above list,
2091 in their own alphabetical suborder.
2093 An attribute that refers to another type entry T is processed
2094 as follows: (a) If T is in the list V at some V[x], use the
2095 letter 'R' as the marker and use the unsigned LEB128 encoding
2096 of x as the attribute value; otherwise, (b) use the letter 'T'
2097 as the marker, process the type T recursively by performing
2098 Steps 2 through 7, and use the result as the attribute value.
2100 Other attribute values use the letter 'A' as the marker, and
2101 the value consists of the form code (encoded as an unsigned
2102 LEB128 value) followed by the encoding of the value according
2103 to the form code. To ensure reproducibility of the signature,
2104 the set of forms used in the signature computation is limited
2105 to the following: DW\_FORM\_sdata,
2108 and DW\_FORM\_block.
2110 \item If the tag in Step 3 is one of DW\-\_TAG\-\_pointer\-\_type,
2111 DW\-\_TAG\-\_reference\-\_type,
2112 DW\-\_TAG\-\_rvalue\-\_reference\-\_type,
2113 DW\-\_TAG\-\_ptr\-\_to\-\_member\-\_type,
2114 or DW\-\_TAG\-\_friend, and the referenced
2115 type (via the DW\-\_AT\-\_type or
2116 DW\-\_AT\-\_friend attribute) has a
2117 DW\-\_AT\-\_name attribute, append to S the letter 'N', the DWARF
2118 attribute code (DW\-\_AT\-\_type or
2119 DW\-\_AT\-\_friend), the context of
2120 the type (according to the method in Step 2), the letter 'E',
2121 and the name of the type. For DW\-\_TAG\-\_friend, if the referenced
2122 entry is a DW\-\_TAG\-\_subprogram, the context is omitted and the
2123 name to be used is the ABI-specific name of the subprogram
2124 (e.g., the mangled linker name).
2127 \item 6.If the tag in Step 3 is not one of DW\-\_TAG\-\_pointer\-\_type,
2128 DW\-\_TAG\-\_reference\-\_type,
2129 DW\-\_TAG\-\_rvalue\-\_reference\-\_type,
2130 DW\-\_TAG\-\_ptr\-\_to\-\_member\-\_type, or
2131 DW\-\_TAG\-\_friend, but has
2132 a DW\-\_AT\-\_type attribute, or if the referenced type (via
2133 the DW\-\_AT\-\_type or
2134 DW\-\_AT\-\_friend attribute) does not have a
2135 DW\-\_AT\-\_name attribute, the attribute is processed according to
2136 the method in Step 4 for an attribute that refers to another
2140 \item Visit each child C of the debugging information
2141 entry as follows: If C is a nested type entry or a member
2142 function entry, and has a DW\-\_AT\-\_name attribute, append to
2143 S the letter 'S', the tag of C, and its name; otherwise,
2144 process C recursively by performing Steps 3 through 7,
2145 appending the result to S. Following the last child (or if
2146 there are no children), append a zero byte.
2151 For the purposes of this algorithm, if a debugging information
2153 DW\-\_AT\-\_specification
2154 attribute that refers to
2155 another entry D (which has a
2156 DW\-\_AT\-\_declaration
2158 then S inherits the attributes and children of D, and S is
2159 processed as if those attributes and children were present in
2160 the entry S. Exception: if a particular attribute is found in
2161 both S and D, the attribute in S is used and the corresponding
2162 one in D is ignored.
2164 DWARF tag and attribute codes are appended to the sequence
2165 as unsigned LEB128 values, using the values defined earlier
2168 \textit{A grammar describing this computation may be found in
2169 Appendix \refersec{app:typesignaturecomputationgrammar}.
2172 \textit{An attribute that refers to another type entry should
2173 be recursively processed or replaced with the name of the
2174 referent (in Step 4, 5 or 6). If neither treatment applies to
2175 an attribute that references another type entry, the entry
2176 that contains that attribute should not be considered for a
2177 separate type unit.}
2179 \textit{If a debugging information entry contains an attribute from
2180 the list above that would require an unsupported form, that
2181 entry should not be considered for a separate type unit.}
2183 \textit{A type should be considered for a separate type unit only
2184 if all of the type entries that it contains or refers to in
2185 Steps 6 and 7 can themselves each be considered for a separate
2188 Where the DWARF producer may reasonably choose two or more
2189 different forms for a given attribute, it should choose
2190 the simplest possible form in computing the signature. (For
2191 example, a constant value should be preferred to a location
2192 expression when possible.)
2194 Once the string S has been formed from the DWARF encoding,
2195 an MD5 hash is computed for the string and the lower 64 bits
2196 are taken as the type signature.
2198 \textit{The string S is intended to be a flattened representation of
2199 the type that uniquely identifies that type (i.e., a different
2200 type is highly unlikely to produce the same string).}
2202 \textit{A debugging information entry should not be placed in a
2203 separate type unit if any of the following apply:}
2207 \item \textit{The entry has an attribute whose value is a location
2208 expression, and the location expression contains a reference to
2209 another debugging information entry (e.g., a DW\_OP\_call\_ref
2210 operator), as it is unlikely that the entry will remain
2211 identical across compilation units.}
2213 \item \textit{The entry has an attribute whose value refers
2214 to a code location or a location list.}
2216 \item \textit{The entry has an attribute whose value refers
2217 to another debugging information entry that does not represent
2222 \textit{Certain attributes are not included in the type signature:}
2225 \item \textit{The DW\_AT\_declaration attribute is not included because it
2226 indicates that the debugging information entry represents an
2227 incomplete declaration, and incomplete declarations should
2228 not be placed in separate type units.}
2230 \item \textit{The DW\_AT\_description attribute is not included because
2231 it does not provide any information unique to the defining
2232 declaration of the type.}
2234 \item \textit{The DW\_AT\_decl\_file, DW\_AT\_decl\_line, and
2235 DW\_AT\_decl\_column attributes are not included because they
2236 may vary from one source file to the next, and would prevent
2237 two otherwise identical type declarations from producing the