Skip to content

debuginfo: DWARF single-location variables (DW_FORM_exprloc + scopes) #1704

Description

@octalide

What

Emit DW_TAG_variable/DW_TAG_formal_parameter with DW_AT_location = DW_FORM_exprloc holding ONE expression (DW_OP_fbreg/breg for stack, DW_OP_reg* for register, DW_OP_addr for global) + DW_TAG_lexical_block scoping, read from the OP_DBG_VALUE entity. Register numbers come from #1693 (per-ISA). NO .debug_loclists yet. Shared, covers ELF + Mach-O on all ISAs.

Why

frame variable / info locals for variables that live in one place across their scope (the common case) — the first half of the variable-location capability, without loclists machinery. Frame-slot offsets are already in MirFunction.frame; the single final home is on MirVReg.assigned/spill_slot.

Acceptance

  • lldb/gdb frame variable shows correct values for stationary locals/params on a sample -g program, on x64/arm64/riscv64 where the prime applies (correct DWARF register numbers per ISA).
  • DW_OP_fbreg locations rely on the retained-frame-pointer invariant (no FP omission under -g).
  • llvm-dwarfdump --verify clean.

Depends-on: #1703, #1695, #1693.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:codegenIR/middle-end, isel, regalloc, frame, encoders, inline asmfeaturenew capability, or an extension of an existing one

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions