X-Git-Url: https://git.siccegge.de//index.cgi?a=blobdiff_plain;f=src%2Fgui%2FMainwindow.cxx;h=f98cd60a226888da2f780af6c3dc924cdde6a45b;hb=9230b2cf1a95c50e2bf0b4ca8e214bddd45cf65f;hp=c00c8f83637950f55cdf8009eb4c633a460b8999;hpb=9f0c6d8fbed0f25248f28acced4c7372dd259d7a;p=frida%2Ffrida.git diff --git a/src/gui/Mainwindow.cxx b/src/gui/Mainwindow.cxx index c00c8f8..f98cd60 100644 --- a/src/gui/Mainwindow.cxx +++ b/src/gui/Mainwindow.cxx @@ -1,6 +1,7 @@ #include "Mainwindow.hxx" #include "qt.hxx" #include "disassembler/llvm/LLVMDisassembler.hxx" +#include "widgets/CFGScene.hxx" #include #include @@ -76,7 +77,7 @@ namespace { BasicBlockWidget * local__add_basic_block(BasicBlock * block, Disassembler * dis, std::map& known_blocks, - QGraphicsScene * scene, uint64_t starty, uint64_t startx) { + CFGScene * scene, uint64_t starty, uint64_t startx) { decltype(known_blocks.begin()) old; if ((old = known_blocks.find(block->getStartAddress())) != known_blocks.end()) @@ -91,7 +92,7 @@ namespace { scene->addItem(widget); widget->setFlag(QGraphicsItem::ItemIsMovable, true); - widget->moveBy(100*startx, 10*(block->getStartAddress() - starty)); + widget->moveBy(100*startx, block->getStartAddress() - starty); dis->printEachInstruction(block->getStartAddress(), block->getEndAddress(), [&](uint8_t* bytes, size_t byte_count, const std::string& line) { @@ -101,10 +102,13 @@ namespace { BasicBlockWidget *tmp, *nextl(NULL), *nextr(NULL); BasicBlock * tmpblock; if (block->getNextBlock(0) != 0) { + int xshift = 0; + if (block->getNextBlock(1) != 0) + xshift = 1; tmpblock = dis->getBasicBlock(block->getNextBlock(0)); tmp = local__add_basic_block(tmpblock, dis, known_blocks, - scene, starty, startx+1); + scene, starty, startx+xshift); nextl = tmp; tmp->addPrevious(widget); } @@ -125,7 +129,7 @@ void Mainwindow::populateSymbolInformation(Function* fun) { QTabWidget * w = new QTabWidget(); // CFG - QGraphicsScene * scene = new QGraphicsScene; + CFGScene * scene = new CFGScene; BasicBlock * block = disassembler->getBasicBlock(fun->getStartAddress());