Fixes: simplify "Attach to Running Process" code

Details: also sorts by process name by default
This commit is contained in:
hjk
2009-01-05 14:38:51 +01:00
parent 02fec25be1
commit 6705bc7e60
4 changed files with 6 additions and 10 deletions

View File

@@ -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

View File

@@ -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;
};

View File

@@ -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();

View File

@@ -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
}