本文整理汇总了C++中Stmt::tostring方法的典型用法代码示例。如果您正苦于以下问题:C++ Stmt::tostring方法的具体用法?C++ Stmt::tostring怎么用?C++ Stmt::tostring使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stmt
的用法示例。
在下文中一共展示了Stmt::tostring方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: print_vine_ir
void print_vine_ir(asm_program_t *prog, vector<vine_block_t *> vblocks )
{
unsigned int i, j;
for ( i = 0; i < vblocks.size(); i++ )
{
vine_block_t *block = vblocks.at(i);
assert(block);
vector<Stmt *> *inner = block->vine_ir;
// cout << "Vine Block " << i << endl;
cout << " {" << endl;
// declvis vis;
// vis.compute(inner);
// print_decls(vis.decls);
// cout << " ";
ostringstream os;
ostream_insn(prog, block->inst, os);
cout << " // " << os.str() << endl;
vector<VarDecl *> globals = get_reg_decls();
map<string,reg_t> context;
for(vector<VarDecl *>::const_iterator gi = globals.begin();
gi != globals.end(); gi++){
VarDecl *vd = *gi;
context.insert(pair<string, reg_t>(vd->name, vd->typ));
}
for ( j = 0; j < inner->size(); j++ )
{
#ifdef TYPECHECKING
try {
if (typecheck_stmt(&context, inner->at(j)) < 0) {
cout <<"Type error found at:" <<endl;
}
} catch (TypeError &e) {
cout <<"Type Error: " << e.what() <<endl;
cout <<"Found at:" <<endl;
}
#endif
Stmt *s = inner->at(j);
cout << " " << s->tostring();
// if(s->stmt_type == LABEL)
// cout << endl;
// else
// cout << ";" << endl;
cout << endl;
}
cout << " }" << endl;
}
}
示例2: print_merged_ir
void print_merged_ir( vector<Stmt *> ir )
{
unsigned int i;
for ( i = 0; i < ir.size(); i++ )
{
Stmt *stmt = ir.at(i);
assert(stmt);
cout << stmt->ir_address << "\t\t" << stmt->tostring() << endl;
}
}
示例3: print_globals
void print_globals(){
vector<VarDecl *> globals = get_reg_decls();
for(vector<VarDecl *>::const_iterator it = globals.begin();
it != globals.end(); it++){
VarDecl *s = *it;
cout << s->tostring() << endl;
}
cout << "var mem:reg8_t[reg32_t];" << endl;
vector<Stmt *> helpers = gen_eflags_helpers();
for(vector<Stmt *>::const_iterator it = helpers.begin();
it != helpers.end(); it++){
Stmt *s = *it;
cout << s->tostring() << endl;
}
}
示例4: process_bil
void CReilFromBilTranslator::process_bil(reil_raw_t *raw_info, bap_block_t *block)
{
int size = block->bap_ir->size();
reset_state(block);
if (raw_info)
{
current_raw_info = raw_info;
}
log_write(LOG_BIL, "BAP {");
for (int i = 0; i < size; i++)
{
// enumerate BIL statements
Stmt *s = block->bap_ir->at(i);
log_write(LOG_BIL, " %s", s->tostring().c_str());
}
if (is_unknown_insn(block))
{
log_write(LOG_BIL, " // %.8llx was not translated", raw_info->addr);
// add metainformation about unknown instruction into the code
process_unknown_insn();
goto _end;
}
for (int i = 0; i < size; i++)
{
current_stmt = i;
// enumerate BIL statements
Stmt *s = block->bap_ir->at(i);
uint64_t inst_flags = IOPT_ASM_END;
for (int n = i + 1; n < size; n++)
{
// check for last IR instruction
Stmt *s_next = block->bap_ir->at(n);
if (s_next->stmt_type == MOVE ||
s_next->stmt_type == CJMP ||
s_next->stmt_type == JMP)
{
inst_flags = 0;
break;
}
}
if (i < size - 1)
{
Stmt *s_next = block->bap_ir->at(i + 1);
// check for the special statement that following current
if (s_next->stmt_type == SPECIAL)
{
Special *special = (Special *)s_next;
// translate special statement to the REIL instruction options
inst_flags |= convert_special(special);
}
}
// convert statement to REIL code
process_bil_stmt(s, inst_flags);
}
if (inst_count == 0)
{
// add I_NONE
process_empty_insn();
}
_end:
if (inst_handler)
{
vector<reil_inst_t *>::iterator it;
// enumerate translated instructions
for (it = translated_insts.begin(); it != translated_insts.end(); ++it)
{
reil_inst_t *reil_inst = *it;
// check for JCC with label
if (reil_inst->op == I_JCC && reil_inst->c.type == A_LOC &&
strlen(reil_inst->c.name) > 0)
{
vector<BAP_LABEL *>::iterator it_l;
bool label_found = false;
// find label by name
for (it_l = translated_labels.begin(); it_l != translated_labels.end(); ++it_l)
{
BAP_LABEL *label = *it_l;
//.........这里部分代码省略.........
示例5: process_bil
void CReilFromBilTranslator::process_bil(reil_raw_t *raw_info, bap_block_t *block)
{
int size = block->bap_ir->size();
reset_state(block);
if (raw_info)
{
current_raw_info = raw_info;
}
log_write(LOG_BIL, "BAP {");
for (int i = 0; i < size; i++)
{
// enumerate BIL statements
Stmt *s = block->bap_ir->at(i);
log_write(LOG_BIL, " %s", s->tostring().c_str());
}
if (is_unknown_insn(block))
{
log_write(LOG_BIL, " // %.8llx was not translated", raw_info->addr);
// add metainformation about unknown instruction into the code
process_unknown_insn();
goto _end;
}
for (int i = 0; i < size; i++)
{
current_stmt = i;
// enumerate BIL statements
Stmt *s = block->bap_ir->at(i);
uint64_t inst_flags = IOPT_ASM_END;
for (int n = i + 1; n < size; n++)
{
// check for last IR instruction
Stmt *s_next = block->bap_ir->at(n);
if (s_next->stmt_type == MOVE ||
s_next->stmt_type == CJMP ||
s_next->stmt_type == JMP)
{
inst_flags = 0;
break;
}
}
if (i < size - 1)
{
// check for the special statement that following current
Stmt *s_next = block->bap_ir->at(i + 1);
if (s_next->stmt_type == SPECIAL)
{
Special *special = (Special *)s_next;
// translate special statement to the REIL instruction options
inst_flags |= convert_special(special);
}
}
// convert statement to REIL code
process_bil_stmt(s, inst_flags);
}
if (inst_count == 0)
{
// add I_NONE
process_empty_insn();
}
_end:
log_write(LOG_BIL, "}");
return;
}