static BaseSemantics::RiscOperatorsPtr make_ops() { SymbolicSemantics::RiscOperatorsPtr retval = SymbolicSemantics::RiscOperators::instance(regdict); retval->computingDefiners(do_usedef ? SymbolicSemantics::TRACK_ALL_DEFINERS : SymbolicSemantics::TRACK_NO_DEFINERS); TestSemantics<SymbolicSemantics::SValuePtr, BaseSemantics::RegisterStateGenericPtr, SymbolicSemantics::MemoryStatePtr, BaseSemantics::StatePtr, SymbolicSemantics::RiscOperatorsPtr> tester; tester.test(retval); return retval; }
void visit(SgNode *node) { SgAsmBlock *block = isSgAsmBlock(node); if (block && block->has_instructions()) { using namespace rose::BinaryAnalysis::InstructionSemantics2; const RegisterDictionary *regdict = RegisterDictionary::dictionary_i386(); SymbolicSemantics::RiscOperatorsPtr ops = SymbolicSemantics::RiscOperators::instance(regdict); ops->computingDefiners(SymbolicSemantics::TRACK_ALL_DEFINERS); // only used so we can test that it works BaseSemantics::DispatcherPtr dispatcher = DispatcherX86::instance(ops, 32); const SgAsmStatementPtrList &stmts = block->get_statementList(); for (SgAsmStatementPtrList::const_iterator si=stmts.begin(); si!=stmts.end(); ++si) { SgAsmX86Instruction *insn = isSgAsmX86Instruction(*si); if (insn) { std::cout <<unparseInstructionWithAddress(insn) <<"\n"; dispatcher->processInstruction(insn); std::cout <<*ops <<"\n"; } } } }
NoOperation::NoOperation(Disassembler *disassembler) { normalizer_ = StateNormalizer::instance(); if (disassembler) { const RegisterDictionary *registerDictionary = disassembler->get_registers(); ASSERT_not_null(registerDictionary); size_t addrWidth = disassembler->instructionPointerRegister().get_nbits(); SMTSolver *solver = NULL; SymbolicSemantics::RiscOperatorsPtr ops = SymbolicSemantics::RiscOperators::instance(registerDictionary, solver); ops->computingDefiners(SymbolicSemantics::TRACK_NO_DEFINERS); ops->computingMemoryWriters(SymbolicSemantics::TRACK_LATEST_WRITER); // necessary to erase non-written memory BaseSemantics::MemoryCellListPtr mstate = BaseSemantics::MemoryCellList::promote(ops->currentState()->memoryState()); ASSERT_not_null(mstate); mstate->occlusionsErased(true); cpu_ = disassembler->dispatcher()->create(ops, addrWidth, registerDictionary); } }