thermosphere: fix break/continue (?), fix attach/detach
This commit is contained in:
@@ -50,8 +50,8 @@ static const struct{
|
||||
} gdbCommandHandlers[] = {
|
||||
{ '?', GDB_HANDLER(GetStopReason) },
|
||||
{ '!', GDB_HANDLER(EnableExtendedMode) },
|
||||
{ 'c', GDB_HANDLER(Continue) },
|
||||
{ 'C', GDB_HANDLER(Continue) },
|
||||
{ 'c', GDB_HANDLER(ContinueOrStepDeprecated) },
|
||||
{ 'C', GDB_HANDLER(ContinueOrStepDeprecated) },
|
||||
{ 'D', GDB_HANDLER(Detach) },
|
||||
{ 'F', GDB_HANDLER(HioReply) },
|
||||
{ 'g', GDB_HANDLER(ReadRegisters) },
|
||||
@@ -184,14 +184,27 @@ void GDB_InitializeContext(GDBContext *ctx, TransportInterfaceType ifaceType, u3
|
||||
|
||||
void GDB_AttachToContext(GDBContext *ctx)
|
||||
{
|
||||
if (!(ctx->flags & GDB_FLAG_ATTACHED_AT_START)) {
|
||||
// TODO: debug pause
|
||||
}
|
||||
|
||||
// TODO: move the debug traps enable here?
|
||||
// TODO: process the event
|
||||
|
||||
ctx->attachedCoreList = getActiveCoreMask();
|
||||
|
||||
// We're in full-stop mode at this point
|
||||
// Break cores, but don't send the debug event (it will be fetched with '?')
|
||||
// Initialize lastDebugEvent
|
||||
|
||||
debugManagerSetReportingEnabled(true);
|
||||
ctx->sendOwnDebugEventDisallowed = true;
|
||||
|
||||
GDB_BreakAllCores(ctx);
|
||||
|
||||
DebugEventInfo *info = debugManagerGetCoreDebugEvent(currentCoreCtx->coreId);
|
||||
info->preprocessed = true;
|
||||
info->handled = true;
|
||||
ctx->lastDebugEvent = info;
|
||||
|
||||
ctx->state = GDB_STATE_ATTACHED;
|
||||
|
||||
ctx->sendOwnDebugEventDisallowed = false;
|
||||
}
|
||||
|
||||
void GDB_DetachFromContext(GDBContext *ctx)
|
||||
@@ -212,6 +225,9 @@ void GDB_DetachFromContext(GDBContext *ctx)
|
||||
|
||||
ctx->currentHioRequestTargetAddr = 0;
|
||||
memset(&ctx->currentHioRequest, 0, sizeof(PackedGdbHioRequest));
|
||||
|
||||
debugManagerSetReportingFalse(true);
|
||||
debugManagerContinueCores(getActiveCoreMask());
|
||||
}
|
||||
|
||||
void GDB_AcquireContext(GDBContext *ctx)
|
||||
|
||||
@@ -31,13 +31,13 @@ static bool GDB_PreprocessDebugEvent(GDBContext *ctx, DebugEventInfo *info)
|
||||
switch (info->type) {
|
||||
case DBGEVENT_CORE_ON: {
|
||||
shouldSignal = ctx->catchThreadEvents;
|
||||
if (!info->handled) {
|
||||
if (!info->preprocessed) {
|
||||
ctx->attachedCoreList |= BIT(info->coreId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DBGEVENT_CORE_OFF: {
|
||||
if (!info->handled) {
|
||||
if (!info->preprocessed) {
|
||||
u32 newLst = ctx->attachedCoreList & ~BIT(info->coreId);
|
||||
if (ctx->selectedThreadId == info->coreId && newLst != 0) {
|
||||
ctx->selectedThreadId = __builtin_ctz(newLst);
|
||||
@@ -46,7 +46,7 @@ static bool GDB_PreprocessDebugEvent(GDBContext *ctx, DebugEventInfo *info)
|
||||
ctx->attachedCoreList = newLst;
|
||||
shouldSignal = ctx->catchThreadEvents || newLst == 0;
|
||||
} else {
|
||||
shouldSignal = ctx->catchThreadEvents;
|
||||
shouldSignal = ctx->catchThreadEvents || ctx->attachedCoreList == 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -56,7 +56,7 @@ static bool GDB_PreprocessDebugEvent(GDBContext *ctx, DebugEventInfo *info)
|
||||
break;
|
||||
}
|
||||
|
||||
info->handled = true;
|
||||
info->preprocessed = true;
|
||||
restoreInterruptFlags(irqFlags);
|
||||
return shouldSignal;
|
||||
}
|
||||
@@ -287,7 +287,14 @@ void GDB_BreakAllCores(GDBContext *ctx)
|
||||
if (ctx->flags & GDB_FLAG_NONSTOP) {
|
||||
debugManagerBreakCores(ctx->attachedCoreList);
|
||||
} else {
|
||||
debugManagerBreakCores(BIT(currentCoreCtx->coreId));
|
||||
// Break all cores too, but mark everything but the first has handled
|
||||
debugManagerBreakCores(ctx->attachedCoreList);
|
||||
u32 rem = ctx->attachedCoreList & ~BIT(currentCoreCtx->coreId);
|
||||
FOREACH_BIT (tmp, coreId, rem) {
|
||||
DebugEventInfo *info = debugManagerGetCoreDebugEvent(coreId);
|
||||
info->handled = true;
|
||||
info->preprocessed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,10 +11,11 @@
|
||||
#include "../core_ctx.h"
|
||||
#include "../debug_manager.h"
|
||||
|
||||
void GDB_ContinueExecution(GDBContext *ctx);
|
||||
int GDB_SendStopReply(GDBContext *ctx, DebugEventInfo *info, bool asNotification);
|
||||
int GDB_TrySignalDebugEvent(GDBContext *ctx, DebugEventInfo *info);
|
||||
|
||||
void GDB_BreakAllCores(GDBContext *ctx);
|
||||
|
||||
GDB_DECLARE_VERBOSE_HANDLER(Stopped);
|
||||
|
||||
GDB_DECLARE_HANDLER(Detach);
|
||||
|
||||
Reference in New Issue
Block a user