diff --git a/src/plugins/debugger/commonoptionspage.ui b/src/plugins/debugger/commonoptionspage.ui
index 23ac787f49fb8f89a45ab77df6428d592ce579fd..8804fa8dbd309d632e87ef3d621208bbc72523b3 100644
--- a/src/plugins/debugger/commonoptionspage.ui
+++ b/src/plugins/debugger/commonoptionspage.ui
@@ -33,7 +33,7 @@
       <item>
        <widget class="QCheckBox" name="checkBoxUseAlternatingRowColors">
         <property name="text">
-         <string>Use alternating row colors in debug views.</string>
+         <string>Use alternating row colors in debug views</string>
         </property>
        </widget>
       </item>
diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp
index 13b1679dc8e1a7344330759002322d131357709f..ee7c653f06efeaf33282e26a5db496a89fb3fdac 100644
--- a/src/plugins/debugger/debuggermanager.cpp
+++ b/src/plugins/debugger/debuggermanager.cpp
@@ -30,6 +30,7 @@
 #include "debuggermanager.h"
 
 #include "debuggeractions.h"
+#include "debuggerrunner.h"
 #include "debuggerconstants.h"
 #include "idebuggerengine.h"
 
@@ -172,7 +173,7 @@ void DebuggerManager::init()
     m_busy = false;
 
     m_attachedPID = 0;
-    m_startMode = StartInternal;
+    m_runControl = 0;
 
     m_disassemblerHandler = 0;
     m_modulesHandler = 0;
@@ -295,21 +296,6 @@ void DebuggerManager::init()
     connect(m_watchHandler, SIGNAL(watchModelUpdateRequested()),
         this, SLOT(updateWatchModel()));
 
-    m_startExternalAction = new QAction(this);
-    m_startExternalAction->setText(tr("Start and Debug External Application..."));
-
-    m_attachExternalAction = new QAction(this);
-    m_attachExternalAction->setText(tr("Attach to Running External Application..."));
-
-    m_attachCoreAction = new QAction(this);
-    m_attachCoreAction->setText(tr("Attach to Core..."));
-    connect(m_attachCoreAction, SIGNAL(triggered()), this, SLOT(attachCore()));
-
-    m_attachRemoteAction = new QAction(this);
-    m_attachRemoteAction->setText(tr("Attach to Running Remote Application..."));
-    connect(m_attachRemoteAction, SIGNAL(triggered()),
-        this, SLOT(attachRemoteApplication()));
-
     m_continueAction = new QAction(this);
     m_continueAction->setText(tr("Continue"));
     m_continueAction->setIcon(QIcon(":/gdbdebugger/images/debugger_continue_small.png"));
@@ -371,11 +357,6 @@ void DebuggerManager::init()
     connect(m_continueAction, SIGNAL(triggered()),
         this, SLOT(continueExec()));
 
-    connect(m_startExternalAction, SIGNAL(triggered()),
-        this, SLOT(startExternalApplication()));
-    connect(m_attachExternalAction, SIGNAL(triggered()),
-        this, SLOT(attachExternalApplication()));
-
     connect(m_stopAction, SIGNAL(triggered()),
         this, SLOT(interruptDebuggingRequest()));
     connect(m_resetAction, SIGNAL(triggered()),
@@ -798,30 +779,6 @@ void DebuggerManager::setConfigValue(const QString &name, const QVariant &value)
     emit setConfigValueRequested(name, value);
 }
 
