From ca7f49071b4784cf923cc8bc518b9a4c02259d4a Mon Sep 17 00:00:00 2001
From: ck <qt-info@nokia.com>
Date: Fri, 30 Jul 2010 12:14:54 +0200
Subject: [PATCH] Maemo: Complete support for debugging via remote gdb.

1) Make sources available on device.
2) Enable users to switch between gdb and gdbserver approach (users may not be able to use the former if they have no control over their firewall).

Reviewed-by: kh1
---
 src/plugins/debugger/debuggerengine.h         |   7 +-
 .../debugger/gdb/abstractplaingdbadapter.h    |   2 +-
 .../debugger/gdb/remoteplaingdbadapter.cpp    |   7 +
 .../debugger/gdb/remoteplaingdbadapter.h      |   1 +
 .../qt-maemo/maemoconstants.h                 |   2 +
 .../qt-maemo/maemodebugsupport.cpp            | 100 ++++++----
 .../qt-maemo/maemodebugsupport.h              |  14 +-
 .../qt-maemo/maemoglobal.cpp                  |   5 +
 .../qt4projectmanager/qt-maemo/maemoglobal.h  |   1 +
 .../qt-maemo/maemorunconfiguration.cpp        |  37 +++-
 .../qt-maemo/maemorunconfiguration.h          |   7 +
 .../qt-maemo/maemorunconfigurationwidget.cpp  | 181 +++++++++++++-----
 .../qt-maemo/maemorunconfigurationwidget.h    |  20 +-
 .../qt-maemo/maemoruncontrol.cpp              |   2 +-
 .../qt-maemo/maemosshrunner.cpp               |  62 +++---
 .../qt-maemo/maemosshrunner.h                 |   7 +-
 16 files changed, 309 insertions(+), 146 deletions(-)

diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h
index fc8448fbcc2..e620fae251e 100644
--- a/src/plugins/debugger/debuggerengine.h
+++ b/src/plugins/debugger/debuggerengine.h
@@ -75,20 +75,23 @@ public:
     bool useTerminal;
     bool breakAtMain;
     QString crashParameter; // for AttachCrashedExternal
+
     // for remote debugging
     QString remoteChannel;
     QString remoteArchitecture;
     QString symbolFileName;
     QString serverStartScript;
     QString sysRoot;
+    QByteArray remoteDumperLib;
+    QByteArray remoteSourcesDir;
+    Core::SshConnectionParameters connParams;
+
     QString debuggerCommand;
     int toolChainType;
-    QByteArray remoteDumperLib;
     QString qtInstallPath;
 
     QString dumperLibrary;
     QStringList dumperLibraryLocations;
-    Core::SshConnectionParameters connParams;
     DebuggerStartMode startMode;
 };
 
diff --git a/src/plugins/debugger/gdb/abstractplaingdbadapter.h b/src/plugins/debugger/gdb/abstractplaingdbadapter.h
index a6b60e0188d..834439a4ed7 100644
--- a/src/plugins/debugger/gdb/abstractplaingdbadapter.h
+++ b/src/plugins/debugger/gdb/abstractplaingdbadapter.h
@@ -43,7 +43,7 @@ class AbstractPlainGdbAdapter : public AbstractGdbAdapter
 public:
     AbstractPlainGdbAdapter(GdbEngine *engine, QObject *parent = 0);
 
-    void setupInferior();
+    virtual void setupInferior();
     void runEngine();
 
 protected:
diff --git a/src/plugins/debugger/gdb/remoteplaingdbadapter.cpp b/src/plugins/debugger/gdb/remoteplaingdbadapter.cpp
index 6fc15c1c8f5..2d06ff31754 100644
--- a/src/plugins/debugger/gdb/remoteplaingdbadapter.cpp
+++ b/src/plugins/debugger/gdb/remoteplaingdbadapter.cpp
@@ -51,6 +51,13 @@ void RemotePlainGdbAdapter::startAdapter()
     emit requestSetup();
 }
 
+void RemotePlainGdbAdapter::setupInferior()
+{
+    AbstractPlainGdbAdapter::setupInferior();
+    m_engine->postCommand("directory "
+        + m_engine->startParameters().remoteSourcesDir);
+}
+
 void RemotePlainGdbAdapter::interruptInferior()
 {
     m_gdbProc.interruptInferior();
diff --git a/src/plugins/debugger/gdb/remoteplaingdbadapter.h b/src/plugins/debugger/gdb/remoteplaingdbadapter.h
index 43080a95b1e..eb683f531c5 100644
--- a/src/plugins/debugger/gdb/remoteplaingdbadapter.h
+++ b/src/plugins/debugger/gdb/remoteplaingdbadapter.h
@@ -51,6 +51,7 @@ signals:
 
 private:
     void startAdapter();
+    void setupInferior();
     void interruptInferior();
     void shutdownInferior();
     void shutdownAdapter();
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoconstants.h b/src/plugins/qt4projectmanager/qt-maemo/maemoconstants.h
index aa5db8a99c5..ff0d0d994b6 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemoconstants.h
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemoconstants.h
@@ -72,6 +72,8 @@ static const QLatin1String MountPortsKey(PREFIX ".MountPorts");
 static const QLatin1String HostAddressFromDeviceKey(PREFIX ".HostAddressFromDevice");
 static const QLatin1String BaseEnvironmentBaseKey(PREFIX ".BaseEnvironmentBase");
 static const QLatin1String UserEnvironmentChangesKey(PREFIX ".UserEnvironmentChanges");
+static const QLatin1String UseRemoteGdbKey(PREFIX ".UseRemoteGdb");
+static const QLatin1String GdbMountPortKey(PREFIX ".GdbMountPort");
 
 } // namespace Internal
 } // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp
index edece998b3c..037246199bf 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp
@@ -48,6 +48,7 @@
 #include <debugger/gdb/remoteplaingdbadapter.h>
 #include <projectexplorer/toolchain.h>
 
