nx_dwarf_loclists.nx
buildroot/runtime/nx_dwarf_loclists.nx
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
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
| 65 | struct NxDwLl |
consts
| 50 | const NX_DWLL_VERSION: i64 = 5 |
| 51 | const NX_DWLL_ADDR_SIZE: i64 = 8 |
| 52 | const NX_DWLL_SEG_SIZE: i64 = 0 |
| 55 | const NX_DW_LLE_END_OF_LIST: i64 = 0x00 |
| 56 | const NX_DW_LLE_BASE_ADDRESSX: i64 = 0x01 |
| 57 | const NX_DW_LLE_STARTX_ENDX: i64 = 0x02 |
| 58 | const NX_DW_LLE_STARTX_LENGTH: i64 = 0x03 |
| 59 | const NX_DW_LLE_OFFSET_PAIR: i64 = 0x04 |
| 60 | const NX_DW_LLE_DEFAULT_LOC: i64 = 0x05 |
| 61 | const NX_DW_LLE_BASE_ADDRESS: i64 = 0x06 |
| 62 | const NX_DW_LLE_START_END: i64 = 0x07 |
| 63 | const NX_DW_LLE_START_LENGTH: i64 = 0x08 |
| 73 | const NX_DWLL_BYTES: i64 = 40 |
functions
| 75 | func nx_dwll_new(cap: i64) -> *NxDwLl called by 1: main |
| 86 | func nx_dwll_byte(r: *NxDwLl, b: i64) -> i64 |
| 93 | func nx_dwll_u16(r: *NxDwLl, v: i64) -> i64 |
| 98 | func nx_dwll_u32(r: *NxDwLl, v: i64) -> i64 |
| 105 | func nx_dwll_u64(r: *NxDwLl, v: i64) -> i64 |
| 114 | func nx_dwll_uleb(r: *NxDwLl, v: i64) -> i64 |
| 130 | func nx_dwll_patch_u32(r: *NxDwLl, off: i64, v: i64) -> i64 |
| 140 | func nx_dwll_cu_begin(r: *NxDwLl, n_offset_entries: i64) -> i64 |
| 157 | func nx_dwll_patch_offset(r: *NxDwLl, idx: i64, list_off_in_cu: i64) -> i64 |
| 162 | func nx_dwll_list_offset(r: *NxDwLl, n_offset_entries: i64) -> i64 called by 1: main |
| 169 | func nx_dwll_start_length(r: *NxDwLl, start: i64, length: i64, expr_buf: *u8, expr_len: i64) -> i64 |
| 183 | func nx_dwll_default_location(r: *NxDwLl, expr_buf: *u8, expr_len: i64) -> i64 |
| 194 | func nx_dwll_end_list(r: *NxDwLl) -> i64 |
| 198 | func nx_dwll_cu_end(r: *NxDwLl) -> i64 |
| 208 | func main() -> i64 |