def search(cls, **type):
"""Search through all of the names within the database and return the first result.
Please review the help for names.list for the definition of ``type``.
"""
query_s = ', '.join("{:s}={!r}".format(k,v) for k,v in type.iteritems())
res = __builtin__.list(cls.__iterate__(**type))
if len(res) > 1:
__builtin__.map(logging.info, (("[{:d}] {:x} {:s}".format(idx, idaapi.get_nlist_ea(idx), idaapi.get_nlist_name(idx))) for idx in res))
f1, f2 = idaapi.get_nlist_ea, idaapi.get_nlist_name
logging.warn("{:s}.search({:s}) : Found {:d} matching results, returning the first one. : {:x} {!r}".format('.'.join((__name__, cls.__name__)), query_s, len(res), f1(res[0]), f2(res[0])))
res = __builtin__.next(iter(res), None)
if res is None:
raise LookupError("{:s}.search({:s}) : Found 0 matching results.".format('.'.join((__name__, cls.__name__)), query_s))
return idaapi.get_nlist_ea(res)
评论列表
文章目录