2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-06-16 17:03:43 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2011-06-16 17:03:43 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-06-16 17:03:43 +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.
|
2011-06-16 17:03:43 +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.
|
2011-06-16 17:03:43 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2012-07-25 17:41:01 +02:00
|
|
|
|
2011-06-16 17:03:43 +02:00
|
|
|
#include "remotelinuxdebugsupport.h"
|
|
|
|
|
|
2017-05-04 12:12:27 +02:00
|
|
|
#include "remotelinuxcustomrunconfiguration.h"
|
2011-08-02 12:20:16 +02:00
|
|
|
#include "remotelinuxrunconfiguration.h"
|
2011-06-16 17:03:43 +02:00
|
|
|
|
2014-12-12 15:33:16 +01:00
|
|
|
#include <debugger/debuggerruncontrol.h>
|
|
|
|
|
|
2012-07-25 17:41:01 +02:00
|
|
|
#include <projectexplorer/buildconfiguration.h>
|
2011-06-27 10:11:17 +02:00
|
|
|
#include <projectexplorer/project.h>
|
2016-01-26 15:53:26 +01:00
|
|
|
#include <projectexplorer/runnables.h>
|
2011-07-27 18:04:43 +02:00
|
|
|
#include <projectexplorer/target.h>
|
2011-06-16 17:03:43 +02:00
|
|
|
#include <projectexplorer/toolchain.h>
|
2016-01-06 16:50:36 +01:00
|
|
|
|
2015-08-10 17:43:58 +02:00
|
|
|
#include <qmldebug/qmldebugcommandlinearguments.h>
|
2011-06-16 17:03:43 +02:00
|
|
|
|
2016-01-26 15:53:26 +01:00
|
|
|
#include <utils/qtcassert.h>
|
|
|
|
|
#include <utils/qtcprocess.h>
|
|
|
|
|
|
2011-06-16 17:03:43 +02:00
|
|
|
using namespace Debugger;
|
|
|
|
|
using namespace ProjectExplorer;
|
2016-01-26 15:53:26 +01:00
|
|
|
using namespace Utils;
|
2011-06-16 17:03:43 +02:00
|
|
|
|
|
|
|
|
namespace RemoteLinux {
|
2011-08-02 12:20:16 +02:00
|
|
|
|
2017-05-09 10:25:11 +02:00
|
|
|
LinuxDeviceDebugSupport::LinuxDeviceDebugSupport(RunControl *runControl)
|
2017-05-04 12:12:27 +02:00
|
|
|
: DebuggerRunTool(runControl)
|
2011-08-02 12:20:16 +02:00
|
|
|
{
|
2017-05-09 10:25:11 +02:00
|
|
|
setDisplayName("DebugSupport");
|
|
|
|
|
|
|
|
|
|
auto portsGatherer = new GdbServerPortsGatherer(runControl);
|
|
|
|
|
portsGatherer->setUseGdbServer(isCppDebugging());
|
|
|
|
|
portsGatherer->setUseQmlServer(isQmlDebugging());
|
|
|
|
|
|
|
|
|
|
auto gdbServer = new GdbServerRunner(runControl);
|
|
|
|
|
gdbServer->addDependency(portsGatherer);
|
|
|
|
|
|
|
|
|
|
addDependency(gdbServer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LinuxDeviceDebugSupport::~LinuxDeviceDebugSupport()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LinuxDeviceDebugSupport::start()
|
|
|
|
|
{
|
|
|
|
|
auto portsGatherer = runControl()->worker<GdbServerPortsGatherer>();
|
|
|
|
|
QTC_ASSERT(portsGatherer, reportFailure(); return);
|
|
|
|
|
|
|
|
|
|
const QString host = device()->sshParameters().host;
|
|
|
|
|
const Port gdbServerPort = portsGatherer->gdbServerPort();
|
|
|
|
|
const Port qmlServerPort = portsGatherer->qmlServerPort();
|
|
|
|
|
|
|
|
|
|
RunConfiguration *runConfig = runControl()->runConfiguration();
|
2011-08-02 12:20:16 +02:00
|
|
|
|
2017-05-04 12:12:27 +02:00
|
|
|
QString symbolFile;
|
|
|
|
|
if (auto rlrc = qobject_cast<RemoteLinuxRunConfiguration *>(runConfig))
|
|
|
|
|
symbolFile = rlrc->localExecutableFilePath();
|
|
|
|
|
if (auto rlrc = qobject_cast<Internal::RemoteLinuxCustomRunConfiguration *>(runConfig))
|
|
|
|
|
symbolFile = rlrc->localExecutableFilePath();
|
|
|
|
|
if (symbolFile.isEmpty()) {
|
2017-05-09 10:25:11 +02:00
|
|
|
// *errorMessage = tr("Cannot debug: Local executable is not set.");
|
2017-05-04 12:12:27 +02:00
|
|
|
return;
|
|
|
|
|
}
|
2011-08-02 12:20:16 +02:00
|
|
|
|
2017-05-04 12:12:27 +02:00
|
|
|
DebuggerStartParameters params;
|
|
|
|
|
params.startMode = AttachToRemoteServer;
|
|
|
|
|
params.closeMode = KillAndExitMonitorAtClose;
|
2011-06-16 17:03:43 +02:00
|
|
|
|
2017-05-04 12:12:27 +02:00
|
|
|
if (isQmlDebugging()) {
|
2017-05-09 10:25:11 +02:00
|
|
|
params.qmlServer.host = host;
|
|
|
|
|
params.qmlServer.port = qmlServerPort;
|
|
|
|
|
params.inferior.commandLineArguments.replace("%qml_port%",
|
|
|
|
|
QString::number(qmlServerPort.number()));
|
2017-05-04 12:12:27 +02:00
|
|
|
}
|
|
|
|
|
if (isCppDebugging()) {
|
|
|
|
|
Runnable r = runnable();
|
|
|
|
|
QTC_ASSERT(r.is<StandardRunnable>(), return);
|
|
|
|
|
auto stdRunnable = r.as<StandardRunnable>();
|
|
|
|
|
params.useExtendedRemote = true;
|
|
|
|
|
params.inferior.executable = stdRunnable.executable;
|
|
|
|
|
params.inferior.commandLineArguments = stdRunnable.commandLineArguments;
|
|
|
|
|
if (isQmlDebugging()) {
|
|
|
|
|
params.inferior.commandLineArguments.prepend(' ');
|
|
|
|
|
params.inferior.commandLineArguments.prepend(
|
|
|
|
|
QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices));
|
|
|
|
|
}
|
2017-05-09 10:25:11 +02:00
|
|
|
|
|
|
|
|
params.remoteChannel = QString("%1:%2").arg(host).arg(gdbServerPort.number());
|
2017-05-04 12:12:27 +02:00
|
|
|
params.symbolFile = symbolFile;
|
|
|
|
|
}
|
2017-04-21 11:39:01 +02:00
|
|
|
|
2017-05-04 12:12:27 +02:00
|
|
|
setStartParameters(params);
|
2011-06-16 17:03:43 +02:00
|
|
|
|
2017-05-09 10:25:11 +02:00
|
|
|
DebuggerRunTool::start();
|
2011-06-16 17:03:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace RemoteLinux
|