Debugger: Merge debug mode and analyze mode

On the user-visible side, only the 'Analyze' mode button disappears,
and instead a combobox to switch between different tools in appears
in the Debug mode toolbar.

Internally, that's quite some re-organzition: The centralized
'Analyze mode is busy' flag is gone, allowing us to run e.g.
ClangStaticAnalyzer and MemCheck in parallel.

Analyzer tools and debugger now share the same mechanism to
generate/load/save dock widgets.

Analyzer tools now create and handle their own start/stop button
when appropriate. In general, Analyzer tools can create/handle more
than one run control at a time.

Further consolidation is possible, e.g. RunControl state handling
could be merged into the base ProjectExplorer::RunControl to
avoid the still existing duplication in ~15 instances.

Change-Id: I91e5940ebc4211f98056d507cf2f7b5f8efe7f07
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
hjk
2016-03-02 13:57:37 +01:00
parent c326011feb
commit 92e301a054
79 changed files with 2135 additions and 2642 deletions

View File

@@ -51,7 +51,7 @@
#include <QMessageBox>
#include <QPushButton>
using namespace Analyzer;
using namespace Debugger;
using namespace Core;
using namespace ProjectExplorer;
@@ -102,16 +102,16 @@ QmlProfilerRunControl::QmlProfilerRunControl(RunConfiguration *runConfiguration,
QmlProfilerRunControl::~QmlProfilerRunControl()
{
if (d->m_profilerState)
stopEngine();
stop();
delete d;
}
bool QmlProfilerRunControl::startEngine()
void QmlProfilerRunControl::start()
{
d->m_tool->finalizeRunControl(this);
QTC_ASSERT(d->m_profilerState, return false);
QTC_ASSERT(d->m_profilerState, finished(); return);
QTC_ASSERT(connection().is<AnalyzerConnection>(), return false);
QTC_ASSERT(connection().is<AnalyzerConnection>(), finished(); return);
auto conn = connection().as<AnalyzerConnection>();
if (conn.analyzerPort != 0)
@@ -120,13 +120,14 @@ bool QmlProfilerRunControl::startEngine()
d->m_noDebugOutputTimer.start();
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppRunning);
d->m_running = true;
emit starting();
return true;
}
void QmlProfilerRunControl::stopEngine()
RunControl::StopResult QmlProfilerRunControl::stop()
{
QTC_ASSERT(d->m_profilerState, return);
d->m_running = false;
QTC_ASSERT(d->m_profilerState, return RunControl::StoppedSynchronously);
switch (d->m_profilerState->currentState()) {
case QmlProfilerStateManager::AppRunning:
@@ -147,6 +148,13 @@ void QmlProfilerRunControl::stopEngine()
}
break;
}
return RunControl::StoppedSynchronously;
}
bool QmlProfilerRunControl::isRunning() const
{
return d->m_running;
}
void QmlProfilerRunControl::notifyRemoteFinished()
@@ -156,7 +164,6 @@ void QmlProfilerRunControl::notifyRemoteFinished()
switch (d->m_profilerState->currentState()) {
case QmlProfilerStateManager::AppRunning:
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppDying);
AnalyzerManager::stopTool();
emit finished();
break;
case QmlProfilerStateManager::Idle:
@@ -215,7 +222,6 @@ void QmlProfilerRunControl::wrongSetupMessageBox(const QString &errorMessage)
// KILL
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppDying);
d->m_noDebugOutputTimer.stop();
AnalyzerManager::stopTool();
emit finished();
}
@@ -270,12 +276,4 @@ void QmlProfilerRunControl::profilerStateChanged()
}
}
RunControl::StopResult QmlProfilerRunControl::stop()
{
StopResult result = Analyzer::AnalyzerRunControl::stop();
if (d->m_profilerState->currentState() != QmlProfilerStateManager::Idle)
m_isRunning = true;
return result;
}
} // namespace QmlProfiler