Skip to content
DwarfCfiBuildRow

DwarfCfiBuildRow

Description

Run the CIE’s initial instructions plus the FDE’s instructions up to (but not past) target_pc, producing the unwind row that applies at that PC.

Parameters

Name Direction Description
cfi in Parsed .eh_frame index.
fde in FDE covering target_pc (caller obtained via DwarfCfiFindFde).
target_pc in File-relative virtual address inside the FDE’s [pc_begin, pc_begin+pc_range) range.
out out Populated on success.

Success

Returns true. out->cfa.kind is set to a usable rule (typically REG_OFFSET on x86-64). out->regs[ra] tells the caller where to find the previous frame’s return address.

Failure

Returns false on malformed CFI bytecode, unsupported DW_CFA_*_expression instructions, or target_pc outside the FDE. out is left zeroed.

Usage example (Cross-references)

Usage examples (Cross-references)
            if (ok) {
                DwarfUnwindRow row;
                ok = DwarfCfiBuildRow(&cfi, fde, file_relative, &row);
                ok = ok && row.cfa.kind == DWARF_CFA_RULE_REG_OFFSET;
                ok = ok && row.regs[row.return_address_register].kind == DWARF_REG_RULE_OFFSET;
    
            DwarfUnwindRow row;
            if (!DwarfCfiBuildRow(cfi, fde, file_relative, &row))
                break;
    }
    
    bool DwarfCfiBuildRow(const DwarfCfi *cfi, const DwarfFde *fde, u64 target_pc, DwarfUnwindRow *out) {
        if (!cfi || !fde || !out)
            return false;
Last updated on