Commit b7651241 authored by hjk's avatar hjk
Browse files

debugger: refactoring

remove DebuggerRunControl from DebuggerManager
use typedef for QSharedPointer<DebuggerStartParameters>
parent 89b7c6cb
......@@ -154,7 +154,8 @@ static const char *stateName(int s)
DebuggerStartParameters::DebuggerStartParameters()
: attachPID(-1),
useTerminal(false),
toolChainType(ProjectExplorer::ToolChain::UNKNOWN)
toolChainType(ProjectExplorer::ToolChain::UNKNOWN),
startMode(NoStartMode)
{}
void DebuggerStartParameters::clear()
......@@ -172,6 +173,7 @@ void DebuggerStartParameters::clear()
remoteArchitecture.clear();
serverStartScript.clear();
toolChainType = ProjectExplorer::ToolChain::UNKNOWN;
startMode = NoStartMode;
}
......@@ -210,8 +212,6 @@ void DebuggerManager::init()
m_status = -1;
m_busy = false;
m_runControl = 0;
m_modulesHandler = 0;
m_registerHandler = 0;
......@@ -809,15 +809,14 @@ static IDebuggerEngine *determineDebuggerEngine(int /* pid */,
#endif
}
void DebuggerManager::startNewDebugger(DebuggerRunControl *runControl,
const QSharedPointer<DebuggerStartParameters> &startParameters)
void DebuggerManager::startNewDebugger(const DebuggerStartParametersPtr &sp)
{
m_startParameters = sp;
if (Debugger::Constants::Internal::debug)
qDebug() << Q_FUNC_INFO << '\n' << *startParameters;
qDebug() << Q_FUNC_INFO << '\n' << *m_startParameters;
m_startParameters = startParameters;
m_inferiorPid = startParameters->attachPID > 0 ? startParameters->attachPID : 0;
m_runControl = runControl;
m_inferiorPid = m_startParameters->attachPID > 0
? m_startParameters->attachPID : 0;
const QString toolChainName = ProjectExplorer::ToolChain::toolChainName(static_cast<ProjectExplorer::ToolChain::ToolChainType>(m_startParameters->toolChainType));
emit debugModeRequested();
......@@ -1437,7 +1436,7 @@ void DebuggerManager::showQtDumperLibraryWarning(const QString &details)
DebuggerStartMode DebuggerManager::startMode() const
{
return m_runControl ? m_runControl->startMode() : NoStartMode;
return m_startParameters->startMode;
}
void DebuggerManager::reloadFullStack()
......
......@@ -164,8 +164,10 @@ public:
QString dumperLibrary;
QStringList dumperLibraryLocations;
DebuggerStartMode startMode;
};
typedef QSharedPointer<DebuggerStartParameters> DebuggerStartParametersPtr;
QDebug operator<<(QDebug str, const DebuggerStartParameters &);
class IDebuggerEngine;
......@@ -251,7 +253,7 @@ private:
virtual qint64 inferiorPid() const = 0;
virtual QSharedPointer<DebuggerStartParameters> startParameters() const = 0;
virtual DebuggerStartParametersPtr startParameters() const = 0;
};
......@@ -274,12 +276,11 @@ public:
QLabel *statusLabel() const { return m_statusLabel; }
IDebuggerEngine *currentEngine() const { return m_engine; }
virtual QSharedPointer<DebuggerStartParameters> startParameters() const;
virtual DebuggerStartParametersPtr startParameters() const;
virtual qint64 inferiorPid() const;
public slots:
void startNewDebugger(DebuggerRunControl *runControl,
const QSharedPointer<DebuggerStartParameters> &startParameters);
void startNewDebugger(const DebuggerStartParametersPtr &sp);
void exitDebugger();
void setSimpleDockWidgetArrangement();
......@@ -399,7 +400,6 @@ public:
int status() const { return m_status; }
// FIXME: hide this in the engines?
DebuggerStartMode startMode() const;
DebuggerRunControl *runControl() const { return m_runControl; }
QList<Symbol> moduleSymbols(const QString &moduleName);
......@@ -432,10 +432,7 @@ private:
void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos);
// FIXME: Remove engine-specific state
QSharedPointer<DebuggerStartParameters> m_startParameters;
DebuggerRunControl *m_runControl;
QString m_dumperLib;
QStringList m_dumperLibLocations;
DebuggerStartParametersPtr m_startParameters;
qint64 m_inferiorPid;
......
......@@ -178,7 +178,7 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
void DebuggerRunControl::start()
{
m_running = true;
m_manager->startNewDebugger(this, m_startParameters);
m_manager->startNewDebugger(m_startParameters);
}
void DebuggerRunControl::slotAddToOutputWindowInline(const QString &data)
......
......@@ -69,13 +69,13 @@ public:
virtual ProjectExplorer::RunControl
*run(RunConfigurationPtr runConfiguration,
const QString &mode,
const QSharedPointer<DebuggerStartParameters> &sp,
const DebuggerStartParametersPtr &sp,
DebuggerStartMode startMode);
static RunConfigurationPtr createDefaultRunConfiguration(const QString &executable = QString());
private:
QSharedPointer<DebuggerStartParameters> m_startParameters;
DebuggerStartParametersPtr m_startParameters;
DebuggerManager *m_manager;
};
......@@ -88,7 +88,7 @@ class DebuggerRunControl
public:
DebuggerRunControl(DebuggerManager *manager,
DebuggerStartMode mode,
const QSharedPointer<DebuggerStartParameters> &sp,
const DebuggerStartParametersPtr &startParamters,
ApplicationRunConfigurationPtr runConfiguration);
DebuggerStartMode startMode() const { return m_mode; }
......@@ -99,6 +99,7 @@ public:
virtual bool isRunning() const;
Q_SLOT void debuggingFinished();
DebuggerStartParametersPtr startParameters() { return m_startParameters; }
signals:
void stopRequested();
......@@ -108,7 +109,7 @@ private slots:
private:
const DebuggerStartMode m_mode;
const QSharedPointer<DebuggerStartParameters> m_startParameters;
DebuggerStartParametersPtr m_startParameters;
DebuggerManager *m_manager;
bool m_running;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment