diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 6864fbccdf034cbcbbb88a0a6eeef1797fa9e934..d8c203f22e2390eb8386eb7ce9b1452a99b05f28 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -1294,6 +1294,7 @@ void DebuggerPlugin::startRemoteApplication()
     StartRemoteDialog dlg(m_manager->mainWindow());
     QStringList arches;
     arches.append(_("i386:x86-64:intel"));
+    arches.append(_("i386"));
     dlg.setRemoteArchitectures(arches);
     dlg.setRemoteChannel(
             configValue(_("LastRemoteChannel")).toString());
diff --git a/src/plugins/debugger/gdb/remotegdbadapter.cpp b/src/plugins/debugger/gdb/remotegdbadapter.cpp
index beed13ac93115b95569c5f78a320bd8a572cb9ea..87abff240e548edc6eb2c28cce0993adbae96988 100644
--- a/src/plugins/debugger/gdb/remotegdbadapter.cpp
+++ b/src/plugins/debugger/gdb/remotegdbadapter.cpp
@@ -99,11 +99,10 @@ void RemoteGdbAdapter::startAdapter()
 
     QString location = theDebuggerStringSetting(GdbLocation);
 
-/*  
-    // FIXME: make asynchroneouis
+    // FIXME: make asynchroneous
     // Start the remote server
     if (startParameters().serverStartScript.isEmpty()) {
-        showStatusMessage(_("No server start script given. "
+        m_engine->showStatusMessage(_("No server start script given. "
             "Assuming server runs already."));
     } else {
         if (!startParameters().workingDir.isEmpty())
@@ -113,7 +112,6 @@ void RemoteGdbAdapter::startAdapter()
         m_uploadProc.start(_("/bin/sh ") + startParameters().serverStartScript);
         m_uploadProc.waitForStarted();
     }
-*/
 
     // Start the debugger
     m_gdbProc.start(location, gdbArgs);
