mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2025-01-03 11:11:14 +00:00
thermosphere: gdb: fix a few bugs
This commit is contained in:
parent
86eaa7777b
commit
eff433f62c
5 changed files with 14 additions and 12 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue