Date: | Sun, 25 Nov 2012 22:55:48 +0000 |
---|---|
From: | Wei Ming Khoo <weimzz@xxxxxxxxx> |
Subject: | Re: [DynInst_API:] getType() for Expression/InstructionAPI? |
Brilliant, thanks. The visitor class also solved my problem of calculating jump and call targets. From what I observed, call targets don't seem to appear in block->getTargets(...). struct OperandTarget : public Dyninst::InstructionAPI::Visitor {
virtual void visit(Dyninst::InstructionAPI::BinaryFunction *) {}; virtual void visit(Dyninst::InstructionAPI::Dereference *) {} virtual void visit(Dyninst::InstructionAPI::Immediate *i) {
switch( i->eval().type ){ case s8: target += i->eval().val.s8val; break; case u8: target += i->eval().val.u8val; break; case s16: target += i->eval().val.s16val; break;
case u16: target += i->eval().val.u16val; break; case s32: target += i->eval().val.s32val; break; case u32: target += i->eval().val.u32val; break; }
} virtual void visit(Dyninst::InstructionAPI::RegisterAST *) {} OperandTarget(unsigned long eip) : target(eip) {}; unsigned long target; }; unsigned long getTarget( _expression_::Ptr expr, unsigned long eip ){ OperandTarget o(eip); expr->apply(&o); return o.target; } Regards,
--wm On Sun, Nov 25, 2012 at 1:59 AM, Andrew Bernat <bernat@xxxxxxxxxxx> wrote:
|
[← Prev in Thread] | Current Thread | [Next in Thread→] |
---|---|---|
|
Previous by Date: | Re: [DynInst_API:] getType() for Expression/InstructionAPI?, Andrew Bernat |
---|---|
Next by Date: | Re: [DynInst_API:] getType() for Expression/InstructionAPI?, Andrew Bernat |
Previous by Thread: | Re: [DynInst_API:] getType() for Expression/InstructionAPI?, Andrew Bernat |
Next by Thread: | Re: [DynInst_API:] getType() for Expression/InstructionAPI?, Andrew Bernat |
Indexes: | [Date] [Thread] |