本文整理汇总了C++中PBB::print方法的典型用法代码示例。如果您正苦于以下问题:C++ PBB::print方法的具体用法?C++ PBB::print怎么用?C++ PBB::print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PBB
的用法示例。
在下文中一共展示了PBB::print方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testDelaySlot
void FrontSparcTest::testDelaySlot() {
BinaryFileFactory bff;
BinaryFile *pBF = bff.Load(BRANCH_SPARC);
if (pBF == NULL)
pBF = new BinaryFileStub(); // fallback on stub
CPPUNIT_ASSERT(pBF != 0);
CPPUNIT_ASSERT(pBF->GetMachine() == MACHINE_SPARC);
Prog* prog = new Prog;
FrontEnd *pFE = new SparcFrontEnd(pBF, prog, &bff);
prog->setFrontEnd(pFE);
// decode calls readLibraryCatalog(), which needs to have definitions for non-sparc architectures cleared
Type::clearNamedTypes();
pFE->decode(prog);
bool gotMain;
ADDRESS addr = pFE->getMainEntryPoint(gotMain);
CPPUNIT_ASSERT (addr != NO_ADDRESS);
std::string name("testDelaySlot");
UserProc* pProc = new UserProc(prog, name, addr);
std::ofstream dummy;
bool res = pFE->processProc(addr, pProc, dummy, false);
CPPUNIT_ASSERT(res == 1);
Cfg* cfg = pProc->getCFG();
BB_IT it;
PBB bb = cfg->getFirstBB(it);
std::ostringstream o1;
bb->print(o1);
std::string expected("Call BB:\n"
"in edges: \n"
"out edges: 10a98 \n"
"00010a80 0 *32* tmp := r14 - 120\n"
" 0 *32* m[r14] := r16\n"
" 0 *32* m[r14 + 4] := r17\n"
" 0 *32* m[r14 + 8] := r18\n"
" 0 *32* m[r14 + 12] := r19\n"
" 0 *32* m[r14 + 16] := r20\n"
" 0 *32* m[r14 + 20] := r21\n"
" 0 *32* m[r14 + 24] := r22\n"
" 0 *32* m[r14 + 28] := r23\n"
" 0 *32* m[r14 + 32] := r24\n"
" 0 *32* m[r14 + 36] := r25\n"
" 0 *32* m[r14 + 40] := r26\n"
" 0 *32* m[r14 + 44] := r27\n"
" 0 *32* m[r14 + 48] := r28\n"
" 0 *32* m[r14 + 52] := r29\n"
" 0 *32* m[r14 + 56] := r30\n"
" 0 *32* m[r14 + 60] := r31\n"
" 0 *32* r24 := r8\n"
" 0 *32* r25 := r9\n"
" 0 *32* r26 := r10\n"
" 0 *32* r27 := r11\n"
" 0 *32* r28 := r12\n"
" 0 *32* r29 := r13\n"
" 0 *32* r30 := r14\n"
" 0 *32* r31 := r15\n"
" 0 *32* r14 := tmp\n"
"00010a84 0 *32* r16 := 0x11400\n"
"00010a88 0 *32* r16 := r16 | 808\n"
"00010a8c 0 *32* r8 := r16\n"
"00010a90 0 *32* tmp := r30\n"
" 0 *32* r9 := r30 - 20\n"
"00010a90 0 CALL scanf(\n"
" )\n"
" Reaching definitions: \n"
" Live variables: \n");
std::string actual(o1.str());
CPPUNIT_ASSERT_EQUAL(expected, actual);
bb = cfg->getNextBB(it);
CPPUNIT_ASSERT(bb);
std::ostringstream o2;
bb->print(o2);
expected = std::string("Call BB:\n"
"in edges: 10a90 \n"
"out edges: 10aa4 \n"
"00010a98 0 *32* r8 := r16\n"
"00010a9c 0 *32* tmp := r30\n"
" 0 *32* r9 := r30 - 24\n"
"00010a9c 0 CALL scanf(\n"
" )\n"
" Reaching definitions: \n"
" Live variables: \n");
actual = std::string(o2.str());
CPPUNIT_ASSERT_EQUAL(expected, actual);
bb = cfg->getNextBB(it);
CPPUNIT_ASSERT(bb);
std::ostringstream o3;
bb->print(o3);
expected = std::string("Twoway BB:\n"
"in edges: 10a9c \n"
"out edges: 10ac8 10ab8 \n"
"00010aa4 0 *32* r8 := m[r30 - 20]\n"
"00010aa8 0 *32* r16 := 5\n"
"00010aac 0 *32* tmp := r16\n"
//.........这里部分代码省略.........