1
0
Fork 0

GUI: Added command to follow address in symbols tab

This commit is contained in:
morsisko 2021-07-31 19:36:30 +02:00
parent 1cdcaa242c
commit 5e6e503185
7 changed files with 37 additions and 0 deletions

View File

@ -1746,6 +1746,11 @@ BRIDGE_IMPEXP void GuiShowReferences()
_gui_sendmessage(GUI_SHOW_REF, 0, 0);
}
BRIDGE_IMPEXP void GuiSelectInSymbolsTab(duint addr)
{
_gui_sendmessage(GUI_SELECT_IN_SYMBOLS_TAB, (void*)addr, nullptr);
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
hInst = hinstDLL;

View File

@ -1197,6 +1197,7 @@ typedef enum
GUI_INVALIDATE_SYMBOL_SOURCE, // param1=duint base, param2=unused
GUI_GET_CURRENT_GRAPH, // param1=BridgeCFGraphList*, param2=unused
GUI_SHOW_REF, // param1=unused, param2=unused
GUI_SELECT_IN_SYMBOLS_TAB, // param1=duint addr, param2=unused
} GUIMSG;
//GUI Typedefs
@ -1378,6 +1379,7 @@ BRIDGE_IMPEXP void GuiInvalidateSymbolSource(duint base);
BRIDGE_IMPEXP void GuiExecuteOnGuiThreadEx(GUICALLBACKEX cbGuiThread, void* userdata);
BRIDGE_IMPEXP void GuiGetCurrentGraph(BridgeCFGraphList* graphList);
BRIDGE_IMPEXP void GuiShowReferences();
BRIDGE_IMPEXP void GuiSelectInSymbolsTab(duint addr);
#ifdef __cplusplus
}

View File

@ -304,3 +304,26 @@ bool cbShowReferences(int argc, char* argv[])
GuiShowReferences();
return true;
}
bool cbSymbolsFollow(int argc, char* argv[])
{
if(argc < 2)
return false;
duint addr;
if(!valfromstring(argv[1], &addr, false) || !MemIsValidReadPtr(addr, true))
{
dprintf(QT_TRANSLATE_NOOP("DBG", "Invalid address \"%s\"!\n"), argv[1]);
return false;
}
duint base = ModBaseFromAddr(addr);
if(!base)
{
dprintf(QT_TRANSLATE_NOOP("DBG", "Address \"%s\" doesn't belong to any module!\n"), argv[1]);
return false;
}
GuiSelectInSymbolsTab(base);
GuiFocusView(GUI_SYMMOD);
return true;
}

View File

@ -21,3 +21,4 @@ bool cbInstrSetFavToolShortcut(int argc, char* argv[]);
bool cbInstrFoldDisassembly(int argc, char* argv[]);
bool cbDebugUpdateTitle(int argc, char* argv[]);
bool cbShowReferences(int argc, char* argv[]);
bool cbSymbolsFollow(int argc, char* argv[]);

View File

@ -406,6 +406,7 @@ static void registercommands()
dbgcmdnew("FoldDisassembly", cbInstrFoldDisassembly, true); //fold disassembly segment
dbgcmdnew("guiupdatetitle", cbDebugUpdateTitle, true); // set relevant disassembly title
dbgcmdnew("showref", cbShowReferences, false); // show references window
dbgcmdnew("symfollow", cbSymbolsFollow, false); // show references window
//misc
dbgcmdnew("chd", cbInstrChd, false); //Change directory

View File

@ -879,6 +879,10 @@ void* Bridge::processMessage(GUIMSG type, void* param1, void* param2)
case GUI_SHOW_REF:
emit showReferences();
break;
case GUI_SELECT_IN_SYMBOLS_TAB:
emit symbolSelectModule(duint(param1));
break;
}
return nullptr;

View File

@ -110,6 +110,7 @@ MainWindow::MainWindow(QWidget* parent)
connect(Bridge::getBridge(), SIGNAL(addFavouriteItem(int, QString, QString)), this, SLOT(addFavouriteItem(int, QString, QString)));
connect(Bridge::getBridge(), SIGNAL(setFavouriteItemShortcut(int, QString, QString)), this, SLOT(setFavouriteItemShortcut(int, QString, QString)));
connect(Bridge::getBridge(), SIGNAL(selectInMemoryMap(duint)), this, SLOT(displayMemMapWidget()));
connect(Bridge::getBridge(), SIGNAL(symbolSelectModule(duint)), this, SLOT(displaySymbolWidget()));
connect(Bridge::getBridge(), SIGNAL(closeApplication()), this, SLOT(close()));
// Setup menu API