-void DebuggerManager::startExternalApplication()
-{
-    if (!startNewDebugger(StartExternal))
-        emit debuggingFinished();
-}
-
-void DebuggerManager::attachExternalApplication()
-{
-    if (!startNewDebugger(AttachExternal))
-        emit debuggingFinished();
-}
-
-void DebuggerManager::attachCore()
-{
-    if (!startNewDebugger(AttachCore))
-        emit debuggingFinished();
-}
-
-void DebuggerManager::attachRemoteApplication()
-{
-    if (!startNewDebugger(AttachRemote))
-        emit debuggingFinished();
-}
-
 // Figure out the debugger type of an executable
 static bool determineDebuggerType(const QString &executable,
                                   DebuggerManager::DebuggerType *dt,
@@ -869,12 +826,13 @@ static bool determineDebuggerType(int  /* pid */,
     return true;
 }
 
-bool DebuggerManager::startNewDebugger(DebuggerStartMode mode)
+void DebuggerManager::startNewDebugger(DebuggerRunControl *runControl)
 {
+    m_runControl = runControl;
+
     if (Debugger::Constants::Internal::debug)
-        qDebug() << Q_FUNC_INFO << mode;
+        qDebug() << Q_FUNC_INFO << startMode();
 
-    m_startMode = mode;
     // FIXME: Clean up
 
     switch  (startMode()) {
@@ -884,8 +842,10 @@ bool DebuggerManager::startNewDebugger(DebuggerStartMode mode)
             configValue(_("LastExternalExecutableFile")).toString());
         dlg.setExecutableArguments(
             configValue(_("LastExternalExecutableArguments")).toString());
-        if (dlg.exec() != QDialog::Accepted)
-            return false;
+        if (dlg.exec() != QDialog::Accepted) {
+            runControl->debuggingFinished();
+            return;
+        }
         setConfigValue(_("LastExternalExecutableFile"),
             dlg.executableFile());
         setConfigValue(_("LastExternalExecutableArguments"),
@@ -898,8 +858,10 @@ bool DebuggerManager::startNewDebugger(DebuggerStartMode mode)
     }
     case AttachExternal: {
         AttachExternalDialog dlg(mainWindow());
-        if (dlg.exec() != QDialog::Accepted)
-            return false;
+        if (dlg.exec() != QDialog::Accepted) {
+            runControl->debuggingFinished();
+            return;
+        }
         m_executable = QString();
         m_processArgs = QStringList();
         m_workingDir = QString();
@@ -907,7 +869,8 @@ bool DebuggerManager::startNewDebugger(DebuggerStartMode mode)
         if (m_attachedPID == 0) {
             QMessageBox::warning(mainWindow(), tr("Warning"),
                 tr("Cannot attach to PID 0"));
-            return false;
+            runControl->debuggingFinished();
+            return;
         }
         break;
     }
@@ -924,8 +887,10 @@ bool DebuggerManager::startNewDebugger(DebuggerStartMode mode)
             }
             StartExternalDialog dlg(mainWindow());
             dlg.setExecutableFile(startDirectory);
-            if (dlg.exec() != QDialog::Accepted)
-                return false;
+            if (dlg.exec() != QDialog::Accepted) {
+                runControl->debuggingFinished();
+                return;
+            }
             m_executable = dlg.executableFile();
             m_processArgs = dlg.executableArguments().split(' ');
             m_workingDir = QString();
@@ -943,8 +908,10 @@ bool DebuggerManager::startNewDebugger(DebuggerStartMode mode)
             configValue(_("LastExternalExecutableFile")).toString());
         dlg.setCoreFile(
             configValue(_("LastExternalCoreFile")).toString());
-        if (dlg.exec() != QDialog::Accepted)
-            return false;
+        if (dlg.exec() != QDialog::Accepted) {
+            runControl->debuggingFinished();
+            return;
+        }
         setConfigValue(_("LastExternalExecutableFile"),
             dlg.executableFile());
         setConfigValue(_("LastExternalCoreFile"),
@@ -963,8 +930,10 @@ bool DebuggerManager::startNewDebugger(DebuggerStartMode mode)
         dlg.setRemoteArchitectures(arches);
         dlg.setRemoteChannel(configValue(_("LastRemoteChannel")).toString());
         dlg.setRemoteArchitecture(configValue(_("LastRemoteArchtecture")).toString());
-        if (dlg.exec() != QDialog::Accepted)
-            return false;
+        if (dlg.exec() != QDialog::Accepted) {  
+            runControl->debuggingFinished();
+            return;
+        }
         setConfigValue(_("LastRemoteChannel"), dlg.remoteChannel());
         setConfigValue(_("LastRemoteArchitecture"), dlg.remoteArchitecture());
         m_remoteChannel = dlg.remoteChannel();
@@ -983,8 +952,8 @@ bool DebuggerManager::startNewDebugger(DebuggerStartMode mode)
     if (!hasDebugger) {
         QMessageBox::warning(mainWindow(), tr("Warning"),
                 tr("Cannot debug '%1': %2").arg(m_executable, errorMessage));
-        return false;
-
+        debuggingFinished();
+        return;
     }
     if (Debugger::Constants::Internal::debug)
         qDebug() << m_executable << type;
@@ -994,10 +963,11 @@ bool DebuggerManager::startNewDebugger(DebuggerStartMode mode)
     setStatus(DebuggerProcessStartingUp);
     if (!m_engine->startDebugger()) {
         setStatus(DebuggerProcessNotReady);
-        return false;
+        debuggingFinished();
+        return;
     }
 
-    return true;
+    return;
 }
 
 void DebuggerManager::cleanupViews()
@@ -1257,20 +1227,21 @@ void DebuggerManager::setStatus(int status)
         || status == DebuggerInferiorStopRequested
         || status == DebuggerInferiorStopped;
 
-    const bool starting = status == DebuggerProcessStartingUp;
+    //const bool starting = status == DebuggerProcessStartingUp;
     const bool running = status == DebuggerInferiorRunning;
 
     const bool ready = status == DebuggerInferiorStopped
             && startMode() != AttachCore;
 
-    m_startExternalAction->setEnabled(!started && !starting);
-    m_attachExternalAction->setEnabled(!started && !starting);
-#ifdef Q_OS_WIN
-    m_attachCoreAction->setEnabled(false);
-#else
-    m_attachCoreAction->setEnabled(!started && !starting);
-#endif
-    m_attachRemoteAction->setEnabled(!started && !starting);
+// FIXME
+//    m_startExternalAction->setEnabled(!started && !starting);
+//    m_attachExternalAction->setEnabled(!started && !starting);
+//#ifdef Q_OS_WIN
+//    m_attachCoreAction->setEnabled(false);
+//#else
+//    m_attachCoreAction->setEnabled(!started && !starting);
+//#endif
+//    m_attachRemoteAction->setEnabled(!started && !starting);
     m_watchAction->setEnabled(ready);
     m_breakAction->setEnabled(true);
 
@@ -1570,6 +1541,12 @@ void DebuggerManager::showQtDumperLibraryWarning(const QString &details)
     }
 }
 
+DebuggerStartMode DebuggerManager::startMode() const
+{
+    return m_runControl->startMode();
+}
+
+
 //////////////////////////////////////////////////////////////////////
 //
 // Testing
@@ -1581,8 +1558,7 @@ void DebuggerManager::runTest(const QString &fileName)
     m_executable = fileName;
     m_processArgs = QStringList() << "--run-debuggee";
     m_workingDir = QString();
-    if (!startNewDebugger(StartInternal))
-        emit debuggingFinished();
+    //startNewDebugger(StartInternal);
 }
 
 #include "debuggermanager.moc"
diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h
index f238b148ab7ae9d1623454d864fb0abb2c9526d0..ad92a003f3b839e3d184d33a40d09b721dd91064 100644
--- a/src/plugins/debugger/debuggermanager.h
+++ b/src/plugins/debugger/debuggermanager.h
@@ -56,6 +56,7 @@ namespace Debugger {
 namespace Internal {
 
 class DebuggerOutputWindow;
+class DebuggerRunControl;
 class DebuggerPlugin;
 class DebugMode;
 
@@ -204,7 +205,7 @@ public:
     enum DebuggerType { GdbDebugger, ScriptDebugger, WinDebugger };
 
 public slots:
-    bool startNewDebugger(DebuggerStartMode mode);
+    void startNewDebugger(DebuggerRunControl *runControl);
     void exitDebugger(); 
 
     void setSimpleDockWidgetArrangement();
@@ -223,10 +224,6 @@ public slots:
     void resetLocation();
 
     void interruptDebuggingRequest();
-    void startExternalApplication();
-    void attachExternalApplication();
-    void attachCore();
-    void attachRemoteApplication();
 
     void jumpToLineExec();
     void runToLineExec();
@@ -328,7 +325,8 @@ public:
     // one of the interfaces
     QAbstractItemModel *threadsModel();
     int status() const { return m_status; }
-    DebuggerStartMode startMode() const { return m_startMode; }
+    DebuggerStartMode startMode() const;
+    DebuggerRunControl *runControl() const { return m_runControl; }
 
     QList<Symbol> moduleSymbols(const QString &moduleName);
 
@@ -377,7 +375,7 @@ private:
     BreakpointData *findBreakpoint(const QString &fileName, int lineNumber);
     void setToolTipExpression(const QPoint &pos, const QString &exp0);
 
-    DebuggerStartMode m_startMode;
+    DebuggerRunControl *m_runControl;
     DebuggerType m_debuggerType;
 
     /// Views
@@ -405,10 +403,6 @@ private:
 
     /// Actions
     friend class DebuggerPlugin;
-    QAction *m_startExternalAction;
-    QAction *m_attachExternalAction;
-    QAction *m_attachCoreAction;
-    QAction *m_attachRemoteAction;
     QAction *m_continueAction;
     QAction *m_stopAction;
     QAction *m_resetAction; // FIXME: Should not be needed in a stable release
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 0809df5ccafef742ba3d397d6b9872c169d85e46..cbb8a160cabc400a272a5f0d2716a72345ceac30 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -463,31 +463,48 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
     //Core::ActionContainer *mcppcontext =
     //    am->actionContainer(CppEditor::Constants::M_CONTEXT);
 
+    // External apps
+    m_startExternalAction = new QAction(this);
+    m_startExternalAction->setText(tr("Start and Debug External Application..."));
+    connect(m_startExternalAction, SIGNAL(triggered()),
+        this, SLOT(startExternalApplication()));
+
+    m_attachExternalAction = new QAction(this);
+    m_attachExternalAction->setText(tr("Attach to Running External Application..."));
+    connect(m_attachExternalAction, SIGNAL(triggered()),
+        this, SLOT(attachExternalApplication()));
+
+    m_attachCoreAction = new QAction(this);
+    m_attachCoreAction->setText(tr("Attach to Core..."));
+    connect(m_attachCoreAction, SIGNAL(triggered()), this, SLOT(attachCore()));
+
+    m_attachRemoteAction = new QAction(this);
+    m_attachRemoteAction->setText(tr("Attach to Running Remote Application..."));
+    connect(m_attachRemoteAction, SIGNAL(triggered()),
+        this, SLOT(attachRemoteApplication()));
+
+
     Core::ActionContainer *mdebug =
         am->actionContainer(ProjectExplorer::Constants::M_DEBUG);
 
     Core::Command *cmd = 0;
-    cmd = am->registerAction(m_manager->m_startExternalAction,
+    cmd = am->registerAction(m_startExternalAction,
         Constants::STARTEXTERNAL, globalcontext);
     mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
 
-    cmd = am->registerAction(m_manager->m_attachExternalAction,
+    cmd = am->registerAction(m_attachExternalAction,
         Constants::ATTACHEXTERNAL, globalcontext);
     mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
 
-    if (m_manager->m_attachCoreAction) {
-        cmd = am->registerAction(m_manager->m_attachCoreAction,
-                                 Constants::ATTACHCORE, globalcontext);
-        mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
-    }
+    cmd = am->registerAction(m_attachCoreAction,
+        Constants::ATTACHCORE, globalcontext);
+    mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
 
-    #if 0
+    #if 1
     // FIXME: not yet functional
-    if (m_manager->m_attachRemoteAction) {
-        cmd = am->registerAction(m_manager->m_attachRemoteAction,
-                                 Constants::ATTACHREMOTE, globalcontext);
-        mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
-    }
+    cmd = am->registerAction(m_attachRemoteAction,
+        Constants::ATTACHREMOTE, globalcontext);
+    mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
     #endif
 
     cmd = am->registerAction(m_manager->m_continueAction,
@@ -642,7 +659,9 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
     m_debugMode = new DebugMode(this);
     //addAutoReleasedObject(m_debugMode);
 
-    addAutoReleasedObject(new DebuggerRunner(m_manager));
+    // register factory of DebuggerRunControl
+    m_debuggerRunner = new DebuggerRunner(m_manager);
+    addAutoReleasedObject(m_debuggerRunner);
 
     QList<int> context;
     context.append(uidm->uniqueIdentifier(Core::Constants::C_EDITORMANAGER));
@@ -1036,6 +1055,48 @@ void DebuggerPlugin::showSettingsDialog()
         QLatin1String(Debugger::Constants::DEBUGGER_COMMON_SETTINGS_PAGE));
 }
 
+static QSharedPointer<RunConfiguration> activeRunConfiguration()
+{
+    ProjectExplorer::Project *project =
+        ProjectExplorerPlugin::instance()->currentProject();
+    if (project)
+        return project->activeRunConfiguration();
+    return QSharedPointer<RunConfiguration>();
+}
+
+void DebuggerPlugin::startExternalApplication()
+{
+    QSharedPointer<RunConfiguration> rc = activeRunConfiguration();
+    if (RunControl *runControl = m_debuggerRunner
+            ->run(rc, ProjectExplorer::Constants::DEBUGMODE, StartExternal))
+        runControl->start();
+}
+
+void DebuggerPlugin::attachExternalApplication()
+{
+    QSharedPointer<RunConfiguration> rc = activeRunConfiguration();
+    if (RunControl *runControl = m_debuggerRunner
+            ->run(rc, ProjectExplorer::Constants::DEBUGMODE, AttachExternal))
+        runControl->start();
+}
+
+void DebuggerPlugin::attachCore()
+{
+    QSharedPointer<RunConfiguration> rc = activeRunConfiguration();
+    if (RunControl *runControl = m_debuggerRunner
+            ->run(rc, ProjectExplorer::Constants::DEBUGMODE, AttachCore))
+        runControl->start();
+}
+
+void DebuggerPlugin::attachRemoteApplication()
+{
+    QSharedPointer<RunConfiguration> rc = activeRunConfiguration();
+    if (RunControl *runControl = m_debuggerRunner
+            ->run(rc, ProjectExplorer::Constants::DEBUGMODE, AttachRemote))
+        runControl->start();
+}
+
+
 #include "debuggerplugin.moc"
 
 Q_EXPORT_PLUGIN(DebuggerPlugin)
diff --git a/src/plugins/debugger/debuggerplugin.h b/src/plugins/debugger/debuggerplugin.h
index 44a5f2e7711faea96aba22293998bf942b48859b..8990a64191738f3e1c29086604a68892ca3c37bc 100644
--- a/src/plugins/debugger/debuggerplugin.h
+++ b/src/plugins/debugger/debuggerplugin.h
@@ -56,6 +56,7 @@ namespace Internal {
 
 class BreakpointData;
 class DebuggerManager;
+class DebuggerRunner;
 class DebugMode;
 class LocationMark;
 
@@ -96,6 +97,11 @@ private slots:
     void focusCurrentEditor(Core::IMode *mode);
     void showSettingsDialog();
 
+    void startExternalApplication();
+    void attachExternalApplication();
+    void attachCore();
+    void attachRemoteApplication();
+
 private:
     void readSettings();
     void writeSettings() const;
@@ -107,12 +113,18 @@ private:
 
     DebuggerManager *m_manager;
     DebugMode *m_debugMode;
+    DebuggerRunner *m_debuggerRunner;
 
     QString m_previousMode;
     LocationMark *m_locationMark;
     int m_gdbRunningContext;
 
     QAction *m_toggleLockedAction;
+
+    QAction *m_startExternalAction;
+    QAction *m_attachExternalAction;
+    QAction *m_attachCoreAction;
+    QAction *m_attachRemoteAction;
 };
 
 } // namespace Internal
diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp
index 0153ef67531aa240036ace56dbe1f937e99f517f..8739091296c8c11c156652289a7ad9e46ea841f9 100644
--- a/src/plugins/debugger/debuggerrunner.cpp
+++ b/src/plugins/debugger/debuggerrunner.cpp
@@ -57,6 +57,7 @@ using ProjectExplorer::ApplicationRunConfiguration;
 //
 ////////////////////////////////////////////////////////////////////////
 
+// A factory to create DebuggerRunControls
 DebuggerRunner::DebuggerRunner(DebuggerManager *manager)
   : m_manager(manager)
 {}
@@ -72,14 +73,23 @@ QString DebuggerRunner::displayName() const
     return tr("Debug");
 }
 
-RunControl* DebuggerRunner::run(RunConfigurationPtr runConfiguration, const QString &mode)
+RunControl* DebuggerRunner::run(RunConfigurationPtr runConfiguration,
+    const QString &mode, DebuggerStartMode startMode)
 {
     QTC_ASSERT(mode == ProjectExplorer::Constants::DEBUGMODE, return 0);
     ApplicationRunConfigurationPtr rc =
         qSharedPointerCast<ApplicationRunConfiguration>(runConfiguration);
-    QTC_ASSERT(rc, return 0);
+    //QTC_ASSERT(rc, return 0);
     //qDebug() << "***** Debugging" << rc->name() << rc->executable();
-    return new DebuggerRunControl(m_manager, rc);
+    DebuggerRunControl *runControl = new DebuggerRunControl(m_manager, rc);
+    runControl->setStartMode(startMode);
+    return runControl;
+}
+
+RunControl* DebuggerRunner::run(RunConfigurationPtr runConfiguration,
+    const QString &mode)
+{
+    return run(runConfiguration, mode, StartInternal);
 }
 
 QWidget *DebuggerRunner::configurationWidget(RunConfigurationPtr runConfiguration)
@@ -120,24 +130,25 @@ void DebuggerRunControl::start()
     m_running = true;
     ApplicationRunConfigurationPtr rc =
         qSharedPointerCast<ApplicationRunConfiguration>(runConfiguration());
-    QTC_ASSERT(rc, return);
-    ProjectExplorer::Project *project = rc->project();
-    QTC_ASSERT(project, return);
-
-    m_manager->m_executable = rc->executable();
-    m_manager->m_environment = rc->environment().toStringList();
-    m_manager->m_workingDir = rc->workingDirectory();
-    m_manager->m_processArgs = rc->commandLineArguments();
-    m_manager->m_dumperLib = rc->dumperLibrary();
-    m_manager->m_buildDir =
-        project->buildDirectory(project->activeBuildConfiguration());
-    m_manager->m_useTerminal = rc->runMode() == ApplicationRunConfiguration::Console;
+    if (rc) {
+        m_manager->m_executable = rc->executable();
+        m_manager->m_environment = rc->environment().toStringList();
+        m_manager->m_workingDir = rc->workingDirectory();
+        m_manager->m_processArgs = rc->commandLineArguments();
+        m_manager->m_dumperLib = rc->dumperLibrary();
+        ProjectExplorer::Project *project = rc->project();
+        QTC_ASSERT(project, /**/);
+        if (project) {
+            m_manager->m_buildDir =
+                project->buildDirectory(project->activeBuildConfiguration());
+        }
+        m_manager->m_useTerminal = rc->runMode() == ApplicationRunConfiguration::Console;
+    }
 
     //emit addToOutputWindow(this, tr("Debugging %1").arg(m_executable));
-    if (m_manager->startNewDebugger(StartInternal))
-        emit started();
-    else
-        debuggingFinished();
+    m_manager->startNewDebugger(this);
+    emit started();
+    //debuggingFinished();
 }
 
 void DebuggerRunControl::slotAddToOutputWindowInline(const QString &data)
