本文整理汇总了C++中Trace::consume_header方法的典型用法代码示例。如果您正苦于以下问题:C++ Trace::consume_header方法的具体用法?C++ Trace::consume_header怎么用?C++ Trace::consume_header使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Trace
的用法示例。
在下文中一共展示了Trace::consume_header方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assembly
//.........这里部分代码省略.........
bblock->bap_ir = new vector<Stmt *>();
bblock->inst = tf->id;
//generate_bap_ir_block(prog, bblock);
Label * label = new Label("ReadSyscall");
if (atts)
label->attributes.cv = tf->getOperands() ;
bblock->bap_ir->push_back(label);
bblock->vex_ir = NULL;
result->push_back(bblock);
//cerr << sf->callno << " " << sf->args[0] << " " << sf->args[4] << endl;
//for (int i = 0 ; i < bblock->bap_ir->size() ; i ++)
// cout << bblock->bap_ir->at(i)->tostring() << endl ;
break;
}
case pintrace::FRM_EXCEPT: // TODO: Fill this in
{
break;
}
default:
break;
}
/* After all this, delete the frame */
delete f;
/* Clean up prog, prog->abfd, and vex memory */
asmir_close(prog);
}
}
else {
ifstream trace ;
trace.open(filename.c_str());
if (!trace.is_open()) {
cerr << "Couldn't open " << filename << endl;
exit(1);
}
Trace * trc ;
EntryHeader eh;
TraceHeader hdr;
try {
trace.read(BLOCK(hdr), TRACE_HEADER_FIXED_SIZE);
assert(hdr.magicnumber == MAGIC_NUMBER) ;
switch (hdr.version)
{
case 40: trc = new Trace_v40(&trace); break;
case 41: trc = new Trace_v41(&trace); break;
case 50: trc = new Trace_v50(&trace); break;
default: throw "unsupported trace version";
}
trc->consume_header(&hdr) ;
/* Since the traces do not contain any architecture information *
* we only support x86 for now - ethan */
VexArch arch = VexArchX86;
/* XXX Suspected memory leak! (Is prog freed?) */
asm_program_t * prog = asmir_new_asmp_for_arch(bfd_arch_i386);
// Initializations
translate_init();
while(!trace.eof()) {
// Reading each entry header
trc->read_entry_header(&eh);
counter ++ ;
if (counter > offset) {
bap_block_t *bblock = new bap_block_t;
bblock->bap_ir = new vector<Stmt *>();
bblock->inst = eh.address;
// lift the instruction to VEX IL
bblock->vex_ir = translate_insn(arch, eh.rawbytes, eh.address);
// and then to BAP IL
generate_bap_ir_block(prog, bblock);
if (atts)
bblock->bap_ir->front()->attributes.cv = trc->operand_status(&eh) ;
// append to result
result->push_back(bblock);
int i;
if (print)
for ( i = 0 ; i < bblock->bap_ir->size() ; i ++)
cout << bblock->bap_ir->at(i)->tostring() << endl ;
}
}
}
catch (const char * s)
{
cout << s << endl ;
}
}
return result;
}