forked from qt-creator/qt-creator
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>
This commit is contained in:
committed by
Tobias Nätterlund
parent
2a8a411b21
commit
bd4105def7
@@ -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();
|
||||
|
@@ -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)
|
||||
|
@@ -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;
|
||||
};
|
||||
|
@@ -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));
|
||||
|
Reference in New Issue
Block a user