diff --git a/src/plugins/debugger/debuggerrunner.h b/src/plugins/debugger/debuggerrunner.h
index 437b2c27016be0359a21c4e0d98f196c25d49c0e..619498bba6ecc374c414eea12c9d7020c7d75367 100644
--- a/src/plugins/debugger/debuggerrunner.h
+++ b/src/plugins/debugger/debuggerrunner.h
@@ -30,6 +30,8 @@
 #ifndef DEBUGGERRUNNER_H
 #define DEBUGGERRUNNER_H
 
+#include "debuggermanager.h"
+
 #include <projectexplorer/runconfiguration.h>
 
 namespace ProjectExplorer {
@@ -55,17 +57,20 @@ class DebuggerRunner : public ProjectExplorer::IRunConfigurationRunner
 public:
     explicit DebuggerRunner(DebuggerManager *manager);
 
+    // ProjectExplorer::IRunConfigurationRunner
     virtual bool canRun(RunConfigurationPtr runConfiguration, const QString &mode);
     virtual QString displayName() const;
     virtual ProjectExplorer::RunControl *run(RunConfigurationPtr runConfiguration,
         const QString &mode);
     virtual QWidget *configurationWidget(RunConfigurationPtr runConfiguration);
 
+    virtual ProjectExplorer::RunControl *run(RunConfigurationPtr runConfiguration,
+        const QString &mode, DebuggerStartMode startMode);
 private:
     DebuggerManager *m_manager;
 };
 
