diff options
author | Tim Sander <tim@krieglstein.org> | 2014-06-05 15:10:43 +0200 |
---|---|---|
committer | hjk <hjk121@nokiamail.com> | 2014-06-17 12:46:17 +0200 |
commit | 162d0e3d0957b434f33714df4ca892e41f9666c0 (patch) | |
tree | 2b1dd1320c75d16501b47422f452efb45e817ebe | |
parent | 594b184bb1865f84a8fa8058f4dfa858c5640890 (diff) | |
download | qt-creator-162d0e3d0957b434f33714df4ca892e41f9666c0.tar.gz |
RemoteLinux: switch to extended-remote connection
Change-Id: If282a037e5b26f81859aaad8b407d644aa8b5c1c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
-rw-r--r-- | src/plugins/debugger/gdb/remotegdbserveradapter.cpp | 9 | ||||
-rw-r--r-- | src/plugins/remotelinux/remotelinuxdebugsupport.cpp | 7 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp index c031ab132c..4d2098fc9d 100644 --- a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp +++ b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp @@ -295,7 +295,6 @@ void GdbRemoteServerEngine::handleTargetExtendedRemote(const GdbResponse &respon { QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); if (response.resultClass == GdbResultDone) { - // gdb server will stop the remote application itself. showMessage(_("ATTACHED TO GDB SERVER STARTED")); showMessage(msgAttachedToStoppedInferior(), StatusBar); QString postAttachCommands = debuggerCore()->stringSetting(GdbPostAttachCommands); @@ -303,7 +302,13 @@ void GdbRemoteServerEngine::handleTargetExtendedRemote(const GdbResponse &respon foreach (const QString &cmd, postAttachCommands.split(QLatin1Char('\n'))) postCommand(cmd.toLatin1()); } - postCommand("attach " + QByteArray::number(m_targetPid), CB(handleTargetExtendedAttach)); + if (m_targetPid > 0) { // attach to pid if valid + // gdb server will stop the remote application itself. + postCommand("attach " + QByteArray::number(m_targetPid), CB(handleTargetExtendedAttach)); + } else { + postCommand("-gdb-set remote exec-file " + startParameters().remoteExecutable.toLatin1(), + CB(handleTargetExtendedAttach)); + } } else { QString msg = msgConnectRemoteServerFailed( QString::fromLocal8Bit(response.data["msg"].data())); diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp index 8685b33223..db9b15f45d 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp @@ -60,6 +60,7 @@ public: : engine(engine), qmlDebugging(runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useQmlDebugger()), cppDebugging(runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useCppDebugger()), + target(DeviceKitInformation::device(runConfig->target()->kit())->sshParameters().host.toLatin1()), gdbServerPort(-1), qmlPort(-1) { } @@ -68,6 +69,7 @@ public: bool qmlDebugging; bool cppDebugging; QByteArray gdbserverOutput; + QByteArray target; int gdbServerPort; int qmlPort; }; @@ -175,8 +177,9 @@ void LinuxDeviceDebugSupport::startExecution() command = device()->debugServerPath(); if (command.isEmpty()) command = QLatin1String("gdbserver"); - args.prepend(remoteFilePath()); args.prepend(QString::fromLatin1(":%1").arg(d->gdbServerPort)); + args.prepend(QString::fromLatin1("--multi")); + args.prepend(QString::fromLatin1("--once")); } connect(runner, SIGNAL(finished(bool)), SLOT(handleAppRunnerFinished(bool))); @@ -260,6 +263,8 @@ void LinuxDeviceDebugSupport::handleAdapterSetupFailed(const QString &error) void LinuxDeviceDebugSupport::handleAdapterSetupDone() { AbstractRemoteLinuxRunSupport::handleAdapterSetupDone(); + QByteArray remote = d->target + ':' + QByteArray::number(d->gdbServerPort); + d->engine->notifyEngineRemoteServerRunning(remote, -1); d->engine->notifyEngineRemoteSetupDone(d->gdbServerPort, d->qmlPort); } |