2016-01-15 14:57:40 +01:00
|
|
|
/****************************************************************************
|
2012-06-29 07:23:13 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 BlackBerry Limited. All rights reserved.
|
2012-06-29 07:23:13 +02:00
|
|
|
** 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
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2012-10-02 09:12:39 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2012-06-29 07:23:13 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2012-06-29 07:23:13 +02:00
|
|
|
|
|
|
|
|
#include "qnxdebugsupport.h"
|
|
|
|
|
#include "qnxconstants.h"
|
2016-05-19 08:56:05 +02:00
|
|
|
#include "qnxdevice.h"
|
2012-07-26 09:02:34 +02:00
|
|
|
#include "qnxrunconfiguration.h"
|
2013-11-05 14:29:05 +01:00
|
|
|
#include "slog2inforunner.h"
|
2017-05-09 10:25:11 +02:00
|
|
|
#include "qnxqtversion.h"
|
|
|
|
|
#include "qnxutils.h"
|
2012-06-29 07:23:13 +02:00
|
|
|
|
2014-10-17 13:40:04 +02:00
|
|
|
#include <debugger/debuggerruncontrol.h>
|
2017-05-09 10:25:11 +02:00
|
|
|
|
|
|
|
|
#include <projectexplorer/applicationlauncher.h>
|
2012-07-26 09:02:34 +02:00
|
|
|
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
|
2012-09-03 18:31:44 +02:00
|
|
|
#include <projectexplorer/kitinformation.h>
|
2016-01-26 15:53:26 +01:00
|
|
|
#include <projectexplorer/runnables.h>
|
2012-07-26 09:02:34 +02:00
|
|
|
#include <projectexplorer/target.h>
|
2017-05-09 10:25:11 +02:00
|
|
|
|
|
|
|
|
#include <qmldebug/qmldebugcommandlinearguments.h>
|
|
|
|
|
#include <qtsupport/qtkitinformation.h>
|
|
|
|
|
|
2012-06-29 07:23:13 +02:00
|
|
|
#include <utils/qtcassert.h>
|
2013-08-08 14:05:11 +02:00
|
|
|
#include <utils/qtcprocess.h>
|
2012-06-29 07:23:13 +02:00
|
|
|
|
2017-05-09 10:25:11 +02:00
|
|
|
using namespace Debugger;
|
2012-07-26 09:02:34 +02:00
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
|
2016-03-15 09:26:34 +01:00
|
|
|
namespace Qnx {
|
|
|
|
|
namespace Internal {
|
2012-06-29 07:23:13 +02:00
|
|
|
|
2017-05-09 10:25:11 +02:00
|
|
|
// QnxDebuggeeRunner
|
2012-06-29 07:23:13 +02:00
|
|
|
|
2017-05-09 10:25:11 +02:00
|
|
|
class QnxDebuggeeRunner : public ProjectExplorer::SimpleTargetRunner
|
2012-06-29 07:23:13 +02:00
|
|
|
{
|
2017-05-09 10:25:11 +02:00
|
|
|
public:
|
2017-07-07 09:46:22 +02:00
|
|
|
QnxDebuggeeRunner(RunControl *runControl, GdbServerPortsGatherer *portsGatherer)
|
|
|
|
|
: SimpleTargetRunner(runControl), m_portsGatherer(portsGatherer)
|
2017-05-09 10:25:11 +02:00
|
|
|
{
|
|
|
|
|
setDisplayName("QnxDebuggeeRunner");
|
|
|
|
|
}
|
2012-06-29 07:23:13 +02:00
|
|
|
|
2017-05-09 10:25:11 +02:00
|
|
|
private:
|
|
|
|
|
void start() override
|
|
|
|
|
{
|
|
|
|
|
StandardRunnable r = runnable().as<StandardRunnable>();
|
|
|
|
|
QStringList arguments;
|
2017-07-07 09:46:22 +02:00
|
|
|
if (m_portsGatherer->useGdbServer()) {
|
|
|
|
|
Utils::Port pdebugPort = m_portsGatherer->gdbServerPort();
|
2017-05-09 10:25:11 +02:00
|
|
|
r.executable = Constants::QNX_DEBUG_EXECUTABLE;
|
|
|
|
|
arguments.append(pdebugPort.toString());
|
|
|
|
|
}
|
2017-07-07 09:46:22 +02:00
|
|
|
if (m_portsGatherer->useQmlServer()) {
|
2016-11-03 11:18:35 +01:00
|
|
|
arguments.append(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices,
|
2017-07-07 09:46:22 +02:00
|
|
|
m_portsGatherer->qmlServerPort()));
|
2016-11-03 11:18:35 +01:00
|
|
|
}
|
|
|
|
|
arguments.append(Utils::QtcProcess::splitArgs(r.commandLineArguments));
|
2017-05-09 10:25:11 +02:00
|
|
|
r.commandLineArguments = Utils::QtcProcess::joinArgs(arguments);
|
2016-11-03 11:18:35 +01:00
|
|
|
|
2017-09-06 17:11:42 +02:00
|
|
|
setRunnable(r);
|
|
|
|
|
|
2017-05-09 10:25:11 +02:00
|
|
|
SimpleTargetRunner::start();
|
|
|
|
|
}
|
2017-07-07 09:46:22 +02:00
|
|
|
|
|
|
|
|
GdbServerPortsGatherer *m_portsGatherer;
|
2017-05-09 10:25:11 +02:00
|
|
|
};
|
2012-06-29 07:23:13 +02:00
|
|
|
|
|
|
|
|
|
2017-05-09 10:25:11 +02:00
|
|
|
// QnxDebugSupport
|
2012-06-29 07:23:13 +02:00
|
|
|
|
2017-05-09 10:25:11 +02:00
|
|
|
QnxDebugSupport::QnxDebugSupport(RunControl *runControl)
|
|
|
|
|
: DebuggerRunTool(runControl)
|
2012-06-29 07:23:13 +02:00
|
|
|
{
|
2017-05-09 10:25:11 +02:00
|
|
|
setDisplayName("QnxDebugSupport");
|
|
|
|
|
appendMessage(tr("Preparing remote side..."), Utils::LogMessageFormat);
|
2012-06-29 07:23:13 +02:00
|
|
|
|
2017-07-07 09:46:22 +02:00
|
|
|
m_portsGatherer = new GdbServerPortsGatherer(runControl);
|
|
|
|
|
m_portsGatherer->setUseGdbServer(isCppDebugging());
|
|
|
|
|
m_portsGatherer->setUseQmlServer(isQmlDebugging());
|
2012-06-29 07:23:13 +02:00
|
|
|
|
2017-07-07 09:46:22 +02:00
|
|
|
auto debuggeeRunner = new QnxDebuggeeRunner(runControl, m_portsGatherer);
|
2017-08-08 14:09:50 +02:00
|
|
|
debuggeeRunner->addStartDependency(m_portsGatherer);
|
2013-11-01 15:39:59 +01:00
|
|
|
|
2017-05-09 10:25:11 +02:00
|
|
|
auto slog2InfoRunner = new Slog2InfoRunner(runControl);
|
2017-09-06 17:11:42 +02:00
|
|
|
debuggeeRunner->addStartDependency(slog2InfoRunner);
|
2012-06-29 07:23:13 +02:00
|
|
|
|
2017-09-06 17:11:42 +02:00
|
|
|
addStartDependency(debuggeeRunner);
|
2012-06-29 07:23:13 +02:00
|
|
|
}
|
|
|
|
|
|
2017-05-09 10:25:11 +02:00
|
|
|
void QnxDebugSupport::start()
|
2012-06-29 07:23:13 +02:00
|
|
|
{
|
2017-05-09 10:25:11 +02:00
|
|
|
auto runConfig = qobject_cast<QnxRunConfiguration *>(runControl()->runConfiguration());
|
|
|
|
|
QTC_ASSERT(runConfig, return);
|
|
|
|
|
Target *target = runConfig->target();
|
|
|
|
|
Kit *k = target->kit();
|
|
|
|
|
|
2017-09-08 15:15:46 +02:00
|
|
|
auto inferior = runConfig->runnable().as<StandardRunnable>();
|
|
|
|
|
inferior.executable = runConfig->remoteExecutableFilePath();
|
|
|
|
|
inferior.commandLineArguments = runConfig->arguments();
|
|
|
|
|
|
|
|
|
|
setStartMode(AttachToRemoteServer);
|
|
|
|
|
setCloseMode(KillAtClose);
|
|
|
|
|
setUseCtrlCStub(true);
|
|
|
|
|
setSymbolFile(runConfig->localExecutableFilePath());
|
|
|
|
|
setRemoteChannel(m_portsGatherer->gdbServerChannel());
|
|
|
|
|
setQmlServer(m_portsGatherer->qmlServer());
|
|
|
|
|
setInferior(inferior);
|
2013-11-05 14:29:05 +01:00
|
|
|
|
2017-05-09 10:25:11 +02:00
|
|
|
auto qtVersion = dynamic_cast<QnxQtVersion *>(QtSupport::QtKitInformation::qtVersion(k));
|
|
|
|
|
if (qtVersion)
|
2017-09-08 15:15:46 +02:00
|
|
|
setSolibSearchPath(QnxUtils::searchPaths(qtVersion));
|
2017-03-28 17:19:05 +02:00
|
|
|
|
2017-09-06 17:11:42 +02:00
|
|
|
DebuggerRunTool::start();
|
2013-11-05 14:29:05 +01:00
|
|
|
}
|
2016-03-15 09:26:34 +01:00
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Qnx
|