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