gdb: rework meaning of selected/used
This commit is contained in:
parent
bd670cf87c
commit
e57b546dd4
@ -57,15 +57,16 @@ typedef struct Breakpoint
|
||||
bool persistent;
|
||||
} Breakpoint;
|
||||
|
||||
typedef enum GDBFlags
|
||||
enum
|
||||
{
|
||||
GDB_FLAG_SELECTED = 1,
|
||||
GDB_FLAG_USED = 2,
|
||||
GDB_FLAG_ALLOCATED_MASK = GDB_FLAG_SELECTED | GDB_FLAG_USED,
|
||||
GDB_FLAG_NOACK = 4,
|
||||
GDB_FLAG_PROCESS_CONTINUING = 8,
|
||||
GDB_FLAG_TERMINATE_PROCESS = 16,
|
||||
GDB_FLAG_ATTACHED_AT_START = 32,
|
||||
} GDBFlags;
|
||||
};
|
||||
|
||||
typedef enum GDBState
|
||||
{
|
||||
@ -91,7 +92,7 @@ typedef struct GDBContext
|
||||
RecursiveLock lock;
|
||||
u16 localPort;
|
||||
|
||||
GDBFlags flags;
|
||||
u32 flags;
|
||||
GDBState state;
|
||||
|
||||
u32 pid;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user