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"; } } } }
void visit(SgNode *node) { SgAsmBlock *block = isSgAsmBlock(node); if (block && block->has_instructions()) { using namespace BinaryAnalysis::InstructionSemantics; typedef SymbolicSemantics::Policy<SymbolicSemantics::State, SymbolicSemantics::ValueType> Policy; typedef X86InstructionSemantics<Policy, SymbolicSemantics::ValueType> Semantics; Policy policy(NULL/*no SMT solver*/); Semantics semantics(policy); 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"; semantics.processInstruction(insn); std::cout <<policy; } } } }