Tracing function calls

This commit is contained in:
Pierre Pronchery 2011-09-06 22:00:15 +00:00
parent 40805047c4
commit 1ed2fb51a1

View File

@ -368,12 +368,23 @@ static int _decode_operand(ArchPlugin * plugin, ArchInstructionCall * call,
static int _decode_postproc(ArchPlugin * plugin, ArchInstructionCall * call, static int _decode_postproc(ArchPlugin * plugin, ArchInstructionCall * call,
unsigned int opcode) unsigned int opcode)
{ {
ArchPluginHelper * helper = plugin->helper;
ArchOperand * ao;
AsmFunction * af;
switch(opcode) switch(opcode)
{ {
case 0xe8: /* call */ case 0xe8: /* call */
ao = &call->operands[0];
ao->value.immediate.value += call->base + 5;
af = helper->get_function_by_id(helper->arch,
ao->value.immediate.value);
if(af != NULL)
ao->value.immediate.name = af->name;
break;
case 0xe9: /* jump */ case 0xe9: /* jump */
call->operands[0].value.immediate.value += call->base ao = &call->operands[0];
+ 5; ao->value.immediate.value += call->base + 5;
break; break;
case 0x0f80: /* jo */ case 0x0f80: /* jo */
case 0x0f81: /* jno */ case 0x0f81: /* jno */
@ -391,12 +402,12 @@ static int _decode_postproc(ArchPlugin * plugin, ArchInstructionCall * call,
case 0x0f8d: /* jnl, jge */ case 0x0f8d: /* jnl, jge */
case 0x0f8e: /* jle, jng */ case 0x0f8e: /* jle, jng */
case 0x0f8f: /* jg, jnle */ case 0x0f8f: /* jg, jnle */
call->operands[0].value.immediate.value += call->base ao = &call->operands[0];
+ 6; ao->value.immediate.value += call->base + 6;
break; break;
case 0xeb: /* jump */ case 0xeb: /* jump */
call->operands[0].value.immediate.value += call->base ao = &call->operands[0];
+ 2; ao->value.immediate.value += call->base + 2;
break; break;
} }
return 0; return 0;