'Search for all call references or data access to a function/variable
Args:
- search: function or variable to search for (String)
- filename: binary/library to search (String)
Returns:
- list of tuple (address(Int), asm instruction(String))'

@memoized
def xrefs(self, search='', filename=None):

    result = []
    if (not filename):
        filename = self.getfile()
    if (not filename):
        return None
    vmap = self.get_vmmap(filename)
    elfbase = (vmap[0][0] if vmap else 0)
    if (to_int(search) is not None):
        search = ('%x' % to_int(search))
    search_data = 1
    if (search == ''):
        search_data = 0
    out = execute_external_command(("%s    -M    intel    -z    --prefix-address    -d    '%s'    |    grep    '%s'" % (config.OBJDUMP, filename, search)))
    for line in out.splitlines():
        if (not line):
            continue
        addr = to_int(('0x' + line.split()[0].strip()))
        if (not addr):
            continue
        if (addr < elfbase):
            addr += elfbase
        out = self.execute_redirect(('x/i    0x%x' % addr))
        if out:
            line = out
            p = re.compile('\\s*(0x[^    ]*).*?:\\s*([^    ]*)\\s*(.*)')
        else:
            p = re.compile('(.*?)\\s*<.*?>\\s*([^    ]*)\\s*(.*)')
        m = p.search(line)
        if m:
            (address, opcode, opers) = m.groups()
            if (('call' in opcode) and (search in opers)):
                result += [(addr, line.strip())]
            if search_data:
                if (('mov' in opcode) and (search in opers)):
                    result += [(addr, line.strip())]
    return result
