code wiki / (root) / nx_dwarf_abbrev.nx

nx_dwarf_abbrev.nx

buildroot/runtime/nx_dwarf_abbrev.nx

8118 B221 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tooltopic dwarf
docsdependenciesstructsconstsfunctions

about

nx_dwarf_abbrev.nx -- DWARF .debug_abbrev section builder. DWARF DIE entries don't carry their own attribute schemas; they reference an entry in .debug_abbrev that says "this DIE is tag T, has children Y/N, and its attributes appear in the order (name1, form1), (name2, form2), ...". Sharing one abbrev entry across many DIEs makes .debug_info compact. One abbrev declaration encodes: abbrev_code -- uleb128, the integer DIEs reference tag -- uleb128 (DW_TAG_*) has_children -- 1 byte: 0x00 = no, 0x01 = yes sequence of (name, form) uleb128 pairs, terminated by (0, 0) The whole .debug_abbrev section is a concatenation of such declarations, terminated by an abbrev_code of 0. We use nx_intern over (tag, has_children, attr_list_hash) to dedup -- two DIEs with the same shape get the same abbrev code. Common DW_TAG_* / DW_AT_* / DW_FORM_* constants exposed for use by the upcoming nx_dwarf_info.nx (DIE forest builder).

dependencies 1 imports · 0 importers

syscalls.nx nx_dwarf_abbrev.nx

imports: syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nx_dwabbrev_new nx_dwabbrev_begin nx_dwabbrev_uleb nx_dwabbrev_byte nx_dwabbrev_byte ↻ nx_dwabbrev_attr nx_dwabbrev_uleb ↻ nx_dwabbrev_end nx_dwabbrev_byte ↻ nx_dwabbrev_finish nx_dwabbrev_end ↻ nx_dwabbrev_byte ↻ nx_dwabbrev_size

structs

83struct NxDwAbbrev

consts

34const NX_DW_TAG_compile_unit: i64 = 0x11
35const NX_DW_TAG_subprogram: i64 = 0x2E
36const NX_DW_TAG_variable: i64 = 0x34
37const NX_DW_TAG_formal_parameter: i64 = 0x05
38const NX_DW_TAG_lexical_block: i64 = 0x0B
39const NX_DW_TAG_base_type: i64 = 0x24
40const NX_DW_TAG_pointer_type: i64 = 0x0F
41const NX_DW_TAG_array_type: i64 = 0x01
42const NX_DW_TAG_structure_type: i64 = 0x13
43const NX_DW_TAG_member: i64 = 0x0D
44const NX_DW_TAG_enumeration_type: i64 = 0x04
45const NX_DW_TAG_enumerator: i64 = 0x28
49const NX_DW_AT_name: i64 = 0x03
50const NX_DW_AT_byte_size: i64 = 0x0B
51const NX_DW_AT_low_pc: i64 = 0x11
52const NX_DW_AT_high_pc: i64 = 0x12
53const NX_DW_AT_language: i64 = 0x13
54const NX_DW_AT_comp_dir: i64 = 0x1B
55const NX_DW_AT_producer: i64 = 0x25
56const NX_DW_AT_prototyped: i64 = 0x27
57const NX_DW_AT_stmt_list: i64 = 0x10
58const NX_DW_AT_type: i64 = 0x49
59const NX_DW_AT_encoding: i64 = 0x3E
60const NX_DW_AT_external: i64 = 0x3F
61const NX_DW_AT_decl_file: i64 = 0x3A
62const NX_DW_AT_decl_line: i64 = 0x3B
66const NX_DW_FORM_addr: i64 = 0x01
67const NX_DW_FORM_data1: i64 = 0x0B
68const NX_DW_FORM_data2: i64 = 0x05
69const NX_DW_FORM_data4: i64 = 0x06
70const NX_DW_FORM_data8: i64 = 0x07
71const NX_DW_FORM_string: i64 = 0x08
72const NX_DW_FORM_strp: i64 = 0x0E
73const NX_DW_FORM_ref4: i64 = 0x13
74const NX_DW_FORM_ref8: i64 = 0x14
75const NX_DW_FORM_sec_offset: i64 = 0x17
76const NX_DW_FORM_flag: i64 = 0x0C
77const NX_DW_FORM_flag_present: i64 = 0x19
78const NX_DW_FORM_udata: i64 = 0x0F
79const NX_DW_FORM_sdata: i64 = 0x0D
91const NX_DW_ABBREV_BYTES: i64 = 40

functions

93func nx_dwabbrev_new(cap: i64) -> *NxDwAbbrev
called by 1: main
106func nx_dwabbrev_byte(a: *NxDwAbbrev, v: i64) -> i64
113func nx_dwabbrev_uleb(a: *NxDwAbbrev, v: i64) -> i64
132func nx_dwabbrev_begin(a: *NxDwAbbrev, tag: i64, has_children: i64) -> i64
143func nx_dwabbrev_attr(a: *NxDwAbbrev, name: i64, form: i64) -> i64
called by 1: main calls 1: nx_dwabbrev_uleb
151func nx_dwabbrev_end(a: *NxDwAbbrev) -> i64
161func nx_dwabbrev_finish(a: *NxDwAbbrev) -> i64
167func nx_dwabbrev_size(a: *NxDwAbbrev) -> i64 { return a.used }
called by 1: main
168func nx_dwabbrev_bytes(a: *NxDwAbbrev) -> *u8 { return a.buf }
172func main() -> i64