-
+// This is a job description
 class DebuggerRunControl : public ProjectExplorer::RunControl
 {
     Q_OBJECT
@@ -74,20 +79,25 @@ public:
     DebuggerRunControl(DebuggerManager *manager,
         ApplicationRunConfigurationPtr runConfiguration);
 
+    // ProjectExplorer::RunControl
     virtual void start();
     virtual void stop();
     virtual bool isRunning() const;
 
+    void setStartMode(DebuggerStartMode mode) { m_mode = mode; }
+    DebuggerStartMode startMode() const { return m_mode; }
+    Q_SLOT void debuggingFinished();
+    
 signals:
     void stopRequested();
 
 private slots:
-    void debuggingFinished();
     void slotAddToOutputWindowInline(const QString &output);
 
 private:
     DebuggerManager *m_manager;
     bool m_running;
+    DebuggerStartMode m_mode;
 };
 
 } // namespace Internal
diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp
index d7ddb965a0a5ba34c5877a9af37b0308b17e4edd..653a6817b62afeb6e8c7f00cdbfd0aaff141efdc 100644
--- a/src/plugins/debugger/gdbengine.cpp
+++ b/src/plugins/debugger/gdbengine.cpp
@@ -1313,7 +1313,7 @@ void GdbEngine::exitDebugger()
                 qDebug() << "STATUS ON EXITDEBUGGER: " << q->status());
             interruptInferior();
         }
