nx_dwarf_addr.nx
buildroot/runtime/nx_dwarf_addr.nx
about
nx_dwarf_addr.nx -- DWARF v5 .debug_addr builder.
Same indirection trick as .debug_str_offsets, applied to runtime
code addresses. DWARF v4 stored each address inline as 8 bytes
in DIE attributes (DW_FORM_addr). DWARF v5 introduces
DW_FORM_addrx -- a uleb128 index into a per-CU address table
living in .debug_addr.
Benefits:
- All link-time-relocated addresses concentrate in ONE section
(the linker only patches .debug_addr, never DIEs).
- DIEs become smaller and more compressible.
- Addresses can be deduplicated within a CU.
Per-CU layout (DWARF v5 7.27):
length u32 (excludes itself)
version u16 = 5
addr_size u8 = 8
segment_selector u8 = 0
addresses[] 8 bytes each (vaddr post-link)
Caller emits one CU contribution per .debug_info CU and writes
one u64 per address the CU references. DIE attributes use form
DW_FORM_addrx (uleb128 index).
Pairs with nx_dwarf_info (consumer) + nx_dwarf_str_offsets
(sister DWARF v5 indirection).
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
| 41 | struct NxDwAddr |
consts
| 37 | const NX_DWADDR_VERSION: i64 = 5 |
| 38 | const NX_DWADDR_ADDR_SIZE: i64 = 8 |
| 39 | const NX_DWADDR_SEG_SIZE: i64 = 0 |
| 49 | const NX_DWADDR_BYTES: i64 = 40 |
functions
| 51 | func nx_dwaddr_new(cap: i64) -> *NxDwAddr called by 1: main |
| 62 | func nx_dwaddr_byte(a: *NxDwAddr, b: i64) -> i64 |
| 69 | func nx_dwaddr_u16(a: *NxDwAddr, v: i64) -> i64 |
| 74 | func nx_dwaddr_u32(a: *NxDwAddr, v: i64) -> i64 |
| 81 | func nx_dwaddr_u64(a: *NxDwAddr, v: i64) -> i64 |
| 90 | func nx_dwaddr_patch_u32(a: *NxDwAddr, off: i64, v: i64) -> i64 called by 1: nx_dwaddr_cu_end |
| 99 | func nx_dwaddr_cu_begin(a: *NxDwAddr) -> i64 |
| 112 | func nx_dwaddr_add(a: *NxDwAddr, vaddr: i64) -> i64 |
| 122 | func nx_dwaddr_cu_base(a: *NxDwAddr) -> i64 called by 1: main |
| 128 | func nx_dwaddr_cu_end(a: *NxDwAddr) -> i64 |
| 138 | func main() -> i64 |