Date: | Sat, 24 Nov 2012 12:46:06 +0000 |
---|---|
From: | Wei Ming Khoo <weimzz@xxxxxxxxx> |
Subject: | [DynInst_API:] getType() for Expression/InstructionAPI? |
Hi, I'm trying to extract 4 pieces of information from a disassembly (assume 32bit x86 for now): mnemonic, number of operands, operand (register, memory reference, immediate value), and operation width (8/16/32 bit).
I got as far as Instruction::Ptr insn; ... Operation operation = insn->getOperation(); std::vector<Operand> operands;
insn->getOperands(operands); for (int i=0; i<operands.size(); i++){ _expression_::Ptr expr; expr = insn->getOperand(i).getValue();
std::vector<_expression_::Ptr> children; expr->getChildren(children); printf("%s %d ", expr->format().c_str(), children.size() ); } Here's where I got stuck. How do I distinguish between a register, memory reference and an immediate? An ugly hack would be look at the expr->format().c_str() string to decide, but I was wondering if there was a more elegant way to do this?
Regards, --wm
|
[← Prev in Thread] | Current Thread | [Next in Thread→] |
---|---|---|
|
Previous by Date: | Re: [DynInst_API:] undefined reference to `dlopen' error during parseThat build, Andrew Bernat |
---|---|
Next by Date: | [DynInst_API:] [dynC_API], 郭维超 |
Previous by Thread: | [DynInst_API:] dyninst_proccontrol branch not building on i686 fedora 17, William Cohen |
Next by Thread: | Re: [DynInst_API:] getType() for Expression/InstructionAPI?, Andrew Bernat |
Indexes: | [Date] [Thread] |