def __init__(self, infile, cache=False, cfg_options=None, debugangr=False):
self.infile = infile
self.error = False
self._stack_patch_data = []
self.stack_increases = {}
if cfg_options is None:
cfg_options = {}
cachename = infile + '.fcfg'
l.info("Loading %s", infile)
try:
if not cache: raise IOError('fuck off')
fh = open(cachename, 'rb')
self.project, self.cfg = pickle.load(fh)
self.cfg.project = self.project
fh.close()
except (IOError, OSError, pickle.UnpicklingError):
if debugangr:
import ipdb; ipdb.set_trace()
self.project = Project(infile, load_options={'auto_load_libs': False})
self.cfg = self.project.analyses.CFGFast(**cfg_options)
try:
fh = open(cachename, 'wb')
pickle.dump((self.project, self.cfg), fh, -1)
fh.close()
except (IOError, OSError, pickle.PicklingError):
l.exception('Error pickling CFG')
评论列表
文章目录