all repos — mgba @ 88ef2e21693afac38e44222bff9931d8ea575785

mGBA Game Boy Advance Emulator

Qt: Fix launching with -g (fixes #1018)
Vicki Pfau vi@endrift.com
Wed, 25 Apr 2018 09:09:17 -0700
commit

88ef2e21693afac38e44222bff9931d8ea575785

parent

773151638842e8a91cf0f4b2661322719fc3abb9

M src/platform/qt/DebuggerController.cppsrc/platform/qt/DebuggerController.cpp

@@ -32,6 +32,10 @@ if (controller) {

connect(m_gameController.get(), &CoreController::stopping, [this]() { setController(nullptr); }); + if (m_autoattach) { + m_autoattach = false; + attach(); + } } }

@@ -43,11 +47,12 @@ if (m_gameController) {

attachInternal(); m_gameController->setDebugger(m_debugger); mDebuggerEnter(m_debugger, DEBUGGER_ENTER_ATTACHED, 0); + } else { + m_autoattach = true; } } void DebuggerController::detach() { - QObject::disconnect(m_autoattach); if (!isAttached()) { return; }

@@ -55,6 +60,8 @@ if (m_gameController) {

CoreController::Interrupter interrupter(m_gameController); shutdownInternal(); m_gameController->setDebugger(nullptr); + } else { + m_autoattach = false; } }

@@ -67,7 +74,7 @@ mDebuggerEnter(m_debugger, DEBUGGER_ENTER_MANUAL, 0);

} void DebuggerController::shutdown() { - QObject::disconnect(m_autoattach); + m_autoattach = false; if (!isAttached()) { return; }
M src/platform/qt/DebuggerController.hsrc/platform/qt/DebuggerController.h

@@ -39,7 +39,7 @@ mDebugger* const m_debugger;

std::shared_ptr<CoreController> m_gameController; private: - QMetaObject::Connection m_autoattach; + bool m_autoattach = false; }; }
M src/platform/qt/GDBController.cppsrc/platform/qt/GDBController.cpp

@@ -34,7 +34,6 @@ m_bindAddress.ipv4 = htonl(bindAddress);

} void GDBController::listen() { - CoreController::Interrupter interrupter(m_gameController); if (!isAttached()) { attach(); }
M src/platform/qt/Window.cppsrc/platform/qt/Window.cpp

@@ -175,6 +175,9 @@ #ifdef USE_GDB_STUB

if (args->debuggerType == DEBUGGER_GDB) { if (!m_gdbController) { m_gdbController = new GDBController(this); + if (m_controller) { + m_gdbController->setController(m_controller); + } m_gdbController->listen(); } }