Commit 588d44c5 authored by hjk's avatar hjk
Browse files

debugger: always enable attaching to external process

parent cc013037
......@@ -74,7 +74,7 @@ public:
void populate(QList<ProcData> processes, const QString &excludePid = QString());
private:
enum { processImageRole = Qt::UserRole };
enum { ProcessImageRole = Qt::UserRole, ProcessNameRole };
bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
......@@ -121,8 +121,12 @@ QString ProcessListFilterModel::executableForPid(const QString &pid) const
const int rowCount = m_model->rowCount();
for (int r = 0; r < rowCount; r++) {
const QStandardItem *item = m_model->item(r, 0);
if (item->text() == pid)
return item->data(processImageRole).toString();
if (item->text() == pid) {
QString name = item->data(ProcessImageRole).toString();
if (name.isEmpty())
name = item->data(ProcessNameRole).toString();
return name;
}
}
return QString();
}
......@@ -135,18 +139,18 @@ void ProcessListFilterModel::populate(QList<ProcData> processes, const QString &
m_model->removeRows(0, rowCount);
QStandardItem *root = m_model->invisibleRootItem();
foreach(const ProcData &proc, processes) {
foreach (const ProcData &proc, processes) {
QList<QStandardItem *> row;
row.append(new QStandardItem(proc.ppid));
row.front()->setData(QVariant(proc.image), processImageRole);
QString name = proc.image.isEmpty() ? proc.name : proc.image;
row.back()->setData(name, ProcessImageRole);
row.append(new QStandardItem(proc.name));
if (!proc.image.isEmpty())
row.back()->setToolTip(proc.image);
row.back()->setToolTip(proc.image);
row.append(new QStandardItem(proc.state));
if (proc.ppid == excludePid)
foreach(QStandardItem *i, row)
i->setEnabled(false);
foreach (QStandardItem *item, row)
item->setEnabled(false);
root->appendRow(row);
}
}
......@@ -412,7 +416,7 @@ QString AttachExternalDialog::executable() const
void AttachExternalDialog::pidChanged(const QString &pid)
{
bool enabled = !pid.isEmpty() && pid != QLatin1String("0") && pid != m_selfPid;;
bool enabled = !pid.isEmpty() && pid != QLatin1String("0") && pid != m_selfPid;
okButton()->setEnabled(enabled);
}
......
......@@ -1694,6 +1694,7 @@ void DebuggerPluginPrivate::attachExternalApplication
}
DebuggerStartParameters sp;
sp.attachPID = pid;
sp.displayName = tr("Process %1").arg(pid);
sp.executable = binary;
sp.crashParameter = crashParameter;
sp.startMode = crashParameter.isEmpty() ? AttachExternal:AttachCrashedExternal;
......@@ -1718,7 +1719,7 @@ void DebuggerPluginPrivate::attachCore(const QString &core, const QString &exe)
DebuggerStartParameters sp;
sp.executable = exe;
sp.coreFile = core;
sp.displayName = tr("Core file: \"%1\"").arg(core);
sp.displayName = tr("Core file \"%1\"").arg(core);
sp.startMode = AttachCore;
DebuggerRunControl *rc = createDebugger(sp);
startDebugger(rc);
......@@ -2187,7 +2188,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
//const bool running = m_state == InferiorRunOk;
m_startExternalAction->setEnabled(!started && !starting);
m_attachExternalAction->setEnabled(!started && !starting);
m_attachExternalAction->setEnabled(true);
#ifdef Q_OS_WIN
m_attachCoreAction->setEnabled(false);
#else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment