Attempt to make gdb server to exit gracefully
This commit is contained in:
parent
aa89de282b
commit
5676534ec1
|
@ -81,6 +81,11 @@ int dbg_sys_getc(void)
|
||||||
size_t len = sizeof packet;
|
size_t len = sizeof packet;
|
||||||
const enum read_socket_err err = ReadSocket(client_socket, &packet, &len);
|
const enum read_socket_err err = ReadSocket(client_socket, &packet, &len);
|
||||||
|
|
||||||
|
#ifdef _POSIX_VERSION
|
||||||
|
if (exit_loop)
|
||||||
|
pthread_exit(NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (err) {
|
switch (err) {
|
||||||
case READ_SOCKET_OK:
|
case READ_SOCKET_OK:
|
||||||
return packet;
|
return packet;
|
||||||
|
@ -130,6 +135,9 @@ static int wait_hit_or_break(struct msg *msg)
|
||||||
do {
|
do {
|
||||||
int ret = mq_receive(in_queue, (char *)msg, sizeof *msg, 0);
|
int ret = mq_receive(in_queue, (char *)msg, sizeof *msg, 0);
|
||||||
|
|
||||||
|
if (exit_loop)
|
||||||
|
return 1;
|
||||||
|
|
||||||
if (ret < 0 && errno == EAGAIN) {
|
if (ret < 0 && errno == EAGAIN) {
|
||||||
/* Breakpoint has not been hit yet, look for incoming messages from gdb. */
|
/* Breakpoint has not been hit yet, look for incoming messages from gdb. */
|
||||||
char packet;
|
char packet;
|
||||||
|
@ -213,6 +221,9 @@ static int wait_ack(struct msg *msg)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
if (exit_loop)
|
||||||
|
return 1;
|
||||||
|
|
||||||
ret = mq_receive(in_queue, (char *)msg, sizeof *msg, 0);
|
ret = mq_receive(in_queue, (char *)msg, sizeof *msg, 0);
|
||||||
} while (ret < 0 && errno == EAGAIN);
|
} while (ret < 0 && errno == EAGAIN);
|
||||||
|
|
||||||
|
|
|
@ -466,8 +466,6 @@ int main(int argc, char *argv[]) {
|
||||||
psxCpu->Execute();
|
psxCpu->Execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.GdbServer) dbg_stop();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,6 +513,7 @@ void SysClose() {
|
||||||
ReleasePlugins();
|
ReleasePlugins();
|
||||||
|
|
||||||
StopDebugger();
|
StopDebugger();
|
||||||
|
if (Config.GdbServer) dbg_stop();
|
||||||
|
|
||||||
if (emuLog != NULL) fclose(emuLog);
|
if (emuLog != NULL) fclose(emuLog);
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,8 +244,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||||
|
|
||||||
RunGui();
|
RunGui();
|
||||||
|
|
||||||
if (Config.GdbServer) dbg_stop();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2018,6 +2016,7 @@ void SysClose() {
|
||||||
ReleasePlugins();
|
ReleasePlugins();
|
||||||
|
|
||||||
StopDebugger();
|
StopDebugger();
|
||||||
|
if (Config.GdbServer) dbg_stop();
|
||||||
|
|
||||||
if (Config.PsxOut) CloseConsole();
|
if (Config.PsxOut) CloseConsole();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue