本文整理汇总了C++中IRStmt_Dirty函数的典型用法代码示例。如果您正苦于以下问题:C++ IRStmt_Dirty函数的具体用法?C++ IRStmt_Dirty怎么用?C++ IRStmt_Dirty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IRStmt_Dirty函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: instrument_Triop
/* instruments a Binary Operation Expression in a Ist_WrTmp statement */
static void instrument_Triop(IRSB* sb, IRStmt* st, Addr64 cia) {
Char thisFct[]="instrument_Triop";
IRDirty* di;
IRExpr** argv;
IRExpr *op = st->Ist.WrTmp.data;
IRExpr* oa_event_expr;
IROp irop=op->Iex.Triop.details->op;
void* f=callbackFromIROp(irop);
if (f == NULL) return;
OA_InstrumentContext inscon=contextFor(cia, irop);
if (not_worth_watching(inscon))
return; // filter events that can't be attached to source-code location
updateStats(inscon->op);
oa_event_expr = mkIRExpr_HWord( (HWord)inscon );
IRExpr * args1[2];
packToI32orI64(sb, op->Iex.Triop.details->arg2, args1, irop);
IRExpr * args2[2];
packToI32orI64(sb, op->Iex.Triop.details->arg3, args2, irop);
argv = mkIRExprVec_3(args1[0], args2[0], oa_event_expr);
di = unsafeIRDirty_0_N( 3, thisFct, VG_(fnptr_to_fnentry)( f ), argv);
addStmtToIRSB( sb, IRStmt_Dirty(di) );
if (args1[1] != NULL) {
// we need a second callback for 64bit types
argv = mkIRExprVec_3(args1[1], args2[1], oa_event_expr);
di = unsafeIRDirty_0_N( 3, thisFct, VG_(fnptr_to_fnentry)( f ), argv);
addStmtToIRSB( sb, IRStmt_Dirty(di) );
}
}
示例2: instrument_WrTmp_Mux0X
void instrument_WrTmp_Mux0X(IRStmt* st, IRSB* sb_out)
{
IRTemp tmp = st->Ist.WrTmp.tmp;
IRExpr* data = st->Ist.WrTmp.data;
IRExpr* cond = data->Iex.Mux0X.cond;
IRExpr* expr0 = data->Iex.Mux0X.expr0;
IRExpr* exprX = data->Iex.Mux0X.exprX;
Int size = sizeofIRType_bits(typeOfIRExpr(sb_out->tyenv, expr0));
IRDirty* di;
tl_assert(cond->tag == Iex_RdTmp);
tl_assert(isIRAtom(expr0));
tl_assert(isIRAtom(exprX));
tl_assert(typeOfIRTemp(sb_out->tyenv, tmp) == typeOfIRExpr(sb_out->tyenv, expr0));
tl_assert(typeOfIRTemp(sb_out->tyenv, tmp) == typeOfIRExpr(sb_out->tyenv, exprX));
di = unsafeIRDirty_0_N(0,
"helper_instrument_WrTmp_Mux0X",
VG_(fnptr_to_fnentry)(helper_instrument_WrTmp_Mux0X),
mkIRExprVec_5(mkIRExpr_HWord(tmp),
assignNew_HWord(sb_out, cond),
mkIRExpr_HWord((expr0->tag == Iex_RdTmp) ? expr0->Iex.RdTmp.tmp : IRTemp_INVALID),
mkIRExpr_HWord((exprX->tag == Iex_RdTmp) ? exprX->Iex.RdTmp.tmp : IRTemp_INVALID),
mkIRExpr_HWord(size))
);
addStmtToIRSB(sb_out, IRStmt_Dirty(di));
}
示例3: AddOpRhsTypeHelper
void AddOpRhsTypeHelper(IRSB* sb, IRExpr* arg, IntTyStateHint hint, Addr addr)
{
IRDirty * d;
HWord tmpname;
switch (arg->tag)
{
case(Iex_RdTmp):
tmpname = (HWord)arg->Iex.RdTmp.tmp;
d = unsafeIRDirty_0_N(0, "EmitTmpHelper",
&EmitTmpHelper,
mkIRExprVec_4(
mkIRExpr_HWord(tmpname),
mkIRExpr_HWord(hint),
mkIRExpr_HWord(counter),
mkIRExpr_HWord(addr)
)
);
setHelperAnns(d);
addStmtToIRSB(sb,IRStmt_Dirty(d));
break;
default:
break;
}
return;
}
示例4: VG_
static void VG_(add_stmt_call_invalidate_if_not_gdbserved)
( IRSB* sb_in,
VexGuestLayout* layout,
VexGuestExtents* vge,
IRTemp jmp,
IRSB* irsb)
{
void* fn;
const HChar* nm;
IRExpr** args;
Int nargs;
IRDirty* di;
fn = &VG_(helperc_invalidate_if_not_gdbserved);
nm = "VG_(helperc_invalidate_if_not_gdbserved)";
args = mkIRExprVec_1(IRExpr_RdTmp (jmp));
nargs = 1;
di = unsafeIRDirty_0_N( nargs/*regparms*/, nm,
VG_(fnptr_to_fnentry)( fn ), args );
di->nFxState = 0;
addStmtToIRSB(irsb, IRStmt_Dirty(di));
}
示例5: AddStoreHelper
void AddStoreHelper(IRSB* sb, IRExpr* addr, IRExpr* data)
{
IRDirty* d;
HWord tmpname;
switch (addr->tag)
{
case (Iex_RdTmp):
switch (data->tag)
{
case (Iex_RdTmp):
tmpname = (HWord) data->Iex.RdTmp.tmp;
d = unsafeIRDirty_0_N(0,
"EmitStoreAddr2TmpHelper",
&EmitStoreAddr2TmpHelper,
mkIRExprVec_3(addr,
mkIRExpr_HWord(tmpname),
mkIRExpr_HWord(counter)
)
);
setHelperAnns(d);
addStmtToIRSB(sb, IRStmt_Dirty(d));
break;
case (Iex_Const):
/* add code to emit new tyvar for memory address */
d = unsafeIRDirty_0_N(0,
"EmitStoreAddr2ConstHelper",
&EmitStoreAddr2ConstHelper,
mkIRExprVec_1(addr
)
);
setHelperAnns(d);
addStmtToIRSB(sb,IRStmt_Dirty(d));
break;
default:
/* Should not reach here. */
ppIRExpr(data);
vpanic("Bad store address!\n");
break;
}
break;
default:
break;
}
return;
}
示例6: cond
/*
cc_op
add/sub/mul
adc/sbb
shl/Shl/sar
tmp = cond(cc_op(cc_dep1, cc_dep2))
and/or/xor
inc/dec
rol/ror
tmp = cond(cc_op(cc_dep1, 0))
The taintness of tmp depends on taintness of both args. (we can't handle and(cc_dep1, 0) which gives an untainted result)
cf. valgrind guest_x86_defs.h
*/
void instrument_WrTmp_CCall(IRStmt* st, IRSB* sb_out)
{
IRTemp tmp = st->Ist.WrTmp.tmp;
IRExpr* data = st->Ist.WrTmp.data;
IRCallee* cee = data->Iex.CCall.cee;
IRExpr** args = data->Iex.CCall.args;
IRDirty* di;
if (VG_(strcmp)(cee->name, "x86g_calculate_condition") == 0)
{
IRExpr* cond = args[0];
IRExpr* cc_op = args[1];
IRExpr* cc_dep1 = args[2];
IRExpr* cc_dep2 = args[3];
tl_assert(cond->tag == Iex_Const && cond->Iex.Const.con->tag == Ico_U32);
tl_assert(isIRAtom(cc_op));
tl_assert(isIRAtom(cc_dep1));
tl_assert(isIRAtom(cc_dep2));
if (cc_op->tag == Iex_Const) tl_assert(cc_op->Iex.Const.con->tag == Ico_U32);
if (cc_dep1->tag == Iex_Const) tl_assert(cc_dep1->Iex.Const.con->tag == Ico_U32);
if (cc_dep2->tag == Iex_Const) tl_assert(cc_dep2->Iex.Const.con->tag == Ico_U32);
// typeOf(x86g_calculate_condition) == typeOf(tmp) == I32
di = unsafeIRDirty_0_N(0,
"helper_instrument_WrTmp_CCall_x86g_calculate_condition",
VG_(fnptr_to_fnentry)(helper_instrument_WrTmp_CCall_x86g_calculate_condition),
mkIRExprVec_7(mkIRExpr_HWord(tmp),
mkIRExpr_HWord((cc_dep1->tag == Iex_RdTmp) ? cc_dep1->Iex.RdTmp.tmp : IRTemp_INVALID),
mkIRExpr_HWord((cc_dep2->tag == Iex_RdTmp) ? cc_dep2->Iex.RdTmp.tmp : IRTemp_INVALID),
mkIRExpr_HWord(cond->Iex.Const.con->Ico.U32),
(cc_op->tag == Iex_RdTmp) ? assignNew_HWord(sb_out, cc_op) : mkIRExpr_HWord(cc_op->Iex.Const.con->Ico.U32),
(cc_dep1->tag == Iex_RdTmp) ? assignNew_HWord(sb_out, cc_dep1) : mkIRExpr_HWord(cc_dep1->Iex.Const.con->Ico.U32),
(cc_dep2->tag == Iex_RdTmp) ? assignNew_HWord(sb_out, cc_dep2) : mkIRExpr_HWord(cc_dep2->Iex.Const.con->Ico.U32))
);
addStmtToIRSB(sb_out, IRStmt_Dirty(di));
}
else {
di = unsafeIRDirty_0_N(0,
"helper_instrument_WrTmp_CCall_else",
VG_(fnptr_to_fnentry)(helper_instrument_WrTmp_CCall_else),
mkIRExprVec_0()
);
addStmtToIRSB(sb_out, IRStmt_Dirty(di));
}
}
示例7: instrument_WrTmp_Binop
void instrument_WrTmp_Binop(IRStmt* st, IRSB* sb_out)
{
IRTemp tmp = st->Ist.WrTmp.tmp;
IRExpr* data = st->Ist.WrTmp.data;
IROp op = data->Iex.Binop.op;
IRExpr* arg1 = data->Iex.Binop.arg1;
IRExpr* arg2 = data->Iex.Binop.arg2;
UInt arg1_value = 0, arg2_value = 0;
IRExpr* expr = IRExpr_Binop(op, arg1, arg2);
Int size = sizeofIRType_bits(typeOfIRExpr(sb_out->tyenv, expr));
IRDirty* di;
// we don't care about floating point and SIMD operations
if (op > Iop_AddF64)
return;
tl_assert(isIRAtom(arg1));
tl_assert(isIRAtom(arg2));
tl_assert(typeOfIRTemp(sb_out->tyenv, tmp) == typeOfIRExpr(sb_out->tyenv, expr));
if (arg1->tag == Iex_Const)
{
switch (arg1->Iex.Const.con->tag)
{
case Ico_U1: arg1_value = arg1->Iex.Const.con->Ico.U1; break;
case Ico_U8: arg1_value = arg1->Iex.Const.con->Ico.U8; break;
case Ico_U16: arg1_value = arg1->Iex.Const.con->Ico.U16; break;
case Ico_U32: arg1_value = arg1->Iex.Const.con->Ico.U32; break;
case Ico_U64: arg1_value = arg1->Iex.Const.con->Ico.U64; break;
default: VG_(tool_panic)("instrument_WrTmp_Binop");
}
}
if (arg2->tag == Iex_Const)
{
switch (arg2->Iex.Const.con->tag)
{
case Ico_U1: arg2_value = arg2->Iex.Const.con->Ico.U1; break;
case Ico_U8: arg2_value = arg2->Iex.Const.con->Ico.U8; break;
case Ico_U16: arg2_value = arg2->Iex.Const.con->Ico.U16; break;
case Ico_U32: arg2_value = arg2->Iex.Const.con->Ico.U32; break;
case Ico_U64: arg2_value = arg2->Iex.Const.con->Ico.U64; break;
default: VG_(tool_panic)("instrument_WrTmp_Binop");
}
}
di = unsafeIRDirty_0_N(0,
"helper_instrument_WrTmp_Binop",
VG_(fnptr_to_fnentry)(helper_instrument_WrTmp_Binop),
mkIRExprVec_7(mkIRExpr_HWord(tmp),
mkIRExpr_HWord((arg1->tag == Iex_RdTmp) ? arg1->Iex.RdTmp.tmp : IRTemp_INVALID),
mkIRExpr_HWord((arg2->tag == Iex_RdTmp) ? arg2->Iex.RdTmp.tmp : IRTemp_INVALID),
mkIRExpr_HWord(op),
mkIRExpr_HWord(size),
(arg1->tag == Iex_RdTmp) ? assignNew_HWord(sb_out, arg1) : mkIRExpr_HWord(arg1_value),
(arg2->tag == Iex_RdTmp) ? assignNew_HWord(sb_out, arg2) : mkIRExpr_HWord(arg2_value))
);
addStmtToIRSB(sb_out, IRStmt_Dirty(di));
}
示例8: addDynamicDisownNonNull
void addDynamicDisownNonNull(IRSB* sbOut, IRTemp idx){
IRDirty* disownDirty =
unsafeIRDirty_0_N(1, "disownShadowTempNonNullDynamic",
VG_(fnptr_to_fnentry)(disownShadowTempNonNullDynamic),
mkIRExprVec_1(mkU64(idx)));
disownDirty->mFx = Ifx_Modify;
disownDirty->mAddr = mkU64((uintptr_t)&(shadowTemps[idx]));
disownDirty->mSize = sizeof(ShadowTemp*);
addStmtToIRSB(sbOut, IRStmt_Dirty(disownDirty));
}
示例9: AddPutHelper
void AddPutHelper(IRSB* sb, Int offset, IRExpr* data)
{
IRDirty * d;
HWord h_offset = (HWord)(offset);
HWord lhs_name;
switch (data->tag)
{
case(Iex_Const):
d = unsafeIRDirty_0_N(0, "EmitPutConstHelper",
&EmitPutConstHelper,
mkIRExprVec_2(mkIRExpr_HWord(h_offset),
mkIRExpr_HWord(counter)
)
);
setHelperAnns(d);
addStmtToIRSB(sb, IRStmt_Dirty(d));
break;
case(Iex_RdTmp):
lhs_name = (HWord)data->Iex.RdTmp.tmp;
d = unsafeIRDirty_0_N(0, "EmitPutTmpHelper",
&EmitPutTmpHelper,
mkIRExprVec_3(mkIRExpr_HWord(h_offset),
mkIRExpr_HWord(lhs_name),
mkIRExpr_HWord(counter)
)
);
setHelperAnns(d);
addStmtToIRSB(sb, IRStmt_Dirty(d));
break;
default:
break;
}
return;
}
示例10: instrument_WrTmp_Const
void instrument_WrTmp_Const(IRStmt* st, IRSB* sb_out)
{
IRTemp tmp = st->Ist.WrTmp.tmp;
IRDirty* di;
di = unsafeIRDirty_0_N(0,
"helper_instrument_WrTmp_Const",
VG_(fnptr_to_fnentry)(helper_instrument_WrTmp_Const),
mkIRExprVec_1(mkIRExpr_HWord(tmp))
);
addStmtToIRSB(sb_out, IRStmt_Dirty(di));
}
示例11: instrument_store
static void instrument_store(IRSB* const bb,
IRExpr* const addr_expr,
const HWord size)
{
IRExpr* size_expr;
IRExpr** argv;
IRDirty* di;
switch (size)
{
case 1:
argv = mkIRExprVec_1(addr_expr);
di = unsafeIRDirty_0_N(/*regparms*/1,
"drd_trace_store_1",
VG_(fnptr_to_fnentry)(drd_trace_store_1),
argv);
break;
case 2:
argv = mkIRExprVec_1(addr_expr);
di = unsafeIRDirty_0_N(/*regparms*/1,
"drd_trace_store_2",
VG_(fnptr_to_fnentry)(drd_trace_store_2),
argv);
break;
case 4:
argv = mkIRExprVec_1(addr_expr);
di = unsafeIRDirty_0_N(/*regparms*/1,
"drd_trace_store_4",
VG_(fnptr_to_fnentry)(drd_trace_store_4),
argv);
break;
case 8:
argv = mkIRExprVec_1(addr_expr);
di = unsafeIRDirty_0_N(/*regparms*/1,
"drd_trace_store_8",
VG_(fnptr_to_fnentry)(drd_trace_store_8),
argv);
break;
default:
size_expr = mkIRExpr_HWord(size);
argv = mkIRExprVec_2(addr_expr, size_expr);
di = unsafeIRDirty_0_N(/*regparms*/2,
"drd_trace_store",
VG_(fnptr_to_fnentry)(drd_trace_store),
argv);
break;
}
addStmtToIRSB(bb, IRStmt_Dirty(di));
}
示例12: instrument_detail
/* A helper that adds the instrumentation for a detail. */
static void instrument_detail(IRSB* sb, Op op, IRType type)
{
IRDirty* di;
IRExpr** argv;
const UInt typeIx = type2index(type);
tl_assert(op < N_OPS);
tl_assert(typeIx < N_TYPES);
argv = mkIRExprVec_1( mkIRExpr_HWord( (HWord)&detailCounts[op][typeIx] ) );
di = unsafeIRDirty_0_N( 1, "increment_detail",
VG_(fnptr_to_fnentry)( &increment_detail ),
argv);
addStmtToIRSB( sb, IRStmt_Dirty(di) );
}
示例13: flushEvents
static void flushEvents(IRSB* sb)
{
Int i;
Char* helperName;
void* helperAddr;
IRExpr** argv;
IRDirty* di;
Event* ev;
for (i = 0; i < events_used; i++) {
ev = &events[i];
// Decide on helper fn to call and args to pass it.
switch (ev->ekind) {
case Event_Ir:
helperName = "trace_instr";
helperAddr = trace_instr;
break;
case Event_Dr:
helperName = "trace_load";
helperAddr = trace_load;
break;
case Event_Dw:
helperName = "trace_store";
helperAddr = trace_store;
break;
case Event_Dm:
helperName = "trace_modify";
helperAddr = trace_modify;
break;
default:
tl_assert(0);
}
// Add the helper.
argv = mkIRExprVec_2( ev->addr, mkIRExpr_HWord( ev->size ) );
di = unsafeIRDirty_0_N( /*regparms*/2,
helperName, VG_(fnptr_to_fnentry)( helperAddr ),
argv );
addStmtToIRSB( sb, IRStmt_Dirty(di) );
}
events_used = 0;
}
示例14: addEvent_FnEntry
static
void addEvent_FnEntry ( IRSB* sb, char *fnname)
{
IRExpr** argv;
IRDirty* di;
char *buf = (char *)VG_(malloc)("addEvent_FnEntry",100*sizeof(char));
tl_assert(buf!=NULL);
VG_(strcpy)(buf,fnname);
argv = mkIRExprVec_1( mkIRExpr_HWord( (HWord) buf ));
di = unsafeIRDirty_0_N( /*regparms*/1,
"trace_fnentry", VG_(fnptr_to_fnentry)( trace_fnentry ),
argv );
if(events_used > 0)
flushEvents(sb);
addStmtToIRSB( sb, IRStmt_Dirty(di) );
}
示例15: pyvex_deepCopyIRStmt
IRStmt* pyvex_deepCopyIRStmt ( IRStmt* s )
{
switch (s->tag) {
case Ist_NoOp:
return IRStmt_NoOp();
case Ist_AbiHint:
return IRStmt_AbiHint(pyvex_deepCopyIRExpr(s->Ist.AbiHint.base),
s->Ist.AbiHint.len,
pyvex_deepCopyIRExpr(s->Ist.AbiHint.nia));
case Ist_IMark:
return IRStmt_IMark(s->Ist.IMark.addr,
s->Ist.IMark.len,
s->Ist.IMark.delta);
case Ist_Put:
return IRStmt_Put(s->Ist.Put.offset,
pyvex_deepCopyIRExpr(s->Ist.Put.data));
case Ist_PutI:
return IRStmt_PutI(pyvex_deepCopyIRPutI(s->Ist.PutI.details));
case Ist_WrTmp:
return IRStmt_WrTmp(s->Ist.WrTmp.tmp,
pyvex_deepCopyIRExpr(s->Ist.WrTmp.data));
case Ist_Store:
return IRStmt_Store(s->Ist.Store.end,
pyvex_deepCopyIRExpr(s->Ist.Store.addr),
pyvex_deepCopyIRExpr(s->Ist.Store.data));
case Ist_CAS:
return IRStmt_CAS(pyvex_deepCopyIRCAS(s->Ist.CAS.details));
case Ist_LLSC:
return IRStmt_LLSC(s->Ist.LLSC.end,
s->Ist.LLSC.result,
pyvex_deepCopyIRExpr(s->Ist.LLSC.addr),
s->Ist.LLSC.storedata
? pyvex_deepCopyIRExpr(s->Ist.LLSC.storedata)
: NULL);
case Ist_Dirty:
return IRStmt_Dirty(pyvex_deepCopyIRDirty(s->Ist.Dirty.details));
case Ist_MBE:
return IRStmt_MBE(s->Ist.MBE.event);
case Ist_Exit:
return IRStmt_Exit(pyvex_deepCopyIRExpr(s->Ist.Exit.guard),
s->Ist.Exit.jk,
pyvex_deepCopyIRConst(s->Ist.Exit.dst),
s->Ist.Exit.offsIP);
default:
vpanic("pyvex_deepCopyIRStmt");
}
}