def find_best_instruction(addr, cpu_name, meta=None):
    """Given an instruction and meta information this attempts to find
    the best instruction for the frame.  In some circumstances we can
    fix it up a bit to improve the accuracy.  For more information see
    `symbolize_frame`.
    """
    addr = rv = parse_addr(addr)

    # In case we're not on the crashing frame we apply a simple heuristic:
    # since we're most likely dealing with return addresses we just assume
    # that the call is one instruction behind the current one.
    if not meta or meta.get('frame_number') != 0:
        rv = get_previous_instruction(addr, cpu_name)

    # In case registers are available we can check if the PC register
    # does not match the given address we have from the first frame.
    # If that is the case and we got one of a few signals taht are likely
    # it seems that going with one instruction back is actually the
    # correct thing to do.
    else:
        regs = meta.get('registers')
        ip = get_ip_register(regs, cpu_name)
        if ip is not None and ip != addr and \
           meta.get('signal') in (SIGILL, SIGBUS, SIGSEGV):
            rv = get_previous_instruction(addr, cpu_name)

    # Don't ask me why we do this, but apparently on arm we get better
    # hits if we look at the end of an instruction in the DWARF file than
    # the beginning.
    return round_to_instruction_end(rv, cpu_name)
def find_best_instruction ( addr , cpu_name , meta = None ) : addr = rv = parse_addr ( addr ) if not meta or meta . get ( 'frame_number' ) != 0 : rv = get_previous_instruction ( addr , cpu_name ) else : regs = meta . get ( 'registers' ) ip = get_ip_register ( regs , cpu_name ) if ip is not None and ip != addr and meta . get ( 'signal' ) in ( SIGILL , SIGBUS , SIGSEGV ) : rv = get_previous_instruction ( addr , cpu_name ) return round_to_instruction_end ( rv , cpu_name )
Given an instruction and meta information this attempts to find
    the best instruction for the frame.  In some circumstances we can
    fix it up a bit to improve the accuracy.  For more information see
    `symbolize_frame`.