code wiki / (root) / nx_dwarf_str.nx

nx_dwarf_str.nx

buildroot/runtime/nx_dwarf_str.nx

5330 B148 linesdepth 5pulls 5 transitivereach 0 importersview sourcekind tooltopic dwarf
docsdependenciesstructsconstsfunctions

about

nx_dwarf_str.nx -- DWARF .debug_str + .debug_line_str builder. DWARF stores its strings in dedicated sections (.debug_str / .debug_line_str) so DIE entries (.debug_info) and line-program file names (.debug_line) can reference them by 4- or 8-byte offset instead of inlining bytes. Crucial for keeping debug info compact when many DIEs share names ("int", "char *", function names, etc.). API matches nx_strtab but with two ergonomic differences: * Dedup via nx_intern on the input bytes. Same input string always returns the same offset, so DIE-side references hash-cons cleanly. * `intern_at_in_pool` returns the OFFSET (the value DWARF wants), not a *u8. Pairs with nx_dwarf_line.nx (file-name strings) and the forthcoming nx_dwarf_info.nx (DIE attribute strings).

dependencies 2 imports · 0 importers

syscalls.nx nx_intern.nx nx_dwarf_str.nx

imports: syscalls.nxnx_intern.nx

imported by: nobody (leaf or entry point)

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

main nx_dwstr_new nx_intern_new nx_intern_next_pow2 nx_hash_new nx_dwstr_size nx_dwstr_get nx_intern_get nx_hash_fnv1a_bytes nx_hash_get nx_hash_probe nx_hash_fnv1a_i64 nx_intern_bytes_eq nx_hash_put nx_hash_probe ↻ nx_intern_count nx_dwstr_at nx_dwstr_get_cstr nx_dwstr_get ↻

structs

32struct NxDwStr

consts

30const NX_MAGIC_1024: i64 = 1024
39const NX_DWSTR_BYTES: i64 = 32

functions

41func nx_dwstr_new(bytes_cap: i64, ids_cap: i64) -> *NxDwStr
called by 1: main calls 1: nx_intern_new
54func nx_dwstr_get(s: *NxDwStr, bytes: *u8, len: i64) -> i64
91func nx_dwstr_get_cstr(s: *NxDwStr, str: *u8) -> i64
called by 1: main calls 1: nx_dwstr_get
99func nx_dwstr_size(s: *NxDwStr) -> i64 { return s.flat_used }
called by 1: main
100func nx_dwstr_bytes(s: *NxDwStr) -> *u8 { return s.flat }
103func nx_dwstr_at(s: *NxDwStr, offset: i64) -> *u8
called by 1: main
110func main() -> i64