From 2360a2d743514014db57ec143c5ff1b469e5ada1 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 13 Mar 2017 13:48:55 +0100 Subject: [PATCH] ProjectExplorer: Run RunControl::{start,stop} always asynchronously This introduces a mini-state-"machine" to handle RunControl states Intialized->[Starting->Running->Stopping->Stopped->]*->Finished. Needing time between trying to start and getting feedback is nowadays the normal setup for all remote targets as well as for most local tools. Making that the default for all runs simplifies the code and provides an opportunity to (a) fix some currently wrong reports of "stopped immediately" and (b) to remove target-specific (WinRT) or tool-specific (Valgrind, GammaRay) state members doing essentially the same. Change-Id: I7f52fee41144188ee8389e922fdc265f8c0a6459 Reviewed-by: David Schulz Reviewed-by: Tobias Hunger --- src/plugins/android/androidruncontrol.cpp | 3 +- src/plugins/android/androidruncontrol.h | 2 +- .../clangstaticanalyzerruncontrol.cpp | 3 +- .../clangstaticanalyzerruncontrol.h | 2 +- src/plugins/debugger/debuggerruncontrol.cpp | 5 +- src/plugins/debugger/debuggerruncontrol.h | 2 +- src/plugins/ios/iosruncontrol.cpp | 3 +- src/plugins/ios/iosruncontrol.h | 3 +- src/plugins/ios/iosrunfactories.cpp | 2 +- src/plugins/projectexplorer/appoutputpane.cpp | 21 ++---- src/plugins/projectexplorer/appoutputpane.h | 2 - .../projectexplorer/projectexplorer.cpp | 13 +--- .../projectexplorer/runconfiguration.cpp | 59 ++++++++++++--- .../projectexplorer/runconfiguration.h | 22 ++++-- .../qmlprofiler/qmlprofilerruncontrol.cpp | 6 +- .../qmlprofiler/qmlprofilerruncontrol.h | 2 +- .../tests/localqmlprofilerrunner_test.cpp | 75 +++++++++++-------- .../tests/localqmlprofilerrunner_test.h | 15 +++- src/plugins/qnx/qnxruncontrol.cpp | 4 +- src/plugins/qnx/qnxruncontrol.h | 2 +- src/plugins/valgrind/memcheckengine.cpp | 6 +- src/plugins/valgrind/memcheckengine.h | 2 +- src/plugins/valgrind/valgrindengine.cpp | 3 +- src/plugins/valgrind/valgrindengine.h | 2 +- src/plugins/winrt/winrtruncontrol.cpp | 5 +- src/plugins/winrt/winrtruncontrol.h | 2 +- 26 files changed, 155 insertions(+), 111 deletions(-) diff --git a/src/plugins/android/androidruncontrol.cpp b/src/plugins/android/androidruncontrol.cpp index 7c5d815a168..eb622956e2c 100644 --- a/src/plugins/android/androidruncontrol.cpp +++ b/src/plugins/android/androidruncontrol.cpp @@ -67,10 +67,9 @@ void AndroidRunControl::start() m_runner->start(); } -RunControl::StopResult AndroidRunControl::stop() +void AndroidRunControl::stop() { m_runner->stop(); - return StoppedSynchronously; } void AndroidRunControl::handleRemoteProcessFinished(const QString &error) diff --git a/src/plugins/android/androidruncontrol.h b/src/plugins/android/androidruncontrol.h index 5dc9fffb6b5..8c23173bf89 100644 --- a/src/plugins/android/androidruncontrol.h +++ b/src/plugins/android/androidruncontrol.h @@ -42,7 +42,7 @@ public: ~AndroidRunControl() override; void start() override; - StopResult stop() override; + void stop() override; QString displayName() const override; private: diff --git a/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 35607a95480..5d8b183cece 100644 --- a/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -563,7 +563,7 @@ void ClangStaticAnalyzerRunControl::start() analyzeNextFile(); } -RunControl::StopResult ClangStaticAnalyzerRunControl::stop() +void ClangStaticAnalyzerRunControl::stop() { QSetIterator i(m_runners); while (i.hasNext()) { @@ -577,7 +577,6 @@ RunControl::StopResult ClangStaticAnalyzerRunControl::stop() Utils::NormalMessageFormat); m_progress.reportFinished(); reportApplicationStop(); - return RunControl::StoppedSynchronously; } void ClangStaticAnalyzerRunControl::analyzeNextFile() diff --git a/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h b/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h index 9776de88d2e..7faf3c311ac 100644 --- a/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h +++ b/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h @@ -57,7 +57,7 @@ public: const CppTools::ProjectInfo &projectInfo); void start() override; - StopResult stop() override; + void stop() override; bool success() const { return m_success; } // For testing. bool supportsReRunning() const override { return false; } diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index 49e85e98405..e3741994938 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -276,11 +276,10 @@ bool DebuggerRunControl::promptToStop(bool *optionalPrompt) const return result; } -RunControl::StopResult DebuggerRunControl::stop() +void DebuggerRunControl::stop() { - QTC_ASSERT(m_engine, return StoppedSynchronously); + QTC_ASSERT(m_engine, return); m_engine->quitDebugger(); - return AsynchronousStop; } void DebuggerRunControl::debuggingFinished() diff --git a/src/plugins/debugger/debuggerruncontrol.h b/src/plugins/debugger/debuggerruncontrol.h index f2c61e21054..5c876e4352f 100644 --- a/src/plugins/debugger/debuggerruncontrol.h +++ b/src/plugins/debugger/debuggerruncontrol.h @@ -68,7 +68,7 @@ public: // ProjectExplorer::RunControl void start() override; bool promptToStop(bool *prompt = 0) const override; - StopResult stop() override; // Called from SnapshotWindow. + void stop() override; // Called from SnapshotWindow. QString displayName() const override; bool supportsReRunning() const override; void handleApplicationOutput(const QString &msg, int channel); diff --git a/src/plugins/ios/iosruncontrol.cpp b/src/plugins/ios/iosruncontrol.cpp index 16997045327..30311f1300c 100644 --- a/src/plugins/ios/iosruncontrol.cpp +++ b/src/plugins/ios/iosruncontrol.cpp @@ -64,10 +64,9 @@ void IosRunControl::start() m_runner->start(); } -RunControl::StopResult IosRunControl::stop() +void IosRunControl::stop() { m_runner->stop(); - return StoppedSynchronously; } void IosRunControl::handleRemoteProcessFinished(bool cleanEnd) diff --git a/src/plugins/ios/iosruncontrol.h b/src/plugins/ios/iosruncontrol.h index b60f73d4527..400087fe9c2 100644 --- a/src/plugins/ios/iosruncontrol.h +++ b/src/plugins/ios/iosruncontrol.h @@ -41,9 +41,8 @@ public: explicit IosRunControl(IosRunConfiguration *runConfig); ~IosRunControl() override; - void start() override; - StopResult stop() override; + void stop() override; QString displayName() const override; private: diff --git a/src/plugins/ios/iosrunfactories.cpp b/src/plugins/ios/iosrunfactories.cpp index 1bc18f473cd..9df208f8c2b 100644 --- a/src/plugins/ios/iosrunfactories.cpp +++ b/src/plugins/ios/iosrunfactories.cpp @@ -179,7 +179,7 @@ RunControl *IosRunControlFactory::create(RunConfiguration *runConfig, // The device can only run an application at a time, if an app is running stop it. if (m_activeRunControls.contains(devId)) { if (QPointer activeRunControl = m_activeRunControls[devId]) - activeRunControl->stop(); + activeRunControl->initiateStop(); m_activeRunControls.remove(devId); } if (mode == ProjectExplorer::Constants::NORMAL_RUN_MODE) diff --git a/src/plugins/projectexplorer/appoutputpane.cpp b/src/plugins/projectexplorer/appoutputpane.cpp index 4be4b6697de..e387b1d0da2 100644 --- a/src/plugins/projectexplorer/appoutputpane.cpp +++ b/src/plugins/projectexplorer/appoutputpane.cpp @@ -506,7 +506,7 @@ void AppOutputPane::reRunRunControl() handleOldOutput(tab.window); tab.window->scrollToBottom(); - tab.runControl->start(); + tab.runControl->initiateStart(); } void AppOutputPane::attachToRunControl() @@ -525,7 +525,7 @@ void AppOutputPane::stopRunControl() RunControl *rc = m_runControlTabs.at(index).runControl; if (rc->isRunning() && optionallyPromptToStop(rc)) - rc->stop(); + rc->initiateStop(); if (debug) qDebug() << "OutputPane::stopRunControl " << rc; @@ -556,7 +556,7 @@ bool AppOutputPane::closeTab(int tabIndex, CloseTabMode closeTabMode) if (debug) qDebug() << "OutputPane::closeTab tab " << tabIndex << m_runControlTabs[index].runControl - << m_runControlTabs[index].window << m_runControlTabs[index].asyncClosing; + << m_runControlTabs[index].window; // Prompt user to stop if (m_runControlTabs[index].runControl->isRunning()) { switch (closeTabMode) { @@ -575,15 +575,8 @@ bool AppOutputPane::closeTab(int tabIndex, CloseTabMode closeTabMode) break; } if (m_runControlTabs[index].runControl->isRunning()) { // yes it might have stopped already, then just close - QWidget *tabWidget = m_tabWidget->widget(tabIndex); - if (m_runControlTabs[index].runControl->stop() == RunControl::AsynchronousStop) { - m_runControlTabs[index].asyncClosing = true; - return false; - } - tabIndex = m_tabWidget->indexOf(tabWidget); - index = indexOf(tabWidget); - if (tabIndex == -1 || index == -1) - return false; + m_runControlTabs[index].runControl->initiateStop(); + return false; } } @@ -741,10 +734,6 @@ void AppOutputPane::slotRunControlFinished2(RunControl *sender) m_runControlTabs.at(senderIndex).window->setFormatter(nullptr); // Reset formater for this RC - // Check for asynchronous close. Close the tab. - if (m_runControlTabs.at(senderIndex).asyncClosing) - closeTab(tabWidgetIndexOf(senderIndex), CloseTabNoPrompt); - emit runControlFinished(sender); if (!isRunning()) diff --git a/src/plugins/projectexplorer/appoutputpane.h b/src/plugins/projectexplorer/appoutputpane.h index 963b66ec9e3..d8129798de7 100644 --- a/src/plugins/projectexplorer/appoutputpane.h +++ b/src/plugins/projectexplorer/appoutputpane.h @@ -128,8 +128,6 @@ private: Core::OutputWindow *window = nullptr); RunControl *runControl; Core::OutputWindow *window; - // Is the run control stopping asynchronously, close the tab once it finishes - bool asyncClosing = false; BehaviorOnOutput behaviorOnOutput = Flash; }; diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 64cdb35e841..f38f8b3150a 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -2004,7 +2004,7 @@ void ProjectExplorerPluginPrivate::startRunControl(RunControl *runControl, Core: || ((runMode == Constants::DEBUG_RUN_MODE || runMode == Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN) && m_projectExplorerSettings.showDebugOutput); m_outputPane->setBehaviorOnOutput(runControl, popup ? AppOutputPane::Popup : AppOutputPane::Flash); - runControl->start(); + runControl->initiateStart(); emit m_instance->updateRunActions(); } @@ -2306,16 +2306,11 @@ int ProjectExplorerPluginPrivate::queue(QList projects, QList ste } } - QList asyncStop; if (stopThem) { - foreach (RunControl *rc, toStop) { - if (rc->stop() == RunControl::AsynchronousStop) - asyncStop << rc; - } - } + foreach (RunControl *rc, toStop) + rc->initiateStop(); - if (!asyncStop.isEmpty()) { - WaitForStopDialog dialog(asyncStop); + WaitForStopDialog dialog(toStop); dialog.exec(); if (dialog.canceled()) diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp index 4bacf18638b..f78b5fd720b 100644 --- a/src/plugins/projectexplorer/runconfiguration.cpp +++ b/src/plugins/projectexplorer/runconfiguration.cpp @@ -535,7 +535,7 @@ public: // A handle to the actual application process. Utils::ProcessHandle applicationProcessHandle; - bool isRunning = false; + RunControl::State state = RunControl::State::Initialized; #ifdef Q_OS_OSX // This is used to bring apps in the foreground on Mac @@ -575,6 +575,18 @@ RunControl::~RunControl() delete d; } +void RunControl::initiateStart() +{ + setState(State::Starting); + QTimer::singleShot(0, this, &RunControl::start); +} + +void RunControl::initiateStop() +{ + setState(State::Stopping); + QTimer::singleShot(0, this, &RunControl::stop); +} + Utils::OutputFormatter *RunControl::outputFormatter() const { return d->outputFormatter; @@ -696,7 +708,7 @@ bool RunControl::promptToStop(bool *optionalPrompt) const bool RunControl::isRunning() const { - return d->isRunning; + return d->state == State::Running; } /*! @@ -735,6 +747,33 @@ bool RunControl::showPromptToStopDialog(const QString &title, return close; } +static bool isAllowedTransition(RunControl::State from, RunControl::State to) +{ + switch (from) { + case RunControl::State::Initialized: + return to == RunControl::State::Starting; + case RunControl::State::Starting: + return to == RunControl::State::Running; + case RunControl::State::Running: + return to == RunControl::State::Stopping + || to == RunControl::State::Stopped; + case RunControl::State::Stopping: + return to == RunControl::State::Stopped; + case RunControl::State::Stopped: + return false; + } + qDebug() << "UNKNOWN DEBUGGER STATE:" << from; + return false; +} + +void RunControl::setState(RunControl::State state) +{ + if (!isAllowedTransition(d->state, state)) { + qDebug() << "Invalid run state transition from " << d->state << " to " << state; + } + d->state = state; +} + /*! Brings the application determined by this RunControl's \c applicationProcessHandle to the foreground. @@ -752,13 +791,18 @@ void RunControl::bringApplicationToForeground() void RunControl::reportApplicationStart() { - d->isRunning = true; + setState(State::Running); emit started(QPrivateSignal()); } void RunControl::reportApplicationStop() { - d->isRunning = false; + if (d->state == State::Stopped) { + // FIXME: Currently various tool implementations call reportApplicationStop() + // multiple times. Fix it there and then add a soft assert here. + return; + } + setState(State::Stopped); QTC_CHECK(d->applicationProcessHandle.isValid()); setApplicationProcessHandle(Utils::ProcessHandle()); emit finished(QPrivateSignal()); @@ -896,14 +940,9 @@ void SimpleRunControl::start() } } -RunControl::StopResult SimpleRunControl::stop() +void SimpleRunControl::stop() { d->m_launcher.stop(); - - if (isSynchronousLauncher(this)) - return StoppedSynchronously; - else - return AsynchronousStop; } void SimpleRunControl::onProcessStarted() diff --git a/src/plugins/projectexplorer/runconfiguration.h b/src/plugins/projectexplorer/runconfiguration.h index 0290fd3d963..0121374c4a3 100644 --- a/src/plugins/projectexplorer/runconfiguration.h +++ b/src/plugins/projectexplorer/runconfiguration.h @@ -353,20 +353,24 @@ class PROJECTEXPLORER_EXPORT RunControl : public QObject Q_OBJECT public: - enum StopResult { - StoppedSynchronously, // Stopped. - AsynchronousStop // Stop sequence has been started + enum class State { + Initialized, + Starting, + Running, + Stopping, + Stopped }; + Q_ENUM(State) RunControl(RunConfiguration *runConfiguration, Core::Id mode); ~RunControl() override; - virtual void start() = 0; + + void initiateStart(); // Calls start() asynchronously. + void initiateStop(); // Calls stop() asynchronously. virtual bool promptToStop(bool *optionalPrompt = nullptr) const; - virtual StopResult stop() = 0; virtual bool supportsReRunning() const { return true; } - virtual QString displayName() const; void setDisplayName(const QString &displayName); @@ -404,6 +408,9 @@ signals: void applicationProcessHandleChanged(QPrivateSignal); // Use setApplicationProcessHandle protected: + virtual void start() = 0; + virtual void stop() = 0; + void reportApplicationStart(); // Call this when the application starts to run void reportApplicationStop(); // Call this when the application has stopped for any reason @@ -413,6 +420,7 @@ protected: bool *prompt = nullptr) const; private: + void setState(State state); void bringApplicationToForegroundInternal(); Internal::RunControlPrivate *d; }; @@ -425,7 +433,7 @@ public: ApplicationLauncher &applicationLauncher(); void start() override; - StopResult stop() override; + void stop() override; virtual void onProcessStarted(); virtual void onProcessFinished(int exitCode, QProcess::ExitStatus status); diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp index f0a64d2a5a2..b87093b8e12 100644 --- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp @@ -118,9 +118,9 @@ void QmlProfilerRunControl::start() emit starting(); } -RunControl::StopResult QmlProfilerRunControl::stop() +void QmlProfilerRunControl::stop() { - QTC_ASSERT(d->m_profilerState, return RunControl::StoppedSynchronously); + QTC_ASSERT(d->m_profilerState, return); switch (d->m_profilerState->currentState()) { case QmlProfilerStateManager::AppRunning: @@ -141,8 +141,6 @@ RunControl::StopResult QmlProfilerRunControl::stop() } break; } - - return RunControl::StoppedSynchronously; } void QmlProfilerRunControl::notifyRemoteFinished() diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.h b/src/plugins/qmlprofiler/qmlprofilerruncontrol.h index 5c7c770755b..464b7f1047a 100644 --- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.h +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.h @@ -48,7 +48,7 @@ public: void notifyRemoteSetupDone(Utils::Port port) override; void notifyRemoteSetupFailed(const QString &errorMessage) override; void start() override; - StopResult stop() override; + void stop() override; void cancelProcess(); void notifyRemoteFinished() override; bool supportsReRunning() const override { return false; } diff --git a/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp b/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp index 6fee07966a2..2656c4bb9d8 100644 --- a/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp +++ b/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp @@ -37,40 +37,39 @@ LocalQmlProfilerRunnerTest::LocalQmlProfilerRunnerTest(QObject *parent) : QObjec { } +void LocalQmlProfilerRunnerTest::connectRunner(LocalQmlProfilerRunner *runner) +{ + connect(runner, &LocalQmlProfilerRunner::started, this, [this] { + QVERIFY(!running); + ++runCount; + running = true; + }); + connect(runner, &LocalQmlProfilerRunner::stopped, this, [this] { + QVERIFY(running); + running = false; + }); +} + void LocalQmlProfilerRunnerTest::testRunner() { - Debugger::AnalyzerConnection connection; - LocalQmlProfilerRunner::Configuration configuration; configuration.debuggee.executable = "\\-/|\\-/"; configuration.debuggee.environment = Utils::Environment::systemEnvironment(); // should not be used anywhere but cannot be empty configuration.socket = connection.analyzerSocket = QString("invalid"); - Debugger::AnalyzerRunControl *rc = Debugger::createAnalyzerRunControl( + rc = Debugger::createAnalyzerRunControl( nullptr, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE); rc->setConnection(connection); auto runner = new LocalQmlProfilerRunner(configuration, rc); + connectRunner(runner); - bool running = false; - int runCount = 0; - - auto connectRunner = [&]() { - connect(runner, &LocalQmlProfilerRunner::started, this, [&running, &runCount](){ - QVERIFY(!running); - ++runCount; - running = true; - }); - connect(runner, &LocalQmlProfilerRunner::stopped, this, [&running](){ - QVERIFY(running); - running = false; - }); - }; - - connectRunner(); - - rc->start(); + rc->initiateStart(); + QTimer::singleShot(0, this, &LocalQmlProfilerRunnerTest::testRunner1); +} +void LocalQmlProfilerRunnerTest::testRunner1() +{ QTRY_COMPARE_WITH_TIMEOUT(runCount, 1, 10000); QTRY_VERIFY_WITH_TIMEOUT(!running, 10000); @@ -84,10 +83,14 @@ void LocalQmlProfilerRunnerTest::testRunner() rc = Debugger::createAnalyzerRunControl( nullptr, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE); rc->setConnection(connection); - runner = new LocalQmlProfilerRunner(configuration, rc); - connectRunner(); - rc->start(); + auto runner = new LocalQmlProfilerRunner(configuration, rc); + connectRunner(runner); + rc->initiateStart(); + QTimer::singleShot(0, this, &LocalQmlProfilerRunnerTest::testRunner2); +} +void LocalQmlProfilerRunnerTest::testRunner2() +{ QTRY_COMPARE_WITH_TIMEOUT(runCount, 2, 10000); QTRY_VERIFY_WITH_TIMEOUT(!running, 10000); @@ -101,17 +104,25 @@ void LocalQmlProfilerRunnerTest::testRunner() rc = Debugger::createAnalyzerRunControl( nullptr, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE); rc->setConnection(connection); - runner = new LocalQmlProfilerRunner(configuration, rc); - connectRunner(); - rc->start(); + auto runner = new LocalQmlProfilerRunner(configuration, rc); + connectRunner(runner); + rc->initiateStart(); - QTRY_COMPARE_WITH_TIMEOUT(runCount, 3, 10000); - rc->stop(); - QTRY_VERIFY_WITH_TIMEOUT(!running, 10000); - - delete rc; + QTimer::singleShot(0, this, &LocalQmlProfilerRunnerTest::testRunner3); } +void LocalQmlProfilerRunnerTest::testRunner3() +{ + QTRY_COMPARE_WITH_TIMEOUT(runCount, 3, 10000); + rc->initiateStop(); + QTimer::singleShot(0, this, &LocalQmlProfilerRunnerTest::testRunner4); +} + +void LocalQmlProfilerRunnerTest::testRunner4() +{ + QTRY_VERIFY_WITH_TIMEOUT(!running, 10000); + delete rc; +} void LocalQmlProfilerRunnerTest::testFindFreePort() { diff --git a/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.h b/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.h index f8c40a1238e..8f893781473 100644 --- a/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.h +++ b/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.h @@ -27,7 +27,7 @@ #include #include -#include +#include namespace QmlProfiler { namespace Internal { @@ -42,6 +42,19 @@ private slots: void testRunner(); void testFindFreePort(); void testFindFreeSocket(); + +private: + void connectRunner(LocalQmlProfilerRunner *runner); + void testRunner1(); + void testRunner2(); + void testRunner3(); + void testRunner4(); + + bool running = false; + int runCount = 0; + Debugger::AnalyzerRunControl *rc = nullptr; + Debugger::AnalyzerConnection connection; + LocalQmlProfilerRunner::Configuration configuration; }; } // namespace Internal diff --git a/src/plugins/qnx/qnxruncontrol.cpp b/src/plugins/qnx/qnxruncontrol.cpp index bf0fb99264b..9081e3d6173 100644 --- a/src/plugins/qnx/qnxruncontrol.cpp +++ b/src/plugins/qnx/qnxruncontrol.cpp @@ -57,10 +57,10 @@ QnxRunControl::QnxRunControl(RunConfiguration *runConfig) connect(m_slog2Info, &Slog2InfoRunner::commandMissing, this, &QnxRunControl::printMissingWarning); } -RunControl::StopResult QnxRunControl::stop() +void QnxRunControl::stop() { m_slog2Info->stop(); - return SimpleRunControl::stop(); + SimpleRunControl::stop(); } void QnxRunControl::printMissingWarning() diff --git a/src/plugins/qnx/qnxruncontrol.h b/src/plugins/qnx/qnxruncontrol.h index b0891d7a4d9..49b99790aec 100644 --- a/src/plugins/qnx/qnxruncontrol.h +++ b/src/plugins/qnx/qnxruncontrol.h @@ -38,7 +38,7 @@ class QnxRunControl : public ProjectExplorer::SimpleRunControl public: explicit QnxRunControl(ProjectExplorer::RunConfiguration *runConfig); - StopResult stop() override; + void stop() override; private: void printMissingWarning(); diff --git a/src/plugins/valgrind/memcheckengine.cpp b/src/plugins/valgrind/memcheckengine.cpp index bd4fbfcdf3a..c463b2be6af 100644 --- a/src/plugins/valgrind/memcheckengine.cpp +++ b/src/plugins/valgrind/memcheckengine.cpp @@ -81,11 +81,11 @@ void MemcheckRunControl::start() ValgrindRunControl::start(); } -RunControl::StopResult MemcheckRunControl::stop() +void MemcheckRunControl::stop() { disconnect(&m_parser, &ThreadedParser::internalError, this, &MemcheckRunControl::internalParserError); - return ValgrindRunControl::stop(); + ValgrindRunControl::stop(); } QStringList MemcheckRunControl::toolArguments() const @@ -163,7 +163,7 @@ void MemcheckWithGdbRunControl::startDebugger() QTC_ASSERT(gdbRunControl, return); connect(gdbRunControl, &RunControl::finished, gdbRunControl, &RunControl::deleteLater); - gdbRunControl->start(); + gdbRunControl->initiateStart(); } void MemcheckWithGdbRunControl::appendLog(const QByteArray &data) diff --git a/src/plugins/valgrind/memcheckengine.h b/src/plugins/valgrind/memcheckengine.h index 4930c5fac70..9c011886c15 100644 --- a/src/plugins/valgrind/memcheckengine.h +++ b/src/plugins/valgrind/memcheckengine.h @@ -43,7 +43,7 @@ public: Core::Id runMode); void start() override; - StopResult stop() override; + void stop() override; QStringList suppressionFiles() const; diff --git a/src/plugins/valgrind/valgrindengine.cpp b/src/plugins/valgrind/valgrindengine.cpp index fb41439943d..b2224f0a16d 100644 --- a/src/plugins/valgrind/valgrindengine.cpp +++ b/src/plugins/valgrind/valgrindengine.cpp @@ -107,11 +107,10 @@ void ValgrindRunControl::start() } } -RunControl::StopResult ValgrindRunControl::stop() +void ValgrindRunControl::stop() { m_isStopping = true; runner()->stop(); - return AsynchronousStop; } QString ValgrindRunControl::executable() const diff --git a/src/plugins/valgrind/valgrindengine.h b/src/plugins/valgrind/valgrindengine.h index cd3fbfe75da..5b71e94a1a8 100644 --- a/src/plugins/valgrind/valgrindengine.h +++ b/src/plugins/valgrind/valgrindengine.h @@ -46,7 +46,7 @@ public: Core::Id runMode); void start() override; - StopResult stop() override; + void stop() override; bool supportsReRunning() const override { return false; } QString executable() const; diff --git a/src/plugins/winrt/winrtruncontrol.cpp b/src/plugins/winrt/winrtruncontrol.cpp index c211a463043..eb2082063fc 100644 --- a/src/plugins/winrt/winrtruncontrol.cpp +++ b/src/plugins/winrt/winrtruncontrol.cpp @@ -67,13 +67,12 @@ void WinRtRunControl::start() reportApplicationStart(); } -RunControl::StopResult WinRtRunControl::stop() +void WinRtRunControl::stop() { if (m_state == StoppedState) - return StoppedSynchronously; + return; m_runner->stop(); - return AsynchronousStop; } void WinRtRunControl::onProcessStarted() diff --git a/src/plugins/winrt/winrtruncontrol.h b/src/plugins/winrt/winrtruncontrol.h index e30f6424a09..d7686895aa5 100644 --- a/src/plugins/winrt/winrtruncontrol.h +++ b/src/plugins/winrt/winrtruncontrol.h @@ -51,7 +51,7 @@ public: explicit WinRtRunControl(WinRtRunConfiguration *runConfiguration, Core::Id mode); void start() override; - StopResult stop() override; + void stop() override; private: enum State { StartingState, StartedState, StoppedState };