diff --git a/radare2 b/radare2 index 3b2b5925..7e063d0b 160000 --- a/radare2 +++ b/radare2 @@ -1 +1 @@ -Subproject commit 3b2b592506809d4dcfed7c7cff29dd8fa2c2e9d1 +Subproject commit 7e063d0b47878f0e9992fcef8756e6a3e29bdba9 diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index ff01913b..bba29000 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -60,7 +60,6 @@ #include "widgets/ConsoleWidget.h" #include "dialogs/OptionsDialog.h" #include "widgets/EntrypointWidget.h" -#include "widgets/DisassemblerGraphView.h" #include "dialogs/SaveProjectDialog.h" // graphics @@ -204,8 +203,8 @@ void MainWindow::initUI() graphDock = new QDockWidget(tr("Graph"), this); graphDock->setObjectName("Graph"); graphDock->setAllowedAreas(Qt::AllDockWidgetAreas); - DisassemblerGraphView *gv = new DisassemblerGraphView(graphDock); - graphDock->setWidget(gv); + graphView = new DisassemblerGraphView(graphDock); + graphDock->setWidget(graphView); dockWidgets.push_back(graphDock); // Add Sections dock panel diff --git a/src/MainWindow.h b/src/MainWindow.h index c479c5fc..7da72bc5 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -1,15 +1,18 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include -#include #include + +#include "cutter.h" // only needed for ut64 #include "widgets/DisassemblyWidget.h" +#include "widgets/DisassemblerGraphView.h" #include "widgets/SidebarWidget.h" #include "widgets/HexdumpWidget.h" -#include "cutter.h" // only needed for ut64 #include "utils/Configuration.h" +#include +#include + class CutterCore; class DockWidget; class Omnibar; @@ -34,6 +37,7 @@ class QAction; class SectionsDock; class ConsoleWidget; class EntrypointWidget; +class DisassemblerGraphView; class QDockWidget; @@ -186,6 +190,7 @@ private: SidebarWidget *sidebarDock; HexdumpWidget *hexdumpDock; QDockWidget *graphDock; + DisassemblerGraphView *graphView; QDockWidget *asmDock; QDockWidget *calcDock; Omnibar *omnibar; diff --git a/src/cutter.cpp b/src/cutter.cpp index f5078fce..a7ca2387 100644 --- a/src/cutter.cpp +++ b/src/cutter.cpp @@ -755,7 +755,6 @@ void CutterCore::getOpcodes() void CutterCore::setSettings() { - setConfig("scr.color", false); setConfig("scr.interactive", false); setConfig("asm.lines", false); // Intredazting... @@ -805,10 +804,9 @@ void CutterCore::setSettings() //setConfig("http.root","/usr/local/radare2/osx/share/radare2/1.1.0-git/www"); //setConfig("bin.rawstr", "true"); - // Graph colors and design - cmd("ec graph.true rgb:88FF88"); - cmd("ec graph.false rgb:FF6666"); - cmd("ec graph.trufae rgb:4183D7"); + // Colors + setConfig("scr.color", false); + setConfig("scr.truecolor", true); } QList CutterCore::getSeekHistory() diff --git a/src/cutter.h b/src/cutter.h index 55c6d403..7cf4a615 100644 --- a/src/cutter.h +++ b/src/cutter.h @@ -209,13 +209,16 @@ public: void analyze(int level, QList advanced); // Seek functions - bool graphDisplay = false; void seek(QString addr); void seek(ut64 offset); void seekPrev(); void seekNext(); RVA getOffset(); + // Graph - Disassembly view priority + bool graphPriority = true; + bool graphDisplay = false; + ut64 math(const QString &expr); QString itoa(ut64 num, int rdx = 16); diff --git a/src/utils/Configuration.cpp b/src/utils/Configuration.cpp index c12750f7..02ac72e2 100644 --- a/src/utils/Configuration.cpp +++ b/src/utils/Configuration.cpp @@ -18,15 +18,15 @@ Configuration* Configuration::instance() void Configuration::loadDefaultColors() { - //Core()->cmd("eco behelit"); - Core()->cmd("eco smyck"); + Core()->cmd("eco cutter"); QJsonObject colors = Core()->cmdj("ecj").object(); for (auto color : colors.keys()) { QJsonArray rgb = colors[color].toArray(); QColor col = QColor(rgb[0].toInt(), rgb[1].toInt(), rgb[2].toInt()); s.setValue("colors." + color, col); } - //s.setValue("colors.gui.alt_background", QColor(255, 255, 255)); + s.setValue("colors.gui.background", QColor(255, 255, 245)); + s.setValue("colors.gui.alt_background", QColor(245, 250, 255)); } const QFont Configuration::getFont() const diff --git a/src/widgets/DisassemblerGraphView.cpp b/src/widgets/DisassemblerGraphView.cpp index beadfd71..47c4e969 100644 --- a/src/widgets/DisassemblerGraphView.cpp +++ b/src/widgets/DisassemblerGraphView.cpp @@ -1643,11 +1643,9 @@ void DisassemblerGraphView::on_seekChanged(RVA addr) Q_UNUSED(addr); loadCurrentGraph(); Function f = this->analysis.functions[this->function]; - if (f.blocks.size() > 0) { - Core()->graphDisplay = true; + Core()->graphDisplay = f.blocks.size() > 0; + if (Core()->graphDisplay && Core()->graphPriority) { this->parentWidget()->raise(); - } else { - Core()->graphDisplay = false; } this->renderFunction(this->analysis.functions[this->function]); } @@ -1811,6 +1809,7 @@ void DisassemblerGraphView::followDisassemblerSlot() void DisassemblerGraphView::colorsUpdatedSlot() { disassemblyBackgroundColor = ConfigColor("gui.background"); + mDisabledBreakpointColor = disassemblyBackgroundColor; graphNodeColor = ConfigColor("gui.border"); backgroundColor = ConfigColor("gui.alt_background"); disassemblySelectionColor = ConfigColor("gui.highlight"); diff --git a/src/widgets/DisassemblerGraphView.h b/src/widgets/DisassemblerGraphView.h index 91c5f21f..a6ab161b 100644 --- a/src/widgets/DisassemblerGraphView.h +++ b/src/widgets/DisassemblerGraphView.h @@ -288,7 +288,6 @@ public slots: void seekPrev(); private: - MainWindow* main; QString status; Analysis analysis; duint function; diff --git a/src/widgets/DisassemblyWidget.cpp b/src/widgets/DisassemblyWidget.cpp index cba1904f..a4cbfdf5 100644 --- a/src/widgets/DisassemblyWidget.cpp +++ b/src/widgets/DisassemblyWidget.cpp @@ -34,7 +34,7 @@ DisassemblyWidget::DisassemblyWidget(QWidget *parent) : connect(mDisasTextEdit, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showDisasContextMenu(const QPoint &))); - // x or X to show XRefs + // x to show XRefs QShortcut *shortcut_x = new QShortcut(QKeySequence(Qt::Key_X), mDisasTextEdit); shortcut_x->setContext(Qt::WidgetShortcut); connect(shortcut_x, SIGNAL(activated()), this, SLOT(showXrefsDialog())); @@ -52,6 +52,11 @@ DisassemblyWidget::DisassemblyWidget(const QString &title, QWidget *parent) : this->setWindowTitle(title); } +QWidget* DisassemblyWidget::getTextWidget() +{ + return mDisasTextEdit; +} + void DisassemblyWidget::highlightCurrentLine() { QList extraSelections; @@ -159,7 +164,7 @@ bool DisassemblyWidget::loadMoreDisassembly() if (offset != RVA_INVALID) { - CutterCore::getInstance()->seek(offset); + //CutterCore::getInstance()->seek(offset); QString raw = CutterCore::getInstance()->cmd("pd 200"); QString txt = raw.section("\n", 1, -1); //this->disasTextEdit->appendPlainText(" ;\n ; New content here\n ;\n " + txt.trimmed()); @@ -227,11 +232,14 @@ void DisassemblyWidget::refreshDisasm() disconnect(mDisasTextEdit->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(disasmScrolled())); disconnect(mDisasTextEdit, SIGNAL(cursorPositionChanged()), this, SLOT(on_mDisasTextEdit_cursorPositionChanged())); - QString disas = CutterCore::getInstance()->cmd("pd 200"); + Core()->setConfig("scr.html", true); + Core()->setConfig("scr.color", true); + QString disas = Core()->cmd("pd 100"); + Core()->setConfig("scr.html", false); + Core()->setConfig("scr.color", false); mDisasTextEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); - - mDisasTextEdit->setPlainText(disas.trimmed()); + mDisasTextEdit->setHtml(disas); auto cursor = mDisasTextEdit->textCursor(); cursor.setPosition(0); @@ -251,7 +259,7 @@ void DisassemblyWidget::refreshDisasm() connect(mDisasTextEdit, SIGNAL(cursorPositionChanged()), this, SLOT(on_mDisasTextEdit_cursorPositionChanged())); //this->on_mDisasTextEdit_cursorPositionChanged(); - this->highlightDisasms(); + //this->highlightDisasms(); } void DisassemblyWidget::on_mDisasTextEdit_cursorPositionChanged() @@ -356,7 +364,7 @@ bool DisassemblyWidget::eventFilter(QObject *obj, QEvent *event) void DisassemblyWidget::on_seekChanged(RVA offset) { Q_UNUSED(offset); - if (!Core()->graphDisplay) { + if (!Core()->graphDisplay || !Core()->graphPriority) { this->raise(); } refreshDisasm(); diff --git a/src/widgets/DisassemblyWidget.h b/src/widgets/DisassemblyWidget.h index cd2678d1..10147e43 100644 --- a/src/widgets/DisassemblyWidget.h +++ b/src/widgets/DisassemblyWidget.h @@ -12,6 +12,7 @@ class DisassemblyWidget : public QDockWidget public: explicit DisassemblyWidget(QWidget *parent = nullptr); explicit DisassemblyWidget(const QString &title, QWidget *parent = nullptr); + QWidget* getTextWidget(); signals: