summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authoraldelaro5 <aldelaro5@gmail.com>2021-10-01 01:57:40 -0400
committeraldelaro5 <aldelaro5@gmail.com>2021-10-21 08:26:42 -0400
commit657bb00c0153a754fe120abc4f499f95bdc35816 (patch)
tree977828b5e20a23a1c6dfa73815a8bc95e280847e /Source/Core
parentb8395280d3fb90dc166bdad940c2d2404834104a (diff)
GDBStub: Cleanly shut down on stop
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Core.cpp9
-rw-r--r--Source/Core/Core/PowerPC/GDBStub.cpp9
2 files changed, 17 insertions, 1 deletions
diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp
index f32e814616..444e1bb0ba 100644
--- a/Source/Core/Core/Core.cpp
+++ b/Source/Core/Core/Core.cpp
@@ -393,6 +393,15 @@ static void CpuThread(const std::optional<std::string>& savestate_path, bool del
if (_CoreParameter.bFastmem)
EMM::UninstallExceptionHandler();
+
+#ifdef USE_GDBSTUB
+ if (gdb_active())
+ {
+ gdb_deinit();
+ INFO_LOG_FMT(GDB_STUB, "Killed by CPU shutdown");
+ return;
+ }
+#endif
}
static void FifoPlayerThread(const std::optional<std::string>& savestate_path,
diff --git a/Source/Core/Core/PowerPC/GDBStub.cpp b/Source/Core/Core/PowerPC/GDBStub.cpp
index f588696276..7e947fccf2 100644
--- a/Source/Core/Core/PowerPC/GDBStub.cpp
+++ b/Source/Core/Core/PowerPC/GDBStub.cpp
@@ -689,6 +689,13 @@ void gdb_handle_exception(bool loop_until_continue)
{
while (gdb_active())
{
+ if (CPU::GetState() == CPU::State::PowerDown)
+ {
+ gdb_deinit();
+ INFO_LOG_FMT(GDB_STUB, "killed by power down");
+ return;
+ }
+
if (!gdb_data_available())
{
if (loop_until_continue)
@@ -822,7 +829,7 @@ static void gdb_init_generic(int domain, const sockaddr* server_addr, socklen_t
INFO_LOG_FMT(GDB_STUB, "Client connected.");
#ifdef _WIN32
- closesocket(tmpsock);
+ closesocket(s_tmpsock);
#else
close(tmpsock);
#endif