Debugger: Rework start parameter completion.

It's again a linear process now, with explicit entrance point for
all users.

Task-number: QTCREATORBUG-14618
Change-Id: I96c08947270ce34d7bc6c8be1d7f350dbfa14794
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
hjk
2015-06-24 08:26:35 +02:00
parent f886c70199
commit 60a8442d8c
12 changed files with 395 additions and 375 deletions

View File

@@ -957,7 +957,7 @@ public:
DebuggerMainWindow *m_mainWindow;
Id m_previousMode;
QList<DebuggerRunParameters> m_scheduledStarts;
QVector<QPair<DebuggerRunParameters, Kit *>> m_scheduledStarts;
ProxyAction *m_visibleStartAction;
ProxyAction *m_hiddenStopAction;
@@ -1183,13 +1183,11 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
}
}
}
if (!fillParametersFromKit(&rp, kit, errorMessage))
return false;
if (rp.startMode == StartExternal) {
rp.displayName = tr("Executable file \"%1\"").arg(rp.executable);
rp.startMessage = tr("Debugging file %1.").arg(rp.executable);
}
m_scheduledStarts.append(rp);
m_scheduledStarts.append(QPair<DebuggerRunParameters, Kit *>(rp, kit));
return true;
}
// -wincrashevent <event-handle>:<pid>. A handle used for
@@ -1204,8 +1202,6 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
return false;
}
DebuggerRunParameters rp;
if (!fillParametersFromKit(&rp, findUniversalCdbKit(), errorMessage))
return false;
rp.startMode = AttachCrashedExternal;
rp.crashParameter = it->section(QLatin1Char(':'), 0, 0);
rp.attachPID = it->section(QLatin1Char(':'), 1, 1).toULongLong();
@@ -1216,7 +1212,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
"does not match the pattern <handle>:<pid>.").arg(*it, option);
return false;
}
m_scheduledStarts.append(rp);
m_scheduledStarts.append(QPair<DebuggerRunParameters, Kit *>(rp, findUniversalCdbKit()));
return true;
}
@@ -1320,8 +1316,9 @@ void DebuggerPluginPrivate::onCurrentProjectChanged(Project *project)
void DebuggerPluginPrivate::startAndDebugApplication()
{
DebuggerRunParameters rp;
if (StartApplicationDialog::run(ICore::dialogParent(), &rp))
createAndScheduleRun(rp);
Kit *kit;
if (StartApplicationDialog::run(ICore::dialogParent(), &rp, &kit))
createAndScheduleRun(rp, kit);
}
void DebuggerPluginPrivate::attachCore()
@@ -1349,8 +1346,6 @@ void DebuggerPluginPrivate::attachCore()
QString display = dlg.useLocalCoreFile() ? dlg.localCoreFile() : dlg.remoteCoreFile();
DebuggerRunParameters rp;
bool res = fillParametersFromKit(&rp, dlg.kit());
QTC_ASSERT(res, return);
rp.masterEngineType = DebuggerKitInformation::engineType(dlg.kit());
rp.executable = dlg.localExecutableFile();
rp.coreFile = dlg.localCoreFile();
@@ -1358,7 +1353,7 @@ void DebuggerPluginPrivate::attachCore()
rp.startMode = AttachCore;
rp.closeMode = DetachAtClose;
rp.overrideStartScript = dlg.overrideStartScript();
createAndScheduleRun(rp);
createAndScheduleRun(rp, dlg.kit());
}
void DebuggerPluginPrivate::startRemoteCdbSession()
@@ -1367,8 +1362,6 @@ void DebuggerPluginPrivate::startRemoteCdbSession()
DebuggerRunParameters rp;
Kit *kit = findUniversalCdbKit();
QTC_ASSERT(kit, return);
bool res = fillParametersFromKit(&rp, kit);
QTC_ASSERT(res, return);
rp.startMode = AttachToRemoteServer;
rp.closeMode = KillAtClose;
StartRemoteCdbDialog dlg(ICore::dialogParent());
@@ -1380,17 +1373,18 @@ void DebuggerPluginPrivate::startRemoteCdbSession()
return;
rp.remoteChannel = dlg.connection();
setConfigValue(connectionKey, rp.remoteChannel);
createAndScheduleRun(rp);
createAndScheduleRun(rp, kit);
}
void DebuggerPluginPrivate::attachToRemoteServer()
{
DebuggerRunParameters rp;
Kit *kit;
rp.startMode = AttachToRemoteServer;
if (StartApplicationDialog::run(ICore::dialogParent(), &rp)) {
if (StartApplicationDialog::run(ICore::dialogParent(), &rp, &kit)) {
rp.closeMode = KillAtClose;
rp.serverStartScript.clear();
createAndScheduleRun(rp);
createAndScheduleRun(rp, kit);
}
}
@@ -1488,15 +1482,13 @@ DebuggerRunControl *DebuggerPluginPrivate::attachToRunningProcess(Kit *kit,
}
DebuggerRunParameters rp;
bool res = fillParametersFromKit(&rp, kit);
QTC_ASSERT(res, return 0);
rp.attachPID = process.pid;
rp.displayName = tr("Process %1").arg(process.pid);
rp.executable = process.exe;
rp.startMode = AttachExternal;
rp.closeMode = DetachAtClose;
rp.continueAfterAttach = contAfterAttach;
return createAndScheduleRun(rp);
return createAndScheduleRun(rp, kit);
}
void DebuggerPlugin::attachExternalApplication(RunControl *rc)
@@ -1511,9 +1503,7 @@ void DebuggerPlugin::attachExternalApplication(RunControl *rc)
if (const RunConfiguration *runConfiguration = rc->runConfiguration())
if (const Target *target = runConfiguration->target())
kit = target->kit();
bool res = fillParametersFromKit(&rp, kit);
QTC_ASSERT(res, return);
createAndScheduleRun(rp);
createAndScheduleRun(rp, kit);
}
void DebuggerPluginPrivate::attachToQmlPort()
@@ -1536,8 +1526,6 @@ void DebuggerPluginPrivate::attachToQmlPort()
Kit *kit = dlg.kit();
QTC_ASSERT(kit, return);
bool res = fillParametersFromKit(&rp, kit);
QTC_ASSERT(res, return);
setConfigValue("LastQmlServerPort", dlg.port());
setConfigValue("LastProfile", kit->id().toSetting());
@@ -1568,8 +1556,7 @@ void DebuggerPluginPrivate::attachToQmlPort()
rp.projectSourceDirectory =
!projects.isEmpty() ? projects.first()->projectDirectory().toString() : QString();
rp.projectSourceFiles = sourceFiles;
rp.sysRoot = SysRootKitInformation::sysRoot(kit).toString();
createAndScheduleRun(rp);
createAndScheduleRun(rp, kit);
}
void DebuggerPluginPrivate::enableReverseDebuggingTriggered(const QVariant &value)
@@ -1582,8 +1569,8 @@ void DebuggerPluginPrivate::enableReverseDebuggingTriggered(const QVariant &valu
void DebuggerPluginPrivate::runScheduled()
{
foreach (const DebuggerRunParameters &rp, m_scheduledStarts)
createAndScheduleRun(rp);
for (int i = 0, n = m_scheduledStarts.size(); i != n; ++i)
createAndScheduleRun(m_scheduledStarts.at(i).first, m_scheduledStarts.at(i).second);
}
void DebuggerPluginPrivate::editorOpened(IEditor *editor)
@@ -3375,7 +3362,7 @@ void DebuggerPluginPrivate::testUnloadProject()
void DebuggerPluginPrivate::testRunProject(const DebuggerRunParameters &rp, const TestCallBack &cb)
{
m_testCallbacks.append(cb);
RunControl *rc = createAndScheduleRun(rp);
RunControl *rc = createAndScheduleRun(rp, 0);
connect(rc, &RunControl::finished, this, &DebuggerPluginPrivate::testRunControlFinished);
}