1
0
Fork 0

DBG: commands to change singleshoot flag for breakpoints

This commit is contained in:
mrexodia 2016-08-30 15:35:03 +02:00
parent fd109b8b8f
commit c02dbf7f73
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
3 changed files with 65 additions and 9 deletions

View File

@ -502,6 +502,7 @@ static CMDRESULT cbDebugSetBPXTextCommon(BP_TYPE Type, int argc, char* argv[], c
dprintf(QT_TRANSLATE_NOOP("DBG", "Can't set %s on breakpoint \"%s\"\n"), description, argv[1]);
return STATUS_ERROR;
}
DebugUpdateBreakpointsViewAsync();
return STATUS_CONTINUE;
}
@ -575,8 +576,8 @@ static CMDRESULT cbDebugResetBPXHitCountCommon(BP_TYPE Type, int argc, char* arg
dprintf(QT_TRANSLATE_NOOP("DBG", "Can't set hit count on breakpoint \"%s\""), argv[1]);
return STATUS_ERROR;
}
DebugUpdateBreakpointsViewAsync();
return STATUS_CONTINUE;
}
static CMDRESULT cbDebugSetBPXFastResumeCommon(BP_TYPE Type, int argc, char* argv[])
@ -605,6 +606,37 @@ static CMDRESULT cbDebugSetBPXFastResumeCommon(BP_TYPE Type, int argc, char* arg
dprintf(QT_TRANSLATE_NOOP("DBG", "Can't set fast resume on breakpoint \"%1\""), argv[1]);
return STATUS_ERROR;
}
DebugUpdateBreakpointsViewAsync();
return STATUS_CONTINUE;
}
static CMDRESULT cbDebugSetBPXSingleshootCommon(BP_TYPE Type, int argc, char* argv[])
{
BREAKPOINT bp;
if(argc < 2)
{
dputs(QT_TRANSLATE_NOOP("DBG", "not enough arguments!\n"));
return STATUS_ERROR;
}
auto singleshoot = true;
if(argc > 2)
{
duint value;
if(!valfromstring(argv[2], &value, false))
return STATUS_ERROR;
singleshoot = value != 0;
}
if(!BpGetAny(Type, argv[1], &bp))
{
dprintf(QT_TRANSLATE_NOOP("DBG", "No such breakpoint \"%s\"\n"), argv[1]);
return STATUS_ERROR;
}
if(!BpSetSingleshoot(bp.addr, Type, singleshoot))
{
dprintf(QT_TRANSLATE_NOOP("DBG", "Can't set singleshoot on breakpoint \"%1\""), argv[1]);
return STATUS_ERROR;
}
DebugUpdateBreakpointsViewAsync();
return STATUS_CONTINUE;
}
@ -634,6 +666,7 @@ static CMDRESULT cbDebugSetBPXSilentCommon(BP_TYPE Type, int argc, char* argv[])
dprintf(QT_TRANSLATE_NOOP("DBG", "Can't set fast resume on breakpoint \"%1\""), argv[1]);
return STATUS_ERROR;
}
DebugUpdateBreakpointsViewAsync();
return STATUS_CONTINUE;
}
@ -672,6 +705,11 @@ CMDRESULT cbDebugSetBPXFastResume(int argc, char* argv[])
return cbDebugSetBPXFastResumeCommon(BPNORMAL, argc, argv);
}
CMDRESULT cbDebugSetBPXSingleshoot(int argc, char* argv[])
{
return cbDebugSetBPXSingleshootCommon(BPNORMAL, argc, argv);
}
CMDRESULT cbDebugSetBPXSilent(int argc, char* argv[])
{
return cbDebugSetBPXSilentCommon(BPNORMAL, argc, argv);
@ -717,6 +755,11 @@ CMDRESULT cbDebugSetBPXHardwareFastResume(int argc, char* argv[])
return cbDebugSetBPXFastResumeCommon(BPHARDWARE, argc, argv);
}
CMDRESULT cbDebugSetBPXHardwareSingleshoot(int argc, char* argv[])
{
return cbDebugSetBPXSingleshootCommon(BPHARDWARE, argc, argv);
}
CMDRESULT cbDebugSetBPXHardwareSilent(int argc, char* argv[])
{
return cbDebugSetBPXSilentCommon(BPHARDWARE, argc, argv);
@ -767,6 +810,11 @@ CMDRESULT cbDebugSetBPXMemoryFastResume(int argc, char* argv[])
return cbDebugSetBPXFastResumeCommon(BPMEMORY, argc, argv);
}
CMDRESULT cbDebugSetBPXMemorySingleshoot(int argc, char* argv[])
{
return cbDebugSetBPXSingleshootCommon(BPMEMORY, argc, argv);
}
CMDRESULT cbDebugSetBPXMemorySilent(int argc, char* argv[])
{
return cbDebugSetBPXSilentCommon(BPMEMORY, argc, argv);

View File

@ -24,6 +24,7 @@ CMDRESULT cbDebugSetBPXCommand(int argc, char* argv[]);
CMDRESULT cbDebugSetBPXCommandCondition(int argc, char* argv[]);
CMDRESULT cbDebugGetBPXHitCount(int argc, char* argv[]);
CMDRESULT cbDebugSetBPXFastResume(int argc, char* argv[]);
CMDRESULT cbDebugSetBPXSingleshoot(int argc, char* argv[]);
CMDRESULT cbDebugSetBPXSilent(int argc, char* argv[]);
CMDRESULT cbDebugResetBPXHitCount(int argc, char* argv[]);
CMDRESULT cbDebugSetBPGoto(int argc, char* argv[]);
@ -39,6 +40,7 @@ CMDRESULT cbDebugSetBPXHardwareCommand(int argc, char* argv[]);
CMDRESULT cbDebugSetBPXHardwareCommandCondition(int argc, char* argv[]);
CMDRESULT cbDebugGetBPXHardwareHitCount(int argc, char* argv[]);
CMDRESULT cbDebugSetBPXHardwareFastResume(int argc, char* argv[]);
CMDRESULT cbDebugSetBPXHardwareSingleshoot(int argc, char* argv[]);
CMDRESULT cbDebugSetBPXHardwareSilent(int argc, char* argv[]);
CMDRESULT cbDebugResetBPXHardwareHitCount(int argc, char* argv[]);
CMDRESULT cbDebugSetMemoryBpx(int argc, char* argv[]);
@ -53,6 +55,7 @@ CMDRESULT cbDebugSetBPXMemoryCommand(int argc, char* argv[]);
CMDRESULT cbDebugSetBPXMemoryCommandCondition(int argc, char* argv[]);
CMDRESULT cbDebugGetBPXMemoryHitCount(int argc, char* argv[]);
CMDRESULT cbDebugSetBPXMemoryFastResume(int argc, char* argv[]);
CMDRESULT cbDebugSetBPXMemorySingleshoot(int argc, char* argv[]);
CMDRESULT cbDebugSetBPXMemorySilent(int argc, char* argv[]);
CMDRESULT cbDebugResetBPXMemoryHitCount(int argc, char* argv[]);
CMDRESULT cbDebugBplist(int argc, char* argv[]);

View File

@ -147,6 +147,7 @@ static void registercommands()
dbgcmdnew("SetBreakpointCommand", cbDebugSetBPXCommand, true); //set breakpoint command on hit
dbgcmdnew("SetBreakpointCommandCondition", cbDebugSetBPXCommandCondition, true); //set breakpoint commandCondition
dbgcmdnew("SetBreakpointFastResume", cbDebugSetBPXFastResume, true); //set breakpoint fast resume
dbgcmdnew("SetBreakpointSingleshoot", cbDebugSetBPXSingleshoot, true); //set breakpoint singleshoot
dbgcmdnew("SetBreakpointSilent", cbDebugSetBPXSilent, true); //set breakpoint fast resume
dbgcmdnew("GetBreakpointHitCount", cbDebugGetBPXHitCount, true); //get breakpoint hit count
dbgcmdnew("ResetBreakpointHitCount", cbDebugResetBPXHitCount, true); //reset breakpoint hit count
@ -157,6 +158,7 @@ static void registercommands()
dbgcmdnew("SetHardwareBreakpointCommand", cbDebugSetBPXHardwareCommand, true); //set breakpoint command on hit
dbgcmdnew("SetHardwareBreakpointCommandCondition", cbDebugSetBPXHardwareCommandCondition, true); //set breakpoint commandCondition
dbgcmdnew("SetHardwareBreakpointFastResume", cbDebugSetBPXHardwareFastResume, true); //set breakpoint fast resume
dbgcmdnew("SetHardwareBreakpointSingleshoot", cbDebugSetBPXHardwareSingleshoot, true); //set breakpoint singleshoot
dbgcmdnew("SetHardwareBreakpointSilent", cbDebugSetBPXHardwareSilent, true); //set breakpoint fast resume
dbgcmdnew("GetHardwareBreakpointHitCount", cbDebugGetBPXHardwareHitCount, true); //get breakpoint hit count
dbgcmdnew("ResetHardwareBreakpointHitCount", cbDebugResetBPXHardwareHitCount, true); //reset breakpoint hit count
@ -167,6 +169,7 @@ static void registercommands()
dbgcmdnew("SetMemoryBreakpointCommand", cbDebugSetBPXMemoryCommand, true); //set breakpoint command on hit
dbgcmdnew("SetMemoryBreakpointCommandCondition", cbDebugSetBPXMemoryCommandCondition, true); //set breakpoint commandCondition
dbgcmdnew("SetMemoryBreakpointFastResume", cbDebugSetBPXMemoryFastResume, true); //set breakpoint fast resume
dbgcmdnew("SetMemoryBreakpointSingleshoot", cbDebugSetBPXMemorySingleshoot, true); //set breakpoint singleshoot
dbgcmdnew("SetMemoryBreakpointSilent", cbDebugSetBPXMemorySilent, true); //set breakpoint fast resume
dbgcmdnew("SetMemoryGetBreakpointHitCount", cbDebugGetBPXMemoryHitCount, true); //get breakpoint hit count
dbgcmdnew("ResetMemoryBreakpointHitCount", cbDebugResetBPXMemoryHitCount, true); //reset breakpoint hit count
@ -212,6 +215,7 @@ static void registercommands()
dbgcmdnew("mnemonichelp", cbInstrMnemonichelp, false); //mnemonic help
dbgcmdnew("mnemonicbrief", cbInstrMnemonicbrief, false); //mnemonic brief
dbgcmdnew("virtualmod", cbInstrVirtualmod, true); //virtual module
dbgcmdnew("scriptdll\1dllscript", cbScriptDll, false); //execute a script DLL
//user database
dbgcmdnew("cmt\1cmtset\1commentset", cbInstrCmt, true); //set/edit comment
@ -284,7 +288,16 @@ static void registercommands()
dbgcmdnew("reffindrange\1findrefrange\1refrange", cbInstrRefFindRange, true);
dbgcmdnew("yara", cbInstrYara, true); //yara test command
dbgcmdnew("yaramod", cbInstrYaramod, true); //yara rule on module
dbgcmdnew("savedata", cbInstrSavedata, true); //save data to disk
//analysis
dbgcmdnew("analyse\1analyze\1anal", cbInstrAnalyse, true); //secret analysis command
dbgcmdnew("cfanal\1cfanalyse\1cfanalyze", cbInstrCfanalyse, true); //control flow analysis
dbgcmdnew("analyse_nukem\1analyze_nukem\1anal_nukem", cbInstrAnalyseNukem, true); //secret analysis command #2
dbgcmdnew("exanal\1exanalyse\1exanalyze", cbInstrExanalyse, true); //exception directory analysis
dbgcmdnew("analrecur\1analr", cbInstrAnalrecur, true); //analyze a single function
dbgcmdnew("analxrefs\1analx", cbInstrAnalxrefs, true); //analyze xrefs
dbgcmdnew("analadv", cbInstrAnalyseadv, true); //analyze xref,function and data
//Operating System Control
dbgcmdnew("GetPrivilegeState", cbGetPrivilegeState, true); //get priv state
@ -302,17 +315,9 @@ static void registercommands()
dbgcmdnew("capstone", cbInstrCapstone, true); //disassemble using capstone
dbgcmdnew("visualize", cbInstrVisualize, true); //visualize analysis
dbgcmdnew("meminfo", cbInstrMeminfo, true); //command to debug memory map bugs
dbgcmdnew("cfanal\1cfanalyse\1cfanalyze", cbInstrCfanalyse, true); //control flow analysis
dbgcmdnew("analyse_nukem\1analyze_nukem\1anal_nukem", cbInstrAnalyseNukem, true); //secret analysis command #2
dbgcmdnew("exanal\1exanalyse\1exanalyze", cbInstrExanalyse, true); //exception directory analysis
dbgcmdnew("findallmem\1findmemall", cbInstrFindMemAll, true); //memory map pattern find
dbgcmdnew("setmaxfindresult\1findsetmaxresult", cbInstrSetMaxFindResult, false); //set the maximum number of occurences found
dbgcmdnew("savedata", cbInstrSavedata, true); //save data to disk
dbgcmdnew("scriptdll\1dllscript", cbScriptDll, false); //execute a script DLL
dbgcmdnew("briefcheck", cbInstrBriefcheck, true); //check if mnemonic briefs are missing
dbgcmdnew("analrecur\1analr", cbInstrAnalrecur, true); //analyze a single function
dbgcmdnew("analxrefs\1analx", cbInstrAnalxrefs, true); //analyze xrefs
dbgcmdnew("analadv", cbInstrAnalyseadv, true); //analyze xref,function and data
dbgcmdnew("graph", cbInstrGraph, true); //graph function
dbgcmdnew("DisableLog\1LogDisable", cbInstrDisableLog, false); //disable log
dbgcmdnew("EnableLog\1LogEnable", cbInstrEnableLog, false); //enable log