|
From: 09信管2班 童飞 <ton...@12...> - 2014-08-01 06:50:25
|
Hi Sir,
I am trying to develop a tool using valgrind and I test it work fine on x86 linux. But when I translate my program to arm linux,it failed when I give it a test case.The error message is as follows:
DIRTY 1:I1 ::: EmitBinopTmpTmpTypeHelper{0x3802c4b0}(0x48:I32,0x1402B:I32,0x3D:I32,0x11:I32,0x0:I32)
vex: the `impossible' happened:
iselStmt
vex storage: T total 0 bytes allocated
vex storage: P total 0 bytes allocated
valgrind: the 'impossible' happened:
LibVEX called failure_exit().
==1473== at 0x3802F258:report_and_quit(m_libcassert.c:235)
==1473== at 0xE1A00005:???
sched status:
running_tid=1
Thread 1:status = VgTs_Runnable
==1473 at 0x42A8DC0:???(in/usr/lib/ld-2.18.so)
#######################
I debugged my program, and found that error come from using unsafeIRDirty_1_N for writing into temporary registers.Parts of codes as follows:
########################
case Iex_Binop:
hint = opToHint(rhs->Iex.Binop.op);
if (hint != HopelessHint)
{
AddOpRhsTypeHelper(sb,rhs->Iex.Binop.arg1,hint,addr);
AddOpRhsTypeHelper(sb,rhs->Iex.Binop.arg2,hint,addr);
}
AddBinopHelper(sb,st);
break;
//function AddBinopHelper:
void AddBinopHelper(IRSB* sb,IRStmt* st)
{
IROp op;
IRDirty* d1;
IRDirty* d2;
IRExpr* arg1;
IRExpr* arg2;
HWord lhs,tmpname;
...
...
if (arg1->tag == Iex_RdTmp && arg2->tag == Iex_RdTmp)
{
d2 = unsafeIRDirty_0_N(0, "EmitBinopTmpTmpTypeHelper", //it seems there has a bug
&EmitBinopTmpTmpTypeHelper,
mkIRExprVec_5(
mkIRExpr_HWord(lhs),
mkIRExpr_HWord(op),
mkIRExpr_HWord((HWord)arg1->Iex.RdTmp.tmp),
mkIRExpr_HWord((HWord)arg2->Iex.RdTmp.tmp),
mkIRExpr_HWord(counter)
)
);
setHelperAnns(d2);
addStmtToIRSB(sb,IRStmt_Dirty(d2));
}
}
//function EmitBinopTmpTmpTypeHelper:
void EmitBinopTmpTmpTypeHelper(HWord lhs, HWord op, HWord arg1, HWord arg2, HWord eip)
{
IntType lhsType = Top; //Top defined as unknown type
IntType arg1Type = Top;
IntType arg2Type = Top;
arg1Type = getTypeOf(getVarOf(locToHashKey(arg1,eip,TmpLoc)));
arg2Type = getTypeOf(getVarOf(locToHashKey(arg2,eip,TmpLoc)));
lhsType = BinopTypeStateFunc(op, arg1Type, arg2Type);
/* Check whether lhs arg has a tyvar */
if (getVarOf(locToHashKey(lhs,eip,TmpLoc)) == -1)
{
/* No, so add one */
setVarOf(locToHashKey(lhs,eip,TmpLoc),curtyvar);
curtyvar++;
}
setTypeOf(getVarOf(locToHashKey(lhs,eip,TmpLoc)),lhsType);
return;
}
######################
I don't know why it work fine on x86 ,but useless on arm.English is not my first language.Any help would mean a lot.
Thanks,
Flight. |