nx_dwarf_abbrev.nx
buildroot/runtime/nx_dwarf_abbrev.nx
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
imports: syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| 83 | struct NxDwAbbrev |
consts
| 34 | const NX_DW_TAG_compile_unit: i64 = 0x11 |
| 35 | const NX_DW_TAG_subprogram: i64 = 0x2E |
| 36 | const NX_DW_TAG_variable: i64 = 0x34 |
| 37 | const NX_DW_TAG_formal_parameter: i64 = 0x05 |
| 38 | const NX_DW_TAG_lexical_block: i64 = 0x0B |
| 39 | const NX_DW_TAG_base_type: i64 = 0x24 |
| 40 | const NX_DW_TAG_pointer_type: i64 = 0x0F |
| 41 | const NX_DW_TAG_array_type: i64 = 0x01 |
| 42 | const NX_DW_TAG_structure_type: i64 = 0x13 |
| 43 | const NX_DW_TAG_member: i64 = 0x0D |
| 44 | const NX_DW_TAG_enumeration_type: i64 = 0x04 |
| 45 | const NX_DW_TAG_enumerator: i64 = 0x28 |
| 49 | const NX_DW_AT_name: i64 = 0x03 |
| 50 | const NX_DW_AT_byte_size: i64 = 0x0B |
| 51 | const NX_DW_AT_low_pc: i64 = 0x11 |
| 52 | const NX_DW_AT_high_pc: i64 = 0x12 |
| 53 | const NX_DW_AT_language: i64 = 0x13 |
| 54 | const NX_DW_AT_comp_dir: i64 = 0x1B |
| 55 | const NX_DW_AT_producer: i64 = 0x25 |
| 56 | const NX_DW_AT_prototyped: i64 = 0x27 |
| 57 | const NX_DW_AT_stmt_list: i64 = 0x10 |
| 58 | const NX_DW_AT_type: i64 = 0x49 |
| 59 | const NX_DW_AT_encoding: i64 = 0x3E |
| 60 | const NX_DW_AT_external: i64 = 0x3F |
| 61 | const NX_DW_AT_decl_file: i64 = 0x3A |
| 62 | const NX_DW_AT_decl_line: i64 = 0x3B |
| 66 | const NX_DW_FORM_addr: i64 = 0x01 |
| 67 | const NX_DW_FORM_data1: i64 = 0x0B |
| 68 | const NX_DW_FORM_data2: i64 = 0x05 |
| 69 | const NX_DW_FORM_data4: i64 = 0x06 |
| 70 | const NX_DW_FORM_data8: i64 = 0x07 |
| 71 | const NX_DW_FORM_string: i64 = 0x08 |
| 72 | const NX_DW_FORM_strp: i64 = 0x0E |
| 73 | const NX_DW_FORM_ref4: i64 = 0x13 |
| 74 | const NX_DW_FORM_ref8: i64 = 0x14 |
| 75 | const NX_DW_FORM_sec_offset: i64 = 0x17 |
| 76 | const NX_DW_FORM_flag: i64 = 0x0C |
| 77 | const NX_DW_FORM_flag_present: i64 = 0x19 |
| 78 | const NX_DW_FORM_udata: i64 = 0x0F |
| 79 | const NX_DW_FORM_sdata: i64 = 0x0D |
| 91 | const NX_DW_ABBREV_BYTES: i64 = 40 |
functions
| 93 | func nx_dwabbrev_new(cap: i64) -> *NxDwAbbrev called by 1: main |
| 106 | func nx_dwabbrev_byte(a: *NxDwAbbrev, v: i64) -> i64 |
| 113 | func nx_dwabbrev_uleb(a: *NxDwAbbrev, v: i64) -> i64 |
| 132 | func nx_dwabbrev_begin(a: *NxDwAbbrev, tag: i64, has_children: i64) -> i64 |
| 143 | func nx_dwabbrev_attr(a: *NxDwAbbrev, name: i64, form: i64) -> i64 |
| 151 | func nx_dwabbrev_end(a: *NxDwAbbrev) -> i64 |
| 161 | func nx_dwabbrev_finish(a: *NxDwAbbrev) -> i64 |
| 167 | func nx_dwabbrev_size(a: *NxDwAbbrev) -> i64 { return a.used } called by 1: main |
| 168 | func nx_dwabbrev_bytes(a: *NxDwAbbrev) -> *u8 { return a.buf } |
| 172 | func main() -> i64 |