+#include <QtCore/QDir>
 #include <QtCore/QFileInfo>
 
 using namespace Core;
@@ -62,20 +63,28 @@ RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runC
 {
     DebuggerStartParameters params;
     const MaemoDeviceConfig &devConf = runConfig->deviceConfig();
-#ifdef USE_GDBSERVER
-    params.startMode = AttachToRemote;
-    params.executable = runConfig->localExecutableFilePath();
-    params.debuggerCommand = runConfig->gdbCmd();
-    params.remoteChannel = devConf.server.host + QLatin1Char(':')
-        + gdbServerPort(runConfig, devConf);
-    params.remoteArchitecture = QLatin1String("arm");
-#else
-    params.startMode = StartRemoteGdb;
-    params.executable = runConfig->remoteExecutableFilePath();
-    params.debuggerCommand = MaemoGlobal::remoteCommandPrefix(runConfig->remoteExecutableFilePath())
-        + QLatin1String(" /usr/bin/gdb");
-    params.connParams = devConf.server;
-#endif
+    if (runConfig->useRemoteGdb()) {
+        params.startMode = StartRemoteGdb;
+        params.executable = runConfig->remoteExecutableFilePath();
+        params.debuggerCommand
+            = MaemoGlobal::remoteCommandPrefix(runConfig->remoteExecutableFilePath())
+                + QLatin1String(" /usr/bin/gdb");
+        params.connParams = devConf.server;
+        const QString execDirAbs
+            = QDir::fromNativeSeparators(QFileInfo(runConfig->localExecutableFilePath()).path());
+        const QString execDirRel
+            = QDir(runConfig->localDirToMountForRemoteGdb()).relativeFilePath(execDirAbs);
+        params.remoteSourcesDir
+            = QString(MaemoGlobal::remoteProjectSourcesMountPoint()
+                + QLatin1Char('/') + execDirRel).toUtf8();
+    } else {
+        params.startMode = AttachToRemote;
+        params.executable = runConfig->localExecutableFilePath();
+        params.debuggerCommand = runConfig->gdbCmd();
+        params.remoteChannel = devConf.server.host + QLatin1Char(':')
+            + gdbServerPort(runConfig, devConf);
+        params.remoteArchitecture = QLatin1String("arm");
+    }
     params.processArgs = runConfig->arguments();
     params.sysRoot = runConfig->sysRoot();
     params.toolChainType = ToolChain::GCC_MAEMO;
@@ -93,24 +102,22 @@ MaemoDebugSupport::MaemoDebugSupport(MaemoRunConfiguration *runConfig,
     DebuggerRunControl *runControl)
     : QObject(runControl), m_runControl(runControl), m_runConfig(runConfig),
       m_deviceConfig(m_runConfig->deviceConfig()),
-      m_runner(new MaemoSshRunner(this, m_runConfig))
+      m_runner(new MaemoSshRunner(this, m_runConfig, true))
 {
     GdbEngine *engine = qobject_cast<GdbEngine *>(m_runControl->engine());
     Q_ASSERT(engine);
-    m_gdbAdapter = qobject_cast<GdbAdapter *>(engine->gdbAdapter());
+    m_gdbAdapter = engine->gdbAdapter();
     Q_ASSERT(m_gdbAdapter);
     connect(m_gdbAdapter, SIGNAL(requestSetup()), this,
         SLOT(handleAdapterSetupRequested()));
     connect(m_runControl, SIGNAL(finished()), this,
         SLOT(handleDebuggingFinished()));
-#ifdef USE_GDBSERVER
-    m_runner->addProcsToKill(QStringList() << QLatin1String("gdbserver"));
-#else
-    m_runner->addProcsToKill(QStringList() << QLatin1String("gdb"));
-#endif
 }
 
-MaemoDebugSupport::~MaemoDebugSupport() {}
+MaemoDebugSupport::~MaemoDebugSupport()
+{
+    stopSsh();
+}
 
 void MaemoDebugSupport::handleAdapterSetupRequested()
 {
@@ -209,23 +216,22 @@ void MaemoDebugSupport::handleSftpJobFinished(Core::SftpJobId job,
 
 void MaemoDebugSupport::startDebugging()
 {
-#ifdef USE_GDBSERVER
-    connect(m_runner, SIGNAL(remoteErrorOutput(QByteArray)), this,
-        SLOT(handleRemoteErrorOutput(QByteArray)));
-    connect(m_runner, SIGNAL(remoteOutput(QByteArray)), this,
-        SLOT(handleRemoteOutput(QByteArray)));
-    connect(m_runner, SIGNAL(remoteProcessStarted()), this,
-        SLOT(handleRemoteProcessStarted()));
-    const QString &remoteExe = m_runConfig->remoteExecutableFilePath();
-    m_runner->startExecution(QString::fromLocal8Bit("%1 gdbserver :%2 %3 %4")
-        .arg(MaemoGlobal::remoteCommandPrefix(remoteExe))
-        .arg(gdbServerPort(m_runConfig, m_deviceConfig))
-        .arg(remoteExe).arg(m_runConfig->arguments()
-        .join(QLatin1String(" "))).toUtf8());
-#else
-    stopSsh();
-    handleAdapterSetupDone();
-#endif
+    if (useGdb()) {
+        handleAdapterSetupDone();
+    } else {
+        connect(m_runner, SIGNAL(remoteErrorOutput(QByteArray)), this,
+            SLOT(handleRemoteErrorOutput(QByteArray)));
+        connect(m_runner, SIGNAL(remoteOutput(QByteArray)), this,
+            SLOT(handleRemoteOutput(QByteArray)));
+        connect(m_runner, SIGNAL(remoteProcessStarted()), this,
+            SLOT(handleRemoteProcessStarted()));
+        const QString &remoteExe = m_runConfig->remoteExecutableFilePath();
+        m_runner->startExecution(QString::fromLocal8Bit("%1 gdbserver :%2 %3 %4")
+            .arg(MaemoGlobal::remoteCommandPrefix(remoteExe))
+            .arg(gdbServerPort(m_runConfig, m_deviceConfig))
+            .arg(remoteExe).arg(m_runConfig->arguments()
+            .join(QLatin1String(" "))).toUtf8());
+    }
 }
 
 void MaemoDebugSupport::handleRemoteProcessStarted()
@@ -261,7 +267,11 @@ void MaemoDebugSupport::stopSsh()
 
 void MaemoDebugSupport::handleAdapterSetupFailed(const QString &error)
 {
-    m_gdbAdapter->handleSetupFailed(tr("Initial setup failed: %1").arg(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_stopped = true;
     stopSsh();
 }
@@ -269,7 +279,10 @@ void MaemoDebugSupport::handleAdapterSetupFailed(const QString &error)
 void MaemoDebugSupport::handleAdapterSetupDone()
 {
     m_adapterStarted = true;
-    m_gdbAdapter->handleSetupDone();
+    if (useGdb())
+        qobject_cast<RemotePlainGdbAdapter *>(m_gdbAdapter)->handleSetupDone();
+    else
+        qobject_cast<RemoteGdbServerAdapter*>(m_gdbAdapter)->handleSetupDone();
 }
 
 QString MaemoDebugSupport::gdbServerPort(const MaemoRunConfiguration *rc,
@@ -288,5 +301,10 @@ QString MaemoDebugSupport::uploadDir(const MaemoDeviceConfig &devConf)
     return MaemoGlobal::homeDirOnDevice(devConf.server.uname);
 }
 
+bool MaemoDebugSupport::useGdb() const
+{
+    return m_runControl->engine()->startParameters().startMode == StartRemoteGdb;
+}
+
 } // namespace Internal
 } // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.h b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.h
index b0c44e14f10..d2b79b104bc 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.h
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.h
@@ -42,15 +42,12 @@
 #include <QtCore/QObject>
 #include <QtCore/QSharedPointer>
 
-#define USE_GDBSERVER
-
 namespace Core { class SftpChannel; }
 
 namespace Debugger {
 class DebuggerRunControl;
 namespace Internal {
-class RemoteGdbServerAdapter;
-class RemotePlainGdbAdapter;
+class AbstractGdbAdapter;
 }
 }
 
@@ -93,19 +90,14 @@ private:
     void handleAdapterSetupFailed(const QString &error);
     void handleAdapterSetupDone();
     void startDebugging();
+    bool useGdb() const;
 
     Debugger::DebuggerRunControl *m_runControl;
     MaemoRunConfiguration * const m_runConfig;
     const MaemoDeviceConfig m_deviceConfig;
     MaemoSshRunner * const m_runner;
 
-
-#ifdef USE_GDBSERVER
-    typedef Debugger::Internal::RemoteGdbServerAdapter GdbAdapter;
-#else
-    typedef Debugger::Internal::RemotePlainGdbAdapter GdbAdapter;
-#endif
-    GdbAdapter *m_gdbAdapter;
+    Debugger::Internal::AbstractGdbAdapter *m_gdbAdapter;
 
     QSharedPointer<Core::SftpChannel> m_uploader;
     Core::SftpJobId m_uploadJob;
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.cpp
index f3ff1273279..b1e7ac8c13c 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.cpp
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.cpp
@@ -61,5 +61,10 @@ QString MaemoGlobal::remoteEnvironment(const QList<ProjectExplorer::EnvironmentI
     return env.mid(0, env.size() - 1);
 }
 
+QString MaemoGlobal::remoteProjectSourcesMountPoint()
+{
+    return QLatin1String("/tmp/gdbSourcesDir");
+}
+
 } // namespace Internal
 } // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.h b/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.h
index c8f9225b518..7d07c0f420f 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.h
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.h
@@ -49,6 +49,7 @@ public:
     static QString remoteSudo();
     static QString remoteCommandPrefix(const QString &commandFilePath);
     static QString remoteEnvironment(const QList<ProjectExplorer::EnvironmentItem> &list);
+    static QString remoteProjectSourcesMountPoint();
 
     template<class T> static T *buildStep(const ProjectExplorer::BuildConfiguration *bc)
     {
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp
index bd516d2f87b..6ac4bf87298 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp
@@ -55,7 +55,11 @@
 namespace Qt4ProjectManager {
 namespace Internal {
 
-namespace { const QLatin1String DefaultHostAddress("192.168.2.14"); }
+namespace {
+const QLatin1String DefaultHostAddress("192.168.2.14");
+const bool DefaultUseRemoteGdbValue = false;  // TODO: Make true once utfs-server works on Windows.
+const int DefaultGdbMountPort = 10100;
+} // anonymous namespace
 
 using namespace ProjectExplorer;
 
@@ -63,6 +67,9 @@ MaemoRunConfiguration::MaemoRunConfiguration(Qt4Target *parent,
         const QString &proFilePath)
     : RunConfiguration(parent, QLatin1String(MAEMO_RC_ID))
     , m_proFilePath(proFilePath)
+    , m_hostAddressFromDevice(DefaultHostAddress)
+    , m_useRemoteGdb(DefaultUseRemoteGdbValue)
+    , m_gdbMountPort(DefaultGdbMountPort)
     , m_baseEnvironmentBase(SystemEnvironmentBase)
 {
     init();
@@ -74,6 +81,9 @@ MaemoRunConfiguration::MaemoRunConfiguration(Qt4Target *parent,
     , m_proFilePath(source->m_proFilePath)
     , m_gdbPath(source->m_gdbPath)
     , m_arguments(source->m_arguments)
+    , m_hostAddressFromDevice(source->localHostAddressFromDevice())
+    , m_useRemoteGdb(source->useRemoteGdb())
+    , m_gdbMountPort(source->gdbMountPort())
     , m_baseEnvironmentBase(source->m_baseEnvironmentBase)
     , m_systemEnvironment(source->m_systemEnvironment)
     , m_userEnvironmentChanges(source->m_userEnvironmentChanges)
@@ -85,7 +95,6 @@ void MaemoRunConfiguration::init()
 {
     m_devConfigModel = new MaemoDeviceConfigListModel(this);
     m_remoteMounts = new MaemoRemoteMountsModel(this);
-    m_hostAddressFromDevice = DefaultHostAddress;
     setDisplayName(QFileInfo(m_proFilePath).completeBaseName());
 
     updateDeviceConfigurations();
@@ -144,6 +153,8 @@ QVariantMap MaemoRunConfiguration::toMap() const
     const QDir dir = QDir(target()->project()->projectDirectory());
     map.insert(ProFileKey, dir.relativeFilePath(m_proFilePath));
     map.insert(HostAddressFromDeviceKey, m_hostAddressFromDevice);
+    map.insert(UseRemoteGdbKey, useRemoteGdb());
+    map.insert(GdbMountPortKey, gdbMountPort());
     map.insert(BaseEnvironmentBaseKey, m_baseEnvironmentBase);
     map.insert(UserEnvironmentChangesKey,
         ProjectExplorer::EnvironmentItem::toStringList(m_userEnvironmentChanges));
@@ -162,6 +173,8 @@ bool MaemoRunConfiguration::fromMap(const QVariantMap &map)
     m_proFilePath = dir.filePath(map.value(ProFileKey).toString());
     m_hostAddressFromDevice = map.value(HostAddressFromDeviceKey,
         DefaultHostAddress).toString();
+    m_useRemoteGdb = map.value(UseRemoteGdbKey, DefaultUseRemoteGdbValue).toBool();
+    m_gdbMountPort = map.value(GdbMountPortKey, DefaultGdbMountPort).toInt();
     m_userEnvironmentChanges =
         ProjectExplorer::EnvironmentItem::fromStringList(map.value(UserEnvironmentChangesKey)
         .toStringList());
@@ -250,6 +263,26 @@ const QString MaemoRunConfiguration::dumperLib() const
     return qt4bc->qtVersion()->debuggingHelperLibrary();
 }
 
+
+QString MaemoRunConfiguration::localDirToMountForRemoteGdb() const
+{
+    const QString projectDir
+        = QDir::fromNativeSeparators(QDir::cleanPath(activeBuildConfiguration()
+            ->target()->project()->projectDirectory()));
+    const QString execDir
+        = QDir::fromNativeSeparators(QFileInfo(localExecutableFilePath()).path());
+    const int length = qMin(projectDir.length(), execDir.length());
+    int lastSeparatorPos = 0;
+    for (int i = 0; i < length; ++i) {
+        if (projectDir.at(i) != execDir.at(i))
+            return projectDir.left(lastSeparatorPos);
+        if (projectDir.at(i) == QLatin1Char('/'))
+            lastSeparatorPos = i;
+    }
+    return projectDir.length() == execDir.length()
+        ? projectDir : projectDir.left(lastSeparatorPos);
+}
+
 QString MaemoRunConfiguration::localExecutableFilePath() const
 {
     TargetInformation ti = qt4Target()->qt4Project()->rootProjectNode()
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h
index ed18795fb33..ada0a448d49 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h
@@ -96,9 +96,14 @@ public:
     MaemoDeviceConfig deviceConfig() const;
     MaemoDeviceConfigListModel *deviceConfigModel() const;
     QString runtimeGdbServerPort() const;
+    bool useRemoteGdb() const { return m_useRemoteGdb; }
+    void setUseRemoteGdb(bool useRemoteGdb) { m_useRemoteGdb = useRemoteGdb; }
+    int gdbMountPort() const { return m_gdbMountPort; }
+    void setGdbMountPort(int port) { m_gdbMountPort = port; }
 
     const QString gdbCmd() const;
     const QString dumperLib() const;
+    QString localDirToMountForRemoteGdb() const;
 
     virtual QVariantMap toMap() const;
 
@@ -141,6 +146,8 @@ private:
     MaemoRemoteMountsModel *m_remoteMounts;
     QStringList m_arguments;
     QString m_hostAddressFromDevice;
+    bool m_useRemoteGdb;
+    int m_gdbMountPort;
 
     BaseEnvironmentBase m_baseEnvironmentBase;
     ProjectExplorer::Environment m_systemEnvironment;
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp
index c5efebbfea5..a3a726dc3f9 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp
@@ -54,6 +54,8 @@
 #include <QtGui/QLabel>
 #include <QtGui/QLineEdit>
 #include <QtGui/QPushButton>
+#include <QtGui/QRadioButton>
+#include <QtGui/QSpinBox>
 #include <QtGui/QTableView>
 #include <QtGui/QToolButton>
 
@@ -69,7 +71,15 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
 {
     QVBoxLayout *mainLayout = new QVBoxLayout;
     setLayout(mainLayout);
+    addGenericWidgets(mainLayout);
+    mainLayout->addSpacing(20);
+    addDebuggingWidgets(mainLayout);
+    addMountWidgets(mainLayout);
+    addEnvironmentWidgets(mainLayout);
+}
 
+void MaemoRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayout)
+{
     QFormLayout *formLayout = new QFormLayout;
     mainLayout->addLayout(formLayout);
     formLayout->setFormAlignment(Qt::AlignLeft | Qt::AlignVCenter);
@@ -80,7 +90,7 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
     QHBoxLayout *devConfLayout = new QHBoxLayout(devConfWidget);
     m_devConfBox = new QComboBox;
     m_devConfBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
-    m_devConfBox->setModel(runConfiguration->deviceConfigModel());
+    m_devConfBox->setModel(m_runConfiguration->deviceConfigModel());
     devConfLayout->setMargin(0);
     devConfLayout->addWidget(m_devConfBox);
     QLabel *addDevConfLabel= new QLabel(tr("<a href=\"%1\">Manage device configurations</a>")
@@ -99,24 +109,86 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
     m_argsLineEdit = new QLineEdit(m_runConfiguration->arguments().join(" "));
     formLayout->addRow(tr("Arguments:"), m_argsLineEdit);
 
-    mainLayout->addSpacing(20);
-    m_detailsContainer = new Utils::DetailsWidget(this);
+    connect(addDevConfLabel, SIGNAL(linkActivated(QString)), this,
+        SLOT(showSettingsDialog(QString)));
+    connect(debuggerConfLabel, SIGNAL(linkActivated(QString)), this,
+        SLOT(showSettingsDialog(QString)));
+    connect(m_configNameLineEdit, SIGNAL(textEdited(QString)), this,
+        SLOT(configNameEdited(QString)));
+    connect(m_argsLineEdit, SIGNAL(textEdited(QString)), this,
+        SLOT(argumentsEdited(QString)));
+    connect(m_devConfBox, SIGNAL(activated(int)), this,
+            SLOT(setCurrentDeviceConfig(int)));
+    connect(m_runConfiguration->deviceConfigModel(), SIGNAL(currentChanged()),
+        this, SLOT(handleCurrentDeviceConfigChanged()));
+    connect(m_runConfiguration, SIGNAL(targetInformationChanged()), this,
+        SLOT(updateTargetInformation()));
+    handleCurrentDeviceConfigChanged();
+}
+
+void MaemoRunConfigurationWidget::addDebuggingWidgets(QVBoxLayout *mainLayout)
+{
+    m_debugDetailsContainer = new Utils::DetailsWidget(this);
+    QWidget *debugWidget = new QWidget;
+    m_debugDetailsContainer->setWidget(debugWidget);
+#ifndef Q_OS_WIN
+    mainLayout->addWidget(m_debugDetailsContainer);
+#endif
+    QFormLayout *debugLayout = new QFormLayout(debugWidget);
+    QHBoxLayout *debugRadioButtonsLayout = new QHBoxLayout;
+    debugLayout->addRow(debugRadioButtonsLayout);
+    QRadioButton *gdbButton = new QRadioButton(tr("Use remote gdb"));
+    QRadioButton *gdbServerButton = new QRadioButton(tr("Use remote gdbserver"));
+    debugRadioButtonsLayout->addWidget(gdbButton);
+    debugRadioButtonsLayout->addWidget(gdbServerButton);
+    debugRadioButtonsLayout->addStretch(1);
+    QHBoxLayout *debugHostAddressLayout = new QHBoxLayout;
+    m_hostAddressLineEdit2 = new QLineEdit;
+    debugHostAddressLayout->addWidget(m_hostAddressLineEdit2);
+    debugHostAddressLayout->addStretch(1);
+    debugLayout->addRow(tr("This host's address from the device:"),
+        debugHostAddressLayout);
+    m_hostAddressLineEdit2->setText(m_runConfiguration->localHostAddressFromDevice());
+    gdbButton->setChecked(m_runConfiguration->useRemoteGdb());
+    gdbServerButton->setChecked(!gdbButton->isChecked());
+    connect(m_hostAddressLineEdit2, SIGNAL(textEdited(QString)), this,
+        SLOT(handleHostAddressChanged(QString)));
+    connect(gdbButton, SIGNAL(toggled(bool)), this,
+        SLOT(handleDebuggingTypeChanged(bool)));
+    QHBoxLayout *spinBoxLayout = new QHBoxLayout;
+    m_gdbMountPortSpinBox = new QSpinBox;
+    m_gdbMountPortSpinBox->setMinimum(1024);
+    m_gdbMountPortSpinBox->setMaximum((1 << 16) - 1);
+    spinBoxLayout->addWidget(m_gdbMountPortSpinBox);
+    spinBoxLayout->addStretch(1);
+    debugLayout->addRow(tr("Local port for mounting the project directory:"),
+        spinBoxLayout);
+    m_gdbMountPortSpinBox->setValue(m_runConfiguration->gdbMountPort());
+    connect(m_gdbMountPortSpinBox, SIGNAL(valueChanged(int)), this,
+        SLOT(handleGdbMountPortChanged(int)));
+    handleDebuggingTypeChanged(gdbButton->isChecked());
+}
+
+void MaemoRunConfigurationWidget::addMountWidgets(QVBoxLayout *mainLayout)
+{
+
+    m_mountDetailsContainer = new Utils::DetailsWidget(this);
     QWidget *mountViewWidget = new QWidget;
-    m_detailsContainer->setWidget(mountViewWidget);
+    m_mountDetailsContainer->setWidget(mountViewWidget);
 #ifndef Q_OS_WIN
-    mainLayout->addWidget(m_detailsContainer);
+    mainLayout->addWidget(m_mountDetailsContainer);
 #endif
     QVBoxLayout *mountViewLayout = new QVBoxLayout(mountViewWidget);
     QHBoxLayout *hostAddressLayout = new QHBoxLayout;
     mountViewLayout->addLayout(hostAddressLayout);
     QLabel *hostNameLabel
         = new QLabel(tr("This host's address from the device:"));
-    m_hostAddressLineEdit = new QLineEdit;
-    m_hostAddressLineEdit->setText(m_runConfiguration->localHostAddressFromDevice());
-    connect(m_hostAddressLineEdit, SIGNAL(editingFinished()), this,
-        SLOT(handleHostAddressChanged()));
+    m_hostAddressLineEdit1 = new QLineEdit;
+    m_hostAddressLineEdit1->setText(m_runConfiguration->localHostAddressFromDevice());
+    connect(m_hostAddressLineEdit1, SIGNAL(textEdited(QString)), this,
+        SLOT(handleHostAddressChanged(QString)));
     hostAddressLayout->addWidget(hostNameLabel);
-    hostAddressLayout->addWidget(m_hostAddressLineEdit);
+    hostAddressLayout->addWidget(m_hostAddressLineEdit1);
     hostAddressLayout->addStretch(1);
     QHBoxLayout *tableLayout = new QHBoxLayout;
     mountViewLayout->addLayout(tableLayout);
@@ -139,10 +211,34 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
     mountViewButtonsLayout->addWidget(m_removeMountButton);
     mountViewButtonsLayout->addStretch(1);
 
+    connect(addMountButton, SIGNAL(clicked()), this, SLOT(addMount()));
+    connect(m_removeMountButton, SIGNAL(clicked()), this, SLOT(removeMount()));
+    connect(m_mountView, SIGNAL(doubleClicked(QModelIndex)), this,
+        SLOT(changeLocalMountDir(QModelIndex)));
+    connect(m_mountView->selectionModel(),
+        SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this,
+        SLOT(enableOrDisableRemoveMountSpecButton()));
+    connect(m_runConfiguration->remoteMounts(),
+        SIGNAL(rowsInserted(QModelIndex, int, int)), this,
+        SLOT(handleRemoteMountsChanged()));
+    connect(m_runConfiguration->remoteMounts(),
+        SIGNAL(rowsRemoved(QModelIndex, int, int)), this,
+        SLOT(handleRemoteMountsChanged()));
+    connect(m_runConfiguration->remoteMounts(),
+        SIGNAL(dataChanged(QModelIndex, QModelIndex)), this,
+        SLOT(handleRemoteMountsChanged()));
+    connect(m_runConfiguration->remoteMounts(), SIGNAL(modelReset()), this,
+        SLOT(handleRemoteMountsChanged()));
+    enableOrDisableRemoveMountSpecButton();
+    handleRemoteMountsChanged();
+}
+
+void MaemoRunConfigurationWidget::addEnvironmentWidgets(QVBoxLayout *mainLayout)
+{
     QWidget *baseEnvironmentWidget = new QWidget;
     QHBoxLayout *baseEnvironmentLayout = new QHBoxLayout(baseEnvironmentWidget);
     baseEnvironmentLayout->setMargin(0);
-    QLabel *label = new QLabel(tr("Base environment for this runconfiguration:"), this);
+    QLabel *label = new QLabel(tr("Base environment for this run configuration:"), this);
     baseEnvironmentLayout->addWidget(label);
     m_baseEnvironmentComboBox = new QComboBox(this);
     m_baseEnvironmentComboBox->addItems(QStringList() << tr("Clean Environment")
@@ -160,44 +256,6 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
     m_environmentWidget->setUserChanges(m_runConfiguration->userEnvironmentChanges());
     mainLayout->addWidget(m_environmentWidget);
 
-    handleCurrentDeviceConfigChanged();
-    enableOrDisableRemoveButton();
-    handleRemoteMountsChanged();
-
-    connect(m_configNameLineEdit, SIGNAL(textEdited(QString)), this,
-        SLOT(configNameEdited(QString)));
-    connect(m_argsLineEdit, SIGNAL(textEdited(QString)), this,
-        SLOT(argumentsEdited(QString)));
-    connect(m_devConfBox, SIGNAL(activated(int)), this,
-            SLOT(setCurrentDeviceConfig(int)));
-    connect(runConfiguration->deviceConfigModel(), SIGNAL(currentChanged()),
-        this, SLOT(handleCurrentDeviceConfigChanged()));
-    connect(m_runConfiguration, SIGNAL(targetInformationChanged()), this,
-        SLOT(updateTargetInformation()));
-    connect(addDevConfLabel, SIGNAL(linkActivated(QString)), this,
-        SLOT(showSettingsDialog(QString)));
-    connect(debuggerConfLabel, SIGNAL(linkActivated(QString)), this,
-        SLOT(showSettingsDialog(QString)));
-
-    connect(addMountButton, SIGNAL(clicked()), this, SLOT(addMount()));
-    connect(m_removeMountButton, SIGNAL(clicked()), this, SLOT(removeMount()));
-    connect(m_mountView, SIGNAL(doubleClicked(QModelIndex)), this,
-        SLOT(changeLocalMountDir(QModelIndex)));
-    connect(m_mountView->selectionModel(),
-        SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this,
-        SLOT(enableOrDisableRemoveButton()));
-    connect(m_runConfiguration->remoteMounts(),
-        SIGNAL(rowsInserted(QModelIndex, int, int)), this,
-        SLOT(handleRemoteMountsChanged()));
-    connect(m_runConfiguration->remoteMounts(),
-        SIGNAL(rowsRemoved(QModelIndex, int, int)), this,
-        SLOT(handleRemoteMountsChanged()));
-    connect(m_runConfiguration->remoteMounts(),
-        SIGNAL(dataChanged(QModelIndex, QModelIndex)), this,
-        SLOT(handleRemoteMountsChanged()));
-    connect(m_runConfiguration->remoteMounts(), SIGNAL(modelReset()), this,
-        SLOT(handleRemoteMountsChanged()));
-
     connect(m_environmentWidget, SIGNAL(userChangesChanged()), this,
         SLOT(userChangesEdited()));
     connect(m_baseEnvironmentComboBox, SIGNAL(currentIndexChanged(int)),
@@ -250,7 +308,7 @@ void MaemoRunConfigurationWidget::setCurrentDeviceConfig(int index)
     m_runConfiguration->deviceConfigModel()->setCurrentIndex(index);
 }
 
-void MaemoRunConfigurationWidget::enableOrDisableRemoveButton()
+void MaemoRunConfigurationWidget::enableOrDisableRemoveMountSpecButton()
 {
     const QModelIndexList selectedRows
         = m_mountView->selectionModel()->selectedRows();
@@ -294,9 +352,26 @@ void MaemoRunConfigurationWidget::changeLocalMountDir(const QModelIndex &index)
     }
 }
 
-void MaemoRunConfigurationWidget::handleHostAddressChanged()
+void MaemoRunConfigurationWidget::handleHostAddressChanged(const QString &newAddress)
+{
+    m_hostAddressLineEdit1->setText(newAddress);
+    m_hostAddressLineEdit2->setText(newAddress);
+    m_runConfiguration->setLocalHostAddressFromDevice(newAddress);
+}
+
+void MaemoRunConfigurationWidget::handleDebuggingTypeChanged(bool useGdb)
+{
+    m_runConfiguration->setUseRemoteGdb(useGdb);
+    const QString detailsText = useGdb ? tr("Use gdb") : tr("Use gdbserver");
+    m_debugDetailsContainer->setSummaryText(tr("<b>Debugging details:</b> ")
+        + detailsText);
+    m_hostAddressLineEdit2->setEnabled(useGdb);
+    m_gdbMountPortSpinBox->setEnabled(useGdb);
+}
+
+void MaemoRunConfigurationWidget::handleGdbMountPortChanged(int port)
 {
-    m_runConfiguration->setLocalHostAddressFromDevice(m_hostAddressLineEdit->text());
+    m_runConfiguration->setGdbMountPort(port);
 }
 
 void MaemoRunConfigurationWidget::fetchEnvironment()
@@ -367,7 +442,7 @@ void MaemoRunConfigurationWidget::handleRemoteMountsChanged()
             .arg(mountCount);
         break;
     }
-    m_detailsContainer->setSummaryText(QLatin1String("<b>") + text
+    m_mountDetailsContainer->setSummaryText(QLatin1String("<b>") + text
         + QLatin1String("</b>"));
 }
 
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h
index 922e3b6c608..608d0486a95 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h
@@ -43,8 +43,10 @@ class QLabel;
 class QLineEdit;
 class QModelIndex;
 class QPushButton;
+class QSpinBox;
 class QTableView;
 class QToolButton;
+class QVBoxLayout;
 QT_END_NAMESPACE
 
 namespace ProjectExplorer {
@@ -77,8 +79,10 @@ private slots:
     void addMount();
     void removeMount();
     void changeLocalMountDir(const QModelIndex &index);
-    void enableOrDisableRemoveButton();
-    void handleHostAddressChanged();
+    void enableOrDisableRemoveMountSpecButton();
+    void handleHostAddressChanged(const QString &newAddress);
+    void handleDebuggingTypeChanged(bool useGdb);
+    void handleGdbMountPortChanged(int port);
     void fetchEnvironment();
     void fetchEnvironmentFinished();
     void userChangesEdited();
@@ -89,14 +93,22 @@ private slots:
     void handleRemoteMountsChanged();
 
 private:
+    void addGenericWidgets(QVBoxLayout *mainLayout);
+    void addDebuggingWidgets(QVBoxLayout *mainLayout);
+    void addMountWidgets(QVBoxLayout *mainLayout);
+    void addEnvironmentWidgets(QVBoxLayout *mainLayout);
+
     QLineEdit *m_configNameLineEdit;
     QLineEdit *m_argsLineEdit;
     QLabel *m_executableLabel;
     QComboBox *m_devConfBox;
-    QLineEdit *m_hostAddressLineEdit;
+    QLineEdit *m_hostAddressLineEdit1;
+    QLineEdit *m_hostAddressLineEdit2;
+    QSpinBox *m_gdbMountPortSpinBox;
     QTableView *m_mountView;
     QToolButton *m_removeMountButton;
-    Utils::DetailsWidget *m_detailsContainer;
+    Utils::DetailsWidget *m_mountDetailsContainer;
+    Utils::DetailsWidget *m_debugDetailsContainer;
     MaemoRunConfiguration *m_runConfiguration;
 
     bool m_ignoreChange;
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp
index df08195fc25..5701d7ce07d 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp
@@ -57,7 +57,7 @@ MaemoRunControl::MaemoRunControl(RunConfiguration *rc)
     : RunControl(rc, ProjectExplorer::Constants::RUNMODE)
     , m_runConfig(qobject_cast<MaemoRunConfiguration *>(rc))
     , m_devConfig(m_runConfig ? m_runConfig->deviceConfig() : MaemoDeviceConfig())
-    , m_runner(new MaemoSshRunner(this, m_runConfig))
+    , m_runner(new MaemoSshRunner(this, m_runConfig, false))
     , m_running(false)
 {
 }
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp
index bf6f99da468..0169bfbd59b 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp
@@ -36,7 +36,6 @@
 
 #include "maemodeviceconfigurations.h"
 #include "maemoglobal.h"
-#include "maemoremotemountsmodel.h"
 #include "maemorunconfiguration.h"
 #include "maemotoolchain.h"
 
@@ -53,14 +52,17 @@ namespace Qt4ProjectManager {
 namespace Internal {
 
 MaemoSshRunner::MaemoSshRunner(QObject *parent,
-    MaemoRunConfiguration *runConfig)
+    MaemoRunConfiguration *runConfig, bool debugging)
     : QObject(parent), m_runConfig(runConfig),
       m_devConfig(runConfig->deviceConfig()),
-      m_uploadJobId(SftpInvalidJob)
+      m_uploadJobId(SftpInvalidJob),
+      m_debugging(debugging)
 {
     m_procsToKill
         << QFileInfo(m_runConfig->localExecutableFilePath()).fileName()
         << QLatin1String("utfs-client");
+    if (debugging)
+        m_procsToKill << QLatin1String("gdbserver");
 }
 
 MaemoSshRunner::~MaemoSshRunner() {}
@@ -70,13 +72,24 @@ void MaemoSshRunner::setConnection(const QSharedPointer<Core::SshConnection> &co
     m_connection = connection;
 }
 
-void MaemoSshRunner::addProcsToKill(const QStringList &appNames)
-{
-    m_procsToKill << appNames;
-}
-
 void MaemoSshRunner::start()
 {
+    m_mountSpecs.clear();
+    const MaemoRemoteMountsModel * const remoteMounts
+        = m_runConfig->remoteMounts();
+    for (int i = 0; i < remoteMounts->mountSpecificationCount(); ++i) {
+        const MaemoRemoteMountsModel::MountSpecification &mountSpec
+            = remoteMounts->mountSpecificationAt(i);
+        if (mountSpec.isValid())
+            m_mountSpecs << mountSpec;
+    }
+    if (m_debugging && m_runConfig->useRemoteGdb()) {
+        m_mountSpecs << MaemoRemoteMountsModel::MountSpecification(
+            m_runConfig->localDirToMountForRemoteGdb(),
+            MaemoGlobal::remoteProjectSourcesMountPoint(),
+            m_runConfig->gdbMountPort());
+    }
+
     m_stop = false;
     if (m_connection)
         disconnect(m_connection.data(), 0, this, 0);
@@ -109,9 +122,11 @@ void MaemoSshRunner::stop()
         disconnect(m_mountProcess.data(), 0, this, 0);
         m_mountProcess->closeChannel();
     }
-    if (m_runner) {
-        disconnect(m_runner.data(), 0, this, 0);
-        m_runner->closeChannel();
+    if (m_debugging || m_runner) {
+        if (m_runner) {
+            disconnect(m_runner.data(), 0, this, 0);
+            m_runner->closeChannel();
+        }
         cleanup(false);
     }
 }
@@ -140,18 +155,12 @@ void MaemoSshRunner::cleanup(bool initialCleanup)
     }
     QString remoteCall = niceKill + QLatin1String("sleep 1; ") + brutalKill;
 
-    const MaemoRemoteMountsModel * const remoteMounts
-        = m_runConfig->remoteMounts();
-    for (int i = 0; i < remoteMounts->mountSpecificationCount(); ++i) {
-        const MaemoRemoteMountsModel::MountSpecification &mountSpec
-            = remoteMounts->mountSpecificationAt(i);
-        if (mountSpec.isValid()) {
-            remoteCall += QString::fromLocal8Bit("%1 umount %2;")
-                .arg(MaemoGlobal::remoteSudo(), mountSpec.remoteMountPoint);
-        }
+    for (int i = 0; i < m_mountSpecs.count(); ++i) {
+        remoteCall += QString::fromLocal8Bit("%1 umount %2;")
+            .arg(MaemoGlobal::remoteSudo(), m_mountSpecs.at(i).remoteMountPoint);
     }
-
     remoteCall.remove(remoteCall.count() - 1, 1); // Get rid of trailing semicolon.
+
     SshRemoteProcess::Ptr proc
         = m_connection->createRemoteProcess(remoteCall.toUtf8());
     if (initialCleanup) {
@@ -180,7 +189,7 @@ void MaemoSshRunner::handleInitialCleanupFinished(int exitStatus)
     if (exitStatus != SshRemoteProcess::ExitedNormally) {
         emit error(tr("Initial cleanup failed: %1")
             .arg(m_initialCleaner->errorString()));
-    } else if (m_runConfig->remoteMounts()->hasValidMountSpecifications()) {
+    } else if (!m_mountSpecs.isEmpty()) {
         deployUtfsClient();
     } else {
         emit readyForExecution();
@@ -248,20 +257,15 @@ void MaemoSshRunner::handleUploadFinished(Core::SftpJobId jobId,
 
 void MaemoSshRunner::mount()
 {
-    const MaemoRemoteMountsModel * const remoteMounts
-        = m_runConfig->remoteMounts();
     const QString chmodFuse
         = MaemoGlobal::remoteSudo() + QLatin1String(" chmod a+r+w /dev/fuse");
     const QString chmodUtfsClient
         = QLatin1String("chmod a+x ") + utfsClientOnDevice();
     const QLatin1String andOp(" && ");
     QString remoteCall = chmodFuse + andOp + chmodUtfsClient;
-    for (int i = 0; i < remoteMounts->mountSpecificationCount(); ++i) {
+    for (int i = 0; i < m_mountSpecs.count(); ++i) {
         const MaemoRemoteMountsModel::MountSpecification &mountSpec
-            = remoteMounts->mountSpecificationAt(i);
-        if (!mountSpec.isValid())
-            continue;
-
+            = m_mountSpecs.at(i);
         QProcess * const utfsServerProc = new QProcess(this);
         connect(utfsServerProc, SIGNAL(readyReadStandardError()), this,
             SLOT(handleUtfsServerErrorOutput()));
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.h b/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.h
index ca60ffdfb99..4fd7a6295d6 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.h
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.h
@@ -39,6 +39,7 @@
 #include <QtCore/QSharedPointer>
 
 #include "maemodeviceconfigurations.h"
+#include "maemoremotemountsmodel.h"
 
 #include <coreplugin/ssh/sftpdefs.h>
 
@@ -60,11 +61,11 @@ class MaemoSshRunner : public QObject
 {
     Q_OBJECT
 public:
-    MaemoSshRunner(QObject *parent, MaemoRunConfiguration *runConfig);
+    MaemoSshRunner(QObject *parent, MaemoRunConfiguration *runConfig,
+        bool debugging);
     ~MaemoSshRunner();
 
     void setConnection(const QSharedPointer<Core::SshConnection> &connection);
-    void addProcsToKill(const QStringList &appNames);
 
     void start();
     void stop();
@@ -109,9 +110,11 @@ private:
     QSharedPointer<Core::SftpChannel> m_utfsClientUploader;
     QStringList m_procsToKill;
     QList<QProcess *> m_utfsServers;
+    QList<MaemoRemoteMountsModel::MountSpecification> m_mountSpecs;
 
     Core::SftpJobId m_uploadJobId;
     bool m_stop;
+    const bool m_debugging;
 };
 
 } // namespace Internal
-- 
GitLab