Refactor process detaching code

This commit is contained in:
TuxSH
2019-03-31 22:58:36 +02:00
parent fb800bd4c9
commit 63736d7873
7 changed files with 163 additions and 137 deletions

View File

@@ -72,7 +72,7 @@ typedef enum GDBState
GDB_STATE_CONNECTED,
GDB_STATE_NOACK_SENT,
GDB_STATE_NOACK,
GDB_STATE_CLOSING
GDB_STATE_DETACHING
} GDBState;
typedef struct ThreadInfo
@@ -81,9 +81,12 @@ typedef struct ThreadInfo
u32 tls;
} ThreadInfo;
struct GDBServer;
typedef struct GDBContext
{
sock_ctx super;
struct GDBServer *parent;
RecursiveLock lock;
u16 localPort;
@@ -98,7 +101,7 @@ typedef struct GDBContext
u32 currentThreadId, selectedThreadId, selectedThreadIdForContinuing;
u32 totalNbCreatedThreads;
Handle clientAcceptedEvent, continuedEvent;
Handle processAttachedEvent, continuedEvent;
Handle eventToWaitFor;
bool catchThreadEvents;
@@ -130,4 +133,8 @@ typedef int (*GDBCommandHandler)(GDBContext *ctx);
void GDB_InitializeContext(GDBContext *ctx);
void GDB_FinalizeContext(GDBContext *ctx);
Result GDB_AttachToProcess(GDBContext *ctx);
void GDB_DetachFromProcess(GDBContext *ctx);
GDB_DECLARE_HANDLER(Unsupported);