gdb: rework meaning of selected/used
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user