def _setup_core_modules(self): """Set up core modules. """ self.ir_emulator = None self.smt_solver = None self.smt_translator = None if self.arch_info: self.ir_emulator = ReilEmulator(self.arch_info.address_size) if SMT_SOLVER == "Z3": self.smt_solver = Z3Solver() elif SMT_SOLVER == "CVC4": self.smt_solver = CVC4Solver() else: raise Exception("Invalid SMT solver.") self.smt_translator = SmtTranslator(self.smt_solver, self.arch_info.address_size) self.ir_emulator.set_arch_registers( self.arch_info.registers_gp_all) self.ir_emulator.set_arch_registers_size( self.arch_info.registers_size) self.ir_emulator.set_reg_access_mapper(self.arch_info.alias_mapper) self.smt_translator.set_reg_access_mapper( self.arch_info.alias_mapper) self.smt_translator.set_arch_registers_size( self.arch_info.registers_size)
def _setup_core_modules(self): """Set up core modules. """ self.ir_emulator = None self.smt_solver = None self.smt_translator = None if self.arch_info: # Set REIL emulator. self.ir_emulator = ReilEmulator(self.arch_info) # Set SMT Solver. self.smt_solver = None if SMT_SOLVER == "Z3": if _check_solver_installation("z3"): self.smt_solver = Z3Solver() else: logger.warn( "z3 solver is not installed. Run 'barf-install-solvers.sh' to install it." ) elif SMT_SOLVER == "CVC4": if _check_solver_installation("cvc4"): self.smt_solver = CVC4Solver() else: logger.warn( "cvc4 solver is not installed. Run 'barf-install-solvers.sh' to install it." ) elif SMT_SOLVER is not None: raise Exception("Invalid SMT solver.") # Set SMT translator. self.smt_translator = None if self.smt_solver: self.smt_translator = SmtTranslator( self.smt_solver, self.arch_info.address_size) self.smt_translator.set_arch_alias_mapper( self.arch_info.alias_mapper) self.smt_translator.set_arch_registers_size( self.arch_info.registers_size)