From 3311b294b3f38f63e78fe6d731a84f952a26a957 Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Fri, 9 Mar 2012 15:04:59 +0100 Subject: [PATCH] debugger: use target-async/exec-interrupt for remote debugging This seems to be the only way to make the setup work on Windows at all. Change-Id: Ib70c8422dceea84ae5cc9e671de977de0887c80e Reviewed-by: hjk <qthjk@ovi.com> --- src/plugins/debugger/gdb/gdbengine.cpp | 24 ++++++++++++++++++------ src/plugins/debugger/gdb/gdbengine.h | 2 ++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index eba4e69e219..c1ca49f8eb2 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -715,7 +715,7 @@ void GdbEngine::interruptInferior() QTC_ASSERT(state() == InferiorStopRequested, qDebug() << "INTERRUPT INFERIOR: " << state(); return); - if (0 && debuggerCore()->boolSetting(TargetAsync)) { + if (usesExecInterrupt()) { postCommand("-exec-interrupt"); } else { showStatusMessage(tr("Stop requested..."), 5000); @@ -1715,6 +1715,11 @@ void GdbEngine::handleShowVersion(const GdbResponse &response) if (m_gdbVersion > 70300) m_hasBreakpointNotifications = true; + + if (usesExecInterrupt()) + postCommand("set target-async on", ConsoleCommand); + else + postCommand("set target-async off", ConsoleCommand); } } @@ -4707,11 +4712,7 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &settingsIdHint) postCommand("set trust-readonly-sections on", ConsoleCommand); postCommand("set auto-solib-add on", ConsoleCommand); postCommand("set remotecache on", ConsoleCommand); - - if (0 && debuggerCore()->boolSetting(TargetAsync)) { - postCommand("set target-async on", ConsoleCommand); - postCommand("set non-stop on", ConsoleCommand); - } + //postCommand("set non-stop on", ConsoleCommand); // Work around https://bugreports.qt-project.org/browse/QTCREATORBUG-2004 postCommand("maintenance set internal-warning quit no", ConsoleCommand); @@ -5130,6 +5131,17 @@ bool GdbEngine::isHiddenBreakpoint(const BreakpointResponseId &id) const return isQFatalBreakpoint(id) || isQmlStepBreakpoint(id); } +bool GdbEngine::usesExecInterrupt() const +{ + if (m_gdbVersion < 70000) + return false; + + // debuggerCore()->boolSetting(TargetAsync) + DebuggerStartMode mode = startParameters().startMode; + return mode == AttachToRemoteServer + || mode == AttachToRemoteProcess; +} + void GdbEngine::scheduleTestResponse(int testCase, const QByteArray &response) { if (!m_testCases.contains(testCase) && startParameters().testCase != testCase) diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index f8b8fc3df59..08d4e0b17a5 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -732,6 +732,8 @@ private: ////////// View & Data Stuff ////////// BreakpointResponseId m_qFatalBreakpointResponseId; bool m_actingOnExpectedStop; + bool usesExecInterrupt() const; + QHash<int, QByteArray> m_scheduledTestResponses; QSet<int> m_testCases; }; -- GitLab