2012-06-29 07:23:13 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
2013-01-28 17:12:19 +01:00
|
|
|
** Copyright (C) 2011 - 2013 Research In Motion
|
2012-06-29 07:23:13 +02:00
|
|
|
**
|
|
|
|
|
** Contact: Research In Motion (blackberry-qt@qnx.com)
|
|
|
|
|
** Contact: KDAB (info@kdab.com)
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2012-06-29 07:23:13 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2012-06-29 07:23:13 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
** Alternatively, 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, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2012-06-29 07:23:13 +02:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2012-06-29 07:23:13 +02:00
|
|
|
|
|
|
|
|
#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>
|
2012-09-03 18:31:44 +02:00
|
|
|
#include <debugger/debuggerkitinformation.h>
|
2012-06-29 07:23:13 +02:00
|
|
|
#include <projectexplorer/target.h>
|
|
|
|
|
#include <projectexplorer/toolchain.h>
|
2012-09-03 18:31:44 +02:00
|
|
|
#include <qtsupport/qtkitinformation.h>
|
2012-06-29 07:23:13 +02:00
|
|
|
#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();
|
2012-09-03 18:31:44 +02:00
|
|
|
Kit *k = target->kit();
|
2012-07-25 17:41:01 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
const IDevice::ConstPtr device = DeviceKitInformation::device(k);
|
2012-07-27 13:31:13 +02:00
|
|
|
if (device.isNull())
|
2012-07-25 17:41:01 +02:00
|
|
|
return params;
|
|
|
|
|
|
|
|
|
|
params.startMode = AttachToRemoteServer;
|
2012-09-03 18:31:44 +02:00
|
|
|
params.debuggerCommand = DebuggerKitInformation::debuggerCommand(k).toString();
|
|
|
|
|
params.sysRoot = SysRootKitInformation::sysRoot(k).toString();
|
2012-07-25 17:41:01 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
if (ToolChain *tc = ToolChainKitInformation::toolChain(k))
|
2012-07-25 17:41:01 +02:00
|
|
|
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 =
|
2012-09-03 18:31:44 +02:00
|
|
|
dynamic_cast<QnxQtVersion *>(QtSupport::QtKitInformation::qtVersion(k));
|
2012-07-25 17:41:01 +02:00
|
|
|
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()
|
2013-03-21 16:25:09 +01:00
|
|
|
|| !runConfiguration->id().name().startsWith(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX)) {
|
2012-06-29 07:23:13 +02:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const QnxRunConfiguration * const rc = qobject_cast<QnxRunConfiguration *>(runConfiguration);
|
2012-07-25 17:41:01 +02:00
|
|
|
if (mode == DebugRunMode) {
|
2012-09-03 18:31:44 +02:00
|
|
|
const QnxDeviceConfiguration::ConstPtr dev = DeviceKitInformation::device(runConfiguration->target()->kit())
|
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-09-05 12:42:41 +02:00
|
|
|
RunControl *QnxRunControlFactory::create(RunConfiguration *runConfig, RunMode mode, QString *errorMessage)
|
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);
|
2012-09-05 12:42:41 +02:00
|
|
|
DebuggerRunControl * const runControl = DebuggerPlugin::createDebugger(params, rc, errorMessage);
|
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");
|
|
|
|
|
}
|