forked from qt-creator/qt-creator
debugger: structural cleanup remote debugging
Use virtual function instead of if/qobject_cast cascades.
This commit is contained in:
@@ -145,5 +145,16 @@ void AbstractGdbAdapter::showMessage(const QString &msg, int channel, int timeou
|
||||
m_engine->showMessage(msg, channel, timeout);
|
||||
}
|
||||
|
||||
void AbstractGdbAdapter::handleRemoteSetupDone(int gdbServerPort, int qmlPort)
|
||||
{
|
||||
Q_UNUSED(gdbServerPort);
|
||||
Q_UNUSED(qmlPort);
|
||||
}
|
||||
|
||||
void AbstractGdbAdapter::handleRemoteSetupFailed(const QString &reason)
|
||||
{
|
||||
Q_UNUSED(reason);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Debugger
|
||||
|
||||
@@ -90,6 +90,9 @@ public:
|
||||
virtual void trkReloadRegisters() {}
|
||||
virtual void trkReloadThreads() {}
|
||||
|
||||
virtual void handleRemoteSetupDone(int gdbServerPort, int qmlPort);
|
||||
virtual void handleRemoteSetupFailed(const QString &reason);
|
||||
|
||||
protected:
|
||||
DebuggerState state() const;
|
||||
const DebuggerStartParameters &startParameters() const;
|
||||
|
||||
@@ -4398,6 +4398,16 @@ void GdbEngine::removeTooltip()
|
||||
DebuggerEngine::removeTooltip();
|
||||
}
|
||||
|
||||
void GdbEngine::handleRemoteSetupDone(int gdbServerPort, int qmlPort)
|
||||
{
|
||||
m_gdbAdapter->handleRemoteSetupDone(gdbServerPort, qmlPort);
|
||||
}
|
||||
|
||||
void GdbEngine::handleRemoteSetupFailed(const QString &message)
|
||||
{
|
||||
m_gdbAdapter->handleRemoteSetupFailed(message);
|
||||
}
|
||||
|
||||
//
|
||||
// Factory
|
||||
//
|
||||
|
||||
@@ -127,6 +127,8 @@ private: ////////// Gdb Process Management //////////
|
||||
const QString &settingsIdHint = QString());
|
||||
void handleInferiorShutdown(const GdbResponse &response);
|
||||
void handleGdbExit(const GdbResponse &response);
|
||||
void handleRemoteSetupDone(int gdbServerPort, int qmlPort);
|
||||
void handleRemoteSetupFailed(const QString &message);
|
||||
|
||||
void handleAdapterStarted();
|
||||
void defaultInferiorShutdown(const char *cmd);
|
||||
|
||||
@@ -96,7 +96,7 @@ void RemoteGdbServerAdapter::startAdapter()
|
||||
}
|
||||
if (startParameters().serverStartScript.isEmpty()) {
|
||||
showMessage(_("No server start script given. "), StatusBar);
|
||||
emit requestSetup();
|
||||
m_engine->requestRemoteSetup();
|
||||
} else {
|
||||
m_uploadProc.start(_("/bin/sh ") + startParameters().serverStartScript);
|
||||
m_uploadProc.waitForStarted();
|
||||
|
||||
@@ -50,8 +50,7 @@ void RemotePlainGdbAdapter::startAdapter()
|
||||
{
|
||||
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
|
||||
showMessage(QLatin1String("TRYING TO START ADAPTER"));
|
||||
|
||||
emit requestSetup();
|
||||
m_engine->requestRemoteSetup();
|
||||
}
|
||||
|
||||
void RemotePlainGdbAdapter::setupInferior()
|
||||
@@ -101,8 +100,9 @@ void RemotePlainGdbAdapter::shutdownAdapter()
|
||||
m_engine->notifyAdapterShutdownOk();
|
||||
}
|
||||
|
||||
void RemotePlainGdbAdapter::handleSetupDone(int qmlPort)
|
||||
void RemotePlainGdbAdapter::handleSetupDone(int gdbServerPort, int qmlPort)
|
||||
{
|
||||
Q_UNUSED(gdbServerPort);
|
||||
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
|
||||
|
||||
if (qmlPort != -1)
|
||||
|
||||
@@ -43,12 +43,9 @@ class RemotePlainGdbAdapter : public AbstractPlainGdbAdapter
|
||||
public:
|
||||
friend class RemoteGdbProcess;
|
||||
explicit RemotePlainGdbAdapter(GdbEngine *engine, QObject *parent = 0);
|
||||
void handleSetupDone(int qmlPort);
|
||||
void handleSetupDone(int gdbServerPort, int qmlPort);
|
||||
void handleSetupFailed(const QString &reason);
|
||||
|
||||
signals:
|
||||
void requestSetup();
|
||||
|
||||
private slots:
|
||||
void handleGdbStarted();
|
||||
void handleGdbStartFailed();
|
||||
|
||||
Reference in New Issue
Block a user