diff --git a/src/dbg/commands/cmd-debug-control.cpp b/src/dbg/commands/cmd-debug-control.cpp index 7ad4bcce..282e4ca6 100644 --- a/src/dbg/commands/cmd-debug-control.cpp +++ b/src/dbg/commands/cmd-debug-control.cpp @@ -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!")); diff --git a/src/dbg/debugger.cpp b/src/dbg/debugger.cpp index a9d7bad0..d3374d8f 100644 --- a/src/dbg/debugger.cpp +++ b/src/dbg/debugger.cpp @@ -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); diff --git a/src/dbg/debugger.h b/src/dbg/debugger.h index 8868699c..200b5602 100644 --- a/src/dbg/debugger.h +++ b/src/dbg/debugger.h @@ -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();