mirror of
https://github.com/wiiu-env/gdbstub_plugin.git
synced 2024-11-26 05:24:22 +01:00
Fix bug that made debugger thread hang after reconnecting twice
This commit is contained in:
parent
90cf855667
commit
b85459eaec
13
main.py
13
main.py
@ -141,7 +141,6 @@ class Debugger:
|
||||
self.s.settimeout(4)
|
||||
self.s.connect((host, 1560))
|
||||
self.connected = True
|
||||
self.closeRequest = False
|
||||
events.Connected.emit()
|
||||
|
||||
def handleClose(self):
|
||||
@ -272,12 +271,16 @@ class Debugger:
|
||||
self.sendall(bytes([byte]))
|
||||
|
||||
def sendall(self, data):
|
||||
try:
|
||||
self.s.sendall(data)
|
||||
except socket.error:
|
||||
self.handleClose()
|
||||
if self.connected:
|
||||
try:
|
||||
self.s.sendall(data)
|
||||
except socket.error:
|
||||
self.handleClose()
|
||||
|
||||
def recvall(self, num):
|
||||
if not self.connected:
|
||||
return bytes(num)
|
||||
|
||||
try:
|
||||
data = b""
|
||||
while len(data) < num:
|
||||
|
@ -306,7 +306,9 @@ void ExceptionMgr::cleanup() {
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
ExceptionState *state = list[i];
|
||||
OSSendMessage(&state->queue, &message, OS_MESSAGE_FLAGS_BLOCKING);
|
||||
if (state->isPaused) {
|
||||
OSSendMessage(&state->queue, &message, OS_MESSAGE_FLAGS_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
unlock();
|
||||
@ -331,6 +333,7 @@ ExceptionState *ExceptionMgr::findOrCreate(OSThread *thread) {
|
||||
if (!state) {
|
||||
state = new ExceptionState();
|
||||
state->thread = thread;
|
||||
state->isPaused = false;
|
||||
OSInitMessageQueue(&state->queue, &state->message, 1);
|
||||
list.push_back(state);
|
||||
}
|
||||
@ -512,7 +515,9 @@ Debugger::StepCommand Debugger::notifyBreak(ExceptionState *state) {
|
||||
message.args[2] = (uint32_t)state->thread;
|
||||
OSSendMessage(&eventQueue, &message, OS_MESSAGE_FLAGS_BLOCKING);
|
||||
|
||||
state->isPaused = true;
|
||||
OSReceiveMessage(&state->queue, &message, OS_MESSAGE_FLAGS_BLOCKING);
|
||||
state->isPaused = false;
|
||||
return (StepCommand)message.message;
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,8 @@ public:
|
||||
|
||||
OSMessageQueue queue;
|
||||
OSMessage message;
|
||||
|
||||
bool isPaused;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user