.debug_info.dwo holds a full tree of debugging information entries
(DIEs), so any DWARF tag, attribute and form may appear in it. This page lists them all,
from tables 7.2 to 7.6 of
DWARF Version 5. Codes marked
5 are new in version 5. Further down: the codes of expression
operations, base types, languages, the line number program, macro information and call
frame instructions.
Unit types
| Value | Name | Meaning |
|---|---|---|
0x01 | DW_UT_compile | Full compilation unit (not split). |
0x02 | DW_UT_type | Type unit (not split). |
0x03 | DW_UT_partial | Partial compilation unit. |
0x04 | DW_UT_skeleton | Skeleton unit, in the program. |
0x05 | DW_UT_split_compile | Split compilation unit, in the .dwo. |
0x06 | DW_UT_split_type | Split type unit, in the .dwo. |
0x80–0xFF | DW_UT_lo_user–DW_UT_hi_user | Vendor unit types. |
Abbreviations and entries
Each DIE in .debug_info.dwo starts with a ULEB128 abbreviation code
(0 is a null entry, which ends a list of siblings), followed by its attribute values in
the order its abbreviation gives. An abbreviation in .debug_abbrev.dwo
is:
| Field | Encoding | Meaning |
|---|---|---|
| code | ULEB128 | The abbreviation code; 0 ends the unit’s table. |
| tag | ULEB128 | A DW_TAG value. |
| children | 1 byte | 0x00 DW_CHILDREN_no: the next entry is a sibling. 0x01 DW_CHILDREN_yes: the next entry is its first child. |
| attribute specifications | pairs of ULEB128 | An DW_AT name and a DW_FORM; for DW_FORM_implicit_const a SLEB128 value follows, and no value is stored in the DIE. A pair of 0, 0 ends the list. |
With DW_FORM_indirect the value in the DIE starts with a ULEB128 form
code, then the value in that form.
Attributes
The classes say which kinds of form an attribute may use (see classes).
| Value | Name | Classes |
|---|---|---|
0x01 | DW_AT_sibling | reference |
0x02 | DW_AT_location | exprloc, loclist |
0x03 | DW_AT_name | string |
0x04–0x08 | reserved | – |
0x09 | DW_AT_ordering | constant |
0x0a | reserved | – |
0x0b | DW_AT_byte_size | constant, exprloc, reference |
0x0c | reserved (was DW_AT_bit_offset in DWARF 3 and earlier) | constant, exprloc, reference |
0x0d | DW_AT_bit_size | constant, exprloc, reference |
0x0e, 0x0f | reserved | – |
0x10 | DW_AT_stmt_list | lineptr |
0x11 | DW_AT_low_pc | address |
0x12 | DW_AT_high_pc | address, constant |
0x13 | DW_AT_language | constant |
0x14 | reserved | – |
0x15 | DW_AT_discr | reference |
0x16 | DW_AT_discr_value | constant |
0x17 | DW_AT_visibility | constant |
0x18 | DW_AT_import | reference |
0x19 | DW_AT_string_length | exprloc, loclist, reference |
0x1a | DW_AT_common_reference | reference |
0x1b | DW_AT_comp_dir | string |
0x1c | DW_AT_const_value | block, constant, string |
0x1d | DW_AT_containing_type | reference |
0x1e | DW_AT_default_value | constant, reference, flag |
0x1f | reserved | – |
0x20 | DW_AT_inline | constant |
0x21 | DW_AT_is_optional | flag |
0x22 | DW_AT_lower_bound | constant, exprloc, reference |
0x23, 0x24 | reserved | – |
0x25 | DW_AT_producer | string |
0x26 | reserved | – |
0x27 | DW_AT_prototyped | flag |
0x28, 0x29 | reserved | – |
0x2a | DW_AT_return_addr | exprloc, loclist |
0x2b | reserved | – |
0x2c | DW_AT_start_scope | constant, rnglist |
0x2d | reserved | – |
0x2e | DW_AT_bit_stride | constant, exprloc, reference |
0x2f | DW_AT_upper_bound | constant, exprloc, reference |
0x30 | reserved | – |
0x31 | DW_AT_abstract_origin | reference |
0x32 | DW_AT_accessibility | constant |
0x33 | DW_AT_address_class | constant |
0x34 | DW_AT_artificial | flag |
0x35 | DW_AT_base_types | reference |
0x36 | DW_AT_calling_convention | constant |
0x37 | DW_AT_count | constant, exprloc, reference |
0x38 | DW_AT_data_member_location | constant, exprloc, loclist |
0x39 | DW_AT_decl_column | constant |
0x3a | DW_AT_decl_file | constant |
0x3b | DW_AT_decl_line | constant |
0x3c | DW_AT_declaration | flag |
0x3d | DW_AT_discr_list | block |
0x3e | DW_AT_encoding | constant |
0x3f | DW_AT_external | flag |
0x40 | DW_AT_frame_base | exprloc, loclist |
0x41 | DW_AT_friend | reference |
0x42 | DW_AT_identifier_case | constant |
0x43 | reserved (was DW_AT_macro_info in DWARF 4 and earlier) | macptr |
0x44 | DW_AT_namelist_item | reference |
0x45 | DW_AT_priority | reference |
0x46 | DW_AT_segment | exprloc, loclist |
0x47 | DW_AT_specification | reference |
0x48 | DW_AT_static_link | exprloc, loclist |
0x49 | DW_AT_type | reference |
0x4a | DW_AT_use_location | exprloc, loclist |
0x4b | DW_AT_variable_parameter | flag |
0x4c | DW_AT_virtuality | constant |
0x4d | DW_AT_vtable_elem_location | exprloc, loclist |
0x4e | DW_AT_allocated | constant, exprloc, reference |
0x4f | DW_AT_associated | constant, exprloc, reference |
0x50 | DW_AT_data_location | exprloc |
0x51 | DW_AT_byte_stride | constant, exprloc, reference |
0x52 | DW_AT_entry_pc | address, constant |
0x53 | DW_AT_use_UTF8 | flag |
0x54 | DW_AT_extension | reference |
0x55 | DW_AT_ranges | rnglist |
0x56 | DW_AT_trampoline | address, flag, reference, string |
0x57 | DW_AT_call_column | constant |
0x58 | DW_AT_call_file | constant |
0x59 | DW_AT_call_line | constant |
0x5a | DW_AT_description | string |
0x5b | DW_AT_binary_scale | constant |
0x5c | DW_AT_decimal_scale | constant |
0x5d | DW_AT_small | reference |
0x5e | DW_AT_decimal_sign | constant |
0x5f | DW_AT_digit_count | constant |
0x60 | DW_AT_picture_string | string |
0x61 | DW_AT_mutable | flag |
0x62 | DW_AT_threads_scaled | flag |
0x63 | DW_AT_explicit | flag |
0x64 | DW_AT_object_pointer | reference |
0x65 | DW_AT_endianity | constant |
0x66 | DW_AT_elemental | flag |
0x67 | DW_AT_pure | flag |
0x68 | DW_AT_recursive | flag |
0x69 | DW_AT_signature | reference |
0x6a | DW_AT_main_subprogram | flag |
0x6b | DW_AT_data_bit_offset | constant |
0x6c | DW_AT_const_expr | flag |
0x6d | DW_AT_enum_class | flag |
0x6e | DW_AT_linkage_name | string |
0x6f | DW_AT_string_length_bit_size 5 | constant |
0x70 | DW_AT_string_length_byte_size 5 | constant |
0x71 | DW_AT_rank 5 | constant, exprloc |
0x72 | DW_AT_str_offsets_base 5 | stroffsetsptr |
0x73 | DW_AT_addr_base 5 | addrptr |
0x74 | DW_AT_rnglists_base 5 | rnglistsptr |
0x75 | reserved (unused) | – |
0x76 | DW_AT_dwo_name 5 | string |
0x77 | DW_AT_reference 5 | flag |
0x78 | DW_AT_rvalue_reference 5 | flag |
0x79 | DW_AT_macros 5 | macptr |
0x7a | DW_AT_call_all_calls 5 | flag |
0x7b | DW_AT_call_all_source_calls 5 | flag |
0x7c | DW_AT_call_all_tail_calls 5 | flag |
0x7d | DW_AT_call_return_pc 5 | address |
0x7e | DW_AT_call_value 5 | exprloc |
0x7f | DW_AT_call_origin 5 | exprloc |
0x80 | DW_AT_call_parameter 5 | reference |
0x81 | DW_AT_call_pc 5 | address |
0x82 | DW_AT_call_tail_call 5 | flag |
0x83 | DW_AT_call_target 5 | exprloc |
0x84 | DW_AT_call_target_clobbered 5 | exprloc |
0x85 | DW_AT_call_data_location 5 | exprloc |
0x86 | DW_AT_call_data_value 5 | exprloc |
0x87 | DW_AT_noreturn 5 | flag |
0x88 | DW_AT_alignment 5 | constant |
0x89 | DW_AT_export_symbols 5 | flag |
0x8a | DW_AT_deleted 5 | flag |
0x8b | DW_AT_defaulted 5 | constant |
0x8c | DW_AT_loclists_base 5 | loclistsptr |
0x2000–0x3fff | DW_AT_lo_user–DW_AT_hi_user (vendor attributes, e.g. the GNU split-DWARF ones at 0x2130–0x2135) | – |
Forms
“Offset size” is 4 bytes in the 32-bit DWARF format and 8 in the 64-bit format.
| Value | Name | Class | Encoding in the DIE |
|---|---|---|---|
0x01 | DW_FORM_addr | address | An address of address_size bytes, relocated by the linker. |
0x02 | reserved | – | – |
0x03 | DW_FORM_block2 | block | 2-byte length, then that many bytes. |
0x04 | DW_FORM_block4 | block | 4-byte length, then that many bytes. |
0x05 | DW_FORM_data2 | constant | 2 bytes. |
0x06 | DW_FORM_data4 | constant | 4 bytes. |
0x07 | DW_FORM_data8 | constant | 8 bytes. |
0x08 | DW_FORM_string | string | The string itself, ending in a 0 byte. |
0x09 | DW_FORM_block | block | ULEB128 length, then that many bytes. |
0x0a | DW_FORM_block1 | block | 1-byte length, then that many bytes. |
0x0b | DW_FORM_data1 | constant | 1 byte. |
0x0c | DW_FORM_flag | flag | 1 byte: 0 false, other values true. |
0x0d | DW_FORM_sdata | constant | SLEB128. |
0x0e | DW_FORM_strp | string | Offset-size offset into .debug_str. |
0x0f | DW_FORM_udata | constant | ULEB128. |
0x10 | DW_FORM_ref_addr | reference | Offset-size offset from the start of .debug_info. |
0x11 | DW_FORM_ref1 | reference | 1-byte offset from the start of the unit header. |
0x12 | DW_FORM_ref2 | reference | 2-byte unit offset. |
0x13 | DW_FORM_ref4 | reference | 4-byte unit offset. |
0x14 | DW_FORM_ref8 | reference | 8-byte unit offset. |
0x15 | DW_FORM_ref_udata | reference | ULEB128 unit offset. |
0x16 | DW_FORM_indirect | (any) | ULEB128 form code, then a value in that form. |
0x17 | DW_FORM_sec_offset | addrptr, lineptr, loclist, loclistsptr, macptr, rnglist, rnglistsptr, stroffsetsptr | Offset-size offset into the section the attribute’s class names. |
0x18 | DW_FORM_exprloc | exprloc | ULEB128 length, then a DWARF expression. |
0x19 | DW_FORM_flag_present | flag | Nothing: the attribute is present and true. |
0x1a | DW_FORM_strx 5 | string | ULEB128 index into the string offsets table. |
0x1b | DW_FORM_addrx 5 | address | ULEB128 index into .debug_addr. |
0x1c | DW_FORM_ref_sup4 5 | reference | 4-byte offset into a supplementary file’s .debug_info. |
0x1d | DW_FORM_strp_sup 5 | string | Offset-size offset into a supplementary file’s .debug_str. |
0x1e | DW_FORM_data16 5 | constant | 16 bytes. |
0x1f | DW_FORM_line_strp 5 | string | Offset-size offset into .debug_line_str. |
0x20 | DW_FORM_ref_sig8 | reference | 8-byte type signature of a type unit. |
0x21 | DW_FORM_implicit_const 5 | constant | Nothing: the value is the SLEB128 stored in the abbreviation. |
0x22 | DW_FORM_loclistx 5 | loclist | ULEB128 index into the location list offsets. |
0x23 | DW_FORM_rnglistx 5 | rnglist | ULEB128 index into the range list offsets. |
0x24 | DW_FORM_ref_sup8 5 | reference | 8-byte offset into a supplementary file’s .debug_info. |
0x25 | DW_FORM_strx1 5 | string | 1-byte string index. |
0x26 | DW_FORM_strx2 5 | string | 2-byte string index. |
0x27 | DW_FORM_strx3 5 | string | 3-byte string index. |
0x28 | DW_FORM_strx4 5 | string | 4-byte string index. |
0x29 | DW_FORM_addrx1 5 | address | 1-byte address index. |
0x2a | DW_FORM_addrx2 5 | address | 2-byte address index. |
0x2b | DW_FORM_addrx3 5 | address | 3-byte address index. |
0x2c | DW_FORM_addrx4 5 | address | 4-byte address index. |
A .dwo is never relocated, so its producers avoid forms that would need
relocation: strings use the strx forms rather than
DW_FORM_strp, addresses the addrx forms, and references stay
inside the unit or name a type unit with DW_FORM_ref_sig8.
Classes
| Class | Forms | Meaning |
|---|---|---|
| address | addr, addrx, addrx1–addrx4 | A machine address, direct or by index. |
| addrptr | sec_offset | Offset into .debug_addr. |
| block | block1, block2, block4, block | Uninterpreted bytes. |
| constant | data1, data2, data4, data8, data16, sdata, udata, implicit_const | A number or other fixed data, in target byte order. |
| exprloc | exprloc | A DWARF expression or location description. |
| flag | flag, flag_present | True or false. |
| lineptr | sec_offset | Offset into .debug_line or .debug_line.dwo. |
| loclist | loclistx, sec_offset | A location list. |
| loclistsptr | sec_offset | Offset into .debug_loclists. |
| macptr | sec_offset | Offset into .debug_macro or .debug_macro.dwo. |
| reference | ref1, ref2, ref4, ref8, ref_udata, ref_addr, ref_sig8, ref_sup4, ref_sup8 | Another DIE. |
| rnglist | rnglistx, sec_offset | A range list. |
| rnglistsptr | sec_offset | Offset into .debug_rnglists. |
| string | string, strp, line_strp, strp_sup, strx, strx1–strx4 | A string, inline or by offset or index. |
| stroffsetsptr | sec_offset | Offset into .debug_str_offsets. |
Expression operations
A DWARF expression (class exprloc, or a block in a location list) is a
sequence of operations: one byte opcode, then its operands. The machine is a stack;
the value on top when the expression ends is the result. Table 7.9. “gen” is the
generic type, an integer the size of an address with no stated signedness. Codes
marked 5 are new in version 5.
| Code | Name | Operands | Effect |
|---|---|---|---|
0x03 | DW_OP_addr | address (target size) | Push the machine address. |
0x06 | DW_OP_deref | none | Pop an address; push the address-sized value stored there (gen). |
0x08–0x0f | DW_OP_const1u const1s const2u const2s const4u const4s const8u const8s | 1-, 2-, 4- or 8-byte constant | Push the unsigned (u) or signed (s) constant; the order of codes is 08 const1u, 09 const1s, 0a const2u, 0b const2s, 0c const4u, 0d const4s, 0e const8u, 0f const8s. |
0x10 | DW_OP_constu | ULEB128 | Push the constant. |
0x11 | DW_OP_consts | SLEB128 | Push the constant. |
0x12 | DW_OP_dup | none | Duplicate the top entry. |
0x13 | DW_OP_drop | none | Pop the top entry. |
0x14 | DW_OP_over | none | Push a copy of the second entry (same as pick 1). |
0x15 | DW_OP_pick | 1-byte stack index | Push a copy of the entry at that index (0 is the top). |
0x16 | DW_OP_swap | none | Swap the top two entries. |
0x17 | DW_OP_rot | none | Rotate the top three: top becomes third, second becomes top, third becomes second. |
0x18 | DW_OP_xderef | none | Pop an address and an address-space identifier; push the value retrieved by an implementation-defined calculation. |
0x19 | DW_OP_abs | none | Absolute value of the top, as signed. |
0x1a | DW_OP_and | none | Bitwise and of the top two. |
0x1b | DW_OP_div | none | Signed division: second entry divided by top. |
0x1c | DW_OP_minus | none | Second entry minus top. |
0x1d | DW_OP_mod | none | Second entry modulo top. |
0x1e | DW_OP_mul | none | Multiply the top two. |
0x1f | DW_OP_neg | none | Negate the top, as signed. |
0x20 | DW_OP_not | none | Bitwise complement of the top. |
0x21 | DW_OP_or | none | Bitwise or of the top two. |
0x22 | DW_OP_plus | none | Add the top two. |
0x23 | DW_OP_plus_uconst | ULEB128 addend | Add the constant to the top entry. |
0x24 | DW_OP_shl | none | Shift the second entry left (zero fill) by the top. |
0x25 | DW_OP_shr | none | Logical shift right. |
0x26 | DW_OP_shra | none | Arithmetic shift right. |
0x27 | DW_OP_xor | none | Bitwise exclusive or. |
0x28 | DW_OP_bra | signed 2-byte | Pop; if it is not 0, skip that many bytes of the expression forwards or backwards, counted from after the operand. |
0x29–0x2e | DW_OP_eq ge gt le lt ne | none | Pop two, compare second with top, push 1 or 0 (gen). Order of codes: 29 eq, 2a ge, 2b gt, 2c le, 2d lt, 2e ne. Generic operands compare as signed. |
0x2f | DW_OP_skip | signed 2-byte | Unconditional branch, counted as for bra. |
0x30–0x4f | DW_OP_lit0–lit31 | none | Push the literal 0 to 31 (code minus 0x30). |
0x50–0x6f | DW_OP_reg0–reg31 | none | Location description: the object is in register 0 to 31 (code minus 0x50). |
0x70–0x8f | DW_OP_breg0–breg31 | SLEB128 offset | Push register 0 to 31 plus the offset (code minus 0x70). |
0x90 | DW_OP_regx | ULEB128 register | Location description: the object is in that register. |
0x91 | DW_OP_fbreg | SLEB128 offset | Push the function’s frame base (from DW_AT_frame_base) plus the offset. |
0x92 | DW_OP_bregx | ULEB128 register, SLEB128 offset | Push register plus offset. |
0x93 | DW_OP_piece | ULEB128 size | Composite location: the preceding location describes the next piece of that many bytes. |
0x94 | DW_OP_deref_size | 1-byte size | Like deref but reads that many bytes (not more than an address), zero-extended. |
0x95 | DW_OP_xderef_size | 1-byte size | Like xderef with that size. |
0x96 | DW_OP_nop | none | Placeholder with no effect. |
0x97 | DW_OP_push_object_address | none | Push the address of the object being evaluated. |
0x98 | DW_OP_call2 | 2-byte DIE offset | Run the DW_AT_location of that DIE in this unit, then return. |
0x99 | DW_OP_call4 | 4-byte DIE offset | As call2. |
0x9a | DW_OP_call_ref | 4- or 8-byte offset into .debug_info | As call2, possibly in another file. |
0x9b | DW_OP_form_tls_address | none | Pop a thread-local identifier; push its address in this thread’s storage for the module (run-time defined). |
0x9c | DW_OP_call_frame_cfa | none | Push the canonical frame address from the call frame information. |
0x9d | DW_OP_bit_piece | ULEB128 size, ULEB128 offset | Like piece, in bits, with a bit offset into the location. |
0x9e | DW_OP_implicit_value | ULEB128 size, block of that size | The object has no location; its value is the block. |
0x9f | DW_OP_stack_value | none | The object has no location; its value is the top of the stack. Ends the expression. |
0xa0 5 | DW_OP_implicit_pointer | DIE offset (4 or 8 bytes), SLEB128 offset | The object is a pointer that cannot be represented, to the object a given DIE describes, plus the offset. |
0xa1 5 | DW_OP_addrx | ULEB128 index | Push the address at that index of .debug_addr (from DW_AT_addr_base). |
0xa2 5 | DW_OP_constx | ULEB128 index | Push the constant at that index of .debug_addr; for values that need link-time relocation but are not addresses, such as thread-local offsets. |
0xa3 5 | DW_OP_entry_value | ULEB128 size, block of that size | Push the value the described location had on entering the subprogram; the block is an expression or a register description. |
0xa4 5 | DW_OP_const_type | ULEB128 type DIE offset, 1-byte size, constant bytes | Push a constant of that base type. |
0xa5 5 | DW_OP_regval_type | ULEB128 register, ULEB128 type DIE offset | Push the register’s contents as a value of that base type. |
0xa6 5 | DW_OP_deref_type | 1-byte size, ULEB128 type DIE offset | Like deref_size, pushing a value of that base type. |
0xa7 5 | DW_OP_xderef_type | 1-byte size, ULEB128 type DIE offset | Like xderef_size, pushing a value of that base type. |
0xa8 5 | DW_OP_convert | ULEB128 type DIE offset (0 for gen) | Pop, convert to that type, push. |
0xa9 5 | DW_OP_reinterpret | ULEB128 type DIE offset (0 for gen) | Pop, reinterpret the bits as that type (same size), push. |
0xe0–0xff | DW_OP_lo_user–DW_OP_hi_user | vendor | Vendor operations; the standard does not describe them. |
0x01, 0x02, 0x04, 0x05, 0x07 | reserved | — | Marked reserved in table 7.9. |
Operations other than const_type push the generic type. Arithmetic on
the generic type is unsigned modulo the address range, apart from the signed
abs, div, neg and the comparisons. Location
list entries (DW_LLE_*) and range list entries (DW_RLE_*) are on the
units page.
Base types and small enumerations
DW_AT_encoding (DW_ATE_*, table 7.11)
| Code | Name | Code | Name |
|---|---|---|---|
0x01 | address | 0x0a | packed_decimal |
0x02 | boolean | 0x0b | numeric_string |
0x03 | complex_float | 0x0c | edited |
0x04 | float | 0x0d | signed_fixed |
0x05 | signed | 0x0e | unsigned_fixed |
0x06 | signed_char | 0x0f | decimal_float |
0x07 | unsigned | 0x10 | UTF |
0x08 | unsigned_char | 0x11 5 | UCS |
0x09 | imaginary_float | 0x12 5 | ASCII |
0x80–0xff: DW_ATE_lo_user–DW_ATE_hi_user, vendor encodings. | |||
Other enumerations
| Attribute | Values |
|---|---|
DW_AT_decimal_sign (DW_DS_*, 7.12) | 0x01 unsigned, 0x02 leading_overpunch, 0x03 trailing_overpunch, 0x04 leading_separate, 0x05 trailing_separate |
DW_AT_endianity (DW_END_*, 7.13) | 0x00 default, 0x01 big, 0x02 little; 0x40–0xff vendor (lo_user, hi_user) |
DW_AT_accessibility (DW_ACCESS_*, 7.14) | 0x01 public, 0x02 protected, 0x03 private |
DW_AT_visibility (DW_VIS_*, 7.15) | 0x01 local, 0x02 exported, 0x03 qualified |
DW_AT_virtuality (DW_VIRTUALITY_*, 7.16) | 0x00 none (same as the attribute being absent), 0x01 virtual, 0x02 pure_virtual |
Address class (DW_ADDR_none, 7.13) | 0 |
DW_AT_identifier_case (DW_ID_*, 7.18) | 0x00 case_sensitive, 0x01 up_case, 0x02 down_case, 0x03 case_insensitive |
DW_AT_calling_convention (DW_CC_*, 7.19) | 0x01 normal, 0x02 program, 0x03 nocall, 0x04 pass_by_reference (5), 0x05 pass_by_value (5); 0x40–0xff vendor |
DW_AT_inline (DW_INL_*, 7.20) | 0x00 not_inlined, 0x01 inlined, 0x02 declared_not_inlined, 0x03 declared_inlined |
DW_AT_ordering (DW_ORD_*, 7.21) | 0x00 row_major, 0x01 col_major |
DW_AT_discr_list descriptor (DW_DSC_*, 7.22) | 0x00 label, 0x01 range (1-byte constants) |
DW_AT_defaulted (DW_DEFAULTED_*, 7.24, all 5) | 0x00 no, 0x01 in_class, 0x02 out_of_class |
Name index attributes (DW_IDX_*, 7.23, all 5) | 1 compile_unit (constant), 2 type_unit (constant), 3 die_offset (reference), 4 parent (constant), 5 type_hash (DW_FORM_data8); 0x2000–0x3fff vendor |
Source languages
DW_AT_language values (table 7.17), with the lower bound assumed for an
omitted DW_AT_lower_bound in a subrange. A dagger in the standard marks
languages that are reserved but not well supported; 5 is new in
version 5.
| Code | Name | Lower bound | Code | Name | Lower bound |
|---|---|---|---|---|---|
0x0001 | C89 | 0 | 0x0016 5 | Go | 0 |
0x0002 | C | 0 | 0x0017 5 | Modula3 | 1 |
0x0003 | Ada83 | 1 | 0x0018 5 | Haskell | 0 |
0x0004 | C_plus_plus | 0 | 0x0019 5 | C_plus_plus_03 | 0 |
0x0005 | Cobol74 | 1 | 0x001a 5 | C_plus_plus_11 | 0 |
0x0006 | Cobol85 | 1 | 0x001b 5 | OCaml | 0 |
0x0007 | Fortran77 | 1 | 0x001c 5 | Rust | 0 |
0x0008 | Fortran90 | 1 | 0x001d 5 | C11 | 0 |
0x0009 | Pascal83 | 1 | 0x001e 5 | Swift | 0 |
0x000a | Modula2 | 1 | 0x001f 5 | Julia | 1 |
0x000b | Java | 0 | 0x0020 5 | Dylan | 0 |
0x000c | C99 | 0 | 0x0021 5 | C_plus_plus_14 | 0 |
0x000d | Ada95 | 1 | 0x0022 5 | Fortran03 | 1 |
0x000e | Fortran95 | 1 | 0x0023 5 | Fortran08 | 1 |
0x000f | PLI | 1 | 0x0024 5 | RenderScript | 0 |
0x0010 | ObjC | 0 | 0x0025 5 | BLISS | 0 |
0x0011 | ObjC_plus_plus | 0 | 0x8000–0xffff: DW_LANG_lo_user–DW_LANG_hi_user, vendor languages. | ||
0x0012 | UPC | 0 | |||
0x0013 | D | 0 | |||
0x0014 | Python | 0 | |||
0x0015 5 | OpenCL | 0 | |||
All names carry the prefix DW_LANG_. In the standard’s table the
reserved-but-poorly-supported dagger marks Ada83, Cobol74, Cobol85, Ada95, PLI and
Python; OpenCL, Go, Modula3 and Haskell carry both the dagger and the version-5 mark.
The daggers were read from a garbled text extract, so treat them as less certain than
the codes.
Line number program
A .debug_line unit (version 5) is a header followed by a program for a
state machine that builds a table of rows. The version number here is the line
table’s own, independent of the DWARF version. Section 6.2 and 7.22 of the
standard.
Header
| Field | Type | Meaning |
|---|---|---|
unit_length | initial length | Bytes of line information after this field. |
version | uhalf | 5. |
address_size (5) | ubyte | Size of an address (or its offset part) on the target. |
segment_selector_size (5) | ubyte | Size of a segment selector. |
header_length | 4 or 8 bytes | Bytes from after this field to the first byte of the program. |
minimum_instruction_length | ubyte | Size of the smallest machine instruction. |
maximum_operations_per_instruction | ubyte | 1 for non-VLIW targets, where op_index is always 0. |
default_is_stmt | ubyte | Initial value of the is_stmt register. |
line_base | sbyte | Smallest line increment a special opcode can make. |
line_range | ubyte | Number of line increments special opcodes cover. |
opcode_base | ubyte | Number of the first special opcode; 13 in version 5 (one more than the highest standard opcode, 12). Numbers between 12 and the base are vendor standard opcodes. |
standard_opcode_lengths | ubyte array | Number of ULEB128 operands of each standard opcode, from opcode 1 to opcode_base − 1, so a consumer can skip unknown ones. |
directory_entry_format_count, directory_entry_format | ubyte, ULEB128 pairs | Pairs of a content type code (DW_LNCT_*) and a form code describing each directory entry. |
directories_count, directories | ULEB128, entries | Directories searched; entry 0 is the compilation directory. |
file_name_entry_format_count, file_name_entry_format | ubyte, ULEB128 pairs | The same for files; if the count is 0, file_names_count must be 0. |
file_names_count, file_names | ULEB128, entries | Source files; entry 0 is the primary source file, matching DW_AT_name. |
Content types (DW_LNCT_*, table 7.27, all 5)
| Code | Name | Content and forms |
|---|---|---|
0x1 | path | A path string: string, line_strp, strp, strp_sup, and in .debug_line.dwo also strx to strx4. |
0x2 | directory_index | Index into the directories; with data1, data2 or udata. |
0x3 | timestamp | Modification time or 0; with udata, data4, data8 or block. |
0x4 | size | File size in bytes or 0; with udata, data1 to data8. |
0x5 | MD5 | 16-byte MD5 of the file; with data16. |
0x2000–0x3fff | lo_user–hi_user | Vendor content; a consumer that does not know the code skips the data. Allowed forms are listed in section 6.2.4.2. |
Opcodes
An opcode of opcode_base or more is special. Opcode 0 starts an extended
opcode: a ULEB128 length, then that many bytes, the first being the extended opcode.
Everything else is a standard opcode.
A special opcode does seven things: add a signed amount to line, advance
address and op_index, append a row, then clear
basic_block, prologue_end, epilogue_begin and
set discriminator to 0. With adjusted = opcode −
opcode_base: operation advance = adjusted /
line_range; new address = address + minimum_instruction_length
× ((op_index + advance) / maximum_operations_per_instruction);
new op_index = (op_index + advance) % that maximum; line
increment = line_base + (adjusted % line_range).
A producer chooses opcode = (line increment − line_base) +
(line_range × advance) + opcode_base, and if that exceeds 255
uses a standard opcode.
| Code | Name | Operands | Effect |
|---|---|---|---|
0x01 | DW_LNS_copy | none | Append a row; then discriminator to 0 and basic_block, prologue_end, epilogue_begin to false. |
0x02 | DW_LNS_advance_pc | ULEB128 operation advance | Advance address and op_index as for a special opcode. |
0x03 | DW_LNS_advance_line | SLEB128 | Add to line. |
0x04 | DW_LNS_set_file | ULEB128 | Set file. |
0x05 | DW_LNS_set_column | ULEB128 | Set column. |
0x06 | DW_LNS_negate_stmt | none | Flip is_stmt. |
0x07 | DW_LNS_set_basic_block | none | Set basic_block true. |
0x08 | DW_LNS_const_add_pc | none | Advance address and op_index by the amount of special opcode 255. |
0x09 | DW_LNS_fixed_advance_pc | uhalf (not LEB128) | Add the operand to address as it stands (no multiplication) and set op_index to 0. |
0x0a | DW_LNS_set_prologue_end | none | Set prologue_end true. |
0x0b | DW_LNS_set_epilogue_begin | none | Set epilogue_begin true. |
0x0c | DW_LNS_set_isa | ULEB128 | Set isa. |
extended 0x01 | DW_LNE_end_sequence | none | Set end_sequence, append a row, reset all registers. Every sequence ends with it. |
extended 0x02 | DW_LNE_set_address | relocatable address (target size) | Set address and op_index 0. |
extended 0x03 | reserved | — | Kept free for DW_LNE_define_file, which version 5 deprecates. |
extended 0x04 | DW_LNE_set_discriminator | ULEB128 | Set discriminator. |
extended 0x80–0xff | DW_LNE_lo_user–hi_user | vendor | Vendor extended opcodes. |
The registers are address, op_index, file,
line, column, is_stmt,
basic_block, end_sequence, prologue_end,
epilogue_begin, isa and discriminator
(section 6.2.2, table 6.3).
State machine registers (table 6.3)
| Register | Meaning | Initial value (table 6.4) |
|---|---|---|
address | The program-counter value of a machine instruction the compiler generated. | 0 |
op_index | Unsigned index of an operation within a VLIW instruction; the first is 0. Always 0 on non-VLIW architectures. With address it forms an operation pointer. | 0 |
file | Unsigned identity of the source file. | 1 |
line | Unsigned source line number, from 1; 0 where an instruction cannot be attributed to a line. | 1 |
column | Unsigned column within the line, from 1; 0 means the statement begins at the left edge. | 0 |
is_stmt | Boolean: the instruction is a recommended breakpoint location. | the default_is_stmt field of the line program header |
basic_block | Boolean: the instruction begins a basic block. | false |
end_sequence | Boolean: the address is the first byte after the end of a sequence; the rest of the row is not meaningful. | false |
prologue_end | Boolean: a place to suspend for a breakpoint at a function’s entry. | false |
epilogue_begin | Boolean: a place to suspend for a breakpoint just before a function’s exit. | false |
isa | Unsigned code of the instruction set architecture; 0 is the architecturally determined default. The encoding should be shared by all users of an architecture and is recommended to be set by the ABI authors. | 0 |
discriminator | Unsigned identifier of the block the instruction belongs to; assigned arbitrarily by the producer to tell apart blocks at the same file, line and column; 0 when only one block exists there. | 0 |
Macro information
.debug_macro (new in version 5; it replaces .debug_macinfo).
Each macro unit has a header, a series of entries, and ends with an entry whose opcode
is 0.
| Header field | Type | Meaning |
|---|---|---|
version | uhalf | 5; independent of the DWARF version. |
flags | ubyte | Bit 0 offset_size_flag: 0 means 4-byte offsets, 1 means 8-byte. Bit 1 debug_line_offset_flag: the next field is present. Bit 2 opcode_operands_table_flag: the table is present. Other bits reserved. |
debug_line_offset | 4 or 8 bytes | Offset of the unit’s line information in .debug_line. Only if bit 1 is set. |
opcode_operands_table | count and entries | 1-byte count; then for each opcode its number (ubyte), a ULEB128 operand count and one form byte per operand. Describes vendor opcodes and may describe standard ones. |
| Code | Name | Operands |
|---|---|---|
0x01 | DW_MACRO_define | ULEB128 line, null-terminated string |
0x02 | DW_MACRO_undef | ULEB128 line, null-terminated string |
0x03 | DW_MACRO_start_file | ULEB128 line of the include, ULEB128 file index into the line table |
0x04 | DW_MACRO_end_file | none |
0x05 | DW_MACRO_define_strp | ULEB128 line, offset into .debug_str |
0x06 | DW_MACRO_undef_strp | ULEB128 line, offset into .debug_str |
0x07 | DW_MACRO_import | offset into .debug_macro: replay that unit’s entries here |
0x08 | DW_MACRO_define_sup | ULEB128 line, offset into the supplementary file’s .debug_str |
0x09 | DW_MACRO_undef_sup | same |
0x0a | DW_MACRO_import_sup | offset into the supplementary file’s .debug_macro |
0x0b | DW_MACRO_define_strx | ULEB128 line, ULEB128 index into .debug_str_offsets |
0x0c | DW_MACRO_undef_strx | same |
0xe0–0xff | DW_MACRO_lo_user–hi_user | vendor; described in the header’s operand table |
A define string is the macro name, then for a function-like macro the parameter list in
parentheses (no space before it, parameters separated by commas without spaces), then
exactly one space, then the definition. An undefine string is the name alone. Macros
from command-line options come before the first start_file with line 0; the
entry for the primary source file has line 0.
Call frame instructions
.debug_frame and .eh_frame-style frame information (table
7.29). The primary opcode is the top two bits of the first byte; the low six bits carry
an operand or the extended opcode. A CIE id is 0xffffffff in 32-bit
DWARF and 0xffffffffffffffff in 64-bit; the CIE version is 4. “Factored”
offsets are multiplied by the CIE’s data alignment factor, and location deltas by its
code alignment factor.
| Opcode | Name | Operands | Effect |
|---|---|---|---|
high 0x1 | DW_CFA_advance_loc | delta in the low 6 bits | New row at location + delta × code alignment. |
high 0x2 | DW_CFA_offset | register in the low 6 bits; ULEB128 factored offset | Register saved at CFA + offset (offset rule). |
high 0x3 | DW_CFA_restore | register in the low 6 bits | Restore the rule from the CIE’s initial instructions. |
0x00 | DW_CFA_nop | none | No effect (padding). |
0x01 | DW_CFA_set_loc | address | New row at that address (greater than the current one); preceded by a segment selector if the CIE’s size for it is non-zero. |
0x02 | DW_CFA_advance_loc1 | ubyte delta | As advance_loc. |
0x03 | DW_CFA_advance_loc2 | uhalf delta | As advance_loc. |
0x04 | DW_CFA_advance_loc4 | uword delta | As advance_loc. |
0x05 | DW_CFA_offset_extended | ULEB128 register, ULEB128 factored offset | As offset, with a full register operand. |
0x06 | DW_CFA_restore_extended | ULEB128 register | As restore. |
0x07 | DW_CFA_undefined | ULEB128 register | Register has no recoverable value. |
0x08 | DW_CFA_same_value | ULEB128 register | Register keeps its value. |
0x09 | DW_CFA_register | ULEB128 register, ULEB128 register | First register is held in the second. |
0x0a | DW_CFA_remember_state | none | Push the register rules onto a stack. |
0x0b | DW_CFA_restore_state | none | Pop them again. |
0x0c | DW_CFA_def_cfa | ULEB128 register, ULEB128 offset | CFA = register + offset (not factored). |
0x0d | DW_CFA_def_cfa_register | ULEB128 register | Change the CFA register, keep the offset. |
0x0e | DW_CFA_def_cfa_offset | ULEB128 offset | Change the CFA offset, keep the register. |
0x0f | DW_CFA_def_cfa_expression | block (exprloc) | CFA is computed by the expression. |
0x10 | DW_CFA_expression | ULEB128 register, block | Register is saved at the address the expression computes, with the CFA pushed first. |
0x11 | DW_CFA_offset_extended_sf | ULEB128 register, SLEB128 factored offset | As offset_extended, signed. |
0x12 | DW_CFA_def_cfa_sf | ULEB128 register, SLEB128 factored offset | As def_cfa, signed and factored. |
0x13 | DW_CFA_def_cfa_offset_sf | SLEB128 factored offset | As def_cfa_offset, signed and factored. |
0x14 | DW_CFA_val_offset | ULEB128 register, ULEB128 factored offset | Register’s value is CFA + offset (val_offset rule). |
0x15 | DW_CFA_val_offset_sf | ULEB128 register, SLEB128 factored offset | As val_offset, signed. |
0x16 | DW_CFA_val_expression | ULEB128 register, block | Register’s value is what the expression computes, with the CFA pushed first. |
0x1c–0x3f | DW_CFA_lo_user–hi_user | vendor | Vendor instructions. |
Expressions in def_cfa_expression, expression and
val_expression may not use addrx, call2,
call4, call_ref, const_type, constx,
convert, deref_type, regval_type,
reinterpret, push_object_address or
call_frame_cfa.
.debug_frame: CIEs and FDEs (section 6.4.1)
Virtual unwinding is described by an abstract table with one row per code location
and these columns: the location (LOC), the canonical frame address
(CFA, either a register plus a signed offset or a DWARF expression) and
one column per register. A register column holds one of these rules:
undefined (no recoverable value in the previous frame),
same value, offset(N) (saved at CFA+N),
val_offset(N) (the value is CFA+N), register(R) (in register
R), expression(E) (saved at the address E computes),
val_expression(E) (the value is what E computes) and
architectural (defined by the augmenter). The table is stored as
differences. Entries in .debug_frame are aligned to a multiple of the
address size relative to the section start and come as a Common Information Entry
(CIE) or a Frame Description Entry (FDE); there is at least one CIE in a non-empty
section.
| # | CIE field | Type | Meaning |
|---|---|---|---|
| 1 | length | initial length | Bytes of the CIE after this field; the length field plus the value is a multiple of the address size. |
| 2 | CIE_id | 4 or 8 bytes | Marks a CIE: 0xffffffff in 32-bit DWARF, 0xffffffffffffffff in 64-bit DWARF. |
| 3 | version | ubyte | CIE version, independent of the DWARF version; the value is 4. |
| 4 | augmentation | UTF-8 string, NUL-terminated | Identifies an augmentation; a single zero byte when there is none. If the string is unexpected, only length, CIE_id, version and augmentation of a CIE (and length, CIE_pointer, initial_location, address_range of an FDE) can be read. |
| 5 | address_size | ubyte | Size of a target address in this CIE and its FDEs; matches the compilation unit’s if one exists. |
| 6 | segment_selector_size | ubyte | Size of a segment selector, in bytes. |
| 7 | code_alignment_factor | unsigned LEB128 | Factored out of advance-location instructions: the value is operand × factor. |
| 8 | data_alignment_factor | signed LEB128 | Factored out of certain offset instructions: the value is operand × factor. |
| 9 | return_address_register | unsigned LEB128 | The column holding the function’s return address; it may not be a real machine register. |
| 10 | initial_instructions | array of ubyte | Rules that set the initial state of each column; before them every column is undefined unless an ABI or compiler says otherwise. |
| 11 | padding | array of ubyte | Enough DW_CFA_nop to fill the length. |
| # | FDE field | Type | Meaning |
|---|---|---|---|
| 1 | length | initial length | Bytes of the FDE after this field; the length field plus the value is a multiple of the address size. |
| 2 | CIE_pointer | 4 or 8 bytes | Offset into .debug_frame of the CIE for this FDE. |
| 3 | initial_location | segment selector and address | Address of the first location of the entry; preceded by a segment selector when the CIE’s segment_selector_size is non-zero. |
| 4 | address_range | address | Bytes of program instructions the entry describes. |
| 5 | instructions | array of ubyte | Table-defining instructions (the table above). |
| 6 | padding | array of ubyte | Enough DW_CFA_nop to fill the length. |
A function whose code is not contiguous may have several CIEs and FDEs. Because
.debug_frame is useful without .debug_info, the
augmentation string is always UTF-8.
Name index (.debug_names)
Section 6.1.1.4 and 7.19 of the standard. The section holds a name index in eight parts, in this order: header, list of CUs, list of local type units (TUs), list of foreign TUs, hash lookup table (optional), name table, abbreviations table and entry pool.
| # | Header field | Type | Meaning |
|---|---|---|---|
| 1 | unit_length | initial length | Length of this contribution, not counting the field. |
| 2 | version | uhalf | 5; specific to the name index, independent of the DWARF version. |
| 3 | padding | uhalf | Reserved; zero. |
| 4 | comp_unit_count | uword | Number of entries in the CU list (at least 1). |
| 5 | local_type_unit_count | uword | Number of entries in the local TU list. |
| 6 | foreign_type_unit_count | uword | Number of entries in the foreign TU list. |
| 7 | bucket_count | uword | Number of hash buckets; 0 when there is no hash lookup table. |
| 8 | name_count | uword | Number of unique names. |
| 9 | abbrev_table_size | uword | Size in bytes of the abbreviations table. |
| 10 | augmentation_string_size | uword | Size of the augmentation string, rounded up to a multiple of 4. |
| 11 | augmentation_string | UTF-8 characters | Vendor-specific; begins with a 4-character vendor ID when present; padded with NULs to a multiple of 4 bytes. An unrecognised string does not stop a consumer reading the section; it only hints at how complete the index is. |
- List of CUs:
comp_unit_countoffsets into.debug_info, 4 bytes each in 32-bit DWARF and 8 in 64-bit. - List of local TUs:
local_type_unit_countoffsets into.debug_info, the same widths; may be empty. - List of foreign TUs:
foreign_type_unit_count8-byte type signatures (asDW_FORM_ref_sig8); may be empty. - Hash lookup table: optional; an array of
bucket_countbuckets followed by an array ofname_counthashes, all 4-byte unsigned. A name goes in the bucket numbered hash modulobucket_count(from 0). Each bucket holds the index, from 1, of the first matching entry in the hashes array, or 0 when empty. Names that share a bucket are consecutive in the hashes array; a search starts at the bucket’s entry and runs until a match or a hash from a different bucket, and continues past equal hashes whose name differs. Before hashing a name is folded with Unicode 9.0.0 simple case folding (the C and S mappings, with Turkish dotted capital I and dotless small i folded to Latin small i); the original spelling is kept in the name table. - Name table: two arrays, indexed from 1 and one-to-one: string offsets into
.debug_str(or.debug_str.dwo), then entry offsets relative to the start of the entry pool. The items are 4 bytes in 32-bit DWARF and 8 in 64-bit; each array hasname_countitems. With a hash table, the hashes array matches them one-to-one; without one, the names have no ordering requirement. - Abbreviations table: declarations, each an unsigned LEB128 code (never 0), an unsigned LEB128 tag, then pairs of an index attribute and a form (both unsigned LEB128), ended by a 0 attribute and 0 form. The table ends with a single 0 code byte; its size may include padding after it.
- Entry pool: for each name, a series of index entries, each an abbreviation code followed by the attributes that declaration lists, ended by an entry whose code is 0. The entries for one name are contiguous; gaps are allowed between series. The pool fills the rest of the unit.
| Index attribute | Value | Form or class | Meaning |
|---|---|---|---|
DW_IDX_compile_unit | 1 | constant | Index of the CU. |
DW_IDX_type_unit | 2 | constant | Index of the TU (local or foreign). |
DW_IDX_die_offset | 3 | reference | Offset of the DIE within its CU or TU. |
DW_IDX_parent | 4 | constant | Index of the name table entry for the parent. |
DW_IDX_type_hash | 5 | DW_FORM_data8 | Hash of the type declaration. |
DW_IDX_lo_user | 0x2000 | Start of the vendor range. | |
DW_IDX_hi_user | 0x3fff | End of the vendor range. |
The hash function is the “DJB” (Bernstein) hash: start with 5381 in a 32-bit
unsigned integer, and for each byte c of the (case-folded) name compute
hash = hash * 33 + c.
Sources
DWARF Debugging Information Format,
Version 5 (13 February 2017), text read with PDFKit: section 7.5.1 and table 7.2 (unit types), 7.5.2 and 7.5.3 (entries and
abbreviations), table 7.3 (tags), table 7.4 (children), table 7.5 (attributes and
classes), 7.5.5 and table 7.6 (classes and forms). Sections 2.5.1 and 2.6 and table
7.9 (operations), 7.8 to 7.20 and tables 7.11 to 7.24 (base types, enumerations,
languages, name index and defaulted values), 6.2.4 and 6.2.5 with tables 7.25 to 7.27
(line number program), 6.3 and table 7.28 (macros), and 6.4.2 with table 7.29 (call frame
instructions). Table 7.9 is garbled in the extracted text; the operation order and the
operand notes agree with section 2.5, and every code follows from the
running order. Also read: section 6.2.2 with tables 6.3 and 6.4 (line registers),
6.4.1 (CIE and FDE), 6.1.1.4 with table 6.1 (name index), 7.19 with table 7.23, 7.24
(CIE id and version) and 7.33 (hash). Not read: the examples in Appendix D. The note on GNU vendor attributes
is from LLVM’s BinaryFormat/Dwarf.def.