summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/debugger/debuggerrunner.cpp65
-rw-r--r--src/plugins/debugger/debuggerrunner.h11
-rw-r--r--src/plugins/debugger/gdb/remotegdbserveradapter.h2
-rw-r--r--src/plugins/debugger/gdb/remoteplaingdbadapter.h2
-rw-r--r--src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp31
-rw-r--r--src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.h5
6 files changed, 84 insertions, 32 deletions
diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp
index a7cdeb680c..a438b16eba 100644
--- a/src/plugins/debugger/debuggerrunner.cpp
+++ b/src/plugins/debugger/debuggerrunner.cpp
@@ -35,6 +35,10 @@
#include "debuggerplugin.h"
#include "debuggerstringutils.h"
#include "debuggeruiswitcher.h"
+#include "gdb/gdbengine.h"
+#include "gdb/remotegdbserveradapter.h"
+#include "gdb/remoteplaingdbadapter.h"
+#include "qml/qmlcppengine.h"
#ifdef Q_OS_WIN
# include "peutils.h"
@@ -397,6 +401,7 @@ void DebuggerRunControl::createEngine(const DebuggerStartParameters &startParams
switch (engineType) {
case GdbEngineType:
m_engine = createGdbEngine(sp);
+ initGdbEngine(qobject_cast<Internal::GdbEngine *>(m_engine));
break;
case ScriptEngineType:
m_engine = createScriptEngine(sp);
@@ -415,6 +420,8 @@ void DebuggerRunControl::createEngine(const DebuggerStartParameters &startParams
break;
case QmlCppEngineType:
m_engine = createQmlCppEngine(sp);
+ if (Internal::GdbEngine *embeddedGdbEngine = gdbEngine())
+ initGdbEngine(embeddedGdbEngine);
break;
default: {
// Could not find anything suitable.
@@ -430,6 +437,21 @@ void DebuggerRunControl::createEngine(const DebuggerStartParameters &startParams
}
}
+void DebuggerRunControl::initGdbEngine(Internal::GdbEngine *engine)
+{
+ QTC_ASSERT(engine, return)
+
+ // Forward adapter signals.
+ Internal::AbstractGdbAdapter *adapter = engine->gdbAdapter();
+ if (RemotePlainGdbAdapter *rpga = qobject_cast<RemotePlainGdbAdapter *>(adapter)) {
+ connect(rpga, SIGNAL(requestSetup()), this,
+ SIGNAL(gdbAdapterRequestSetup()));
+ } else if (RemoteGdbServerAdapter *rgsa = qobject_cast<RemoteGdbServerAdapter *>(adapter)) {
+ connect(rgsa, SIGNAL(requestSetup()),
+ this, SIGNAL(gdbAdapterRequestSetup()));
+ }
+}
+
QString DebuggerRunControl::displayName() const
{
QTC_ASSERT(m_engine, return QString());
@@ -592,4 +614,47 @@ Internal::DebuggerEngine *DebuggerRunControl::engine()
return m_engine;
}
+Internal::GdbEngine *DebuggerRunControl::gdbEngine() const
+{
+ QTC_ASSERT(m_engine, return 0);
+ if (GdbEngine *gdbEngine = qobject_cast<GdbEngine *>(m_engine))
+ return gdbEngine;
+ if (QmlCppEngine * const qmlEngine = qobject_cast<QmlCppEngine *>(m_engine))
+ if (GdbEngine *embeddedGdbEngine = qobject_cast<GdbEngine *>(qmlEngine->cppEngine()))
+ return embeddedGdbEngine;
+ return 0;
+}
+
+Internal::AbstractGdbAdapter *DebuggerRunControl::gdbAdapter() const
+{
+ GdbEngine *engine = gdbEngine();
+ QTC_ASSERT(engine, return 0)
+ return engine->gdbAdapter();
+}
+
+void DebuggerRunControl::remoteGdbHandleSetupDone()
+{
+ 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();
+ } else {
+ QTC_ASSERT(false, /* */ );
+ }
+}
+
+void DebuggerRunControl::remoteGdbHandleSetupFailed(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);
+ } else {
+ QTC_ASSERT(false, /* */ );
+ }
+}
} // namespace Debugger
diff --git a/src/plugins/debugger/debuggerrunner.h b/src/plugins/debugger/debuggerrunner.h
index 2fbe020165..cca2a24446 100644
--- a/src/plugins/debugger/debuggerrunner.h
+++ b/src/plugins/debugger/debuggerrunner.h
@@ -48,6 +48,8 @@ class DebuggerStartParameters;
namespace Internal {
class DebuggerEngine;
class QmlEngine;
+class GdbEngine;
+class AbstractGdbAdapter;
}
//DEBUGGER_EXPORT QDebug operator<<(QDebug str, const DebuggerStartParameters &);
@@ -113,11 +115,17 @@ public:
void showMessage(const QString &msg, int channel);
+ void remoteGdbHandleSetupDone();
+ void remoteGdbHandleSetupFailed(const QString &message);
+
static bool checkDebugConfiguration(int toolChain,
QString *errorMessage,
QString *settingsCategory = 0,
QString *settingsPage = 0);
+signals:
+ void gdbAdapterRequestSetup();
+
private slots:
void handleFinished();
@@ -127,6 +135,9 @@ protected:
private:
DebuggerEngineType engineForExecutable(const QString &executable);
DebuggerEngineType engineForMode(DebuggerStartMode mode);
+ void initGdbEngine(Internal::GdbEngine *engine);
+ Internal::GdbEngine *gdbEngine() const;
+ Internal::AbstractGdbAdapter *gdbAdapter() const;
Internal::DebuggerEngine *m_engine;
const QWeakPointer<RunConfiguration> m_myRunConfiguration;
diff --git a/src/plugins/debugger/gdb/remotegdbserveradapter.h b/src/plugins/debugger/gdb/remotegdbserveradapter.h
index 0f514e4ac3..ffcb8851e0 100644
--- a/src/plugins/debugger/gdb/remotegdbserveradapter.h
+++ b/src/plugins/debugger/gdb/remotegdbserveradapter.h
@@ -43,7 +43,7 @@ namespace Internal {
//
///////////////////////////////////////////////////////////////////////
-class DEBUGGER_EXPORT RemoteGdbServerAdapter : public AbstractGdbAdapter
+class RemoteGdbServerAdapter : public AbstractGdbAdapter
{
Q_OBJECT
diff --git a/src/plugins/debugger/gdb/remoteplaingdbadapter.h b/src/plugins/debugger/gdb/remoteplaingdbadapter.h
index 0505e3002b..68a2651b06 100644
--- a/src/plugins/debugger/gdb/remoteplaingdbadapter.h
+++ b/src/plugins/debugger/gdb/remoteplaingdbadapter.h
@@ -36,7 +36,7 @@
namespace Debugger {
namespace Internal {
-class DEBUGGER_EXPORT RemotePlainGdbAdapter : public AbstractPlainGdbAdapter
+class RemotePlainGdbAdapter : public AbstractPlainGdbAdapter
{
Q_OBJECT
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp
index 141f5a77ae..f204ac6f28 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp
@@ -41,12 +41,10 @@
#include "maemosshrunner.h"
#include <coreplugin/ssh/sftpchannel.h>
-#include <debugger/debuggerengine.h>
#include <debugger/debuggerplugin.h>
#include <debugger/debuggerrunner.h>
-#include <debugger/qml/qmlcppengine.h>
-#include <debugger/gdb/remotegdbserveradapter.h>
-#include <debugger/gdb/remoteplaingdbadapter.h>
+#include <debugger/debuggerengine.h>
+
#include <projectexplorer/toolchain.h>
#include <QtCore/QDir>
@@ -115,18 +113,7 @@ MaemoDebugSupport::MaemoDebugSupport(MaemoRunConfiguration *runConfig,
m_deviceConfig(m_runConfig->deviceConfig()),
m_runner(new MaemoSshRunner(this, m_runConfig, true))
{
- GdbEngine *gdbEngine = qobject_cast<GdbEngine *>(m_runControl->engine());
- if (!gdbEngine) {
- QmlCppEngine * const qmlEngine
- = qobject_cast<QmlCppEngine *>(m_runControl->engine());
- Q_ASSERT(qmlEngine);
- gdbEngine = qobject_cast<GdbEngine *>(qmlEngine->cppEngine());
- }
- Q_ASSERT(gdbEngine);
- m_gdbAdapter = gdbEngine->gdbAdapter();
- Q_ASSERT(m_gdbAdapter);
- connect(m_gdbAdapter, SIGNAL(requestSetup()), this,
- SLOT(handleAdapterSetupRequested()));
+ connect(m_runControl, SIGNAL(gdbAdapterRequestSetup()), this, SLOT(handleAdapterSetupRequested()));
connect(m_runControl, SIGNAL(finished()), this,
SLOT(handleDebuggingFinished()));
}
@@ -291,11 +278,8 @@ void MaemoDebugSupport::stopSsh()
void MaemoDebugSupport::handleAdapterSetupFailed(const QString &error)
{
- const QString msg = tr("Initial setup failed: %1").arg(error);
- if (useGdb())
- qobject_cast<RemotePlainGdbAdapter *>(m_gdbAdapter)->handleSetupFailed(msg);
- else
- qobject_cast<RemoteGdbServerAdapter*>(m_gdbAdapter)->handleSetupFailed(msg);
+
+ m_runControl->remoteGdbHandleSetupFailed(tr("Initial setup failed: %1").arg(error));
m_stopped = true;
stopSsh();
}
@@ -303,10 +287,7 @@ void MaemoDebugSupport::handleAdapterSetupFailed(const QString &error)
void MaemoDebugSupport::handleAdapterSetupDone()
{
m_adapterStarted = true;
- if (useGdb())
- qobject_cast<RemotePlainGdbAdapter *>(m_gdbAdapter)->handleSetupDone();
- else
- qobject_cast<RemoteGdbServerAdapter*>(m_gdbAdapter)->handleSetupDone();
+ m_runControl->remoteGdbHandleSetupDone();
}
int MaemoDebugSupport::gdbServerPort(const MaemoRunConfiguration *rc)
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.h b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.h
index eec6cdb22f..255dbef177 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.h
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.h
@@ -46,9 +46,6 @@ namespace Core { class SftpChannel; }
namespace Debugger {
class DebuggerRunControl;
-namespace Internal {
-class AbstractGdbAdapter;
-}
}
namespace ProjectExplorer { class RunControl; }
@@ -100,8 +97,6 @@ private:
const MaemoDeviceConfig m_deviceConfig;
MaemoSshRunner * const m_runner;
- Debugger::Internal::AbstractGdbAdapter *m_gdbAdapter;
-
QSharedPointer<Core::SftpChannel> m_uploader;
Core::SftpJobId m_uploadJob;
bool m_adapterStarted;