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