gdb: rework meaning of selected/used

This commit is contained in:
TuxSH
2019-04-10 23:38:10 +02:00
parent bd670cf87c
commit e57b546dd4
3 changed files with 10 additions and 9 deletions

View File

@@ -114,7 +114,7 @@ GDBContext *GDB_SelectAvailableContext(GDBServer *server, u16 minPort, u16 maxPo
// Get a context
u32 id;
for(id = 0; id < MAX_DEBUG && (server->ctxs[id].flags & GDB_FLAG_SELECTED); id++);
for(id = 0; id < MAX_DEBUG && (server->ctxs[id].flags & GDB_FLAG_ALLOCATED_MASK); id++);
if(id < MAX_DEBUG)
ctx = &server->ctxs[id];
else
@@ -129,7 +129,7 @@ GDBContext *GDB_SelectAvailableContext(GDBServer *server, u16 minPort, u16 maxPo
bool portUsed = false;
for(id = 0; id < MAX_DEBUG; id++)
{
if((server->ctxs[id].flags & GDB_FLAG_SELECTED) && server->ctxs[id].localPort == port)
if((server->ctxs[id].flags & GDB_FLAG_ALLOCATED_MASK) && server->ctxs[id].localPort == port)
portUsed = true;
}
@@ -158,7 +158,7 @@ GDBContext *GDB_FindAllocatedContextByPid(GDBServer *server, u32 pid)
GDBContext *ctx = NULL;
for(u32 i = 0; i < MAX_DEBUG; i++)
{
if((server->ctxs[i].flags & GDB_FLAG_SELECTED) && server->ctxs[i].pid == pid)
if((server->ctxs[i].flags & GDB_FLAG_ALLOCATED_MASK) && server->ctxs[i].pid == pid)
ctx = &server->ctxs[i];
}
GDB_UnlockAllContexts(server);
@@ -216,7 +216,7 @@ void GDB_ReleaseClient(GDBServer *server, GDBContext *ctx)
RecursiveLock_Lock(&ctx->lock);
ctx->localPort = 0;
ctx->enableExternalMemoryAccess = false;
ctx->flags = (GDBFlags)0;
ctx->flags = 0;
ctx->state = GDB_STATE_DISCONNECTED;
ctx->catchThreadEvents = false;
@@ -266,7 +266,7 @@ int GDB_DoPacket(GDBContext *ctx)
int ret;
RecursiveLock_Lock(&ctx->lock);
GDBFlags oldFlags = ctx->flags;
u32 oldFlags = ctx->flags;
if(ctx->state == GDB_STATE_DISCONNECTED)
return -1;

View File

@@ -73,7 +73,7 @@ void debuggerSetNextApplicationDebugHandle(Handle debug)
GDB_LockAllContexts(&gdbServer);
nextApplicationGdbCtx->debug = debug;
if (debug == 0)
nextApplicationGdbCtx->flags = (GDBFlags)0;
nextApplicationGdbCtx->flags = 0;
else
nextApplicationGdbCtx->flags |= GDB_FLAG_ATTACHED_AT_START;
nextApplicationGdbCtx = NULL;