-        if (q->startMode() == AttachExternal)
+        if (q->startMode() == AttachExternal || q->startMode() == AttachRemote)
             execCommand(_("detach"));
         else
             execCommand(_("kill"));
@@ -1496,11 +1496,13 @@ bool GdbEngine::startDebugger()
         qq->breakHandler()->removeAllBreakpoints();
     } else if (q->startMode() == AttachRemote) {
         execCommand(_("set architecture %1").arg(q->m_remoteArchitecture));
-        execCommand(_("target remote %1").arg(q->m_remoteChannel));
         qq->breakHandler()->setAllPending();
-        //execCommand(_("info target"), handleStart);
-        qq->notifyInferiorRunningRequested();
-        execCommand(_("-exec-continue"), CB(handleExecRun));
+        //QFileInfo fi(q->m_executable);
+        //QString fileName = fi.absoluteFileName();
+        QString fileName = q->m_executable;
+        execCommand(_("-file-exec-and-symbols \"%1\"").arg(fileName));
+        // works only for > 6.8
+        execCommand(_("set target-async on"), CB(handleTargetAsync));
     } else if (q->m_useTerminal) {
         qq->breakHandler()->setAllPending();
     } else if (q->startMode() == StartInternal || q->startMode() == StartExternal) {
@@ -1595,6 +1597,22 @@ void GdbEngine::handleAttach(const GdbResultRecord &, const QVariant &)
     qq->reloadRegisters();
 }
 
+void GdbEngine::handleTargetAsync(const GdbResultRecord &record, const QVariant &)
+{
+    if (record.resultClass == GdbResultDone) {
+        //execCommand(_("info target"), handleStart);
+        qq->notifyInferiorRunningRequested();
+        execCommand(_("target remote %1").arg(q->m_remoteChannel));
+        execCommand(_("-exec-continue"), CB(handleExecRun));
+    } else if (record.resultClass == GdbResultError) {
+        // a typical response on "old" gdb is:
+        // &"set target-async on\n"
+        //&"No symbol table is loaded.  Use the \"file\" command.\n"
+        //^error,msg="No symbol table is loaded.  Use the \"file\" command."
+        execCommand(_("detach"));
+        execCommand(_("-gdb-exit"), CB(handleExit));
+    }
+}
 void GdbEngine::handleExit(const GdbResultRecord &, const QVariant &)
 {
     q->showStatusMessage(tr("Debugger exited."));
diff --git a/src/plugins/debugger/gdbengine.h b/src/plugins/debugger/gdbengine.h
index 9f1a80dbbc3c2a6b0c239beaa817a1733943db1d..c053bc1c0acf364cfa799fdafbf75aa60a9a6b97 100644
--- a/src/plugins/debugger/gdbengine.h
+++ b/src/plugins/debugger/gdbengine.h
@@ -219,6 +219,7 @@ private:
     void handleQuerySources(const GdbResultRecord &response, const QVariant &);
     void handleTargetCore(const GdbResultRecord &, const QVariant &);
     void handleExit(const GdbResultRecord &, const QVariant &);
+    void handleTargetAsync(const GdbResultRecord &, const QVariant &);
     void debugMessage(const QString &msg);
 
     OutputCollector m_outputCollector;