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