X-Git-Url: https://git.siccegge.de//index.cgi?p=frida%2Ffrida.git;a=blobdiff_plain;f=src%2Fgui%2Fwidgets%2FBasicBlockWidget.cxx;h=de97c51d521c92b6cfc36d1871102a0b31cd221e;hp=ee3b7afc0048ead4a014630349187602ea61b2a4;hb=7e983f239ca96faf5c8ba92cd4de54eba5235f75;hpb=87cd2baa79a6bbfaaad9d0c69bbf1fdb7462c20a diff --git a/src/gui/widgets/BasicBlockWidget.cxx b/src/gui/widgets/BasicBlockWidget.cxx index ee3b7af..de97c51 100644 --- a/src/gui/widgets/BasicBlockWidget.cxx +++ b/src/gui/widgets/BasicBlockWidget.cxx @@ -1,4 +1,5 @@ #include "BasicBlockWidget.hxx" +#include "CFGScene.hxx" #include "gui/Mainwindow.hxx" #include "gui/dialogs/SimpleStringDialog.hxx" #include "core/BasicBlock.hxx" @@ -103,7 +104,7 @@ void CustomQGraphicsTextItem::adjustSize() { BasicBlockWidget::BasicBlockWidget(const QString& name, BasicBlock * block, Mainwindow * mainwindow) : width(200), height(45), name(name) - , _table(NULL) + , currentColor(defaultColor), _table(NULL) , block(block), mainwindow(mainwindow) , logger(log4cxx::Logger::getLogger("gui.BasicBlockWidget." + name.toStdString())) { next[0] = NULL; next[1] = NULL; @@ -122,6 +123,21 @@ BasicBlockWidget::BasicBlockWidget(const QString& name, BasicBlock * block, if (str.startsWith("function:")) { QString address = str.remove("function:"); mainwindow->switchMainPlaneToAddress(address.toInt(NULL, 16)); + } else if (str.startsWith("block:")) { + QString address = str.remove("block:"); + + /* next[0] is always the jumptarget. On a + * conditional jump, next[1] also + * contains the following instruction + * + * TODO: Verify we're switching to the + * right block -- the target + * address matches the next blocks + * start address + */ + LOG4CXX_TRACE(logger, "Highlighting block at Address " << address.toStdString() + << " BasicBlockWidget " << std::hex << next[0]); + ((CFGScene*)this->scene())->highlightBlock(next[0]); } }); instructions = block->getInstructions(); @@ -251,7 +267,7 @@ void BasicBlockWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem*, height = 25 + _widget->boundingRect().height(); if (width < 250) width = 250; - painter->fillRect(0, 0, width, height, QColor(0xcc, 0xcc, 0xff, 0xff)); + painter->fillRect(0, 0, width, height, currentColor); painter->setPen(QColor(0x00, 0x00, 0xff, 0xff)); painter->drawRect(0, 0, width, height); painter->drawText(5, 15, name);