Qt: Update debugger portions to use threadInterrupt/threadContinue

This commit is contained in:
Jeffrey Pfau 2015-01-07 02:05:52 -08:00
parent 7a7dcea212
commit aa12eeef3a
2 changed files with 8 additions and 12 deletions

View File

@ -49,28 +49,25 @@ void GDBController::detach() {
if (!isAttached()) { if (!isAttached()) {
return; return;
} }
bool wasPaused = m_gameController->isPaused();
disconnect(m_gameController, SIGNAL(frameAvailable(const uint32_t*)), this, SLOT(updateGDB())); disconnect(m_gameController, SIGNAL(frameAvailable(const uint32_t*)), this, SLOT(updateGDB()));
m_gameController->setPaused(true); m_gameController->threadInterrupt();
GDBStubShutdown(&m_gdbStub); GDBStubShutdown(&m_gdbStub);
m_gameController->setDebugger(nullptr); m_gameController->setDebugger(nullptr);
m_gameController->setPaused(wasPaused); m_gameController->threadContinue();
} }
void GDBController::listen() { void GDBController::listen() {
m_gameController->threadInterrupt();
if (!isAttached()) { if (!isAttached()) {
attach(); attach();
} }
bool wasPaused = m_gameController->isPaused();
connect(m_gameController, SIGNAL(frameAvailable(const uint32_t*)), this, SLOT(updateGDB())); connect(m_gameController, SIGNAL(frameAvailable(const uint32_t*)), this, SLOT(updateGDB()));
m_gameController->setPaused(true);
GDBStubListen(&m_gdbStub, m_port, m_bindAddress); GDBStubListen(&m_gdbStub, m_port, m_bindAddress);
m_gameController->setPaused(wasPaused); m_gameController->threadContinue();
} }
void GDBController::updateGDB() { void GDBController::updateGDB() {
bool wasPaused = m_gameController->isPaused(); m_gameController->threadInterrupt();
m_gameController->setPaused(true);
GDBStubUpdate(&m_gdbStub); GDBStubUpdate(&m_gdbStub);
m_gameController->setPaused(wasPaused); m_gameController->threadContinue();
} }

View File

@ -146,8 +146,7 @@ ARMDebugger* GameController::debugger() {
} }
void GameController::setDebugger(ARMDebugger* debugger) { void GameController::setDebugger(ARMDebugger* debugger) {
bool wasPaused = isPaused(); threadInterrupt();
setPaused(true);
if (m_threadContext.debugger && GBAThreadHasStarted(&m_threadContext)) { if (m_threadContext.debugger && GBAThreadHasStarted(&m_threadContext)) {
GBADetachDebugger(m_threadContext.gba); GBADetachDebugger(m_threadContext.gba);
} }
@ -155,7 +154,7 @@ void GameController::setDebugger(ARMDebugger* debugger) {
if (m_threadContext.debugger && GBAThreadHasStarted(&m_threadContext)) { if (m_threadContext.debugger && GBAThreadHasStarted(&m_threadContext)) {
GBAAttachDebugger(m_threadContext.gba, m_threadContext.debugger); GBAAttachDebugger(m_threadContext.gba, m_threadContext.debugger);
} }
setPaused(wasPaused); threadContinue();
} }
#endif #endif