1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-19 08:52:25 +00:00

thermosphere: fix reporting logic of initial break event

This commit is contained in:
TuxSH 2020-02-01 16:20:45 +00:00
parent 7acd5a9ec7
commit cb4d898579
3 changed files with 10 additions and 7 deletions

View file

@ -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));
if (reportingEnabled) {
exceptionEnterInterruptibleHypervisorCode();
unmaskIrq();
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);
}

View file

@ -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;

View file

@ -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);
}
}