本文整理汇总了C++中Disassembler::typeOfInst方法的典型用法代码示例。如果您正苦于以下问题:C++ Disassembler::typeOfInst方法的具体用法?C++ Disassembler::typeOfInst怎么用?C++ Disassembler::typeOfInst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Disassembler
的用法示例。
在下文中一共展示了Disassembler::typeOfInst方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: after_predict
void TwoBit::after_predict(unsigned long ip, unsigned long nextIP, bool success)
{
Disassembler disAssem;
unsigned int type = disAssem.typeOfInst(ip, pid);
branchTargetBuffer[TWO_BIT_getBTBOffset(ip)] = nextIP;
if(InstType(type) == CND_JMP)
{
if(success)
{
if(state[TWO_BIT_getBTBOffset(ip)] == TT)
state[TWO_BIT_getBTBOffset(ip)] = TT;
else if(state[TWO_BIT_getBTBOffset(ip)] == T)
state[TWO_BIT_getBTBOffset(ip)] = TT;
else if(state[TWO_BIT_getBTBOffset(ip)] == N)
state[TWO_BIT_getBTBOffset(ip)] = T;
else if(state[TWO_BIT_getBTBOffset(ip)] == NN)
state[TWO_BIT_getBTBOffset(ip)] = N;
}
else
{
if(state[TWO_BIT_getBTBOffset(ip)] == TT)
state[TWO_BIT_getBTBOffset(ip)] = T;
else if(state[TWO_BIT_getBTBOffset(ip)] == T)
state[TWO_BIT_getBTBOffset(ip)] = N;
else if(state[TWO_BIT_getBTBOffset(ip)] == N)
state[TWO_BIT_getBTBOffset(ip)] = NN;
else if(state[TWO_BIT_getBTBOffset(ip)] == NN)
state[TWO_BIT_getBTBOffset(ip)] = NN;
}
}
}
示例2: do_predict
void TwoBit::do_predict(unsigned long ip, BranchResult& result)
{
Disassembler disAssem;
unsigned int type = disAssem.typeOfInst(ip, pid);
if(InstType(type) == CALL || InstType(type) == RETURN || InstType(type) == JMP)
{
result.setTorF(true);
result.setJmpAddress(branchTargetBuffer[TWO_BIT_getBTBOffset(ip)]);
}
else
{
if(state[TWO_BIT_getBTBOffset(ip)] == TT || state[TWO_BIT_getBTBOffset(ip)] == T)
{
result.setTorF(true);
result.setJmpAddress(branchTargetBuffer[TWO_BIT_getBTBOffset(ip)]);
}
else
{
result.setTorF(false);
}
}
}
示例3: main
//.........这里部分代码省略.........
printf("%s\n", workLoad[k]);
}
break;
}
}
try {
if(!loadOn)
throw 1;
}
catch (int ex) {
errExit("Not WorkLoad");
}
struct sigaction act;
act.sa_handler = int_handler;
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
sigaction(SIGINT, &act, NULL);
// select profiled program
Tracer tracer(workLoad[0], &workLoad[0]);
try {
tracer.traceStart();
}
catch(int exept) {
errExit("trace start");
}
// set Simulator
Simul bSim(tracer.getChildPid(), disAssem, &workLoad[0]);
pbSim = &bSim;
// set predictor
bSim.setPredictor(new NotTaken());
bSim.setPredictor(new TwoBit());
bSim.setPredictor(new Correlate());
bSim.setPredictor(new GShare());
bSim.setPredictor(new GShareRet());
gettimeofday(&startTime, NULL);
/*
** Loop now, tracing the child
*/
while (1) {
/*
** Ok, now we will continue the child, but set the single step bit in
** the psw. This will cause the child to exeute just one instruction and
** trap us again. The wait(2) catches the trap.
*/
try {
tracer.traceSingleStep(infoRegs);
ip = infoRegs.getRIP();
}
catch(int except) {
if(errno == ESRCH) {
cout << "Target Process is terminated...." << endl;
break;
}
errMsg("Single step");
break;
}
try {
bSim.runSimulation(ip);
}
catch(int execpt) {
errMsg("runSimulation\n");
}
if(debugOn)
{
try {
disAssem->showInst(ip, tracer.getChildPid());
}
catch(int ex) {
errMsg("showInst");
}
}
if(limitInst)
{
if(disAssem->typeOfInst(ip, tracer.getChildPid()))
{
numOfBranchInst++;
if(numOfBranchInst >= numOfLimitInst)
break;
}
}
}
gettimeofday(&endTime, NULL);
long endSec = (long)endTime.tv_sec * 1000000 + endTime.tv_usec;
long startSec = (long)startTime.tv_sec * 1000000 + startTime.tv_usec;
bSim.setTime(endSec - startSec);
bSim.printResult(rawOn);
return 0;
}