mardi 3 septembre 2019

Using Dyninst library to get operands, but unable to format it to a readable format [on hold]

I am a newbie, I am trying to get the operands in a binary using dyninst.

Using the following command:

    (*iter).getValue()

But the values I have got using the getvalue() in operand class is in hexadecimal and I am not able to format it to an readable format. If anybody has any idea on it, please let me know.

Reference: https://dyninst.org/sites/default/files/manuals/dyninst/instructionAPI.pdf

I have tried adding the .format(), .format(arch) and i also tried

taking the value, for example:

string byte = (*iter).getvalue()

byte.format()

but this also does not work.

Here' a snippet of my code:

std::vector<Operand> operands;
insn->getOperands(operands);

for(auto iter = operands.begin(); iter != operands.end(); ++iter) 
{
 cout << " Registers used for operand " << (* iter ). getValue ()<< endl ;
}

A full working code can also be found here: https://dyninst.org/sites/default/files/manuals/dyninst/instructionAPI.pdf

Page 20

i want a result like "eax" ,"ecx" so register names and I am getting hexadecimal values: 0x123543, 0x3142425

Aucun commentaire:

Enregistrer un commentaire