code wiki / (root) / nx_dwarf_loclists.nx

nx_dwarf_loclists.nx

buildroot/runtime/nx_dwarf_loclists.nx

7363 B247 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tooltopic dwarf
docsdependenciesstructsconstsfunctions

about

nx_dwarf_loclists.nx -- DWARF v5 .debug_loclists builder. Companion to nx_dwarf_loc (single location expression at a fixed PC). loclists describes a variable's location as a SEQUENCE of (PC range, location expression) pairs -- needed when an optimizer moves the variable across registers / spills it to the frame at different points in the function. Without loclists, gdb shows the variable's last-known location at every breakpoint, which is wrong inside the optimized function body. With loclists, gdb shows '<optimized out>' outside any covered range and the right register/offset inside. Per-CU layout (DWARF v5 7.7.3) -- mirrors nx_dwarf_rnglists: length u32 version u16 = 5 addr_size u8 = 8 segment_selector u8 = 0 offset_entry_count u32 offsets[count] u32 loc lists sequence of DW_LLE_* opcodes DW_LLE_* opcodes (subset we emit): end_of_list 0x00 base_addressx 0x01 startx_endx 0x02 startx_length 0x03 offset_pair 0x04 default_location 0x05 base_address 0x06 start_end 0x07 start_length 0x08 Each entry that includes a "location description" is followed by a uleb128 length and that many bytes of DW_OP_* expression (built via nx_dwarf_loc). Pairs with nx_dwarf_loc (location-expression bytes) + nx_dwarf_info (DIE attributes referencing loclists offsets) + nx_dwarf_rnglists (sister section).

dependencies 1 imports · 0 importers

syscalls.nx nx_dwarf_loclists.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_dwll_new nx_dwll_cu_begin nx_dwll_u32 nx_dwll_byte nx_dwll_u16 nx_dwll_byte ↻ nx_dwll_byte ↻ nx_dwll_list_offset nx_dwll_patch_offset nx_dwll_patch_u32 nx_dwll_start_length nx_dwll_byte ↻ nx_dwll_u64 nx_dwll_byte ↻ nx_dwll_uleb nx_dwll_byte ↻ nx_dwll_end_list nx_dwll_byte ↻ nx_dwll_cu_end nx_dwll_patch_u32 ↻

structs

65struct NxDwLl

consts

50const NX_DWLL_VERSION: i64 = 5
51const NX_DWLL_ADDR_SIZE: i64 = 8
52const NX_DWLL_SEG_SIZE: i64 = 0
55const NX_DW_LLE_END_OF_LIST: i64 = 0x00
56const NX_DW_LLE_BASE_ADDRESSX: i64 = 0x01
57const NX_DW_LLE_STARTX_ENDX: i64 = 0x02
58const NX_DW_LLE_STARTX_LENGTH: i64 = 0x03
59const NX_DW_LLE_OFFSET_PAIR: i64 = 0x04
60const NX_DW_LLE_DEFAULT_LOC: i64 = 0x05
61const NX_DW_LLE_BASE_ADDRESS: i64 = 0x06
62const NX_DW_LLE_START_END: i64 = 0x07
63const NX_DW_LLE_START_LENGTH: i64 = 0x08
73const NX_DWLL_BYTES: i64 = 40

functions

75func nx_dwll_new(cap: i64) -> *NxDwLl
called by 1: main
86func nx_dwll_byte(r: *NxDwLl, b: i64) -> i64
93func nx_dwll_u16(r: *NxDwLl, v: i64) -> i64
called by 1: nx_dwll_cu_begin calls 1: nx_dwll_byte
98func nx_dwll_u32(r: *NxDwLl, v: i64) -> i64
called by 1: nx_dwll_cu_begin calls 1: nx_dwll_byte
105func nx_dwll_u64(r: *NxDwLl, v: i64) -> i64
called by 1: nx_dwll_start_length calls 1: nx_dwll_byte
114func nx_dwll_uleb(r: *NxDwLl, v: i64) -> i64
130func nx_dwll_patch_u32(r: *NxDwLl, off: i64, v: i64) -> i64
140func nx_dwll_cu_begin(r: *NxDwLl, n_offset_entries: i64) -> i64
157func nx_dwll_patch_offset(r: *NxDwLl, idx: i64, list_off_in_cu: i64) -> i64
called by 1: main calls 1: nx_dwll_patch_u32
162func nx_dwll_list_offset(r: *NxDwLl, n_offset_entries: i64) -> i64
called by 1: main
169func nx_dwll_start_length(r: *NxDwLl, start: i64, length: i64, expr_buf: *u8, expr_len: i64) -> i64
183func nx_dwll_default_location(r: *NxDwLl, expr_buf: *u8, expr_len: i64) -> i64
194func nx_dwll_end_list(r: *NxDwLl) -> i64
called by 1: main calls 1: nx_dwll_byte
198func nx_dwll_cu_end(r: *NxDwLl) -> i64
called by 1: main calls 1: nx_dwll_patch_u32
208func main() -> i64