def clearParseActions(self): HEXNUM.setParseAction(lambda x: x) REGISTER.setParseAction(lambda x: x) CONNECTIVE.setParseAction(lambda x: x) EQ_SYMBOL.setParseAction(lambda x: x) MEMREF.setParseAction(lambda x: x) RELATION.setParseAction(lambda x: x) FORMULA.setParseAction(lambda x: x)
def setupParseActions(self): HEXNUM.setParseAction(self.createConstExpr) REGISTER.setParseAction(self.getRegisterExpr) CONNECTIVE.setParseAction(self.createNewLogicExpr) EQ_SYMBOL.setParseAction(self.createEqSymbol) MEMREF.setParseAction(self.createNewMemref) RELATION.setParseAction(self.createNewRelation) FORMULA.setParseAction(self.createNewFormula)
def clearParseActions(self): HEXNUM.setParseAction(lambda x:x) REGISTER.setParseAction(lambda x:x) CONNECTIVE.setParseAction(lambda x:x) EQ_SYMBOL.setParseAction(lambda x:x) MEMREF.setParseAction(lambda x:x) RELATION.setParseAction(lambda x:x) FORMULA.setParseAction(lambda x:x)
def add_debug_actions(self): HEXNUM.addParseAction(lambda x: self.debugLog("Hexnum %s" % str(x))) REGISTER.addParseAction( lambda x: self.debugLog("Register %s" % str(x))) CONNECTIVE.addParseAction( lambda x: self.debugLog("Connective %s" % str(x))) EQ_SYMBOL.addParseAction( lambda x: self.debugLog("Eqsymbol %s" % str(x))) MEMREF.addParseAction(lambda x: self.debugLog("Memref %s" % str(x))) RELATION.addParseAction( lambda x: self.debugLog("Relation %s" % str(x))) FORMULA.addParseAction(lambda x: self.debugLog("Formula %s" % str(x)))
def enableDebug(self, verbose=False): self.debug_mode = True if verbose: HEXNUM.setDebug() REGISTER.setDebug() CONNECTIVE.setDebug() EQ_SYMBOL.setDebug() MEMREF.setDebug() RELATION.setDebug() FORMULA.setDebug() self.add_debug_actions()
def add_debug_actions(self): HEXNUM.addParseAction(lambda x:self.debugLog( "Hexnum %s" % str(x))) REGISTER.addParseAction(lambda x:self.debugLog( "Register %s" % str(x))) CONNECTIVE.addParseAction(lambda x:self.debugLog( "Connective %s" % str(x))) EQ_SYMBOL.addParseAction(lambda x:self.debugLog( "Eqsymbol %s" % str(x))) MEMREF.addParseAction(lambda x:self.debugLog( "Memref %s" % str(x))) RELATION.addParseAction(lambda x:self.debugLog( "Relation %s" % str(x))) FORMULA.addParseAction(lambda x:self.debugLog( "Formula %s" % str(x)))
def testMEMREF(self): MEMREF.parseString('[EAX]') MEMREF.parseString('[[EAX]]') MEMREF.parseString('[[EAX+4]]') MEMREF.parseString('[[EAX+EBX]]') MEMREF.parseString('[0x50+4]') MEMREF.parseString('[0x50]')