Qt: Fix launching with -g (fixes #1018)

This commit is contained in:
Vicki Pfau 2018-04-25 09:09:17 -07:00
parent 7731516388
commit 88ef2e2169
4 changed files with 13 additions and 4 deletions

View File

@ -32,6 +32,10 @@ void DebuggerController::setController(std::shared_ptr<CoreController> controlle
connect(m_gameController.get(), &CoreController::stopping, [this]() {
setController(nullptr);
});
if (m_autoattach) {
m_autoattach = false;
attach();
}
}
}
@ -43,11 +47,12 @@ void DebuggerController::attach() {
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 @@ void DebuggerController::detach() {
CoreController::Interrupter interrupter(m_gameController);
shutdownInternal();
m_gameController->setDebugger(nullptr);
} else {
m_autoattach = false;
}
}
@ -67,7 +74,7 @@ void DebuggerController::breakInto() {
}
void DebuggerController::shutdown() {
QObject::disconnect(m_autoattach);
m_autoattach = false;
if (!isAttached()) {
return;
}

View File

@ -39,7 +39,7 @@ protected:
std::shared_ptr<CoreController> m_gameController;
private:
QMetaObject::Connection m_autoattach;
bool m_autoattach = false;
};
}

View File

@ -34,7 +34,6 @@ void GDBController::setBindAddress(uint32_t bindAddress) {
}
void GDBController::listen() {
CoreController::Interrupter interrupter(m_gameController);
if (!isAttached()) {
attach();
}

View File

@ -175,6 +175,9 @@ void Window::argumentsPassed(mArguments* args) {
if (args->debuggerType == DEBUGGER_GDB) {
if (!m_gdbController) {
m_gdbController = new GDBController(this);
if (m_controller) {
m_gdbController->setController(m_controller);
}
m_gdbController->listen();
}
}