forked from qt-creator/qt-creator
debugger: simplify attach-to-{external,core} code
Change-Id: Ia1af4b48d32b2de4c5f320ba7b8ab4594eb0e56d Reviewed-on: http://codereview.qt.nokia.com/252 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -689,16 +689,8 @@ public slots:
|
|||||||
void startRemoteEngine();
|
void startRemoteEngine();
|
||||||
void attachExternalApplication();
|
void attachExternalApplication();
|
||||||
Q_SLOT void attachExternalApplication(ProjectExplorer::RunControl *rc);
|
Q_SLOT void attachExternalApplication(ProjectExplorer::RunControl *rc);
|
||||||
void attachExternalApplication(qint64 pid, const QString &binary,
|
|
||||||
const ProjectExplorer::Abi &abi,
|
|
||||||
const QString &debuggerCommand);
|
|
||||||
void runScheduled();
|
void runScheduled();
|
||||||
void attachCore();
|
void attachCore();
|
||||||
void attachCore(const QString &core, const QString &exeFileName,
|
|
||||||
const ProjectExplorer::Abi &abi = ProjectExplorer::Abi(),
|
|
||||||
const QString &sysroot = QString(),
|
|
||||||
const QString &overrideStartScript = QString(),
|
|
||||||
const QString &debuggerCommand = QString());
|
|
||||||
void attachRemote(const QString &spec);
|
void attachRemote(const QString &spec);
|
||||||
|
|
||||||
void enableReverseDebuggingTriggered(const QVariant &value);
|
void enableReverseDebuggingTriggered(const QVariant &value);
|
||||||
@@ -1412,26 +1404,21 @@ void DebuggerPluginPrivate::attachExternalApplication()
|
|||||||
if (dlg.exec() != QDialog::Accepted)
|
if (dlg.exec() != QDialog::Accepted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setConfigValue(_("LastAttachExternalAbiIndex"), QVariant(dlg.abiIndex()));
|
if (dlg.attachPID() == 0) {
|
||||||
attachExternalApplication(dlg.attachPID(), dlg.executable(), dlg.abi(), dlg.debuggerCommand());
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerPluginPrivate::attachExternalApplication(qint64 pid, const QString &binary,
|
|
||||||
const ProjectExplorer::Abi &abi,
|
|
||||||
const QString &debuggerCommand)
|
|
||||||
{
|
|
||||||
if (pid == 0) {
|
|
||||||
QMessageBox::warning(mainWindow(), tr("Warning"),
|
QMessageBox::warning(mainWindow(), tr("Warning"),
|
||||||
tr("Cannot attach to PID 0"));
|
tr("Cannot attach to process with PID 0"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setConfigValue(_("LastAttachExternalAbiIndex"), QVariant(dlg.abiIndex()));
|
||||||
|
|
||||||
DebuggerStartParameters sp;
|
DebuggerStartParameters sp;
|
||||||
sp.attachPID = pid;
|
sp.attachPID = dlg.attachPID();
|
||||||
sp.displayName = tr("Process %1").arg(pid);
|
sp.displayName = tr("Process %1").arg(dlg.attachPID());
|
||||||
sp.executable = binary;
|
sp.executable = dlg.executable();
|
||||||
sp.startMode = AttachExternal;
|
sp.startMode = AttachExternal;
|
||||||
sp.toolChainAbi = abi.isValid() ? abi : abiOfBinary(sp.executable);
|
sp.toolChainAbi = dlg.abi();
|
||||||
sp.debuggerCommand = debuggerCommand;
|
sp.debuggerCommand = dlg.debuggerCommand();
|
||||||
if (DebuggerRunControl *rc = createDebugger(sp))
|
if (DebuggerRunControl *rc = createDebugger(sp))
|
||||||
startDebugger(rc);
|
startDebugger(rc);
|
||||||
}
|
}
|
||||||
@@ -1465,26 +1452,16 @@ void DebuggerPluginPrivate::attachCore()
|
|||||||
setConfigValue(_("LastExternalCoreAbiIndex"), QVariant(dlg.abiIndex()));
|
setConfigValue(_("LastExternalCoreAbiIndex"), QVariant(dlg.abiIndex()));
|
||||||
setConfigValue(_("LastSysroot"), dlg.sysroot());
|
setConfigValue(_("LastSysroot"), dlg.sysroot());
|
||||||
setConfigValue(_("LastExternalStartScript"), dlg.overrideStartScript());
|
setConfigValue(_("LastExternalStartScript"), dlg.overrideStartScript());
|
||||||
attachCore(dlg.coreFile(), dlg.executableFile(), dlg.abi(),
|
|
||||||
dlg.sysroot(), dlg.overrideStartScript());
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerPluginPrivate::attachCore(const QString &core,
|
|
||||||
const QString &exe,
|
|
||||||
const ProjectExplorer::Abi &abi,
|
|
||||||
const QString &sysroot,
|
|
||||||
const QString &overrideStartScript,
|
|
||||||
const QString &debuggerCommand)
|
|
||||||
{
|
|
||||||
DebuggerStartParameters sp;
|
DebuggerStartParameters sp;
|
||||||
sp.executable = exe;
|
sp.executable = dlg.executableFile();
|
||||||
sp.coreFile = core;
|
sp.coreFile = dlg.coreFile();
|
||||||
sp.displayName = tr("Core file \"%1\"").arg(core);
|
sp.displayName = tr("Core file \"%1\"").arg(dlg.coreFile());
|
||||||
sp.startMode = AttachCore;
|
sp.startMode = AttachCore;
|
||||||
sp.debuggerCommand = debuggerCommand;
|
sp.debuggerCommand = dlg.debuggerCommand();
|
||||||
sp.toolChainAbi = abi.isValid() ? abi : abiOfBinary(sp.coreFile);
|
sp.toolChainAbi = dlg.abi();
|
||||||
sp.sysroot = sysroot;
|
sp.sysroot = dlg.sysroot();
|
||||||
sp.overrideStartScript = overrideStartScript;
|
sp.overrideStartScript = dlg.overrideStartScript();
|
||||||
if (DebuggerRunControl *rc = createDebugger(sp))
|
if (DebuggerRunControl *rc = createDebugger(sp))
|
||||||
startDebugger(rc);
|
startDebugger(rc);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user