2012-06-29 07:23:13 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2011 - 2012 Research In Motion
|
|
|
|
|
**
|
|
|
|
|
** Contact: Research In Motion (blackberry-qt@qnx.com)
|
|
|
|
|
** Contact: KDAB (info@kdab.com)
|
|
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
|
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
|
|
|
** Please review the following information to ensure the GNU Lesser General
|
|
|
|
|
** Public License version 2.1 requirements will be met:
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
|
|
|
|
** If you have questions regarding the use of this file, please contact
|
|
|
|
|
** Nokia at info@qt.nokia.com.
|
|
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "qnxruncontrolfactory.h"
|
|
|
|
|
#include "qnxconstants.h"
|
|
|
|
|
#include "qnxrunconfiguration.h"
|
|
|
|
|
#include "qnxdebugsupport.h"
|
|
|
|
|
#include "qnxqtversion.h"
|
|
|
|
|
#include "qnxruncontrol.h"
|
|
|
|
|
#include "qnxutils.h"
|
|
|
|
|
#include "qnxdeviceconfiguration.h"
|
|
|
|
|
|
|
|
|
|
#include <debugger/debuggerengine.h>
|
|
|
|
|
#include <debugger/debuggerplugin.h>
|
|
|
|
|
#include <debugger/debuggerrunner.h>
|
|
|
|
|
#include <debugger/debuggerstartparameters.h>
|
|
|
|
|
#include <debugger/debuggerprofileinformation.h>
|
2012-07-25 17:41:01 +02:00
|
|
|
#include <debugger/debuggerstartparameters.h>
|
2012-06-29 07:23:13 +02:00
|
|
|
#include <projectexplorer/target.h>
|
|
|
|
|
#include <projectexplorer/toolchain.h>
|
|
|
|
|
#include <qtsupport/qtprofileinformation.h>
|
|
|
|
|
#include <utils/portlist.h>
|
|
|
|
|
|
2012-07-25 17:41:01 +02:00
|
|
|
using namespace Debugger;
|
|
|
|
|
using namespace ProjectExplorer;
|
2012-06-29 07:23:13 +02:00
|
|
|
using namespace Qnx;
|
|
|
|
|
using namespace Qnx::Internal;
|
|
|
|
|
|
2012-07-25 17:41:01 +02:00
|
|
|
DebuggerStartParameters createStartParameters(const QnxRunConfiguration *runConfig)
|
2012-06-29 07:23:13 +02:00
|
|
|
{
|
2012-07-25 17:41:01 +02:00
|
|
|
DebuggerStartParameters params;
|
|
|
|
|
Target *target = runConfig->target();
|
|
|
|
|
Profile *profile = target->profile();
|
|
|
|
|
|
2012-07-27 13:31:13 +02:00
|
|
|
const IDevice::ConstPtr device = DeviceProfileInformation::device(profile);
|
|
|
|
|
if (device.isNull())
|
2012-07-25 17:41:01 +02:00
|
|
|
return params;
|
|
|
|
|
|
|
|
|
|
params.startMode = AttachToRemoteServer;
|
|
|
|
|
params.debuggerCommand = DebuggerProfileInformation::debuggerCommand(profile).toString();
|
|
|
|
|
params.sysRoot = SysRootProfileInformation::sysRoot(profile).toString();
|
|
|
|
|
|
|
|
|
|
if (ToolChain *tc = ToolChainProfileInformation::toolChain(profile))
|
|
|
|
|
params.toolChainAbi = tc->targetAbi();
|
|
|
|
|
|
|
|
|
|
params.symbolFileName = runConfig->localExecutableFilePath();
|
|
|
|
|
params.remoteExecutable = runConfig->remoteExecutableFilePath();
|
2012-07-27 13:31:13 +02:00
|
|
|
params.remoteChannel = device->sshParameters().host + QLatin1String(":-1");
|
2012-07-25 17:41:01 +02:00
|
|
|
params.displayName = runConfig->displayName();
|
|
|
|
|
params.remoteSetupNeeded = true;
|
|
|
|
|
params.closeMode = DetachAtClose;
|
|
|
|
|
|
|
|
|
|
QnxQtVersion *qtVersion =
|
|
|
|
|
dynamic_cast<QnxQtVersion *>(QtSupport::QtProfileInformation::qtVersion(profile));
|
|
|
|
|
if (qtVersion)
|
|
|
|
|
params.solibSearchPath = QnxUtils::searchPaths(qtVersion);
|
|
|
|
|
|
|
|
|
|
return params;
|
2012-06-29 07:23:13 +02:00
|
|
|
}
|
|
|
|
|
|
2012-07-25 17:41:01 +02:00
|
|
|
|
|
|
|
|
QnxRunControlFactory::QnxRunControlFactory(QObject *parent)
|
|
|
|
|
: IRunControlFactory(parent)
|
2012-06-29 07:23:13 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-25 17:41:01 +02:00
|
|
|
bool QnxRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
|
2012-06-29 07:23:13 +02:00
|
|
|
{
|
2012-07-25 17:41:01 +02:00
|
|
|
if (mode != NormalRunMode && mode != DebugRunMode)
|
2012-06-29 07:23:13 +02:00
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (!runConfiguration->isEnabled()
|
|
|
|
|
|| !runConfiguration->id().toString().startsWith(QLatin1String(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX))) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const QnxRunConfiguration * const rc = qobject_cast<QnxRunConfiguration *>(runConfiguration);
|
2012-07-25 17:41:01 +02:00
|
|
|
if (mode == DebugRunMode) {
|
|
|
|
|
const QnxDeviceConfiguration::ConstPtr dev = DeviceProfileInformation::device(runConfiguration->target()->profile())
|
2012-06-29 07:23:13 +02:00
|
|
|
.dynamicCast<const QnxDeviceConfiguration>();
|
|
|
|
|
if (dev.isNull())
|
|
|
|
|
return false;
|
|
|
|
|
return rc->portsUsedByDebuggers() <= dev->freePorts().count();
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-25 17:41:01 +02:00
|
|
|
RunControl *QnxRunControlFactory::create(RunConfiguration *runConfig, RunMode mode)
|
2012-06-29 07:23:13 +02:00
|
|
|
{
|
|
|
|
|
Q_ASSERT(canRun(runConfig, mode));
|
|
|
|
|
|
|
|
|
|
QnxRunConfiguration *rc = qobject_cast<QnxRunConfiguration *>(runConfig);
|
|
|
|
|
Q_ASSERT(rc);
|
2012-07-25 17:41:01 +02:00
|
|
|
if (mode == NormalRunMode)
|
2012-06-29 07:23:13 +02:00
|
|
|
return new QnxRunControl(rc);
|
|
|
|
|
|
2012-07-25 17:41:01 +02:00
|
|
|
const DebuggerStartParameters params = createStartParameters(rc);
|
|
|
|
|
DebuggerRunControl * const runControl = DebuggerPlugin::createDebugger(params, rc);
|
2012-06-29 07:23:13 +02:00
|
|
|
if (!runControl)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
QnxDebugSupport *debugSupport = new QnxDebugSupport(rc, runControl->engine());
|
|
|
|
|
connect(runControl, SIGNAL(finished()), debugSupport, SLOT(handleDebuggingFinished()));
|
|
|
|
|
|
|
|
|
|
return runControl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString QnxRunControlFactory::displayName() const
|
|
|
|
|
{
|
|
|
|
|
return tr("Run on remote QNX device");
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-25 17:41:01 +02:00
|
|
|
RunConfigWidget *QnxRunControlFactory::createConfigurationWidget(RunConfiguration *config)
|
2012-06-29 07:23:13 +02:00
|
|
|
{
|
|
|
|
|
Q_UNUSED(config)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|