forked from qt-creator/qt-creator
debugger: move DebuggerRunControl *m_runControl into IDebuggerEngine.
Plan is to identify make identify an IDebuggerEngine incarnation with a RunControl.
This commit is contained in:
@@ -386,9 +386,10 @@ void CdbDebugEngine::startupChecks()
|
||||
syncDebuggerPaths();
|
||||
}
|
||||
|
||||
void CdbDebugEngine::startDebugger(const DebuggerRunControl *runControl)
|
||||
void CdbDebugEngine::startDebugger()
|
||||
{
|
||||
const DebuggerStartParameters &sp = runControl->sp();
|
||||
QTC_ASSERT(runControl(), return);
|
||||
const DebuggerStartParameters &sp = runControl()->sp();
|
||||
if (debugCDBExecution)
|
||||
qDebug() << "startDebugger";
|
||||
CdbCore::BreakPoint::clearNormalizeFileNameCache();
|
||||
|
@@ -63,7 +63,7 @@ public:
|
||||
|
||||
virtual void shutdown();
|
||||
virtual void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos);
|
||||
virtual void startDebugger(const DebuggerRunControl *runControl);
|
||||
virtual void startDebugger();
|
||||
virtual void exitDebugger();
|
||||
virtual void detachDebugger();
|
||||
virtual void updateWatchData(const WatchData &data);
|
||||
|
@@ -1060,7 +1060,7 @@ static IDebuggerEngine *debuggerEngineForMode(DebuggerStartMode startMode, QStri
|
||||
#endif
|
||||
}
|
||||
|
||||
void DebuggerManager::startNewDebugger(const DebuggerRunControl *runControl)
|
||||
void DebuggerManager::startNewDebugger(DebuggerRunControl *runControl)
|
||||
{
|
||||
if (d->m_state != DebuggerNotReady)
|
||||
return;
|
||||
@@ -1113,7 +1113,8 @@ void DebuggerManager::startNewDebugger(const DebuggerRunControl *runControl)
|
||||
setBusyCursor(false);
|
||||
setState(EngineStarting);
|
||||
connect(d->m_engine, SIGNAL(startFailed()), this, SLOT(startFailed()));
|
||||
d->m_engine->startDebugger(runControl);
|
||||
d->m_engine->setRunControl(runControl);
|
||||
d->m_engine->startDebugger();
|
||||
|
||||
const unsigned engineCapabilities = d->m_engine->debuggerCapabilities();
|
||||
theDebuggerAction(OperateByInstruction)
|
||||
|
@@ -176,8 +176,8 @@ public:
|
||||
|
||||
static DebuggerManager *instance();
|
||||
|
||||
void startNewDebugger(DebuggerRunControl *runControl);
|
||||
public slots:
|
||||
void startNewDebugger(const DebuggerRunControl *runControl);
|
||||
void exitDebugger();
|
||||
void abortDebugger();
|
||||
|
||||
|
@@ -1737,10 +1737,11 @@ bool GdbEngine::checkConfiguration(int toolChain, QString *errorMessage, QString
|
||||
return true;
|
||||
}
|
||||
|
||||
AbstractGdbAdapter *GdbEngine::createAdapter(const DebuggerRunControl *runControl)
|
||||
AbstractGdbAdapter *GdbEngine::createAdapter()
|
||||
{
|
||||
const DebuggerStartParameters *sp = &runControl->sp();
|
||||
switch (sp->toolChainType) {
|
||||
QTC_ASSERT(runControl(), return 0);
|
||||
const DebuggerStartParameters &sp = runControl()->sp();
|
||||
switch (sp.toolChainType) {
|
||||
case ProjectExplorer::ToolChain::WINSCW: // S60
|
||||
case ProjectExplorer::ToolChain::GCCE:
|
||||
case ProjectExplorer::ToolChain::RVCT_ARMV5:
|
||||
@@ -1752,26 +1753,27 @@ AbstractGdbAdapter *GdbEngine::createAdapter(const DebuggerRunControl *runContro
|
||||
break;
|
||||
}
|
||||
// @todo: remove testing hack
|
||||
if (sp->processArgs.size() == 3 && sp->processArgs.at(0) == _("@sym@"))
|
||||
if (sp.processArgs.size() == 3 && sp.processArgs.at(0) == _("@sym@"))
|
||||
return new TrkGdbAdapter(this);
|
||||
switch (sp->startMode) {
|
||||
switch (sp.startMode) {
|
||||
case AttachCore:
|
||||
return new CoreGdbAdapter(this);
|
||||
case AttachToRemote:
|
||||
return new RemoteGdbServerAdapter(this, sp->toolChainType);
|
||||
return new RemoteGdbServerAdapter(this, sp.toolChainType);
|
||||
case StartRemoteGdb:
|
||||
return new RemotePlainGdbAdapter(this);
|
||||
case AttachExternal:
|
||||
return new AttachGdbAdapter(this);
|
||||
default:
|
||||
if (sp->useTerminal)
|
||||
if (sp.useTerminal)
|
||||
return new TermGdbAdapter(this);
|
||||
return new LocalPlainGdbAdapter(this);
|
||||
}
|
||||
}
|
||||
|
||||
void GdbEngine::startDebugger(const DebuggerRunControl *runControl)
|
||||
void GdbEngine::startDebugger()
|
||||
{
|
||||
QTC_ASSERT(runControl(), return);
|
||||
QTC_ASSERT(state() == EngineStarting, qDebug() << state());
|
||||
// This should be set by the constructor or in exitDebugger()
|
||||
// via initializeVariables()
|
||||
@@ -1788,10 +1790,8 @@ void GdbEngine::startDebugger(const DebuggerRunControl *runControl)
|
||||
fp->setKeepOnFinish(false);
|
||||
m_progress->reportStarted();
|
||||
|
||||
m_runControl = runControl;
|
||||
|
||||
delete m_gdbAdapter;
|
||||
m_gdbAdapter = createAdapter(m_runControl);
|
||||
m_gdbAdapter = createAdapter();
|
||||
connectAdapter();
|
||||
|
||||
if (m_gdbAdapter->dumperHandling() != AbstractGdbAdapter::DumperNotAvailable)
|
||||
@@ -3036,9 +3036,10 @@ void GdbEngine::handleMakeSnapshot(const GdbResponse &response)
|
||||
|
||||
void GdbEngine::activateSnapshot(int index)
|
||||
{
|
||||
QTC_ASSERT(runControl(), return);
|
||||
SnapshotData snapshot = m_manager->snapshotHandler()->setCurrentIndex(index);
|
||||
|
||||
DebuggerStartParameters &sp = const_cast<DebuggerStartParameters &>(m_runControl->sp());
|
||||
DebuggerStartParameters &sp = const_cast<DebuggerStartParameters &>(runControl()->sp());
|
||||
sp.startMode = AttachCore;
|
||||
sp.coreFile = snapshot.location();
|
||||
|
||||
@@ -3058,7 +3059,7 @@ void GdbEngine::activateSnapshot(int index)
|
||||
return;
|
||||
debugMessage(_("KILLING DEBUGGER AS REQUESTED BY USER"));
|
||||
delete m_gdbAdapter;
|
||||
m_gdbAdapter = createAdapter(m_runControl);
|
||||
m_gdbAdapter = createAdapter();
|
||||
postCommand("kill", NeedsStop, CB(handleActivateSnapshot));
|
||||
} else {
|
||||
activateSnapshot2();
|
||||
|
@@ -111,7 +111,7 @@ private: ////////// General Interface //////////
|
||||
|
||||
virtual bool checkConfiguration(int toolChain, QString *errorMessage,
|
||||
QString *settingsPage = 0) const;
|
||||
virtual void startDebugger(const DebuggerRunControl *runControl);
|
||||
virtual void startDebugger();
|
||||
virtual unsigned debuggerCapabilities() const;
|
||||
virtual void exitDebugger();
|
||||
virtual void abortDebugger();
|
||||
@@ -125,16 +125,15 @@ private: ////////// General State //////////
|
||||
|
||||
void initializeVariables();
|
||||
DebuggerStartMode startMode() const;
|
||||
const DebuggerRunControl *runControl() const { return m_runControl; }
|
||||
const DebuggerStartParameters &startParameters() const { return m_runControl->sp(); }
|
||||
const DebuggerStartParameters &startParameters() const
|
||||
{ return m_runControl->sp(); }
|
||||
Q_SLOT void setAutoDerefPointers(const QVariant &on);
|
||||
|
||||
const DebuggerRunControl *m_runControl;
|
||||
bool m_registerNamesListed;
|
||||
|
||||
private: ////////// Gdb Process Management //////////
|
||||
|
||||
AbstractGdbAdapter *createAdapter(const DebuggerRunControl *runControl);
|
||||
AbstractGdbAdapter *createAdapter();
|
||||
void connectAdapter();
|
||||
bool startGdb(const QStringList &args = QStringList(),
|
||||
const QString &gdb = QString(),
|
||||
|
@@ -67,12 +67,18 @@ class IDebuggerEngine : public QObject
|
||||
|
||||
public:
|
||||
IDebuggerEngine(DebuggerManager *manager, QObject *parent = 0)
|
||||
: QObject(parent), m_manager(manager)
|
||||
: QObject(parent), m_manager(manager), m_runControl()
|
||||
{}
|
||||
|
||||
// FIXME: Move this to DebuggerEngineFactory::create(); ?
|
||||
void setRunControl(DebuggerRunControl *runControl)
|
||||
{ m_runControl = runControl; }
|
||||
DebuggerRunControl *runControl() const
|
||||
{ return m_runControl; }
|
||||
|
||||
virtual void shutdown() = 0;
|
||||
virtual void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos) = 0;
|
||||
virtual void startDebugger(const DebuggerRunControl *runControl) = 0;
|
||||
virtual void startDebugger() = 0;
|
||||
virtual void exitDebugger() = 0;
|
||||
virtual void abortDebugger() { exitDebugger(); }
|
||||
virtual void detachDebugger() {}
|
||||
@@ -136,6 +142,7 @@ protected:
|
||||
void setState(DebuggerState state, bool forced = false);
|
||||
DebuggerManager *manager() const { return m_manager; }
|
||||
DebuggerManager *m_manager;
|
||||
DebuggerRunControl *m_runControl;
|
||||
|
||||
signals:
|
||||
void startSuccessful();
|
||||
|
@@ -136,11 +136,12 @@ void PdbEngine::exitDebugger()
|
||||
setState(DebuggerNotReady);
|
||||
}
|
||||
|
||||
void PdbEngine::startDebugger(const DebuggerRunControl *runControl)
|
||||
void PdbEngine::startDebugger()
|
||||
{
|
||||
QTC_ASSERT(runControl(), return);
|
||||
setState(AdapterStarting);
|
||||
|
||||
m_scriptFileName = QFileInfo(runControl->sp().executable).absoluteFilePath();
|
||||
m_scriptFileName = QFileInfo(runControl()->sp().executable).absoluteFilePath();
|
||||
QFile scriptFile(m_scriptFileName);
|
||||
if (!scriptFile.open(QIODevice::ReadOnly|QIODevice::Text)) {
|
||||
//debugMessage("STARTING " +m_scriptFileName + "FAILED");
|
||||
|
@@ -72,7 +72,7 @@ private:
|
||||
void shutdown();
|
||||
void setToolTipExpression(const QPoint &mousePos,
|
||||
TextEditor::ITextEditor *editor, int cursorPos);
|
||||
void startDebugger(const DebuggerRunControl *runControl);
|
||||
void startDebugger();
|
||||
|
||||
void exitDebugger();
|
||||
|
||||
|
@@ -201,14 +201,16 @@ void QmlEngine::exitDebugger()
|
||||
manager()->notifyInferiorExited();
|
||||
}
|
||||
|
||||
void QmlEngine::startDebugger(const DebuggerRunControl *runControl)
|
||||
void QmlEngine::startDebugger()
|
||||
{
|
||||
QTC_ASSERT(runControl(), return);
|
||||
qDebug() << "STARTING QML ENGINE";
|
||||
setState(InferiorRunningRequested);
|
||||
showStatusMessage(tr("Running requested..."), 5000);
|
||||
const int pos = runControl->sp().remoteChannel.indexOf(QLatin1Char(':'));
|
||||
const QString host = runControl->sp().remoteChannel.left(pos);
|
||||
const quint16 port = runControl->sp().remoteChannel.mid(pos + 1).toInt();
|
||||
const DebuggerStartParameters &sp = runControl()->sp();
|
||||
const int pos = sp.remoteChannel.indexOf(QLatin1Char(':'));
|
||||
const QString host = sp.remoteChannel.left(pos);
|
||||
const quint16 port = sp.remoteChannel.mid(pos + 1).toInt();
|
||||
//QTimer::singleShot(0, this, SLOT(runInferior()));
|
||||
m_socket->connectToHost(host, port);
|
||||
emit startSuccessful();
|
||||
|
@@ -75,7 +75,7 @@ private:
|
||||
|
||||
void shutdown();
|
||||
void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos);
|
||||
void startDebugger(const DebuggerRunControl *runControl);
|
||||
void startDebugger();
|
||||
void exitDebugger();
|
||||
|
||||
void continueInferior();
|
||||
|
@@ -228,7 +228,7 @@ void ScriptEngine::exitDebugger()
|
||||
setState(DebuggerNotReady);
|
||||
}
|
||||
|
||||
void ScriptEngine::startDebugger(const DebuggerRunControl *runControl)
|
||||
void ScriptEngine::startDebugger()
|
||||
{
|
||||
setState(AdapterStarting);
|
||||
if (m_scriptEngine.isNull())
|
||||
@@ -247,7 +247,8 @@ void ScriptEngine::startDebugger(const DebuggerRunControl *runControl)
|
||||
setState(AdapterStarted);
|
||||
setState(InferiorStarting);
|
||||
|
||||
m_scriptFileName = QFileInfo(runControl->sp().executable).absoluteFilePath();
|
||||
QTC_ASSERT(runControl(), return);
|
||||
m_scriptFileName = QFileInfo(runControl()->sp().executable).absoluteFilePath();
|
||||
QFile scriptFile(m_scriptFileName);
|
||||
if (!scriptFile.open(QIODevice::ReadOnly|QIODevice::Text)) {
|
||||
manager()->showDebuggerOutput(LogError, QString::fromLatin1("Cannot open %1: %2").
|
||||
|
@@ -71,8 +71,7 @@ private:
|
||||
void shutdown();
|
||||
void setToolTipExpression(const QPoint &mousePos,
|
||||
TextEditor::ITextEditor *editor, int cursorPos);
|
||||
void startDebugger(const DebuggerRunControl *runControl);
|
||||
|
||||
void startDebugger();
|
||||
void exitDebugger();
|
||||
|
||||
void continueInferior();
|
||||
|
@@ -203,13 +203,15 @@ void TcfEngine::exitDebugger()
|
||||
manager()->notifyInferiorExited();
|
||||
}
|
||||
|
||||
void TcfEngine::startDebugger(const DebuggerRunControl *runControl)
|
||||
void TcfEngine::startDebugger()
|
||||
{
|
||||
QTC_ASSERT(runControl(), return);
|
||||
setState(InferiorRunningRequested);
|
||||
showStatusMessage(tr("Running requested..."), 5000);
|
||||
const int pos = runControl->sp().remoteChannel.indexOf(QLatin1Char(':'));
|
||||
const QString host = runControl->sp().remoteChannel.left(pos);
|
||||
const quint16 port = runControl->sp().remoteChannel.mid(pos + 1).toInt();
|
||||
const DebuggerStartParameters &sp = runControl()->sp();
|
||||
const int pos = sp.remoteChannel.indexOf(QLatin1Char(':'));
|
||||
const QString host = sp.remoteChannel.left(pos);
|
||||
const quint16 port = sp.remoteChannel.mid(pos + 1).toInt();
|
||||
//QTimer::singleShot(0, this, SLOT(runInferior()));
|
||||
m_socket->connectToHost(host, port);
|
||||
emit startSuccessful();
|
||||
|
@@ -75,7 +75,7 @@ private:
|
||||
|
||||
void shutdown();
|
||||
void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos);
|
||||
void startDebugger(const DebuggerRunControl *runControl);
|
||||
void startDebugger();
|
||||
void exitDebugger();
|
||||
|
||||
void continueInferior();
|
||||
|
Reference in New Issue
Block a user