Date: | Fri, 10 Mar 2017 18:00:31 -0500 |
---|---|
From: | Sazzadur Rahaman <sazzad14@xxxxxx> |
Subject: | Re: [DynInst_API:] Static Taint Analysis using Dyninst |
Hi Xiaozhu, Thank you very much for your prompt reply! I fixed the problem you pointed out (Sorry, for the silly mistake). But now it shows that the type is unknown. Here is the code snippet.-------------- class ConstVisitor: public ASTVisitor { public:  virtual AST::Ptr visit(AST *ast) {  cout << "ast.." << (*ast).format() << endl;  return AST::Ptr();  };  virtual AST::Ptr visit(DataflowAPI::VariableAST *ast) {  cout << "yes.." << (*ast).format() << endl;  return AST::Ptr();  };  virtual AST::Ptr visit(DataflowAPI::RoseAST *ast) {  unsigned totalChildren = ast->numChildren();  for (unsigned i = 0; i < totalChildren; ++i) {  ast->child(i)->accept(this);  }  Â cout << "yes.rose." << (*ast).format() << endl;  return AST::Ptr();  }; }; int getInstruction(Block *b, int index, Instruction::Ptr *insn) {  auto iit = b->start();  while(index > 0) {  const unsigned char * buf =  (const unsigned char*) b->obj()->cs()->getPtrToInstruction(iit);  InstructionDecoder dec(buf,  InstructionDecoder::maxInstructionLength,  b->obj()->cs()->getArch());  *insn = dec.decode();  iit += (*insn)->size();  index--;  }  auto toreturn = iit - (*insn)->size();  return toreturn; } // Assume that block b in function f ends with an indirect jump. void taintAnalysis(Function *f, Block *b) {   // get the fifth instruction of the block  Instruction::Ptr insn;  auto insnPointer = getInstruction(b, 5, &insn);  // Convert the instruction to assignments  AssignmentConverter ac(true, true);  vector<Assignment::Ptr> assignments;  ac.convert(insn, insnPointer, f, b, assignments);  cout << insn->format() << endl;  cout << "number of assignments: " << assignments.size() << endl;  // Assignments can be multiple and we need to run slicer for all of them  for (auto ait = assignments.begin(); ait != assignments.end(); ++ait) {   const AbsRegion &out = (*ait)->out();  Assignment::Ptr assignment = *ait;   Slicer s(assignment, b, f);  cout << out.format().c_str() << endl;  cout << (out.type() == Absloc::Unknown) << endl;  Slicer::Predicates mp;  GraphPtr slice = s.forwardSlice(mp);  cout << slice << endl;   Result_t symRet;  SymEval::expand(slice, symRet);  AST::Ptr pcExp = symRet[assignment];  cout << "number of children of root AST node in sliced graph: " << pcExp->numChildren() << endl;  //just visits AST nodes and prints the formatted version of a node  ConstVisitor cv;  pcExp->accept(&cv);  } } -------------- ------ main  Block size:51 mov [RBP + fffffffffffffff8], a number of assignments: 1 [S[main,-24,0]] 1 0x203f7a0 number of children of root AST node in sliced graph: 0 ------------------- On Fri, Mar 10, 2017 at 5:17 PM, Xiaozhu Meng <xmeng@xxxxxxxxxxx> wrote:
|
[← Prev in Thread] | Current Thread | [Next in Thread→] |
---|---|---|
|
Previous by Date: | Re: [DynInst_API:] Static Taint Analysis using Dyninst, Xiaozhu Meng |
---|---|
Next by Date: | [DynInst_API:] [dyninst/dyninst], wrwilliams |
Previous by Thread: | Re: [DynInst_API:] Static Taint Analysis using Dyninst, Xiaozhu Meng |
Next by Thread: | Re: [DynInst_API:] Static Taint Analysis using Dyninst, Xiaozhu Meng |
Indexes: | [Date] [Thread] |