Maemo: Support QML-only debugging.

Reviewed-by: kh1
This commit is contained in:
Christian Kandeler
2010-09-16 17:08:07 +02:00
parent 82f4e73c7b
commit ae4c35bd86
12 changed files with 158 additions and 89 deletions

View File

@@ -38,6 +38,7 @@
#include "gdb/gdbengine.h"
#include "gdb/remotegdbserveradapter.h"
#include "gdb/remoteplaingdbadapter.h"
#include "qml/qmlengine.h"
#include "qml/qmlcppengine.h"
#ifdef Q_OS_WIN
@@ -435,6 +436,9 @@ void DebuggerRunControl::createEngine(const DebuggerStartParameters &startParams
break;
case QmlEngineType:
d->m_engine = Internal::createQmlEngine(sp);
connect(qobject_cast<QmlEngine *>(d->m_engine),
SIGNAL(remoteStartupRequested()), this,
SIGNAL(engineRequestSetup()));
break;
case QmlCppEngineType:
d->m_engine = Internal::createQmlCppEngine(sp);
@@ -463,10 +467,10 @@ void DebuggerRunControl::initGdbEngine(Internal::GdbEngine *engine)
Internal::AbstractGdbAdapter *adapter = engine->gdbAdapter();
if (RemotePlainGdbAdapter *rpga = qobject_cast<RemotePlainGdbAdapter *>(adapter)) {
connect(rpga, SIGNAL(requestSetup()), this,
SIGNAL(gdbAdapterRequestSetup()));
SIGNAL(engineRequestSetup()));
} else if (RemoteGdbServerAdapter *rgsa = qobject_cast<RemoteGdbServerAdapter *>(adapter)) {
connect(rgsa, SIGNAL(requestSetup()),
this, SIGNAL(gdbAdapterRequestSetup()));
this, SIGNAL(engineRequestSetup()));
}
}
@@ -650,27 +654,35 @@ Internal::AbstractGdbAdapter *DebuggerRunControl::gdbAdapter() const
return engine->gdbAdapter();
}
void DebuggerRunControl::remoteGdbHandleSetupDone()
void DebuggerRunControl::handleRemoteSetupDone()
{
Internal::AbstractGdbAdapter *adapter = gdbAdapter();
QTC_ASSERT(adapter, return);
if (RemotePlainGdbAdapter *rpga = qobject_cast<RemotePlainGdbAdapter *>(adapter)) {
rpga->handleSetupDone();
} else if (RemoteGdbServerAdapter *rgsa = qobject_cast<RemoteGdbServerAdapter *>(adapter)) {
rgsa->handleSetupDone();
if (QmlEngine *qmlEngine = qobject_cast<QmlEngine *>(d->m_engine)) {
qmlEngine->handleRemoteSetupDone();
} else if (Internal::AbstractGdbAdapter *adapter = gdbAdapter()) {
if (RemotePlainGdbAdapter *rpga = qobject_cast<RemotePlainGdbAdapter *>(adapter)) {
rpga->handleSetupDone();
} else if (RemoteGdbServerAdapter *rgsa = qobject_cast<RemoteGdbServerAdapter *>(adapter)) {
rgsa->handleSetupDone();
} else {
QTC_ASSERT(false, /* */ );
}
} else {
QTC_ASSERT(false, /* */ );
}
}
void DebuggerRunControl::remoteGdbHandleSetupFailed(const QString &message)
void DebuggerRunControl::handleRemoteSetupFailed(const QString &message)
{
Internal::AbstractGdbAdapter *adapter = gdbAdapter();
QTC_ASSERT(adapter, return);
if (RemotePlainGdbAdapter *rpga = qobject_cast<RemotePlainGdbAdapter *>(adapter)) {
rpga->handleSetupFailed(message);
} else if (RemoteGdbServerAdapter *rgsa = qobject_cast<RemoteGdbServerAdapter *>(adapter)) {
rgsa->handleSetupFailed(message);
if (QmlEngine *qmlEngine = qobject_cast<QmlEngine *>(d->m_engine)) {
qmlEngine->handleRemoteSetupFailed(message);
} else if (Internal::AbstractGdbAdapter *adapter = gdbAdapter()) {
if (RemotePlainGdbAdapter *rpga = qobject_cast<RemotePlainGdbAdapter *>(adapter)) {
rpga->handleSetupFailed(message);
} else if (RemoteGdbServerAdapter *rgsa = qobject_cast<RemoteGdbServerAdapter *>(adapter)) {
rgsa->handleSetupFailed(message);
} else {
QTC_ASSERT(false, /* */ );
}
} else {
QTC_ASSERT(false, /* */ );
}

View File

@@ -116,8 +116,8 @@ public:
void showMessage(const QString &msg, int channel);
void remoteGdbHandleSetupDone();
void remoteGdbHandleSetupFailed(const QString &message);
void handleRemoteSetupDone();
void handleRemoteSetupFailed(const QString &message);
static bool checkDebugConfiguration(int toolChain,
QString *errorMessage,
@@ -125,7 +125,7 @@ public:
QString *settingsPage = 0);
signals:
void gdbAdapterRequestSetup();
void engineRequestSetup();
public slots:
void emitAddToOutputWindow(const QString &line, bool onStdErr);

View File

@@ -168,19 +168,23 @@ void QmlEngine::setupInferior()
{
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
connect(&d->m_applicationLauncher, SIGNAL(processExited(int)),
this, SLOT(disconnected()));
connect(&d->m_applicationLauncher, SIGNAL(appendMessage(QString,bool)),
runControl(), SLOT(emitAppendMessage(QString,bool)));
connect(&d->m_applicationLauncher, SIGNAL(appendOutput(QString, bool)),
runControl(), SLOT(emitAddToOutputWindow(QString, bool)));
connect(&d->m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
runControl(), SLOT(bringApplicationToForeground(qint64)));
if (startParameters().startMode == AttachToRemote) {
emit remoteStartupRequested();
} else {
connect(&d->m_applicationLauncher, SIGNAL(processExited(int)),
this, SLOT(disconnected()));
connect(&d->m_applicationLauncher, SIGNAL(appendMessage(QString,bool)),
runControl(), SLOT(emitAppendMessage(QString,bool)));
connect(&d->m_applicationLauncher, SIGNAL(appendOutput(QString, bool)),
runControl(), SLOT(emitAddToOutputWindow(QString, bool)));
connect(&d->m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
runControl(), SLOT(bringApplicationToForeground(qint64)));
d->m_applicationLauncher.setEnvironment(startParameters().environment);
d->m_applicationLauncher.setWorkingDirectory(startParameters().workingDirectory);
d->m_applicationLauncher.setEnvironment(startParameters().environment);
d->m_applicationLauncher.setWorkingDirectory(startParameters().workingDirectory);
notifyInferiorSetupOk();
notifyInferiorSetupOk();
}
}
void QmlEngine::connectionEstablished()
@@ -227,6 +231,18 @@ void QmlEngine::runEngine()
plugin()->showMessage(tr("QML Debugger connecting..."), StatusBar);
}
void QmlEngine::handleRemoteSetupDone()
{
notifyInferiorSetupOk();
}
void QmlEngine::handleRemoteSetupFailed(const QString &message)
{
QMessageBox::critical(0,tr("Failed to start application"),
tr("Application startup failed: %1").arg(message));
notifyInferiorSetupFailed();
}
void QmlEngine::shutdownInferiorAsSlave()
{
resetLocation();

View File

@@ -48,6 +48,9 @@ public:
explicit QmlEngine(const DebuggerStartParameters &startParameters);
virtual ~QmlEngine();
void handleRemoteSetupDone();
void handleRemoteSetupFailed(const QString &message);
void setAttachToRunningExternalApp(bool value);
void shutdownInferiorAsSlave();
void shutdownEngineAsSlave();
@@ -59,6 +62,9 @@ public slots:
void messageReceived(const QByteArray &message);
void disconnected();
signals:
void remoteStartupRequested();
private:
// DebuggerEngine implementation
bool isSynchronous() const { return false; }