Commit 342ab57d authored by Friedemann Kleint's avatar Friedemann Kleint

Debugger: Un-export GdbAdapters.

Reviewed-by: hjk
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@nokia.com>
parent 5c074331
......@@ -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
......@@ -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;
......
......@@ -43,7 +43,7 @@ namespace Internal {
//
///////////////////////////////////////////////////////////////////////
class DEBUGGER_EXPORT RemoteGdbServerAdapter : public AbstractGdbAdapter
class RemoteGdbServerAdapter : public AbstractGdbAdapter
{
Q_OBJECT
......
......@@ -36,7 +36,7 @@
namespace Debugger {
namespace Internal {
class DEBUGGER_EXPORT RemotePlainGdbAdapter : public AbstractPlainGdbAdapter
class RemotePlainGdbAdapter : public AbstractPlainGdbAdapter
{
Q_OBJECT
......
......@@ -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)
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment