From e9e5b26d143415369cb0a1ec481be1836af2a88c Mon Sep 17 00:00:00 2001 From: "Mr. eXoDia" Date: Sun, 30 Mar 2014 14:47:56 +0200 Subject: [PATCH] PROJECT: updated todo list GUI: fixed infobox GUI: removed last space GUI: added Goto dialog to the dump --- todo_dbg.txt | 1 - .../Project/Src/BasicView/Disassembly.cpp | 1 + .../Project/Src/BasicView/Disassembly.h | 1 + x64_dbg_gui/Project/Src/BasicView/InfoBox.cpp | 1 + .../Project/Src/Disassembler/QBeaEngine.cpp | 2 ++ x64_dbg_gui/Project/Src/Gui/CPUDump.cpp | 21 +++++++++++++++++++ x64_dbg_gui/Project/Src/Gui/CPUDump.h | 6 ++++++ x64_dbg_gui/Project/Src/main.cpp | 10 +++++++-- 8 files changed, 40 insertions(+), 3 deletions(-) diff --git a/todo_dbg.txt b/todo_dbg.txt index 5ac378b8..d6a6b6f5 100644 --- a/todo_dbg.txt +++ b/todo_dbg.txt @@ -9,7 +9,6 @@ - getremotestring - function parameter - help file updates -- tls callbacks - inject dll - dump memory - dump process diff --git a/x64_dbg_gui/Project/Src/BasicView/Disassembly.cpp b/x64_dbg_gui/Project/Src/BasicView/Disassembly.cpp index 6b845be1..39cbddb7 100644 --- a/x64_dbg_gui/Project/Src/BasicView/Disassembly.cpp +++ b/x64_dbg_gui/Project/Src/BasicView/Disassembly.cpp @@ -895,6 +895,7 @@ void Disassembly::setSingleSelection(int_t index) mSelection.firstSelectedIndex = index; mSelection.fromIndex = index; mSelection.toIndex = index; + emit selectionChanged(rvaToVa(index)); } diff --git a/x64_dbg_gui/Project/Src/BasicView/Disassembly.h b/x64_dbg_gui/Project/Src/BasicView/Disassembly.h index dd454f46..1f0f3767 100644 --- a/x64_dbg_gui/Project/Src/BasicView/Disassembly.h +++ b/x64_dbg_gui/Project/Src/BasicView/Disassembly.h @@ -78,6 +78,7 @@ public: int_t getSize(); signals: + void selectionChanged(int_t parVA); public slots: void disassambleAt(int_t parVA, int_t parCIP); diff --git a/x64_dbg_gui/Project/Src/BasicView/InfoBox.cpp b/x64_dbg_gui/Project/Src/BasicView/InfoBox.cpp index b3df6354..fb4e48b7 100644 --- a/x64_dbg_gui/Project/Src/BasicView/InfoBox.cpp +++ b/x64_dbg_gui/Project/Src/BasicView/InfoBox.cpp @@ -26,4 +26,5 @@ void InfoBox::setInfoLineSlot(int line, QString text) if(line < 0 || line > 2) return; setCellContent(line, 0, text); + reloadData(); } diff --git a/x64_dbg_gui/Project/Src/Disassembler/QBeaEngine.cpp b/x64_dbg_gui/Project/Src/Disassembler/QBeaEngine.cpp index 20a91819..c1908ccc 100644 --- a/x64_dbg_gui/Project/Src/Disassembler/QBeaEngine.cpp +++ b/x64_dbg_gui/Project/Src/Disassembler/QBeaEngine.cpp @@ -171,6 +171,8 @@ Instruction_t QBeaEngine::DisassembleAt(byte_t* data, uint_t size, uint_t instIn len = (len < 1) ? 1 : len ; wInst.instStr = QString(mDisasmStruct.CompleteInstr); + if(wInst.instStr.at(wInst.instStr.length()-1)==' ') + wInst.instStr.chop(1); wInst.dump = QByteArray((char*)mDisasmStruct.EIP, len); wInst.rva = origInstRVA; wInst.lentgh = len; diff --git a/x64_dbg_gui/Project/Src/Gui/CPUDump.cpp b/x64_dbg_gui/Project/Src/Gui/CPUDump.cpp index fa574d5e..8e3b77be 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUDump.cpp +++ b/x64_dbg_gui/Project/Src/Gui/CPUDump.cpp @@ -11,6 +11,15 @@ CPUDump::CPUDump(QWidget *parent) : HexDump(parent) void CPUDump::setupContextMenu() { + //Goto menu + mGotoMenu = new QMenu("&Goto", this); + //Goto->Expression + mGotoExpression = new QAction("&Expression", this); + mGotoExpression->setShortcutContext(Qt::WidgetShortcut); + mGotoExpression->setShortcut(QKeySequence("ctrl+g")); + this->addAction(mGotoExpression); + connect(mGotoExpression, SIGNAL(triggered()), this, SLOT(gotoExpressionSlot())); + //Hex menu mHexMenu = new QMenu("&Hex", this); //Hex->Ascii @@ -140,6 +149,7 @@ QString CPUDump::paintContent(QPainter* painter, int_t rowBase, int rowOffset, i void CPUDump::contextMenuEvent(QContextMenuEvent *event) { QMenu* wMenu = new QMenu(this); //create context menu + wMenu->addMenu(mGotoMenu); wMenu->addMenu(mHexMenu); wMenu->addMenu(mTextMenu); wMenu->addMenu(mIntegerMenu); @@ -149,6 +159,17 @@ void CPUDump::contextMenuEvent(QContextMenuEvent *event) wMenu->exec(event->globalPos()); //execute context menu } +void CPUDump::gotoExpressionSlot() +{ + GotoDialog mGoto(this); + mGoto.setWindowTitle("Enter expression to follow in Dump..."); + if(mGoto.exec()==QDialog::Accepted) + { + QString cmd; + DbgCmdExec(cmd.sprintf("dump \"%s\"", mGoto.expressionText.toUtf8().constData()).toUtf8().constData()); + } +} + void CPUDump::hexAsciiSlot() { int charwidth=QFontMetrics(this->font()).width(QChar(' ')); diff --git a/x64_dbg_gui/Project/Src/Gui/CPUDump.h b/x64_dbg_gui/Project/Src/Gui/CPUDump.h index 6e8fc142..cea3b1c7 100644 --- a/x64_dbg_gui/Project/Src/Gui/CPUDump.h +++ b/x64_dbg_gui/Project/Src/Gui/CPUDump.h @@ -8,6 +8,7 @@ #include "NewTypes.h" #include "HexDump.h" #include "Bridge.h" +#include "GotoDialog.h" class CPUDump : public HexDump { @@ -19,6 +20,8 @@ public: void contextMenuEvent(QContextMenuEvent* event); public slots: + void gotoExpressionSlot(); + void hexAsciiSlot(); void hexUnicodeSlot(); @@ -43,6 +46,9 @@ public slots: void disassemblySlot(); private: + QMenu* mGotoMenu; + QAction* mGotoExpression; + QMenu* mHexMenu; QAction* mHexAsciiAction; QAction* mHexUnicodeAction; diff --git a/x64_dbg_gui/Project/Src/main.cpp b/x64_dbg_gui/Project/Src/main.cpp index 3053a705..528ae074 100644 --- a/x64_dbg_gui/Project/Src/main.cpp +++ b/x64_dbg_gui/Project/Src/main.cpp @@ -17,11 +17,17 @@ bool MyApplication::notify(QObject* receiver, QEvent* event) } catch (const std::exception& ex) { - GuiAddLogMessage(QString().sprintf("Fatal GUI Exception: %s!\n", ex.what()).toUtf8().constData()); + const char* message=QString().sprintf("Fatal GUI Exception: %s!\n", ex.what()).toUtf8().constData(); + GuiAddLogMessage(message); + puts(message); + OutputDebugStringA(message); } catch (...) { - GuiAddLogMessage("Fatal GUI Exception: (...)!\n"); + const char* message="Fatal GUI Exception: (...)!\n"; + GuiAddLogMessage(message); + puts(message); + OutputDebugStringA(message); } return done; }