gdb: simply gdbstate
This commit is contained in:
parent
5f295c4227
commit
1e0996c395
@ -61,9 +61,10 @@ typedef enum GDBFlags
|
||||
{
|
||||
GDB_FLAG_SELECTED = 1,
|
||||
GDB_FLAG_USED = 2,
|
||||
GDB_FLAG_PROCESS_CONTINUING = 4,
|
||||
GDB_FLAG_TERMINATE_PROCESS = 8,
|
||||
GDB_FLAG_ATTACHED_AT_START = 16,
|
||||
GDB_FLAG_NOACK = 4,
|
||||
GDB_FLAG_PROCESS_CONTINUING = 8,
|
||||
GDB_FLAG_TERMINATE_PROCESS = 16,
|
||||
GDB_FLAG_ATTACHED_AT_START = 32,
|
||||
} GDBFlags;
|
||||
|
||||
typedef enum GDBState
|
||||
@ -71,7 +72,6 @@ typedef enum GDBState
|
||||
GDB_STATE_DISCONNECTED,
|
||||
GDB_STATE_CONNECTED,
|
||||
GDB_STATE_NOACK_SENT,
|
||||
GDB_STATE_NOACK,
|
||||
GDB_STATE_DETACHING
|
||||
} GDBState;
|
||||
|
||||
|
@ -178,7 +178,6 @@ void GDB_DetachFromProcess(GDBContext *ctx)
|
||||
ctx->nbThreads = 0;
|
||||
ctx->totalNbCreatedThreads = 0;
|
||||
memset(ctx->threadInfos, 0, sizeof(ctx->threadInfos));
|
||||
ctx->catchThreadEvents = false;
|
||||
}
|
||||
|
||||
GDB_DECLARE_HANDLER(Unsupported)
|
||||
|
@ -141,7 +141,7 @@ int GDB_ReceivePacket(GDBContext *ctx)
|
||||
return -1;
|
||||
if(ctx->buffer[0] == '+') // GDB sometimes acknowleges TCP acknowledgment packets (yes...). IDA does it properly
|
||||
{
|
||||
if(ctx->state == GDB_STATE_NOACK)
|
||||
if(ctx->flags & GDB_FLAG_NOACK)
|
||||
return -1;
|
||||
|
||||
// Consume it
|
||||
@ -193,7 +193,7 @@ int GDB_ReceivePacket(GDBContext *ctx)
|
||||
ctx->commandEnd = ctx->buffer;
|
||||
}
|
||||
|
||||
if(ctx->state >= GDB_STATE_CONNECTED && ctx->state < GDB_STATE_NOACK)
|
||||
if(!(ctx->flags & GDB_FLAG_NOACK))
|
||||
{
|
||||
int r2 = soc_send(ctx->super.sockfd, "+", 1, 0);
|
||||
if(r2 != 1)
|
||||
@ -201,12 +201,12 @@ int GDB_ReceivePacket(GDBContext *ctx)
|
||||
}
|
||||
|
||||
if(ctx->state == GDB_STATE_NOACK_SENT)
|
||||
ctx->state = GDB_STATE_NOACK;
|
||||
ctx->flags |= GDB_FLAG_NOACK;
|
||||
|
||||
return r;
|
||||
|
||||
packet_error:
|
||||
if(ctx->state >= GDB_STATE_CONNECTED && ctx->state < GDB_STATE_NOACK)
|
||||
if(!(ctx->flags & GDB_FLAG_NOACK))
|
||||
{
|
||||
r = soc_send(ctx->super.sockfd, "-", 1, 0);
|
||||
if(r != 1)
|
||||
|
@ -205,6 +205,9 @@ void GDB_ReleaseClient(GDBServer *server, GDBContext *ctx)
|
||||
ctx->enableExternalMemoryAccess = false;
|
||||
ctx->flags = (GDBFlags)0;
|
||||
ctx->state = GDB_STATE_DISCONNECTED;
|
||||
|
||||
ctx->catchThreadEvents = false;
|
||||
|
||||
RecursiveLock_Unlock(&ctx->lock);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user