本文整理汇总了C++中Disassembler::dumpDisassembly方法的典型用法代码示例。如果您正苦于以下问题:C++ Disassembler::dumpDisassembly方法的具体用法?C++ Disassembler::dumpDisassembly怎么用?C++ Disassembler::dumpDisassembly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Disassembler
的用法示例。
在下文中一共展示了Disassembler::dumpDisassembly方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
if (!vm.count("engine")) {
std::cout << "Engine must be specified.\n";
return 2;
} else if (engines.find(vm["engine"].as<std::string>()) == engines.end()) {
std::cout << "Unknown engine.\n";
return 2;
}
if (vm.count("no-stack-effect")) {
setOutputStackEffect(false);
}
Engine *engine = engineFactory.create(vm["engine"].as<std::string>());
engine->_variant = vm["variant"].as<std::string>();
std::string inputFile = vm["input-file"].as<std::string>();
// Disassembly
InstVec insts;
Disassembler *disassembler = engine->getDisassembler(insts);
disassembler->open(inputFile.c_str());
disassembler->disassemble();
if (vm.count("dump-disassembly")) {
std::streambuf *buf;
std::ofstream of;
if (vm["dump-disassembly"].as<std::string>() != "") {
of.open(vm["dump-disassembly"].as<std::string>().c_str());
buf = of.rdbuf();
} else {
buf = std::cout.rdbuf();
}
std::ostream out(buf);
disassembler->dumpDisassembly(out);
}
if (!engine->supportsCodeFlow() || vm.count("only-disassembly") || insts.empty()) {
if (!vm.count("dump-disassembly")) {
disassembler->dumpDisassembly(std::cout);
}
delete disassembler;
delete engine;
return 0;
}
delete disassembler;
// Control flow analysis
ControlFlow *cf = new ControlFlow(insts, engine);
cf->createGroups();
Graph g = cf->analyze();
if (vm.count("dump-graph")) {
std::streambuf *buf;
std::ofstream of;
if (vm["dump-graph"].as<std::string>() != "") {
of.open(vm["dump-graph"].as<std::string>().c_str());
buf = of.rdbuf();
} else {
buf = std::cout.rdbuf();
}
std::ostream out(buf);
boost::write_graphviz(out, g, boost::make_label_writer(get(boost::vertex_name, g)), boost::makeArrowheadWriter(get(boost::edge_attribute, g)), GraphProperties(engine, g));
}