static bool die_has_pc()

in src/backward.h [1765:1795]


    static bool die_has_pc(Dwarf_Die* die, Dwarf_Addr pc)
    {
        Dwarf_Addr low, high;

        // continuous range
        if (dwarf_hasattr(die, DW_AT_low_pc) && dwarf_hasattr(die, DW_AT_high_pc)) {
            if (dwarf_lowpc(die, &low) != 0) {
                return false;
            }
            if (dwarf_highpc(die, &high) != 0) {
                Dwarf_Attribute attr_mem;
                Dwarf_Attribute* attr = dwarf_attr(die, DW_AT_high_pc, &attr_mem);
                Dwarf_Word value;
                if (dwarf_formudata(attr, &value) != 0) {
                    return false;
                }
                high = low + value;
            }
            return pc >= low && pc < high;
        }

        // non-continuous range.
        Dwarf_Addr base;
        ptrdiff_t offset = 0;
        while ((offset = dwarf_ranges(die, offset, &base, &low, &high)) > 0) {
            if (pc >= low && pc < high) {
                return true;
            }
        }
        return false;
    }