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:
|
|
|
|
|
QnxDebuggeeRunner(ProjectExplorer::RunControl *runControl)
|
|
|
|
|
: SimpleTargetRunner(runControl)
|
|
|
|
|
{
|
|
|
|
|
setDisplayName("QnxDebuggeeRunner");
|
|
|
|
|
}
|
2012-06-29 07:23:13 +02:00
|
|
|
|
2017-05-09 10:25:11 +02:00
|
|
|
private:
|
|
|
|
|
void start() override
|
|
|
|
|
{
|
|
|
|
|
auto portsGatherer = runControl()->worker<GdbServerPortsGatherer>();
|
|
|
|
|
|
|
|
|
|
StandardRunnable r = runnable().as<StandardRunnable>();
|
|
|
|
|
QStringList arguments;
|
|
|
|
|
if (portsGatherer->useGdbServer()) {
|
|
|
|
|
Utils::Port pdebugPort = portsGatherer->gdbServerPort();
|
|
|
|
|
r.executable = Constants::QNX_DEBUG_EXECUTABLE;
|
|
|
|
|
arguments.append(pdebugPort.toString());
|
|
|
|
|
}
|
|
|
|
|
if (portsGatherer->useQmlServer()) {
|
2016-11-03 11:18:35 +01:00
|
|
|
arguments.append(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices,
|
2017-05-09 10:25:11 +02:00
|
|
|
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-05-09 10:25:11 +02:00
|
|
|
SimpleTargetRunner::start();
|
|
|
|
|
}
|
|
|
|
|
};
|
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-05-09 10:25:11 +02:00
|
|
|
auto portsGatherer = new GdbServerPortsGatherer(runControl);
|
|
|
|
|
portsGatherer->setUseGdbServer(isCppDebugging());
|
|
|
|
|
portsGatherer->setUseQmlServer(isQmlDebugging());
|
2012-06-29 07:23:13 +02:00
|
|
|
|
2017-05-09 10:25:11 +02:00
|
|
|
auto debuggeeRunner = new QnxDebuggeeRunner(runControl);
|
|
|
|
|
debuggeeRunner->addDependency(portsGatherer);
|
2013-11-01 15:39:59 +01:00
|
|
|
|
2017-05-09 10:25:11 +02:00
|
|
|
auto slog2InfoRunner = new Slog2InfoRunner(runControl);
|
|
|
|
|
slog2InfoRunner->addDependency(debuggeeRunner);
|
2012-06-29 07:23:13 +02:00
|
|
|
|
2017-05-09 10:25:11 +02:00
|
|
|
addDependency(slog2InfoRunner);
|
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 portsGatherer = runControl()->worker<GdbServerPortsGatherer>();
|
|
|
|
|
Utils::Port pdebugPort = portsGatherer->gdbServerPort();
|
|
|
|
|
|
|
|
|
|
auto runConfig = qobject_cast<QnxRunConfiguration *>(runControl()->runConfiguration());
|
|
|
|
|
QTC_ASSERT(runConfig, return);
|
|
|
|
|
Target *target = runConfig->target();
|
|
|
|
|
Kit *k = target->kit();
|
|
|
|
|
|
|
|
|
|
DebuggerStartParameters params;
|
|
|
|
|
params.startMode = AttachToRemoteServer;
|
|
|
|
|
params.useCtrlCStub = true;
|
|
|
|
|
params.inferior.executable = runConfig->remoteExecutableFilePath();
|
|
|
|
|
params.symbolFile = runConfig->localExecutableFilePath();
|
|
|
|
|
params.remoteChannel = QString("%1:%2").arg(device()->sshParameters().host).arg(pdebugPort.number());
|
|
|
|
|
params.closeMode = KillAtClose;
|
|
|
|
|
params.inferior.commandLineArguments = runConfig->arguments();
|
|
|
|
|
|
|
|
|
|
if (isQmlDebugging()) {
|
|
|
|
|
params.qmlServer.host = device()->sshParameters().host;
|
|
|
|
|
params.qmlServer.port = portsGatherer->qmlServerPort();
|
|
|
|
|
params.inferior.commandLineArguments.replace("%qml_port%", params.qmlServer.port.toString());
|
2012-06-29 07:23:13 +02:00
|
|
|
}
|
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)
|
|
|
|
|
params.solibSearchPath = QnxUtils::searchPaths(qtVersion);
|
2013-11-05 14:29:05 +01:00
|
|
|
|
2017-05-09 10:25:11 +02:00
|
|
|
reportStarted();
|
2017-03-28 17:19:05 +02:00
|
|
|
}
|
|
|
|
|
|
2017-05-09 10:25:11 +02:00
|
|
|
void QnxDebugSupport::stop()
|
2017-03-28 17:19:05 +02:00
|
|
|
{
|
2017-05-09 10:25:11 +02:00
|
|
|
// We have to kill the inferior process, as invoking "kill" in
|
|
|
|
|
// gdb doesn't work on QNX gdb.
|
|
|
|
|
auto stdRunnable = runnable().as<StandardRunnable>();
|
|
|
|
|
device()->signalOperation()->killProcess(stdRunnable.executable);
|
2013-11-05 14:29:05 +01:00
|
|
|
}
|
2016-03-15 09:26:34 +01:00
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Qnx
|