@@ -179,12 +177,28 @@ void RemoteGdbAdapter::prepareInferior()
 {
     QTC_ASSERT(state() == AdapterStarted, qDebug() << state());
     setState(InferiorPreparing);
+
+    m_engine->postCommand(_("set architecture %1")
+        .arg(startParameters().remoteArchitecture));
+
     if (!startParameters().processArgs.isEmpty())
         m_engine->postCommand(_("-exec-arguments ")
             + startParameters().processArgs.join(_(" ")));
-    QFileInfo fi(m_engine->startParameters().executable);
-    m_engine->postCommand(_("-file-exec-and-symbols \"%1\"").arg(fi.absoluteFilePath()),
+
+    //qq->breakHandler()->setAllPending();
+    QFileInfo fi(startParameters().executable);
+    QString fileName = fi.absoluteFilePath();
+    m_engine->postCommand(_("-file-exec-and-symbols \"%1\"").arg(fileName),
         CB(handleFileExecAndSymbols));
+
+    // works only for > 6.8
+    //postCommand(_("set target-async on"), CB(handleSetTargetAsync));
+    // 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."
+    //postCommand(_("detach"));
+    //emit inferiorPreparationFailed(msg);
 }
 
 void RemoteGdbAdapter::handleFileExecAndSymbols(const GdbResultRecord &response, const QVariant &)
@@ -192,11 +206,27 @@ void RemoteGdbAdapter::handleFileExecAndSymbols(const GdbResultRecord &response,
     QTC_ASSERT(state() == InferiorPreparing, qDebug() << state());
     if (response.resultClass == GdbResultDone) {
         //m_breakHandler->clearBreakMarkers();
+        QString channel = startParameters().remoteChannel;
+        m_engine->postCommand(_("target remote %1").arg(channel),
+            CB(handleTargetRemote));
+    } else if (response.resultClass == GdbResultError) {
+        QString msg = tr("Starting remote executable failed:\n");
+        msg += __(response.data.findChild("msg").data());
+        setState(InferiorPreparationFailed);
+        emit inferiorPreparationFailed(msg);
+    }
+}
+
+void RemoteGdbAdapter::handleTargetRemote(const GdbResultRecord &record, const QVariant &)
+{
+    QTC_ASSERT(state() == InferiorPreparing, qDebug() << state());
+    if (record.resultClass == GdbResultDone) {
         setState(InferiorPrepared);
         emit inferiorPrepared();
-    } else if (response.resultClass == GdbResultError) {
-        QString msg = tr("Starting executable failed:\n") +
-            __(response.data.findChild("msg").data());
+    } else if (record.resultClass == GdbResultError) {
+        // 16^error,msg="hd:5555: Connection timed out."
+        QString msg = tr("Connecting to remote server failed:\n");
+        msg += __(record.data.findChild("msg").data());
         setState(InferiorPreparationFailed);
         emit inferiorPreparationFailed(msg);
     }
@@ -206,22 +236,22 @@ void RemoteGdbAdapter::startInferior()
 {
     QTC_ASSERT(state() == InferiorPrepared, qDebug() << state());
     setState(InferiorStarting);
-    m_engine->postCommand(_("-exec-run"), CB(handleExecRun));
+    m_engine->postCommand(_("attach"), CB(handleFirstContinue));
+    // FIXME: Is there a way to properly recognize a successful start?
+    setState(InferiorStarted);
+    emit inferiorStarted();
 }
 
-void RemoteGdbAdapter::handleExecRun(const GdbResultRecord &response, const QVariant &)
+void RemoteGdbAdapter::handleFirstContinue(const GdbResultRecord &record, const QVariant &)
 {
-    QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
-    if (response.resultClass == GdbResultRunning) {
-        setState(InferiorStarted);
-        emit inferiorStarted();
-    } else {
-        QTC_ASSERT(response.resultClass == GdbResultError, /**/);
-        const QByteArray &msg = response.data.findChild("msg").data();
-        //QTC_ASSERT(status() == DebuggerInferiorRunning, /**/);
-        //interruptInferior();
-        setState(InferiorStartFailed);
-        emit inferiorStartFailed(msg);
+    //QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
+    QTC_ASSERT(state() == InferiorStarted, qDebug() << state());
+    if (record.resultClass == GdbResultDone) {
+        // inferiorStarted already emitted above, see FIXME
+    } else if (record.resultClass == GdbResultError) {
+        //QString msg = __(record.data.findChild("msg").data());
+        QString msg1 = tr("Connecting to remote server failed:\n");
+        emit inferiorStartFailed(msg1 + record.toString());
     }
 }
 
@@ -232,20 +262,27 @@ void RemoteGdbAdapter::interruptInferior()
 
 void RemoteGdbAdapter::shutdown()
 {
-    if (state() == InferiorStarted) {
+    switch (state()) {
+
+    case AdapterNotRunning:
+        return;
+
+    case InferiorStarted:
         setState(InferiorShuttingDown);
         m_engine->postCommand(_("kill"), CB(handleKill));
         return;
-    }
+    
+    default:
+        QTC_ASSERT(false, qDebug() << state());
+        // fall through
 
-    if (state() == InferiorShutDown) {
+    case InferiorPreparationFailed:
+    case InferiorShutDown:
         setState(AdapterShuttingDown);
         m_engine->postCommand(_("-gdb-exit"), CB(handleExit));
         return;
-    }
 
-    // FIXME: handle other states, too.
-    QTC_ASSERT(state() == AdapterNotRunning, qDebug() << state());
+    }
 }
 
 void RemoteGdbAdapter::handleKill(const GdbResultRecord &response, const QVariant &)
diff --git a/src/plugins/debugger/gdb/remotegdbadapter.h b/src/plugins/debugger/gdb/remotegdbadapter.h
index 613f1fecae6f8b28bd17399e62f1787edb41f59d..74653ffdaf94e71321554ce41a6c9e122fe22c5f 100644
--- a/src/plugins/debugger/gdb/remotegdbadapter.h
+++ b/src/plugins/debugger/gdb/remotegdbadapter.h
@@ -74,7 +74,8 @@ private:
     void handleFileExecAndSymbols(const GdbResultRecord &, const QVariant &);
     void handleKill(const GdbResultRecord &, const QVariant &);
     void handleExit(const GdbResultRecord &, const QVariant &);
-    void handleExecRun(const GdbResultRecord &response, const QVariant &);
+    void handleTargetRemote(const GdbResultRecord &response, const QVariant &);
+    void handleFirstContinue(const GdbResultRecord &response, const QVariant &);
 
     void debugMessage(const QString &msg) { m_engine->debugMessage(msg); }
     Q_SLOT void handleGdbFinished(int, QProcess::ExitStatus);
diff --git a/tests/manual/fakevim/runremotely.sh b/tests/manual/fakevim/runremotely.sh
index c2c47955fae0703052dbd5af6c07061f6b068256..1b52ba66578c755d610edb29beea99f805a3c34b 100755
--- a/tests/manual/fakevim/runremotely.sh
+++ b/tests/manual/fakevim/runremotely.sh
@@ -7,9 +7,10 @@ targetdir=/tmp/run-${exename}
 executable=${sourcedir}/${exename}
 qtlibs=`ldd ${executable} | grep libQt | sed -e 's/^.*=> \(.*\) (.*)$/\1/'`
 
-ssh ${account} "mkdir -p ${targetdir}"
-scp ${executable} ${qtlibs} ${account}:${targetdir}
-ssh ${account} "chrpath -r ${targetdir} ${targetdir}/*"
-ssh -X ${account} "gdbserver localhost:5555 ${targetdir}/${exename}"
-ssh ${account} "rm ${targetdir}/* ; rmdir ${targetdir}"
+ssh ${account} "mkdir -p ${targetdir}" || exit 1
+scp ${executable} ${qtlibs} ${account}:${targetdir} || exit 1
+ssh ${account} "chrpath -r ${targetdir} ${targetdir}/*" || exit 1
+ssh -X ${account} "gdbserver localhost:5555 ${targetdir}/${exename}" || exit 1
+ssh ${account} "rm ${targetdir}/* ; rmdir ${targetdir}" || exit 1
+exit 0