1
0
Fork 0

DBG: gracefully break a trace when pausing

This commit is contained in:
mrexodia 2017-06-30 14:08:28 +02:00
parent a3a25e1695
commit a2e245299a
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
3 changed files with 26 additions and 1 deletions

View File

@ -241,6 +241,11 @@ bool cbDebugPause(int argc, char* argv[])
_dbg_animatestop(); // pause when animating
return true;
}
if(dbgtraceactive())
{
dbgforcebreaktrace(); // pause when tracing
return true;
}
if(!DbgIsDebugging())
{
dputs(QT_TRANSLATE_NOOP("DBG", "Not debugging!"));

View File

@ -196,6 +196,16 @@ struct TraceState
logFile = StringUtils::Utf8ToUtf16(fileName);
}
bool ForceBreakTrace()
{
return forceBreakTrace;
}
void SetForceBreakTrace()
{
forceBreakTrace = true;
}
void Clear()
{
delete traceCondition;
@ -210,6 +220,7 @@ struct TraceState
delete logWriter;
logWriter = nullptr;
writeUtf16 = false;
forceBreakTrace = false;
}
private:
@ -221,7 +232,9 @@ private:
WString logFile;
BufferedWriter* logWriter = nullptr;
bool writeUtf16 = false;
bool forceBreakTrace = false;
};
// Debugging variables
static PROCESS_INFORMATION g_pi = {0, 0, 0, 0};
static char szBaseFileName[MAX_PATH] = "";
@ -331,6 +344,12 @@ bool dbgtraceactive()
return traceState.IsActive();
}
void dbgforcebreaktrace()
{
if(traceState.IsActive())
traceState.SetForceBreakTrace();
}
bool dbgsettracelogfile(const char* fileName)
{
traceState.SetLogFile(fileName);
@ -1363,7 +1382,7 @@ static void cbTraceUniversalConditionalStep(duint cip, bool bStepInto, void(*cal
if(varget("$traceswitchcondition", &script_breakcondition, nullptr, nullptr))
switchCondition = script_breakcondition != 0;
}
if(breakCondition) //break the debugger
if(breakCondition || traceState.ForceBreakTrace()) //break the debugger
{
auto steps = dbgcleartracestate();
varset("$tracecounter", steps, true);

View File

@ -72,6 +72,7 @@ bool dbgsettracelog(const String & expression, const String & text);
bool dbgsettracecmd(const String & expression, const String & text);
bool dbgsettraceswitchcondition(const String & expression);
bool dbgtraceactive();
void dbgforcebreaktrace();
bool dbgsettracelogfile(const char* fileName);
void dbgsetdebuggeeinitscript(const char* fileName);
const char* dbggetdebuggeeinitscript();