forked from qt-creator/qt-creator
Debugger: Remove use of setRunParameters in Qml attach dialog
Change-Id: I90ef143b9c9a0d8606e7d00346c1e508c32a4d88 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -120,6 +120,7 @@ enum DebuggerStartMode
|
|||||||
AttachCore, // Attach to a core file
|
AttachCore, // Attach to a core file
|
||||||
AttachToRemoteServer, // Attach to a running gdbserver
|
AttachToRemoteServer, // Attach to a running gdbserver
|
||||||
AttachToRemoteProcess, // Attach to a running remote process
|
AttachToRemoteProcess, // Attach to a running remote process
|
||||||
|
AttachToQmlServer, // Attach to a running QmlServer
|
||||||
StartRemoteProcess // Start and attach to a remote process
|
StartRemoteProcess // Start and attach to a remote process
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -2145,14 +2145,11 @@ void DebuggerPlugin::getEnginesState(QByteArray *json) const
|
|||||||
|
|
||||||
void DebuggerPluginPrivate::attachToQmlPort()
|
void DebuggerPluginPrivate::attachToQmlPort()
|
||||||
{
|
{
|
||||||
DebuggerRunParameters rp;
|
|
||||||
AttachToQmlPortDialog dlg(ICore::mainWindow());
|
AttachToQmlPortDialog dlg(ICore::mainWindow());
|
||||||
|
|
||||||
const QVariant qmlServerPort = configValue("LastQmlServerPort");
|
const QVariant qmlServerPort = configValue("LastQmlServerPort");
|
||||||
if (qmlServerPort.isValid())
|
if (qmlServerPort.isValid())
|
||||||
dlg.setPort(qmlServerPort.toInt());
|
dlg.setPort(qmlServerPort.toInt());
|
||||||
else if (rp.qmlServer.port() > 0)
|
|
||||||
dlg.setPort(rp.qmlServer.port());
|
|
||||||
else
|
else
|
||||||
dlg.setPort(-1);
|
dlg.setPort(-1);
|
||||||
|
|
||||||
@@ -2169,38 +2166,19 @@ void DebuggerPluginPrivate::attachToQmlPort()
|
|||||||
setConfigValue("LastProfile", kit->id().toSetting());
|
setConfigValue("LastProfile", kit->id().toSetting());
|
||||||
|
|
||||||
IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
||||||
if (device) {
|
QTC_ASSERT(device, return);
|
||||||
QSsh::SshConnectionParameters sshParameters = device->sshParameters();
|
|
||||||
rp.remoteChannel = QString("%1:%2").arg(sshParameters.host).arg(sshParameters.port);
|
|
||||||
QUrl toolControl = device->toolControlChannel(IDevice::QmlControlChannel);
|
|
||||||
rp.qmlServer.setHost(toolControl.host());
|
|
||||||
}
|
|
||||||
rp.qmlServer.setPort(dlg.port());
|
|
||||||
rp.startMode = AttachToRemoteProcess;
|
|
||||||
rp.closeMode = KillAtClose;
|
|
||||||
rp.languages = QmlLanguage;
|
|
||||||
rp.masterEngineType = QmlEngineType;
|
|
||||||
|
|
||||||
//
|
|
||||||
// get files from all the projects in the session
|
|
||||||
//
|
|
||||||
QList<Project *> projects = SessionManager::projects();
|
|
||||||
if (Project *startupProject = SessionManager::startupProject()) {
|
|
||||||
// startup project first
|
|
||||||
projects.removeOne(startupProject);
|
|
||||||
projects.insert(0, startupProject);
|
|
||||||
}
|
|
||||||
QStringList sourceFiles;
|
|
||||||
foreach (Project *project, projects)
|
|
||||||
sourceFiles << project->files(Project::SourceFiles);
|
|
||||||
|
|
||||||
rp.projectSourceDirectory =
|
|
||||||
!projects.isEmpty() ? projects.first()->projectDirectory().toString() : QString();
|
|
||||||
rp.projectSourceFiles = sourceFiles;
|
|
||||||
|
|
||||||
auto debugger = DebuggerRunTool::createFromKit(kit);
|
auto debugger = DebuggerRunTool::createFromKit(kit);
|
||||||
QTC_ASSERT(debugger, return);
|
QTC_ASSERT(debugger, return);
|
||||||
debugger->setRunParameters(rp);
|
|
||||||
|
QUrl qmlServer = device->toolControlChannel(IDevice::QmlControlChannel);
|
||||||
|
qmlServer.setPort(dlg.port());
|
||||||
|
debugger->setQmlServer(qmlServer);
|
||||||
|
|
||||||
|
QSsh::SshConnectionParameters sshParameters = device->sshParameters();
|
||||||
|
debugger->setRemoteChannel(sshParameters.host, sshParameters.port);
|
||||||
|
debugger->setStartMode(AttachToQmlServer);
|
||||||
|
|
||||||
debugger->startRunControl();
|
debugger->startRunControl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -187,7 +187,28 @@ void DebuggerRunTool::setBreakOnMainNextTime()
|
|||||||
|
|
||||||
void DebuggerRunTool::setStartMode(DebuggerStartMode startMode)
|
void DebuggerRunTool::setStartMode(DebuggerStartMode startMode)
|
||||||
{
|
{
|
||||||
|
if (startMode == AttachToQmlServer) {
|
||||||
|
m_runParameters.startMode = AttachToRemoteProcess;
|
||||||
|
m_runParameters.languages = QmlLanguage;
|
||||||
|
m_runParameters.masterEngineType = QmlEngineType;
|
||||||
|
m_runParameters.closeMode = KillAtClose;
|
||||||
|
|
||||||
|
// FIXME: This is horribly wrong.
|
||||||
|
// get files from all the projects in the session
|
||||||
|
QList<Project *> projects = SessionManager::projects();
|
||||||
|
if (Project *startupProject = SessionManager::startupProject()) {
|
||||||
|
// startup project first
|
||||||
|
projects.removeOne(startupProject);
|
||||||
|
projects.insert(0, startupProject);
|
||||||
|
}
|
||||||
|
foreach (Project *project, projects)
|
||||||
|
m_runParameters.projectSourceFiles.append(project->files(Project::SourceFiles));
|
||||||
|
if (!projects.isEmpty())
|
||||||
|
m_runParameters.projectSourceDirectory = projects.first()->projectDirectory().toString();
|
||||||
|
|
||||||
|
} else {
|
||||||
m_runParameters.startMode = startMode;
|
m_runParameters.startMode = startMode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerRunTool::setCloseMode(DebuggerCloseMode closeMode)
|
void DebuggerRunTool::setCloseMode(DebuggerCloseMode closeMode)
|
||||||
|
Reference in New Issue
Block a user