diff --git a/thermosphere/src/debug_manager.c b/thermosphere/src/debug_manager.c index 30b8ec313..df425e71a 100644 --- a/thermosphere/src/debug_manager.c +++ b/thermosphere/src/debug_manager.c @@ -169,7 +169,8 @@ DebugEventInfo *debugManagerGetCoreDebugEvent(u32 coreId) void debugManagerReportEvent(DebugEventType type, ...) { u64 flags = maskIrq(); - if (!atomic_load(&g_debugManager.reportingEnabled)) { + bool reportingEnabled = atomic_load(&g_debugManager.reportingEnabled); + if (!reportingEnabled && type != DBGEVENT_DEBUGGER_BREAK) { restoreInterruptFlags(flags); return; } @@ -200,10 +201,12 @@ void debugManagerReportEvent(DebugEventType type, ...) // Now, pause ourselves and try to signal we have a debug event debugManagerDoPauseCores(BIT(coreId)); - exceptionEnterInterruptibleHypervisorCode(); - unmaskIrq(); + if (reportingEnabled) { + exceptionEnterInterruptibleHypervisorCode(); + unmaskIrq(); - GDB_TrySignalDebugEvent(&g_gdbContext, info); + GDB_TrySignalDebugEvent(&g_gdbContext, info); + } restoreInterruptFlags(flags); } @@ -214,7 +217,7 @@ void debugManagerBreakCores(u32 coreList) if (coreList & ~BIT(coreId)) { generateSgiForList(ThermosphereSgi_ReportDebuggerBreak, coreList & ~BIT(coreId)); } - if (coreList & BIT(coreId) && !debugManagerIsCorePaused(coreId)) { + if ((coreList & BIT(coreId)) && !debugManagerIsCorePaused(coreId)) { debugManagerReportEvent(DBGEVENT_DEBUGGER_BREAK); } diff --git a/thermosphere/src/gdb/debug.c b/thermosphere/src/gdb/debug.c index 9464bc6b8..fcf116616 100644 --- a/thermosphere/src/gdb/debug.c +++ b/thermosphere/src/gdb/debug.c @@ -345,7 +345,7 @@ GDB_DECLARE_HANDLER(GetStopReason) bool nonStop = (ctx->flags & GDB_FLAG_NONSTOP) != 0; if (!nonStop) { // Full-stop: - return GDB_SendStopReply(ctx, ctx->lastDebugEvent, true); + return GDB_SendStopReply(ctx, ctx->lastDebugEvent, false); } else { // Non-stop, start new vStopped sequence ctx->sentDebugEventCoreList = 0; diff --git a/thermosphere/src/main.c b/thermosphere/src/main.c index 8aa9abac7..b6c3f51d0 100644 --- a/thermosphere/src/main.c +++ b/thermosphere/src/main.c @@ -137,6 +137,6 @@ void thermosphereMain(ExceptionStackFrame *frame, u64 pct) if (!currentCoreCtx->isBootCore) { debugManagerReportEvent(DBGEVENT_CORE_ON); } else { - debugManagerPauseCores(BIT(currentCoreCtx->coreId)); + debugManagerReportEvent(DBGEVENT_DEBUGGER_BREAK); } }