Commit 6705bc7e authored by hjk's avatar hjk
Browse files

Fixes: simplify "Attach to Running Process" code

Details: also sorts by process name by default
parent 02fec25b
......@@ -49,12 +49,11 @@
using namespace Debugger::Internal;
AttachExternalDialog::AttachExternalDialog(QWidget *parent, const QString &pid)
AttachExternalDialog::AttachExternalDialog(QWidget *parent)
: QDialog(parent)
{
setupUi(this);
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
m_defaultPID = pid;
m_model = new QStandardItemModel(this);
procView->setSortingEnabled(true);
......@@ -65,8 +64,6 @@ AttachExternalDialog::AttachExternalDialog(QWidget *parent, const QString &pid)
connect(procView, SIGNAL(activated(const QModelIndex &)),
this, SLOT(procSelected(const QModelIndex &)));
pidLineEdit->setText(m_defaultPID);
rebuildProcessList();
}
......@@ -91,7 +88,7 @@ static void insertItem(QStandardItem *root, const QString &pid,
//qDebug() << "HANDLING " << pid;
QStandardItem *parent = 0;
const ProcData &proc = procs[pid];
if (1 || pid == "0") {
if (1 || pid == "0") { // FIXME: a real tree is not-so-nice to search
parent = root;
} else {
if (!known.contains(proc.ppid))
......@@ -148,6 +145,7 @@ void AttachExternalDialog::rebuildProcessList()
procView->expandAll();
procView->resizeColumnToContents(0);
procView->resizeColumnToContents(1);
procView->sortByColumn(1, Qt::AscendingOrder);
}
#ifdef Q_OS_WINDOWS
......
......@@ -48,7 +48,7 @@ class AttachExternalDialog : public QDialog, Ui::AttachExternalDialog
Q_OBJECT
public:
explicit AttachExternalDialog(QWidget *parent, const QString &pid);
explicit AttachExternalDialog(QWidget *parent);
int attachPID() const;
private slots:
......@@ -56,7 +56,6 @@ private slots:
void procSelected(const QModelIndex &);
private:
QString m_defaultPID;
QStandardItemModel *m_model;
};
......
......@@ -804,8 +804,7 @@ bool DebuggerManager::startNewDebugger(StartMode mode)
m_workingDir = QString();
m_attachedPID = -1;
} else if (startMode() == attachExternal) {
QString pid;
AttachExternalDialog dlg(mainWindow(), pid);
AttachExternalDialog dlg(mainWindow());
if (dlg.exec() != QDialog::Accepted)
return false;
m_executable = QString();
......
......@@ -2401,7 +2401,7 @@ void GdbEngine::handleStackListFrames(const GdbResultRecord &record)
if (usable)
q->gotoLocation(frame.file, frame.line, true);
else
qDebug() << "FULL NAME NOT USABLE 0: " << frame.file;
qDebug() << "FULL NAME NOT USABLE 0: " << frame.file << topFrame;
}
#endif
}
......
Supports Markdown
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