1
0
Fork 0

DBG+BRIDGE+GUI: implemented more selection queries (graph + memory map + symbol module)

This commit is contained in:
mrexodia 2016-09-21 21:28:37 +02:00
parent a78db8034e
commit 9c3c8a3334
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
12 changed files with 80 additions and 2 deletions

View File

@ -868,6 +868,9 @@ BRIDGE_IMPEXP bool DbgGetWatchList(ListOf(WATCHINFO) list);
#define GUI_DISASSEMBLY 0
#define GUI_DUMP 1
#define GUI_STACK 2
#define GUI_GRAPH 3
#define GUI_MEMMAP 4
#define GUI_SYMMOD 5
#define GUI_MAX_LINE_SIZE 65536
#define GUI_MAX_DISASSEMBLY_SIZE 2048

View File

@ -61,6 +61,21 @@ SCRIPT_EXPORT duint Script::Gui::Stack::SelectionGetEnd()
return Gui::SelectionGetEnd(StackWindow);
}
SCRIPT_EXPORT duint Script::Gui::Graph::SelectionGetStart()
{
return SelectionGetStart(GraphWindow);
}
SCRIPT_EXPORT duint Script::Gui::MemMap::SelectionGetStart()
{
return SelectionGetStart(MemMapWindow);
}
SCRIPT_EXPORT duint Script::Gui::SymMod::SelectionGetStart()
{
return SelectionGetStart(SymModWindow);
}
static inline int windowToBridge(Script::Gui::Window window)
{
switch(window)
@ -71,6 +86,12 @@ static inline int windowToBridge(Script::Gui::Window window)
return GUI_DUMP;
case Script::Gui::StackWindow:
return GUI_STACK;
case Script::Gui::GraphWindow:
return GUI_GRAPH;
case Script::Gui::MemMapWindow:
return GUI_MEMMAP;
case Script::Gui::SymModWindow:
return GUI_SYMMOD;
default:
return GUI_DISASSEMBLY;
}

View File

@ -30,6 +30,21 @@ namespace Script
SCRIPT_EXPORT duint SelectionGetStart();
SCRIPT_EXPORT duint SelectionGetEnd();
}; //Stack
namespace Graph
{
SCRIPT_EXPORT duint SelectionGetStart();
}; //Graph
namespace MemMap
{
SCRIPT_EXPORT duint SelectionGetStart();
}; //MemoryMap
namespace SymMod
{
SCRIPT_EXPORT duint SelectionGetStart();
}; //SymMod
}; //Gui
namespace Gui
@ -38,7 +53,10 @@ namespace Script
{
DisassemblyWindow,
DumpWindow,
StackWindow
StackWindow,
GraphWindow,
MemMapWindow,
SymModWindow
};
SCRIPT_EXPORT bool SelectionGet(Window window, duint* start, duint* end);

View File

@ -337,6 +337,15 @@ void* Bridge::processMessage(GUIMSG type, void* param1, void* param2)
case GUI_STACK:
emit selectionStackGet(selection);
break;
case GUI_GRAPH:
emit selectionGraphGet(selection);
break;
case GUI_MEMMAP:
emit selectionMemmapGet(selection);
break;
case GUI_SYMMOD:
emit selectionSymmodGet(selection);
break;
default:
return (void*)false;
}

View File

@ -91,6 +91,9 @@ signals:
void selectionDumpSet(const SELECTIONDATA* selection);
void selectionStackGet(SELECTIONDATA* selection);
void selectionStackSet(const SELECTIONDATA* selection);
void selectionGraphGet(SELECTIONDATA* selection);
void selectionMemmapGet(SELECTIONDATA* selection);
void selectionSymmodGet(SELECTIONDATA* selection);
void getStrWindow(const QString title, QString* text);
void autoCompleteAddCmd(const QString cmd);
void autoCompleteDelCmd(const QString cmd);

View File

@ -15,6 +15,6 @@ BridgeResult::~BridgeResult()
dsint BridgeResult::Wait()
{
while(!Bridge::getBridge()->hasBridgeResult) //wait for thread completion
Sleep(100);
Sleep(1);
return Bridge::getBridge()->bridgeResult;
}

View File

