diff --git a/thermosphere/src/debug_manager.c b/thermosphere/src/debug_manager.c index 1be8c75b3..30b8ec313 100644 --- a/thermosphere/src/debug_manager.c +++ b/thermosphere/src/debug_manager.c @@ -79,7 +79,7 @@ void debugManagerInit(TransportInterfaceType gdbIfaceType, u32 gdbIfaceId, u32 g { memset(&g_debugManager, 0, sizeof(DebugManager)); GDB_InitializeContext(&g_gdbContext, gdbIfaceType, gdbIfaceId, gdbIfaceFlags); - GDB_MigrateRxIrq(&g_gdbContext, BIT(currentCoreCtx->coreId)); + GDB_MigrateRxIrq(&g_gdbContext, currentCoreCtx->coreId); } bool debugManagerHandlePause(void) diff --git a/thermosphere/src/gdb/context.c b/thermosphere/src/gdb/context.c index 555f63f9f..e4918ecee 100644 --- a/thermosphere/src/gdb/context.c +++ b/thermosphere/src/gdb/context.c @@ -234,9 +234,9 @@ void GDB_ReleaseContext(GDBContext *ctx) transportInterfaceRelease(ctx->transportInterface); } -void GDB_MigrateRxIrq(GDBContext *ctx, u32 newAffinity) +void GDB_MigrateRxIrq(GDBContext *ctx, u32 coreId) { - transportInterfaceSetInterruptAffinity(ctx->transportInterface, newAffinity); + transportInterfaceSetInterruptAffinity(ctx->transportInterface, BIT(coreId)); } GDB_DECLARE_HANDLER(Unsupported) diff --git a/thermosphere/src/gdb/context.h b/thermosphere/src/gdb/context.h index 0906d0a33..23cbfb691 100644 --- a/thermosphere/src/gdb/context.h +++ b/thermosphere/src/gdb/context.h @@ -106,7 +106,7 @@ void GDB_DetachFromContext(GDBContext *ctx); void GDB_AcquireContext(GDBContext *ctx); void GDB_ReleaseContext(GDBContext *ctx); -void GDB_MigrateRxIrq(GDBContext *ctx, u32 newAffinity); +void GDB_MigrateRxIrq(GDBContext *ctx, u32 coreId); GDB_DECLARE_HANDLER(Unsupported); GDB_DECLARE_HANDLER(EnableExtendedMode); diff --git a/thermosphere/src/gdb/debug.c b/thermosphere/src/gdb/debug.c index 648b41a3c..9464bc6b8 100644 --- a/thermosphere/src/gdb/debug.c +++ b/thermosphere/src/gdb/debug.c @@ -41,7 +41,7 @@ static bool GDB_PreprocessDebugEvent(GDBContext *ctx, DebugEventInfo *info) u32 newLst = ctx->attachedCoreList & ~BIT(info->coreId); if (ctx->selectedThreadId == info->coreId && newLst != 0) { ctx->selectedThreadId = __builtin_ctz(newLst); - GDB_MigrateRxIrq(ctx, BIT(ctx->selectedThreadId)); + GDB_MigrateRxIrq(ctx, ctx->selectedThreadId); } ctx->attachedCoreList = newLst; shouldSignal = ctx->catchThreadEvents || newLst == 0; diff --git a/thermosphere/src/gdb/net.c b/thermosphere/src/gdb/net.c index d22f66515..2a3bd1aee 100644 --- a/thermosphere/src/gdb/net.c +++ b/thermosphere/src/gdb/net.c @@ -166,9 +166,14 @@ int GDB_ReceivePacket(GDBContext *ctx) } switch (hdr) { - case '+': - // Ack, don't do anything else (if allowed) + case '+': { + // Ack, don't do anything else except maybe NoAckMode state transition + if (ctx->noAckSent) { + ctx->flags |= GDB_FLAG_NOACK; + ctx->noAckSent = false; + } return 0; + } case '-': // Nack, return the previous packet transportInterfaceWriteData(iface, ctx->buffer, ctx->lastSentPacketSize); @@ -231,14 +236,11 @@ int GDB_ReceivePacket(GDBContext *ctx) ctx->state = GDB_STATE_ATTACHED; } - if (ctx->noAckSent) { - ctx->flags |= GDB_FLAG_NOACK; - ctx->noAckSent = false; - } - // Set helper attributes, change '#' to NUL + ctx->commandData = ctx->buffer + 2; ctx->commandEnd = ctx->buffer + delimPos; ctx->buffer[delimPos] = '\0'; + DEBUG("Packet: %s\n", ctx->buffer + 1); return (int)(delimPos + 2); }