def whichBranch(self, branch, cond_expr): """ To be called from the process being executed, this function acts as instrumentation. branch can be either True or False, according to the branch taken after the last conditional jump. """ if not (isinstance(cond_expr,SymbolicType)): return # add both possible predicate outcomes to constraint (tree) p = Predicate(cond_expr, branch) p.negate() cneg = self.current_constraint.findChild(p) p.negate() c = self.current_constraint.findChild(p) if c is None: c = self.current_constraint.addChild(p) # Important: we are adding the new constraint # to the queue of the engine for later processing log.debug("New constraint: %s" % c) self.engine.addConstraint(c) if cneg is not None: # We've already processed both cneg.processed = True c.processed = True log.debug("Processed constraint: %s" % c) self.current_constraint = c
def whichBranch(self, branch, cond_expr): """ To be called from the process being executed, this function acts as instrumentation. branch can be either True or False, according to the branch taken after the last conditional jump. """ if not (isinstance(cond_expr, SymbolicType)): return # add both possible predicate outcomes to constraint (tree) p = Predicate(cond_expr, branch) p.negate() cneg = self.current_constraint.findChild(p) p.negate() c = self.current_constraint.findChild(p) if c is None: c = self.current_constraint.addChild(p) # Important: we are adding the new constraint # to the queue of the engine for later processing log.debug("New constraint: %s" % c) self.engine.addConstraint(c) if cneg is not None: # We've already processed both cneg.processed = True c.processed = True log.debug("Processed constraint: %s" % c) self.current_constraint = c
def whichBranch(self, branch, cond_expr): """ To be called from the process being executed, this function acts as instrumentation. branch can be either True or False, according to the branch taken after the last conditional jump. """ if not (isinstance(cond_expr, SymbolicType)): return if self.engine.cutting: stats.pushProfile("subsumption checking") # Important: this call may jump out of this function (and the # whole execution) by throwing an EndExecutionThrowable self.tryCut() stats.popProfile() # add both possible predicate outcomes to constraint (tree) p = Predicate(cond_expr, branch) p.negate() cneg = self.current_constraint.findChild(p) p.negate() c = self.current_constraint.findChild(p) if c is None: c = self.current_constraint.addChild(p) # Important: we are adding the new constraint # to the queue of the engine for later processing log.debug("New constraint: %s" % c) self.engine.addConstraint(c) if cneg is not None: # We've already processed both cneg.processed = True c.processed = True log.debug("Processed constraint: %s" % c) self.current_constraint = c if not self.engine.selected or self.engine.selected is cneg: self.target_reached = True
def whichBranch(self, branch, cond_expr): """ To be called from the process being executed, this function acts as instrumentation. branch can be either True or False, according to the branch taken after the last conditional jump. """ if not (isinstance(cond_expr,SymbolicType)): return if self.engine.cutting: stats.pushProfile("subsumption checking") # Important: this call may jump out of this function (and the # whole execution) by throwing an EndExecutionThrowable self.tryCut() stats.popProfile() # add both possible predicate outcomes to constraint (tree) p = Predicate(cond_expr, branch) p.negate() cneg = self.current_constraint.findChild(p) p.negate() c = self.current_constraint.findChild(p) if c is None: c = self.current_constraint.addChild(p) # Important: we are adding the new constraint # to the queue of the engine for later processing log.debug("New constraint: %s" % c) self.engine.addConstraint(c) if cneg is not None: # We've already processed both cneg.processed = True c.processed = True log.debug("Processed constraint: %s" % c) self.current_constraint = c if not self.engine.selected or self.engine.selected is cneg: self.target_reached = True
def addBranchAfterJump(self, stmt, result): if not stmt.isSymbolic(): return p = Predicate(stmt, result) p.negate() cneg = self.current_constraint.findChild(p) p.negate() c = self.current_constraint.findChild(p) if c is None: c = self.current_constraint.addChild(p) self.engine.addConstraint(c) # Do we have (accidentally) negated some constraint? # If yes, we can mark both as negated if cneg is not None: cneg.negated = True c.negated = True log.debug("Negated constraint: %s" % c) else: log.debug("New constraint: %s" % c) self.current_constraint = c