1
0
Fork 0

DBG: implement symunload command

This commit is contained in:
Duncan Ogilvie 2019-06-18 02:50:31 +02:00
parent d969087bed
commit 80d84e7108
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
3 changed files with 27 additions and 0 deletions

View File

@ -226,6 +226,31 @@ bool cbDebugLoadSymbol(int argc, char* argv[])
return true;
}
bool cbDebugUnloadSymbol(int argc, char* argv[])
{
if(IsArgumentsLessThan(argc, 2))
return false;
//get some module information
duint modbase = ModBaseFromName(argv[1]);
if(!modbase)
{
dprintf(QT_TRANSLATE_NOOP("DBG", "Invalid module \"%s\"!\n"), argv[1]);
return false;
}
EXCLUSIVE_ACQUIRE(LockModules);
auto info = ModInfoFromAddr(modbase);
if(!info)
{
// TODO: this really isn't supposed to happen, but could if the module is suddenly unloaded
dputs("module not found...");
return false;
}
info->unloadSymbols();
GuiRepaintTableView();
dputs(QT_TRANSLATE_NOOP("DBG", "Done!"));
return true;
}
bool cbInstrImageinfo(int argc, char* argv[])
{
duint address;

View File

@ -13,6 +13,7 @@ bool cbInstrAnalyseadv(int argc, char* argv[]);
bool cbInstrVirtualmod(int argc, char* argv[]);
bool cbDebugDownloadSymbol(int argc, char* argv[]);
bool cbDebugLoadSymbol(int argc, char* argv[]);
bool cbDebugUnloadSymbol(int argc, char* argv[]);
bool cbInstrImageinfo(int argc, char* argv[]);
bool cbInstrGetRelocSize(int argc, char* argv[]);
bool cbInstrExhandlers(int argc, char* argv[]);

View File

@ -325,6 +325,7 @@ static void registercommands()
dbgcmdnew("virtualmod", cbInstrVirtualmod, true); //virtual module
dbgcmdnew("symdownload,downloadsym", cbDebugDownloadSymbol, true); //download symbols
dbgcmdnew("symload,loadsym", cbDebugLoadSymbol, true); //load symbols
dbgcmdnew("symunload,unloadsym", cbDebugUnloadSymbol, true); //unload symbols
dbgcmdnew("imageinfo,modimageinfo", cbInstrImageinfo, true); //print module image information
dbgcmdnew("GetRelocSize,grs", cbInstrGetRelocSize, true); //get relocation table size
dbgcmdnew("exhandlers", cbInstrExhandlers, true); //enumerate exception handlers