GdbServer object was getting deleted before the socket thread was shutdown which was causing a crash on detach. Now on destructor it will wait for the thread to thread to exit.