Exemple #1
0
static void callbackBefore(IRBuilder *irb, CONTEXT *ctx, BOOL hasEA, ADDRINT ea, THREADID threadId)
{
    /* Some configurations must be applied before processing */
    processingPyConf.applyConfBeforeProcessing(irb);

    if (!analysisTrigger.getState())
        /* Analysis locked */
        return;

    if (hasEA)
        irb->setup(ea);

    /* Update the current context handler */
    ap.updateCurrentCtxH(new PINContextHandler(ctx, threadId));

    /* Setup Information into Irb */
    irb->setThreadID(ap.getThreadID());

    /* Python callback before IR processing */
    processingPyConf.callbackBeforeIRProc(irb, &ap);

    Inst *inst = irb->process(ap);
    ap.addInstructionToTrace(inst);

    /* Export some information from Irb to Inst */
    inst->setOpcode(irb->getOpcode());
    inst->setOpcodeCategory(irb->getOpcodeCategory());
    inst->setOperands(irb->getOperands());

    /* Python callback before instruction processing */
    processingPyConf.callbackBefore(inst, &ap);
}
Exemple #2
0
/* Callback at the syscall exit */
static void callbackSyscallExit(THREADID threadId, CONTEXT *ctx, SYSCALL_STANDARD std, VOID *v)
{
    if (!analysisTrigger.getState())
        /* Analysis locked */
        return;

    /* Update the current context handler */
    ap.updateCurrentCtxH(new PINContextHandler(ctx, threadId));

    /* Python callback at the end of execution */
    processingPyConf.callbackSyscallExit(threadId, std);
}
Exemple #3
0
static void callbackAfter(CONTEXT *ctx, THREADID threadId)
{
    Inst *inst;

    if (!analysisTrigger.getState())
        /* Analysis locked */
        return;

    /* Update the current context handler */
    ap.updateCurrentCtxH(new PINContextHandler(ctx, threadId));

    /* Get the last instruction */
    inst = ap.getLastInstruction();

    /* Update statistics */
    ap.incNumberOfBranchesTaken(inst->isBranch());

    /* Python callback after instruction processing */
    processingPyConf.callbackAfter(inst, &ap);
}