Exemple #1
0
//----------------------------------------------------------------------
// LookupAddress
//----------------------------------------------------------------------
DWARFDIE
DWARFDebugInfo::LookupAddress (const dw_addr_t address,
                               const dw_offset_t hint_die_offset)
{
    DWARFDIE die;
    DWARFCompileUnit *cu = nullptr;
    if (hint_die_offset != DW_INVALID_OFFSET)
    {
        cu = GetCompileUnit(hint_die_offset);
    }
    else
    {
        DWARFDebugAranges &cu_aranges = GetCompileUnitAranges ();
        const dw_offset_t cu_offset = cu_aranges.FindAddress (address);
        cu = GetCompileUnit(cu_offset);
    }

    if (cu)
    {
        die = cu->LookupAddress(address);
    }
    else
    {
        // The hint_die_offset may have been a pointer to the actual item that
        // we are looking for
        die = GetDIE(hint_die_offset);
        if (die)
        {
            DWARFDebugInfoEntry* function_die = nullptr;

            if (die.GetDIE()->LookupAddress (address, die.GetDWARF(), die.GetCU(), &function_die, nullptr))
                die.Set (die.GetCU(), function_die);
        }
    }
    return die;
}