Ejemplo n.º 1
0
def control_dep_slice(tbdict, cfg):
    print "Calculating control dependencies..."

    start_ts = time.time()

    wlist = defaultdict(list)
    for c in cfg:
        if len(cfg[c]) < 2: continue
        for t in tbdict[c]:
            for i, isn in t.body:
                if is_jcc(isn.op) or is_dynjump(isn.op):
                    wlist[t.trace].append( (i, uses(isn)) )
                    isn.mark()
    wlist = dict(wlist)

    for trace in wlist:
        multislice(trace, wlist[trace])

    end_ts = time.time()
    print "Added branches in %s" % (datetime.timedelta(seconds=end_ts-start_ts))
Ejemplo n.º 2
0
 def get_branch(self):
     return [ins for _, ins in self.body if is_jcc(ins.op) or is_dynjump(ins.op)][0]
Ejemplo n.º 3
0
 def has_dynjump(self):
     return any(is_dynjump(ins.op) for _, ins in self.body)