@ -54,6 +54,7 @@ DisassemblerGraphView::DisassemblerGraphView(QWidget* parent)
connect(Bridge::getBridge(), SIGNAL(loadGraph(BridgeCFGraphList*, duint)), this, SLOT(loadGraphSlot(BridgeCFGraphList*, duint)));
connect(Bridge::getBridge(), SIGNAL(graphAt(duint)), this, SLOT(graphAtSlot(duint)));
connect(Bridge::getBridge(), SIGNAL(updateGraph()), this, SLOT(updateGraphSlot()));
connect(Bridge::getBridge(), SIGNAL(selectionGraphGet(SELECTIONDATA*)), this, SLOT(selectionGetSlot(SELECTIONDATA*)));
//Connect to config
connect(Config(), SIGNAL(colorsUpdated()), this, SLOT(colorsUpdatedSlot()));
@ -1383,3 +1384,9 @@ void DisassemblerGraphView::toggleOverviewSlot()
drawOverview = !drawOverview;
this->viewport()->update();
}
void DisassemblerGraphView::selectionGetSlot(SELECTIONDATA* selection)
{
selection->start = selection->end = cur_instr;
Bridge::getBridge()->setResult(1);
}

View File

@ -258,6 +258,7 @@ public slots:
void fontsUpdatedSlot();
void shortcutsUpdatedSlot();
void toggleOverviewSlot();
void selectionGetSlot(SELECTIONDATA* selection);
private:
QString status;

View File

@ -33,6 +33,7 @@ MemoryMapView::MemoryMapView(StdTable* parent)
connect(Bridge::getBridge(), SIGNAL(updateMemory()), this, SLOT(refreshMap()));
connect(Bridge::getBridge(), SIGNAL(dbgStateChanged(DBGSTATE)), this, SLOT(stateChangedSlot(DBGSTATE)));
connect(Bridge::getBridge(), SIGNAL(selectInMemoryMap(duint)), this, SLOT(selectAddress(duint)));
connect(Bridge::getBridge(), SIGNAL(selectionMemmapGet(SELECTIONDATA*)), this, SLOT(selectionGetSlot(SELECTIONDATA*)));
connect(this, SIGNAL(contextMenuSignal(QPoint)), this, SLOT(contextMenuSlot(QPoint)));
setupContextMenu();
@ -608,3 +609,9 @@ void MemoryMapView::addVirtualModSlot()
return;
DbgCmdExec(QString("virtualmod \"%1\", %2, %3").arg(modname).arg(ToHexString(base)).arg(ToHexString(size)).toUtf8().constData());
}
void MemoryMapView::selectionGetSlot(SELECTIONDATA* selection)
{
selection->start = selection->end = duint(getCellContent(getInitialSelection(), 0).toULongLong(nullptr, 16));
Bridge::getBridge()->setResult(1);
}

View File

@ -41,6 +41,7 @@ public slots:
void selectAddress(duint va);
void findAddressSlot();
void addVirtualModSlot();
void selectionGetSlot(SELECTIONDATA* selection);
private:
QString getProtectionString(DWORD Protect);

View File

@ -81,6 +81,7 @@ SymbolView::SymbolView(QWidget* parent) : QWidget(parent), ui(new Ui::SymbolView
connect(Bridge::getBridge(), SIGNAL(addMsgToSymbolLog(QString)), this, SLOT(addMsgToSymbolLogSlot(QString)));
connect(Bridge::getBridge(), SIGNAL(clearLog()), this, SLOT(clearSymbolLogSlot()));
connect(Bridge::getBridge(), SIGNAL(clearSymbolLog()), this, SLOT(clearSymbolLogSlot()));
connect(Bridge::getBridge(), SIGNAL(selectionSymmodGet(SELECTIONDATA*)), this, SLOT(selectionGetSlot(SELECTIONDATA*)));
connect(mModuleList->mList, SIGNAL(selectionChangedSignal(int)), this, SLOT(moduleSelectionChanged(int)));
connect(mModuleList->mSearchList, SIGNAL(selectionChangedSignal(int)), this, SLOT(moduleSelectionChanged(int)));
connect(mModuleList, SIGNAL(emptySearchResult()), this, SLOT(emptySearchResultSlot()));
@ -589,3 +590,9 @@ void SymbolView::emptySearchResultSlot()
// No result after search
mSearchListView->mCurList->setRowCount(0);
}
void SymbolView::selectionGetSlot(SELECTIONDATA* selection)
{
selection->start = selection->end = duint(mModuleList->mCurList->getCellContent(mModuleList->mCurList->getInitialSelection(), 0).toULongLong(nullptr, 16));
Bridge::getBridge()->setResult(1);
}

View File

@ -50,6 +50,7 @@ private slots:
void refreshShortcutsSlot();
void moduleEntropy();
void emptySearchResultSlot();
void selectionGetSlot(SELECTIONDATA* selection);
signals:
void showReferences();