Esempio n. 1
0
def _process_offset(offset, ea, next_offset):
    """Process an offset in a __got section."""
    # Convert the address containing the offset into an offset in IDA, but continue if it fails.
    if not idc.OpOff(ea, 0, 0):
        _log(1, 'Could not convert {:#x} into an offset', ea)
    # Get the name to which the offset refers.
    name = idau.get_ea_name(offset, user=True)
    if not name:
        _log(3, 'Offset at address {:#x} has target {:#x} without a name', ea,
             offset)
        return False
    # Make sure this isn't an offset to another stub or to a jump function to another stub. See the
    # comment in _symbolicate_stub.
    if stub.symbol_references_stub(name):
        _log(
            1,
            'Offset at address {:#x} has target {:#x} (name {}) that references a stub',
            ea, offset, name)
        return False
    # Set the new name for the offset.
    symbol = next_offset(name)
    if symbol is None:
        _log(0, 'Could not generate offset symbol for {}: names exhausted',
             name)
        return False
    if not idau.set_ea_name(ea, symbol, auto=True):
        _log(2, 'Could not set name {} for offset at {:#x}', symbol, ea)
        return False
    return True
Esempio n. 2
0
def _bad_name_dont_use_as_override(name):
    """Some names shouldn't propagate into vtable symbols."""
    # Ignore jumps and stubs and fixed known special values.
    return (name.startswith('j_') or stub.symbol_references_stub(name)
            or name in _ignore_vtable_methods)