summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Holzammer <andreas.holzammer@kdab.com>2013-03-28 08:14:09 +0100
committerTobias Nätterlund <tobias.naetterlund@kdab.com>2013-04-24 10:44:44 +0200
commitbd4105def7c361f1bb80540f18005116a3cb4dbe (patch)
tree732d8b4a26a53b0900905ac480511598f924767c /src
parent2a8a411b214a42a17b188d032865dc722e10eb99 (diff)
downloadqt-creator-bd4105def7c361f1bb80540f18005116a3cb4dbe.tar.gz
QNX: Enable QML debugging for pure QNX devices
This includes fixing the application arguments when launching the application through gdb. As the application is launched by passing it as an argument to -exec-run (or run), the application arguments needs to go in the same command. -exec-run won't care about arguments set with -exec-arguments when being passed the application binary. Change-Id: I869acbedd2593a931bf5c3d88559ea2bda2c3ff1 Reviewed-by: hjk <hjk121@nokiamail.com> Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com> Reviewed-by: Aurindam Jana <aurindam.jana@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/debugger/gdb/remotegdbserveradapter.cpp9
-rw-r--r--src/plugins/qnx/qnxdebugsupport.cpp51
-rw-r--r--src/plugins/qnx/qnxdebugsupport.h11
-rw-r--r--src/plugins/qnx/qnxruncontrolfactory.cpp22
4 files changed, 78 insertions, 15 deletions
diff --git a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp
index 9b37226222..cba6d0c672 100644
--- a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp
+++ b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp
@@ -397,8 +397,13 @@ void GdbRemoteServerEngine::runEngine()
if (!remoteExecutable.isEmpty()) {
// Cannot use -exec-run for QNX gdb 7.4 as it does not support path parameter for the MI call
const bool useRun = m_isQnxGdb && m_gdbVersion > 70300;
- const QByteArray command = useRun ? "run" : "-exec-run";
- postCommand(command + " " + remoteExecutable.toLocal8Bit(), GdbEngine::RunRequest, CB(handleExecRun));
+ QByteArray command = useRun ? "run" : "-exec-run";
+ command += " " + remoteExecutable.toLocal8Bit();
+
+ const QByteArray arguments = isMasterEngine() ? startParameters().processArgs.toLocal8Bit() : masterEngine()->startParameters().processArgs.toLocal8Bit();
+ command += " " + arguments;
+
+ postCommand(command, GdbEngine::RunRequest, CB(handleExecRun));
} else {
notifyEngineRunAndInferiorStopOk();
continueInferiorInternal();
diff --git a/src/plugins/qnx/qnxdebugsupport.cpp b/src/plugins/qnx/qnxdebugsupport.cpp
index e647d543a5..fdc7b447c0 100644
--- a/src/plugins/qnx/qnxdebugsupport.cpp
+++ b/src/plugins/qnx/qnxdebugsupport.cpp
@@ -34,6 +34,8 @@
#include "qnxrunconfiguration.h"
#include <debugger/debuggerengine.h>
+#include <debugger/debuggerrunconfigurationaspect.h>
+#include <debugger/debuggerstartparameters.h>
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
#include <projectexplorer/kitinformation.h>
@@ -49,12 +51,14 @@ using namespace Qnx::Internal;
QnxDebugSupport::QnxDebugSupport(QnxRunConfiguration *runConfig, Debugger::DebuggerEngine *engine)
: QObject(engine)
- , m_executable(QLatin1String(Constants::QNX_DEBUG_EXECUTABLE))
+ , m_remoteExecutable(runConfig->remoteExecutableFilePath())
, m_commandPrefix(runConfig->commandPrefix())
- , m_arguments(runConfig->arguments())
, m_device(DeviceKitInformation::device(runConfig->target()->kit()))
, m_engine(engine)
- , m_port(-1)
+ , m_pdebugPort(-1)
+ , m_qmlPort(-1)
+ , m_useCppDebugger(runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useCppDebugger())
+ , m_useQmlDebugger(runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useQmlDebugger())
, m_state(Inactive)
{
m_runner = new DeviceApplicationRunner(this);
@@ -68,6 +72,7 @@ QnxDebugSupport::QnxDebugSupport(QnxRunConfiguration *runConfig, Debugger::Debug
connect(m_runner, SIGNAL(finished(bool)), SLOT(handleRemoteProcessFinished(bool)));
connect(m_runner, SIGNAL(reportProgress(QString)), this, SLOT(handleProgressReport(QString)));
connect(m_runner, SIGNAL(remoteStdout(QByteArray)), this, SLOT(handleRemoteOutput(QByteArray)));
+ connect(m_runner, SIGNAL(remoteStderr(QByteArray)), this, SLOT(handleRemoteOutput(QByteArray)));
connect(m_engine, SIGNAL(requestRemoteSetup()), this, SLOT(handleAdapterSetupRequested()));
}
@@ -93,19 +98,38 @@ void QnxDebugSupport::startExecution()
if (m_state == Inactive)
return;
- m_state = StartingRemoteProcess;
Utils::PortList portList = m_device->freePorts();
- m_port = m_portsGatherer->getNextFreePort(&portList);
+ if (m_useCppDebugger)
+ m_pdebugPort = m_portsGatherer->getNextFreePort(&portList);
+ if (m_useQmlDebugger)
+ m_qmlPort = m_portsGatherer->getNextFreePort(&portList);
+
+ if ((m_useCppDebugger && m_pdebugPort == -1) || (m_useQmlDebugger && m_qmlPort == -1)) {
+ handleError(tr("Not enough free ports on device for debugging."));
+ return;
+ }
+
+ m_state = StartingRemoteProcess;
+
+ if (m_useQmlDebugger)
+ m_engine->startParameters().processArgs += QString::fromLocal8Bit(" -qmljsdebugger=port:%1,block").arg(m_qmlPort);
+
+ QString remoteCommandLine;
+ if (m_useCppDebugger)
+ remoteCommandLine = QString::fromLatin1("%1 %2 %3")
+ .arg(m_commandPrefix, executable()).arg(m_pdebugPort);
+ else if (m_useQmlDebugger && !m_useCppDebugger)
+ remoteCommandLine = QString::fromLatin1("%1 %2 %3")
+ .arg(m_commandPrefix, executable(), m_engine->startParameters().processArgs);
- const QString remoteCommandLine = QString::fromLatin1("%1 %2 %3")
- .arg(m_commandPrefix, m_executable).arg(m_port);
m_runner->start(m_device, remoteCommandLine.toUtf8());
}
void QnxDebugSupport::handleRemoteProcessStarted()
{
+ m_state = Debugging;
if (m_engine)
- m_engine->notifyEngineRemoteSetupDone(m_port, -1);
+ m_engine->notifyEngineRemoteSetupDone(m_pdebugPort, m_qmlPort);
}
void QnxDebugSupport::handleRemoteProcessFinished(bool success)
@@ -118,7 +142,7 @@ void QnxDebugSupport::handleRemoteProcessFinished(bool success)
m_engine->notifyInferiorIll();
} else {
- const QString errorMsg = tr("The %1 process closed unexpectedly.").arg(m_executable);
+ const QString errorMsg = tr("The %1 process closed unexpectedly.").arg(executable());
m_engine->notifyEngineRemoteSetupFailed(errorMsg);
}
}
@@ -130,8 +154,15 @@ void QnxDebugSupport::handleDebuggingFinished()
void QnxDebugSupport::setFinished()
{
+ if (m_state != GatheringPorts && m_state != Inactive)
+ m_runner->stop(m_device->processSupport()->killProcessByNameCommandLine(executable()).toUtf8());
+
m_state = Inactive;
- m_runner->stop(m_device->processSupport()->killProcessByNameCommandLine(m_executable).toUtf8());
+}
+
+QString QnxDebugSupport::executable() const
+{
+ return m_useCppDebugger? QLatin1String(Constants::QNX_DEBUG_EXECUTABLE) : m_remoteExecutable;
}
void QnxDebugSupport::handleProgressReport(const QString &progressOutput)
diff --git a/src/plugins/qnx/qnxdebugsupport.h b/src/plugins/qnx/qnxdebugsupport.h
index 95d71921f1..891b6acd87 100644
--- a/src/plugins/qnx/qnxdebugsupport.h
+++ b/src/plugins/qnx/qnxdebugsupport.h
@@ -72,6 +72,8 @@ private:
void startExecution();
void setFinished();
+ QString executable() const;
+
enum State {
Inactive,
GatheringPorts,
@@ -79,14 +81,17 @@ private:
Debugging
};
- const QString m_executable;
+ const QString m_remoteExecutable;
const QString m_commandPrefix;
- const QString m_arguments;
ProjectExplorer::IDevice::ConstPtr m_device;
ProjectExplorer::DeviceApplicationRunner *m_runner;
ProjectExplorer::DeviceUsedPortsGatherer * m_portsGatherer;
Debugger::DebuggerEngine *m_engine;
- int m_port;
+ int m_pdebugPort;
+ int m_qmlPort;
+
+ bool m_useCppDebugger;
+ bool m_useQmlDebugger;
State m_state;
};
diff --git a/src/plugins/qnx/qnxruncontrolfactory.cpp b/src/plugins/qnx/qnxruncontrolfactory.cpp
index dd511f3b9c..34794d46ee 100644
--- a/src/plugins/qnx/qnxruncontrolfactory.cpp
+++ b/src/plugins/qnx/qnxruncontrolfactory.cpp
@@ -41,8 +41,11 @@
#include <debugger/debuggerengine.h>
#include <debugger/debuggerplugin.h>
#include <debugger/debuggerrunner.h>
+#include <debugger/debuggerrunconfigurationaspect.h>
#include <debugger/debuggerstartparameters.h>
#include <debugger/debuggerkitinformation.h>
+#include <projectexplorer/buildconfiguration.h>
+#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <qtsupport/qtkitinformation.h>
@@ -76,6 +79,25 @@ DebuggerStartParameters createStartParameters(const QnxRunConfiguration *runConf
params.displayName = runConfig->displayName();
params.remoteSetupNeeded = true;
params.closeMode = DetachAtClose;
+ params.processArgs = runConfig->arguments();
+
+ Debugger::DebuggerRunConfigurationAspect *aspect
+ = runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>();
+ if (aspect->useQmlDebugger()) {
+ params.languages |= QmlLanguage;
+ params.qmlServerAddress = device->sshParameters().host;
+ params.qmlServerPort = 0; // QML port is handed out later
+ }
+
+ if (aspect->useCppDebugger())
+ params.languages |= Debugger::CppLanguage;
+
+ if (const ProjectExplorer::Project *project = runConfig->target()->project()) {
+ params.projectSourceDirectory = project->projectDirectory();
+ if (const ProjectExplorer::BuildConfiguration *buildConfig = runConfig->target()->activeBuildConfiguration())
+ params.projectBuildDirectory = buildConfig->buildDirectory();
+ params.projectSourceFiles = project->files(ProjectExplorer::Project::ExcludeGeneratedFiles);
+ }
QnxQtVersion *qtVersion =
dynamic_cast<QnxQtVersion *>(QtSupport::QtKitInformation::qtVersion(k));