2009-03-02 14:04:03 +01:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2011-01-11 16:28:15 +01:00
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
2009-03-02 14:04:03 +01:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
2009-03-02 14:04:03 +01:00
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
|
|
|
** Please review the following information to ensure the GNU Lesser General
|
|
|
|
|
** Public License version 2.1 requirements will be met:
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2009-03-02 14:04:03 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-05-06 15:05:37 +02:00
|
|
|
** Nokia at info@qt.nokia.com.
|
2009-03-02 14:04:03 +01:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "debuggerdialogs.h"
|
2011-01-07 09:44:23 +01:00
|
|
|
|
2009-10-08 11:43:26 +02:00
|
|
|
#include "debuggerconstants.h"
|
2011-01-11 11:22:55 +01:00
|
|
|
#include "cdb/cdbengine.h"
|
2009-03-02 14:04:03 +01:00
|
|
|
|
2009-03-02 15:14:12 +01:00
|
|
|
#include "ui_attachcoredialog.h"
|
|
|
|
|
#include "ui_attachexternaldialog.h"
|
|
|
|
|
#include "ui_startexternaldialog.h"
|
2009-05-06 13:27:11 +02:00
|
|
|
#include "ui_startremotedialog.h"
|
2010-12-01 15:41:08 +01:00
|
|
|
#include "ui_startremoteenginedialog.h"
|
2009-03-02 15:14:12 +01:00
|
|
|
|
2009-03-04 16:00:43 +01:00
|
|
|
#ifdef Q_OS_WIN
|
2009-05-19 15:45:58 +02:00
|
|
|
# include "shared/dbgwinutils.h"
|
2009-03-04 16:00:43 +01:00
|
|
|
#endif
|
|
|
|
|
|
2009-10-08 11:43:26 +02:00
|
|
|
#include <coreplugin/icore.h>
|
2011-02-24 16:50:15 +01:00
|
|
|
#include <projectexplorer/abi.h>
|
2010-03-04 10:07:59 +01:00
|
|
|
#include <utils/synchronousprocess.h>
|
2010-09-16 12:28:50 +02:00
|
|
|
#include <utils/historycompleter.h>
|
2010-11-19 16:13:22 +01:00
|
|
|
#include <utils/qtcassert.h>
|
2009-10-08 11:43:26 +02:00
|
|
|
|
2009-03-02 14:04:03 +01:00
|
|
|
#include <QtCore/QDebug>
|
2010-03-04 10:07:59 +01:00
|
|
|
#include <QtCore/QProcess>
|
2010-11-19 16:13:22 +01:00
|
|
|
#include <QtCore/QRegExp>
|
2009-03-02 14:04:03 +01:00
|
|
|
#include <QtCore/QDir>
|
|
|
|
|
#include <QtCore/QFile>
|
2009-03-04 16:48:13 +01:00
|
|
|
#include <QtCore/QCoreApplication>
|
2009-03-02 14:04:03 +01:00
|
|
|
#include <QtGui/QStandardItemModel>
|
|
|
|
|
#include <QtGui/QHeaderView>
|
|
|
|
|
#include <QtGui/QFileDialog>
|
|
|
|
|
#include <QtGui/QPushButton>
|
2009-03-04 16:00:43 +01:00
|
|
|
#include <QtGui/QProxyModel>
|
|
|
|
|
#include <QtGui/QSortFilterProxyModel>
|
2010-10-22 14:03:25 +02:00
|
|
|
#include <QtGui/QMessageBox>
|
2010-11-19 16:13:22 +01:00
|
|
|
#include <QtGui/QGroupBox>
|
2009-03-05 17:30:29 +01:00
|
|
|
|
2010-09-16 12:28:50 +02:00
|
|
|
using namespace Utils;
|
|
|
|
|
|
2009-03-05 17:30:29 +01:00
|
|
|
namespace Debugger {
|
2009-05-04 14:47:45 +02:00
|
|
|
namespace Internal {
|
2009-03-05 17:30:29 +01:00
|
|
|
|
|
|
|
|
bool operator<(const ProcData &p1, const ProcData &p2)
|
|
|
|
|
{
|
|
|
|
|
return p1.name < p2.name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// A filterable process list model
|
2009-05-04 14:47:45 +02:00
|
|
|
class ProcessListFilterModel : public QSortFilterProxyModel
|
|
|
|
|
{
|
2009-03-05 17:30:29 +01:00
|
|
|
public:
|
|
|
|
|
explicit ProcessListFilterModel(QObject *parent);
|
|
|
|
|
QString processIdAt(const QModelIndex &index) const;
|
2010-03-17 10:57:19 +01:00
|
|
|
QString executableForPid(const QString& pid) const;
|
|
|
|
|
|
2010-09-16 12:28:50 +02:00
|
|
|
void populate(QList<ProcData> processes, const QString &excludePid);
|
2009-03-05 17:30:29 +01:00
|
|
|
|
|
|
|
|
private:
|
2010-07-21 09:36:16 +02:00
|
|
|
enum { ProcessImageRole = Qt::UserRole, ProcessNameRole };
|
2010-03-17 10:57:19 +01:00
|
|
|
|
2010-03-09 12:25:43 +01:00
|
|
|
bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
|
|
|
|
|
|
2009-03-05 17:30:29 +01:00
|
|
|
QStandardItemModel *m_model;
|
|
|
|
|
};
|
|
|
|
|
|
2009-05-04 14:47:45 +02:00
|
|
|
ProcessListFilterModel::ProcessListFilterModel(QObject *parent)
|
|
|
|
|
: QSortFilterProxyModel(parent),
|
|
|
|
|
m_model(new QStandardItemModel(this))
|
2009-03-05 17:30:29 +01:00
|
|
|
{
|
|
|
|
|
QStringList columns;
|
|
|
|
|
columns << AttachExternalDialog::tr("Process ID")
|
|
|
|
|
<< AttachExternalDialog::tr("Name")
|
|
|
|
|
<< AttachExternalDialog::tr("State");
|
|
|
|
|
m_model->setHorizontalHeaderLabels(columns);
|
|
|
|
|
setSourceModel(m_model);
|
|
|
|
|
setFilterCaseSensitivity(Qt::CaseInsensitive);
|
|
|
|
|
setFilterKeyColumn(1);
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-09 12:25:43 +01:00
|
|
|
bool ProcessListFilterModel::lessThan(const QModelIndex &left,
|
|
|
|
|
const QModelIndex &right) const
|
|
|
|
|
{
|
|
|
|
|
const QString l = sourceModel()->data(left).toString();
|
|
|
|
|
const QString r = sourceModel()->data(right).toString();
|
|
|
|
|
if (left.column() == 0)
|
|
|
|
|
return l.toInt() < r.toInt();
|
|
|
|
|
return l < r;
|
|
|
|
|
}
|
|
|
|
|
|
2009-03-05 17:30:29 +01:00
|
|
|
QString ProcessListFilterModel::processIdAt(const QModelIndex &index) const
|
|
|
|
|
{
|
|
|
|
|
if (index.isValid()) {
|
|
|
|
|
const QModelIndex index0 = mapToSource(index);
|
2010-06-11 13:35:22 +10:00
|
|
|
QModelIndex siblingIndex = index0.sibling(index0.row(), 0);
|
|
|
|
|
if (const QStandardItem *item = m_model->itemFromIndex(siblingIndex))
|
2009-03-05 17:30:29 +01:00
|
|
|
return item->text();
|
|
|
|
|
}
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-17 10:57:19 +01:00
|
|
|
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);
|
2010-07-21 09:36:16 +02:00
|
|
|
if (item->text() == pid) {
|
|
|
|
|
QString name = item->data(ProcessImageRole).toString();
|
|
|
|
|
if (name.isEmpty())
|
|
|
|
|
name = item->data(ProcessNameRole).toString();
|
|
|
|
|
return name;
|
|
|
|
|
}
|
2010-03-17 10:57:19 +01:00
|
|
|
}
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-16 12:28:50 +02:00
|
|
|
void ProcessListFilterModel::populate
|
|
|
|
|
(QList<ProcData> processes, const QString &excludePid)
|
2009-03-05 17:30:29 +01:00
|
|
|
{
|
|
|
|
|
qStableSort(processes);
|
|
|
|
|
|
|
|
|
|
if (const int rowCount = m_model->rowCount())
|
|
|
|
|
m_model->removeRows(0, rowCount);
|
|
|
|
|
|
|
|
|
|
QStandardItem *root = m_model->invisibleRootItem();
|
2010-07-21 09:36:16 +02:00
|
|
|
foreach (const ProcData &proc, processes) {
|
2009-03-05 17:30:29 +01:00
|
|
|
QList<QStandardItem *> row;
|
|
|
|
|
row.append(new QStandardItem(proc.ppid));
|
2010-07-21 09:36:16 +02:00
|
|
|
QString name = proc.image.isEmpty() ? proc.name : proc.image;
|
|
|
|
|
row.back()->setData(name, ProcessImageRole);
|
2009-03-05 17:30:29 +01:00
|
|
|
row.append(new QStandardItem(proc.name));
|
2010-07-21 09:36:16 +02:00
|
|
|
row.back()->setToolTip(proc.image);
|
2009-03-05 17:30:29 +01:00
|
|
|
row.append(new QStandardItem(proc.state));
|
2010-03-17 10:57:19 +01:00
|
|
|
|
2009-03-05 17:30:29 +01:00
|
|
|
if (proc.ppid == excludePid)
|
2010-07-21 09:36:16 +02:00
|
|
|
foreach (QStandardItem *item, row)
|
|
|
|
|
item->setEnabled(false);
|
2009-03-05 17:30:29 +01:00
|
|
|
root->appendRow(row);
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-03-02 14:04:03 +01:00
|
|
|
|
2009-05-04 14:47:45 +02:00
|
|
|
|
2009-03-02 14:04:03 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// AttachCoreDialog
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
AttachCoreDialog::AttachCoreDialog(QWidget *parent)
|
2009-03-02 15:14:12 +01:00
|
|
|
: QDialog(parent), m_ui(new Ui::AttachCoreDialog)
|
2009-03-02 14:04:03 +01:00
|
|
|
{
|
2011-02-24 16:50:15 +01:00
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
2009-03-02 15:14:12 +01:00
|
|
|
m_ui->setupUi(this);
|
2011-02-24 16:50:15 +01:00
|
|
|
m_ui->toolchainComboBox->init(false);
|
2009-03-02 15:14:12 +01:00
|
|
|
|
2010-09-16 12:28:50 +02:00
|
|
|
m_ui->execFileName->setExpectedKind(PathChooser::File);
|
2009-03-02 15:14:12 +01:00
|
|
|
m_ui->execFileName->setPromptDialogTitle(tr("Select Executable"));
|
|
|
|
|
|
2010-09-16 12:28:50 +02:00
|
|
|
m_ui->coreFileName->setExpectedKind(PathChooser::File);
|
2009-04-10 02:40:16 +02:00
|
|
|
m_ui->coreFileName->setPromptDialogTitle(tr("Select Core File"));
|
2009-03-02 15:14:12 +01:00
|
|
|
|
2011-05-30 12:32:58 +02:00
|
|
|
m_ui->sysrootPathChooser->setExpectedKind(PathChooser::Directory);
|
|
|
|
|
m_ui->sysrootPathChooser->setPromptDialogTitle(tr("Select Sysroot"));
|
|
|
|
|
|
2011-05-03 14:57:05 +02:00
|
|
|
m_ui->overrideStartScriptFileName->setExpectedKind(PathChooser::File);
|
|
|
|
|
m_ui->overrideStartScriptFileName->setPromptDialogTitle(tr("Select Startup Script"));
|
|
|
|
|
|
2009-03-02 15:14:12 +01:00
|
|
|
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
2009-03-02 14:04:03 +01:00
|
|
|
|
2009-03-02 15:14:12 +01:00
|
|
|
connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
|
|
|
|
connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
2011-02-24 16:50:15 +01:00
|
|
|
connect(m_ui->coreFileName, SIGNAL(changed(QString)), this, SLOT(changed()));
|
|
|
|
|
changed();
|
2009-03-02 15:14:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AttachCoreDialog::~AttachCoreDialog()
|
|
|
|
|
{
|
|
|
|
|
delete m_ui;
|
|
|
|
|
}
|
2009-03-02 14:04:03 +01:00
|
|
|
|
2009-03-02 15:14:12 +01:00
|
|
|
QString AttachCoreDialog::executableFile() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->execFileName->path();
|
2009-03-02 14:04:03 +01:00
|
|
|
}
|
|
|
|
|
|
2009-03-02 15:14:12 +01:00
|
|
|
void AttachCoreDialog::setExecutableFile(const QString &fileName)
|
|
|
|
|
{
|
|
|
|
|
m_ui->execFileName->setPath(fileName);
|
2011-02-24 16:50:15 +01:00
|
|
|
changed();
|
2009-03-02 15:14:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString AttachCoreDialog::coreFile() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->coreFileName->path();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AttachCoreDialog::setCoreFile(const QString &fileName)
|
|
|
|
|
{
|
|
|
|
|
m_ui->coreFileName->setPath(fileName);
|
2011-02-24 16:50:15 +01:00
|
|
|
changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProjectExplorer::Abi AttachCoreDialog::abi() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->toolchainComboBox->abi();
|
2009-03-02 15:14:12 +01:00
|
|
|
}
|
2009-03-02 14:04:03 +01:00
|
|
|
|
2011-02-25 16:03:22 +01:00
|
|
|
void AttachCoreDialog::setAbiIndex(int i)
|
2011-02-24 16:50:15 +01:00
|
|
|
{
|
2011-02-25 16:03:22 +01:00
|
|
|
if (i >= 0 && i < m_ui->toolchainComboBox->count())
|
|
|
|
|
m_ui->toolchainComboBox->setCurrentIndex(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int AttachCoreDialog::abiIndex() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->toolchainComboBox->currentIndex();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString AttachCoreDialog::debuggerCommand()
|
|
|
|
|
{
|
|
|
|
|
return m_ui->toolchainComboBox->debuggerCommand();
|
2011-02-24 16:50:15 +01:00
|
|
|
}
|
|
|
|
|
|
2011-05-30 12:56:26 +02:00
|
|
|
QString AttachCoreDialog::sysroot() const
|
2011-05-30 12:32:58 +02:00
|
|
|
{
|
|
|
|
|
return m_ui->sysrootPathChooser->path();
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-30 12:56:26 +02:00
|
|
|
void AttachCoreDialog::setSysroot(const QString &sysroot)
|
2011-05-30 12:32:58 +02:00
|
|
|
{
|
|
|
|
|
m_ui->sysrootPathChooser->setPath(sysroot);
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-03 14:57:05 +02:00
|
|
|
QString AttachCoreDialog::overrideStartScript() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->overrideStartScriptFileName->path();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AttachCoreDialog::setOverrideStartScript(const QString &scriptName)
|
|
|
|
|
{
|
|
|
|
|
m_ui->overrideStartScriptFileName->setPath(scriptName);
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-24 16:50:15 +01:00
|
|
|
bool AttachCoreDialog::isValid() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->toolchainComboBox->currentIndex() >= 0 &&
|
|
|
|
|
!coreFile().isEmpty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AttachCoreDialog::changed()
|
|
|
|
|
{
|
|
|
|
|
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(isValid());
|
|
|
|
|
}
|
2009-05-04 14:47:45 +02:00
|
|
|
|
2009-03-02 14:04:03 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2009-05-04 14:47:45 +02:00
|
|
|
// Process model helpers
|
2009-03-02 14:04:03 +01:00
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2010-07-12 16:03:20 +02:00
|
|
|
#ifndef Q_OS_WIN
|
|
|
|
|
|
2009-03-04 16:48:13 +01:00
|
|
|
static bool isUnixProcessId(const QString &procname)
|
2009-03-02 14:04:03 +01:00
|
|
|
{
|
|
|
|
|
for (int i = 0; i != procname.size(); ++i)
|
|
|
|
|
if (!procname.at(i).isDigit())
|
|
|
|
|
return false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-04 10:07:59 +01:00
|
|
|
|
|
|
|
|
// Determine UNIX processes by running ps
|
|
|
|
|
static QList<ProcData> unixProcessListPS()
|
|
|
|
|
{
|
|
|
|
|
#ifdef Q_OS_MAC
|
|
|
|
|
static const char formatC[] = "pid state command";
|
|
|
|
|
#else
|
|
|
|
|
static const char formatC[] = "pid,state,cmd";
|
|
|
|
|
#endif
|
|
|
|
|
QList<ProcData> rc;
|
|
|
|
|
QProcess psProcess;
|
|
|
|
|
QStringList args;
|
|
|
|
|
args << QLatin1String("-e") << QLatin1String("-o") << QLatin1String(formatC);
|
|
|
|
|
psProcess.start(QLatin1String("ps"), args);
|
|
|
|
|
if (!psProcess.waitForStarted())
|
|
|
|
|
return rc;
|
|
|
|
|
QByteArray output;
|
2010-09-16 12:28:50 +02:00
|
|
|
if (!SynchronousProcess::readDataFromProcess(psProcess, 30000, &output, 0, false))
|
2010-03-04 10:07:59 +01:00
|
|
|
return rc;
|
|
|
|
|
// Split "457 S+ /Users/foo.app"
|
|
|
|
|
const QStringList lines = QString::fromLocal8Bit(output).split(QLatin1Char('\n'));
|
|
|
|
|
const int lineCount = lines.size();
|
|
|
|
|
const QChar blank = QLatin1Char(' ');
|
|
|
|
|
for (int l = 1; l < lineCount; l++) { // Skip header
|
|
|
|
|
const QString line = lines.at(l).simplified();
|
|
|
|
|
const int pidSep = line.indexOf(blank);
|
|
|
|
|
const int cmdSep = pidSep != -1 ? line.indexOf(blank, pidSep + 1) : -1;
|
|
|
|
|
if (cmdSep > 0) {
|
|
|
|
|
ProcData procData;
|
|
|
|
|
procData.ppid = line.left(pidSep);
|
|
|
|
|
procData.state = line.mid(pidSep + 1, cmdSep - pidSep - 1);
|
|
|
|
|
procData.name = line.mid(cmdSep + 1);
|
|
|
|
|
rc.push_back(procData);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return rc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Determine UNIX processes by reading "/proc". Default to ps if
|
|
|
|
|
// it does not exist
|
2009-03-04 16:00:43 +01:00
|
|
|
static QList<ProcData> unixProcessList()
|
2009-03-02 14:04:03 +01:00
|
|
|
{
|
2010-03-04 10:07:59 +01:00
|
|
|
const QDir procDir(QLatin1String("/proc/"));
|
|
|
|
|
if (!procDir.exists())
|
|
|
|
|
return unixProcessListPS();
|
2009-03-04 16:00:43 +01:00
|
|
|
QList<ProcData> rc;
|
2010-03-04 10:07:59 +01:00
|
|
|
const QStringList procIds = procDir.entryList();
|
2009-03-04 16:48:13 +01:00
|
|
|
if (procIds.isEmpty())
|
2009-03-04 16:00:43 +01:00
|
|
|
return rc;
|
2009-03-04 16:48:13 +01:00
|
|
|
foreach (const QString &procId, procIds) {
|
|
|
|
|
if (!isUnixProcessId(procId))
|
2009-03-02 14:04:03 +01:00
|
|
|
continue;
|
2009-03-04 16:00:43 +01:00
|
|
|
QString filename = QLatin1String("/proc/");
|
2009-03-04 16:48:13 +01:00
|
|
|
filename += procId;
|
2009-03-04 16:00:43 +01:00
|
|
|
filename += QLatin1String("/stat");
|
2009-03-02 14:04:03 +01:00
|
|
|
QFile file(filename);
|
2009-08-07 13:01:33 +02:00
|
|
|
if (!file.open(QIODevice::ReadOnly))
|
|
|
|
|
continue; // process may have exited
|
|
|
|
|
|
2009-03-04 16:00:43 +01:00
|
|
|
const QStringList data = QString::fromLocal8Bit(file.readAll()).split(' ');
|
2009-03-02 14:04:03 +01:00
|
|
|
ProcData proc;
|
2009-03-04 16:48:13 +01:00
|
|
|
proc.ppid = procId;
|
2009-03-02 14:04:03 +01:00
|
|
|
proc.name = data.at(1);
|
2009-03-04 16:48:13 +01:00
|
|
|
if (proc.name.startsWith(QLatin1Char('(')) && proc.name.endsWith(QLatin1Char(')'))) {
|
|
|
|
|
proc.name.truncate(proc.name.size() - 1);
|
|
|
|
|
proc.name.remove(0, 1);
|
|
|
|
|
}
|
2009-03-02 14:04:03 +01:00
|
|
|
proc.state = data.at(2);
|
2009-03-04 16:48:13 +01:00
|
|
|
// PPID is element 3
|
2009-03-04 16:00:43 +01:00
|
|
|
rc.push_back(proc);
|
2009-03-02 14:04:03 +01:00
|
|
|
}
|
2009-03-04 16:00:43 +01:00
|
|
|
return rc;
|
|
|
|
|
}
|
2010-07-12 16:03:20 +02:00
|
|
|
#endif // Q_OS_WIN
|
2009-03-02 14:04:03 +01:00
|
|
|
|
2009-03-05 17:30:29 +01:00
|
|
|
static QList<ProcData> processList()
|
2009-03-04 16:00:43 +01:00
|
|
|
{
|
|
|
|
|
#ifdef Q_OS_WIN
|
2009-03-05 17:30:29 +01:00
|
|
|
return winProcessList();
|
2009-03-04 16:00:43 +01:00
|
|
|
#else
|
2009-03-05 17:30:29 +01:00
|
|
|
return unixProcessList();
|
2009-03-04 16:00:43 +01:00
|
|
|
#endif
|
|
|
|
|
}
|
2010-03-09 12:25:43 +01:00
|
|
|
|
|
|
|
|
|
2009-03-04 16:00:43 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// AttachExternalDialog
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2009-05-04 14:47:45 +02:00
|
|
|
AttachExternalDialog::AttachExternalDialog(QWidget *parent)
|
|
|
|
|
: QDialog(parent),
|
|
|
|
|
m_selfPid(QString::number(QCoreApplication::applicationPid())),
|
|
|
|
|
m_ui(new Ui::AttachExternalDialog),
|
|
|
|
|
m_model(new ProcessListFilterModel(this))
|
2009-03-04 16:00:43 +01:00
|
|
|
{
|
2011-02-24 16:50:15 +01:00
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
2009-03-04 16:00:43 +01:00
|
|
|
m_ui->setupUi(this);
|
2011-02-24 16:50:15 +01:00
|
|
|
m_ui->toolchainComboBox->init(true);
|
2009-03-04 16:48:13 +01:00
|
|
|
okButton()->setDefault(true);
|
|
|
|
|
okButton()->setEnabled(false);
|
2009-03-04 16:00:43 +01:00
|
|
|
|
2009-03-05 17:30:29 +01:00
|
|
|
m_ui->procView->setModel(m_model);
|
2009-03-04 16:00:43 +01:00
|
|
|
m_ui->procView->setSortingEnabled(true);
|
2010-03-29 16:19:14 +02:00
|
|
|
m_ui->procView->sortByColumn(1, Qt::AscendingOrder);
|
2009-03-04 16:00:43 +01:00
|
|
|
|
|
|
|
|
connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
|
|
|
|
connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
|
|
|
|
QPushButton *refreshButton = new QPushButton(tr("Refresh"));
|
|
|
|
|
connect(refreshButton, SIGNAL(clicked()), this, SLOT(rebuildProcessList()));
|
|
|
|
|
m_ui->buttonBox->addButton(refreshButton, QDialogButtonBox::ActionRole);
|
2009-12-16 15:58:10 +01:00
|
|
|
m_ui->filterWidget->setFocus(Qt::TabFocusReason);
|
2009-03-04 16:00:43 +01:00
|
|
|
|
2010-03-04 10:07:59 +01:00
|
|
|
m_ui->procView->setAlternatingRowColors(true);
|
|
|
|
|
m_ui->procView->setRootIsDecorated(false);
|
|
|
|
|
m_ui->procView->setUniformRowHeights(true);
|
|
|
|
|
|
2009-03-05 17:30:29 +01:00
|
|
|
// Do not use activated, will be single click in Oxygen
|
|
|
|
|
connect(m_ui->procView, SIGNAL(doubleClicked(QModelIndex)),
|
2009-03-04 16:00:43 +01:00
|
|
|
this, SLOT(procSelected(QModelIndex)));
|
2010-03-09 12:25:43 +01:00
|
|
|
connect(m_ui->procView, SIGNAL(clicked(QModelIndex)),
|
|
|
|
|
this, SLOT(procClicked(QModelIndex)));
|
2009-03-04 16:48:13 +01:00
|
|
|
connect(m_ui->pidLineEdit, SIGNAL(textChanged(QString)),
|
|
|
|
|
this, SLOT(pidChanged(QString)));
|
2009-12-16 15:58:10 +01:00
|
|
|
connect(m_ui->filterWidget, SIGNAL(filterChanged(QString)),
|
2009-10-05 09:19:38 +02:00
|
|
|
this, SLOT(setFilterString(QString)));
|
2009-03-04 16:00:43 +01:00
|
|
|
|
2010-03-09 12:25:43 +01:00
|
|
|
|
2009-12-16 15:58:10 +01:00
|
|
|
setMinimumHeight(500);
|
2009-03-04 16:00:43 +01:00
|
|
|
rebuildProcessList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AttachExternalDialog::~AttachExternalDialog()
|
|
|
|
|
{
|
|
|
|
|
delete m_ui;
|
|
|
|
|
}
|
|
|
|
|
|
2009-10-05 09:19:38 +02:00
|
|
|
void AttachExternalDialog::setFilterString(const QString &filter)
|
|
|
|
|
{
|
|
|
|
|
m_model->setFilterFixedString(filter);
|
|
|
|
|
// Activate the line edit if there's a unique filtered process.
|
|
|
|
|
QString processId;
|
|
|
|
|
if (m_model->rowCount(QModelIndex()) == 1)
|
|
|
|
|
processId = m_model->processIdAt(m_model->index(0, 0, QModelIndex()));
|
|
|
|
|
m_ui->pidLineEdit->setText(processId);
|
|
|
|
|
pidChanged(processId);
|
|
|
|
|
}
|
|
|
|
|
|
2009-03-04 16:48:13 +01:00
|
|
|
QPushButton *AttachExternalDialog::okButton() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->buttonBox->button(QDialogButtonBox::Ok);
|
|
|
|
|
}
|
|
|
|
|
|
2009-03-04 16:00:43 +01:00
|
|
|
void AttachExternalDialog::rebuildProcessList()
|
|
|
|
|
{
|
2009-03-05 17:30:29 +01:00
|
|
|
m_model->populate(processList(), m_selfPid);
|
2009-03-02 15:14:12 +01:00
|
|
|
m_ui->procView->expandAll();
|
|
|
|
|
m_ui->procView->resizeColumnToContents(0);
|
|
|
|
|
m_ui->procView->resizeColumnToContents(1);
|
2009-03-02 14:04:03 +01:00
|
|
|
}
|
|
|
|
|
|
2009-03-04 16:00:43 +01:00
|
|
|
void AttachExternalDialog::procSelected(const QModelIndex &proxyIndex)
|
2009-03-02 14:04:03 +01:00
|
|
|
{
|
2010-03-09 12:25:43 +01:00
|
|
|
const QString processId = m_model->processIdAt(proxyIndex);
|
2009-10-05 09:19:38 +02:00
|
|
|
if (!processId.isEmpty()) {
|
|
|
|
|
m_ui->pidLineEdit->setText(processId);
|
2009-03-04 16:48:13 +01:00
|
|
|
if (okButton()->isEnabled())
|
|
|
|
|
okButton()->animateClick();
|
2009-03-04 16:00:43 +01:00
|
|
|
}
|
2009-03-02 14:04:03 +01:00
|
|
|
}
|
|
|
|
|
|
2010-03-09 12:25:43 +01:00
|
|
|
void AttachExternalDialog::procClicked(const QModelIndex &proxyIndex)
|
|
|
|
|
{
|
|
|
|
|
const QString processId = m_model->processIdAt(proxyIndex);
|
|
|
|
|
if (!processId.isEmpty())
|
|
|
|
|
m_ui->pidLineEdit->setText(processId);
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-17 10:57:19 +01:00
|
|
|
QString AttachExternalDialog::attachPIDText() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->pidLineEdit->text().trimmed();
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-25 16:22:11 +02:00
|
|
|
qint64 AttachExternalDialog::attachPID() const
|
2009-03-02 14:04:03 +01:00
|
|
|
{
|
2010-03-17 10:57:19 +01:00
|
|
|
return attachPIDText().toLongLong();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString AttachExternalDialog::executable() const
|
|
|
|
|
{
|
|
|
|
|
// Search pid in model in case the user typed in the PID.
|
|
|
|
|
return m_model->executableForPid(attachPIDText());
|
2009-03-02 14:04:03 +01:00
|
|
|
}
|
|
|
|
|
|
2011-02-24 16:50:15 +01:00
|
|
|
ProjectExplorer::Abi AttachExternalDialog::abi() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->toolchainComboBox->abi();
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-25 16:03:22 +01:00
|
|
|
void AttachExternalDialog::setAbiIndex(int i)
|
|
|
|
|
{
|
|
|
|
|
if (i >= 0 && i < m_ui->toolchainComboBox->count())
|
|
|
|
|
m_ui->toolchainComboBox->setCurrentIndex(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int AttachExternalDialog::abiIndex() const
|
2011-02-24 16:50:15 +01:00
|
|
|
{
|
2011-02-25 16:03:22 +01:00
|
|
|
return m_ui->toolchainComboBox->currentIndex();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString AttachExternalDialog::debuggerCommand()
|
|
|
|
|
{
|
|
|
|
|
return m_ui->toolchainComboBox->debuggerCommand();
|
2011-02-24 16:50:15 +01:00
|
|
|
}
|
|
|
|
|
|
2009-03-04 16:48:13 +01:00
|
|
|
void AttachExternalDialog::pidChanged(const QString &pid)
|
|
|
|
|
{
|
2011-02-24 16:50:15 +01:00
|
|
|
const bool enabled = !pid.isEmpty() && pid != QLatin1String("0") && pid != m_selfPid
|
|
|
|
|
&& m_ui->toolchainComboBox->currentIndex() >= 0;
|
2009-05-04 14:47:45 +02:00
|
|
|
okButton()->setEnabled(enabled);
|
2009-03-04 16:48:13 +01:00
|
|
|
}
|
|
|
|
|
|
2010-10-22 14:03:25 +02:00
|
|
|
void AttachExternalDialog::accept()
|
|
|
|
|
{
|
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
|
const qint64 pid = attachPID();
|
|
|
|
|
if (pid && isWinProcessBeingDebugged(pid)) {
|
|
|
|
|
QMessageBox::warning(this, tr("Process Already Under Debugger Control"),
|
|
|
|
|
tr("The process %1 is already under the control of a debugger.\n"
|
|
|
|
|
"Qt Creator cannot attach to it.").arg(pid));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
QDialog::accept();
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-04 14:47:45 +02:00
|
|
|
|
2009-05-07 09:35:11 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// StartExternalDialog
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
StartExternalDialog::StartExternalDialog(QWidget *parent)
|
|
|
|
|
: QDialog(parent), m_ui(new Ui::StartExternalDialog)
|
|
|
|
|
{
|
2011-02-24 16:50:15 +01:00
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
2009-05-07 09:35:11 +02:00
|
|
|
m_ui->setupUi(this);
|
2011-02-24 16:50:15 +01:00
|
|
|
m_ui->toolChainComboBox->init(true);
|
2010-09-16 12:28:50 +02:00
|
|
|
m_ui->execFile->setExpectedKind(PathChooser::File);
|
2009-05-07 09:35:11 +02:00
|
|
|
m_ui->execFile->setPromptDialogTitle(tr("Select Executable"));
|
2010-09-16 12:28:50 +02:00
|
|
|
m_ui->execFile->lineEdit()->setCompleter(
|
|
|
|
|
new HistoryCompleter(m_ui->execFile->lineEdit()));
|
2011-02-24 16:50:15 +01:00
|
|
|
connect(m_ui->execFile, SIGNAL(changed(QString)), this, SLOT(changed()));
|
2009-05-07 09:35:11 +02:00
|
|
|
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
2011-02-21 12:42:20 +01:00
|
|
|
m_ui->workingDirectory->setExpectedKind(PathChooser::ExistingDirectory);
|
2010-05-12 11:48:00 +02:00
|
|
|
m_ui->workingDirectory->setPromptDialogTitle(tr("Select Working Directory"));
|
2010-09-16 12:28:50 +02:00
|
|
|
m_ui->workingDirectory->lineEdit()->setCompleter(
|
|
|
|
|
new HistoryCompleter(m_ui->workingDirectory->lineEdit()));
|
2009-05-07 09:35:11 +02:00
|
|
|
|
2010-09-16 12:28:50 +02:00
|
|
|
m_ui->argsEdit->setCompleter(new HistoryCompleter(m_ui->argsEdit));
|
2009-05-07 09:35:11 +02:00
|
|
|
|
|
|
|
|
connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
|
|
|
|
connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
2011-02-24 16:50:15 +01:00
|
|
|
changed();
|
2009-05-07 09:35:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StartExternalDialog::~StartExternalDialog()
|
|
|
|
|
{
|
|
|
|
|
delete m_ui;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StartExternalDialog::setExecutableFile(const QString &str)
|
|
|
|
|
{
|
|
|
|
|
m_ui->execFile->setPath(str);
|
2011-02-24 16:50:15 +01:00
|
|
|
changed();
|
2009-05-07 09:35:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString StartExternalDialog::executableFile() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->execFile->path();
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-12 11:48:00 +02:00
|
|
|
void StartExternalDialog::setWorkingDirectory(const QString &str)
|
|
|
|
|
{
|
|
|
|
|
m_ui->workingDirectory->setPath(str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString StartExternalDialog::workingDirectory() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->workingDirectory->path();
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-07 09:35:11 +02:00
|
|
|
void StartExternalDialog::setExecutableArguments(const QString &str)
|
|
|
|
|
{
|
|
|
|
|
m_ui->argsEdit->setText(str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString StartExternalDialog::executableArguments() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->argsEdit->text();
|
|
|
|
|
}
|
|
|
|
|
|
2009-06-12 12:57:22 +02:00
|
|
|
bool StartExternalDialog::breakAtMain() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->checkBoxBreakAtMain->isChecked();
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-04 09:21:18 +02:00
|
|
|
bool StartExternalDialog::runInTerminal() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->checkBoxRunInTerminal->isChecked();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StartExternalDialog::setRunInTerminal(bool v)
|
|
|
|
|
{
|
|
|
|
|
m_ui->checkBoxRunInTerminal->setChecked(v);
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-24 16:50:15 +01:00
|
|
|
ProjectExplorer::Abi StartExternalDialog::abi() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->toolChainComboBox->abi();
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-25 16:03:22 +01:00
|
|
|
void StartExternalDialog::setAbiIndex(int i)
|
|
|
|
|
{
|
|
|
|
|
if (i >= 0 && i < m_ui->toolChainComboBox->count())
|
|
|
|
|
m_ui->toolChainComboBox->setCurrentIndex(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int StartExternalDialog::abiIndex() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->toolChainComboBox->currentIndex();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString StartExternalDialog::debuggerCommand()
|
2011-02-24 16:50:15 +01:00
|
|
|
{
|
2011-02-25 16:03:22 +01:00
|
|
|
return m_ui->toolChainComboBox->debuggerCommand();
|
2011-02-24 16:50:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool StartExternalDialog::isValid() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->toolChainComboBox->currentIndex() >= 0
|
|
|
|
|
&& !executableFile().isEmpty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StartExternalDialog::changed()
|
|
|
|
|
{
|
|
|
|
|
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(isValid());
|
|
|
|
|
}
|
|
|
|
|
|
2009-03-02 14:04:03 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2009-05-06 13:27:11 +02:00
|
|
|
// StartRemoteDialog
|
2009-03-02 14:04:03 +01:00
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2009-05-06 13:27:11 +02:00
|
|
|
StartRemoteDialog::StartRemoteDialog(QWidget *parent)
|
2009-05-04 14:47:45 +02:00
|
|
|
: QDialog(parent),
|
2009-05-06 13:27:11 +02:00
|
|
|
m_ui(new Ui::StartRemoteDialog)
|
2009-03-02 14:04:03 +01:00
|
|
|
{
|
2011-02-24 16:50:15 +01:00
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
2009-03-02 15:14:12 +01:00
|
|
|
m_ui->setupUi(this);
|
|
|
|
|
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
2010-09-16 12:28:50 +02:00
|
|
|
m_ui->debuggerPathChooser->setExpectedKind(PathChooser::File);
|
2009-12-11 11:49:32 +01:00
|
|
|
m_ui->debuggerPathChooser->setPromptDialogTitle(tr("Select Debugger"));
|
2010-09-16 12:28:50 +02:00
|
|
|
m_ui->executablePathChooser->setExpectedKind(PathChooser::File);
|
2009-12-10 16:57:45 +01:00
|
|
|
m_ui->executablePathChooser->setPromptDialogTitle(tr("Select Executable"));
|
2009-12-11 11:49:32 +01:00
|
|
|
m_ui->sysrootPathChooser->setPromptDialogTitle(tr("Select Sysroot"));
|
2011-05-03 14:57:05 +02:00
|
|
|
m_ui->overrideStartScriptPathChooser->setExpectedKind(PathChooser::File);
|
|
|
|
|
m_ui->overrideStartScriptPathChooser->setPromptDialogTitle(tr("Select GDB Start Script"));
|
2010-09-16 12:28:50 +02:00
|
|
|
m_ui->serverStartScript->setExpectedKind(PathChooser::File);
|
2011-05-03 14:57:05 +02:00
|
|
|
m_ui->serverStartScript->setPromptDialogTitle(tr("Select Server Start Script"));
|
2009-05-07 09:35:11 +02:00
|
|
|
|
2010-01-29 21:33:57 +01:00
|
|
|
connect(m_ui->useServerStartScriptCheckBox, SIGNAL(toggled(bool)),
|
2009-05-07 09:35:11 +02:00
|
|
|
this, SLOT(updateState()));
|
2010-01-29 21:33:57 +01:00
|
|
|
|
2009-03-02 15:14:12 +01:00
|
|
|
connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
|
|
|
|
connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
2009-05-07 09:35:11 +02:00
|
|
|
|
|
|
|
|
updateState();
|
2009-03-02 14:04:03 +01:00
|
|
|
}
|
|
|
|
|
|
2009-05-06 13:27:11 +02:00
|
|
|
StartRemoteDialog::~StartRemoteDialog()
|
2009-03-02 15:14:12 +01:00
|
|
|
{
|
|
|
|
|
delete m_ui;
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-06 13:27:11 +02:00
|
|
|
void StartRemoteDialog::setRemoteChannel(const QString &channel)
|
2009-03-05 17:30:29 +01:00
|
|
|
{
|
2009-05-04 14:47:45 +02:00
|
|
|
m_ui->channelLineEdit->setText(channel);
|
2009-03-05 17:30:29 +01:00
|
|
|
}
|
|
|
|
|
|
2009-05-06 13:27:11 +02:00
|
|
|
QString StartRemoteDialog::remoteChannel() const
|
2009-03-02 14:04:03 +01:00
|
|
|
{
|
2009-05-04 14:47:45 +02:00
|
|
|
return m_ui->channelLineEdit->text();
|
2009-03-02 14:04:03 +01:00
|
|
|
}
|
|
|
|
|
|
2009-12-10 16:57:45 +01:00
|
|
|
void StartRemoteDialog::setLocalExecutable(const QString &executable)
|
|
|
|
|
{
|
|
|
|
|
m_ui->executablePathChooser->setPath(executable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString StartRemoteDialog::localExecutable() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->executablePathChooser->path();
|
2009-12-11 11:49:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StartRemoteDialog::setDebugger(const QString &debugger)
|
|
|
|
|
{
|
|
|
|
|
m_ui->debuggerPathChooser->setPath(debugger);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString StartRemoteDialog::debugger() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->debuggerPathChooser->path();
|
2009-12-10 16:57:45 +01:00
|
|
|
}
|
|
|
|
|
|
2009-05-06 13:27:11 +02:00
|
|
|
void StartRemoteDialog::setRemoteArchitectures(const QStringList &list)
|
2009-05-04 14:47:45 +02:00
|
|
|
{
|
|
|
|
|
m_ui->architectureComboBox->clear();
|
|
|
|
|
if (!list.isEmpty()) {
|
|
|
|
|
m_ui->architectureComboBox->insertItems(0, list);
|
|
|
|
|
m_ui->architectureComboBox->setCurrentIndex(0);
|
2009-03-05 17:30:29 +01:00
|
|
|
}
|
2009-03-02 14:04:03 +01:00
|
|
|
}
|
|
|
|
|
|
2009-05-06 13:27:11 +02:00
|
|
|
void StartRemoteDialog::setRemoteArchitecture(const QString &arch)
|
2009-03-02 14:04:03 +01:00
|
|
|
{
|
2009-05-04 14:47:45 +02:00
|
|
|
int index = m_ui->architectureComboBox->findText(arch);
|
|
|
|
|
if (index != -1)
|
|
|
|
|
m_ui->architectureComboBox->setCurrentIndex(index);
|
2009-03-02 14:04:03 +01:00
|
|
|
}
|
|
|
|
|
|
2009-05-06 13:27:11 +02:00
|
|
|
QString StartRemoteDialog::remoteArchitecture() const
|
2009-03-05 17:30:29 +01:00
|
|
|
{
|
2009-12-10 15:56:10 +01:00
|
|
|
return m_ui->architectureComboBox->currentText();
|
2009-03-05 17:30:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-10-29 14:04:23 +02:00
|
|
|
QString StartRemoteDialog::gnuTarget() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->gnuTargetComboBox->currentText();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StartRemoteDialog::setGnuTargets(const QStringList &gnuTargets)
|
|
|
|
|
{
|
|
|
|
|
m_ui->gnuTargetComboBox->clear();
|
|
|
|
|
if (!gnuTargets.isEmpty()) {
|
|
|
|
|
m_ui->gnuTargetComboBox->insertItems(0, gnuTargets);
|
|
|
|
|
m_ui->gnuTargetComboBox->setCurrentIndex(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StartRemoteDialog::setGnuTarget(const QString &gnuTarget)
|
|
|
|
|
{
|
|
|
|
|
const int index = m_ui->gnuTargetComboBox->findText(gnuTarget);
|
|
|
|
|
if (index != -1)
|
|
|
|
|
m_ui->gnuTargetComboBox->setCurrentIndex(index);
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-03 14:57:05 +02:00
|
|
|
QString StartRemoteDialog::overrideStartScript() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->overrideStartScriptPathChooser->path();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StartRemoteDialog::setOverrideStartScript(const QString &scriptName)
|
|
|
|
|
{
|
|
|
|
|
m_ui->overrideStartScriptPathChooser->setPath(scriptName);
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-06 16:11:42 +02:00
|
|
|
void StartRemoteDialog::setServerStartScript(const QString &scriptName)
|
|
|
|
|
{
|
|
|
|
|
m_ui->serverStartScript->setPath(scriptName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString StartRemoteDialog::serverStartScript() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->serverStartScript->path();
|
|
|
|
|
}
|
2009-03-05 17:30:29 +01:00
|
|
|
|
2009-05-07 09:35:11 +02:00
|
|
|
void StartRemoteDialog::setUseServerStartScript(bool on)
|
2009-03-02 14:04:03 +01:00
|
|
|
{
|
2009-05-07 09:35:11 +02:00
|
|
|
m_ui->useServerStartScriptCheckBox->setChecked(on);
|
2009-03-02 14:04:03 +01:00
|
|
|
}
|
|
|
|
|
|
2009-05-07 09:35:11 +02:00
|
|
|
bool StartRemoteDialog::useServerStartScript() const
|
2009-03-02 14:04:03 +01:00
|
|
|
{
|
2009-05-07 09:35:11 +02:00
|
|
|
return m_ui->useServerStartScriptCheckBox->isChecked();
|
2009-03-02 14:04:03 +01:00
|
|
|
}
|
|
|
|
|
|
2011-05-30 12:56:26 +02:00
|
|
|
void StartRemoteDialog::setSysroot(const QString &sysroot)
|
2009-10-16 16:16:24 +02:00
|
|
|
{
|
|
|
|
|
m_ui->sysrootPathChooser->setPath(sysroot);
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-30 12:56:26 +02:00
|
|
|
QString StartRemoteDialog::sysroot() const
|
2009-10-16 16:16:24 +02:00
|
|
|
{
|
|
|
|
|
return m_ui->sysrootPathChooser->path();
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-07 09:35:11 +02:00
|
|
|
void StartRemoteDialog::updateState()
|
2009-03-02 14:04:03 +01:00
|
|
|
{
|
2009-05-07 09:35:11 +02:00
|
|
|
bool enabled = m_ui->useServerStartScriptCheckBox->isChecked();
|
|
|
|
|
m_ui->serverStartScriptLabel->setEnabled(enabled);
|
|
|
|
|
m_ui->serverStartScript->setEnabled(enabled);
|
2009-03-02 14:04:03 +01:00
|
|
|
}
|
2009-03-05 17:30:29 +01:00
|
|
|
|
2010-11-19 16:13:22 +01:00
|
|
|
// --------- StartRemoteCdbDialog
|
|
|
|
|
static inline QString cdbRemoteHelp()
|
|
|
|
|
{
|
|
|
|
|
const char *cdbConnectionSyntax =
|
|
|
|
|
"Server:Port<br>"
|
|
|
|
|
"tcp:server=Server,port=Port[,password=Password][,ipversion=6]\n"
|
|
|
|
|
"tcp:clicon=Server,port=Port[,password=Password][,ipversion=6]\n"
|
|
|
|
|
"npipe:server=Server,pipe=PipeName[,password=Password]\n"
|
|
|
|
|
"com:port=COMPort,baud=BaudRate,channel=COMChannel[,password=Password]\n"
|
|
|
|
|
"spipe:proto=Protocol,{certuser=Cert|machuser=Cert},server=Server,pipe=PipeName[,password=Password]\n"
|
|
|
|
|
"ssl:proto=Protocol,{certuser=Cert|machuser=Cert},server=Server,port=Socket[,password=Password]\n"
|
|
|
|
|
"ssl:proto=Protocol,{certuser=Cert|machuser=Cert},clicon=Server,port=Socket[,password=Password]";
|
|
|
|
|
|
2011-01-11 11:06:15 +01:00
|
|
|
const QString ext32 = QDir::toNativeSeparators(CdbEngine::extensionLibraryName(false));
|
|
|
|
|
const QString ext64 = QDir::toNativeSeparators(CdbEngine::extensionLibraryName(true));
|
2010-11-19 16:13:22 +01:00
|
|
|
return StartRemoteCdbDialog::tr(
|
|
|
|
|
"<html><body><p>The remote CDB needs to load the matching Qt Creator CDB extension "
|
|
|
|
|
"(<code>%1</code> or <code>%2</code>, respectively).</p><p>Copy it onto the remote machine and set the "
|
|
|
|
|
"environment variable <code>%3</code> to point to its folder.</p><p>"
|
|
|
|
|
"Launch the remote CDB as <code>%4 <executable></code> "
|
|
|
|
|
" to use TCP/IP as communication protocol.</p><p>Enter the connection parameters as:</p>"
|
|
|
|
|
"<pre>%5</pre></body></html>").
|
|
|
|
|
arg(ext32, ext64, QLatin1String("_NT_DEBUGGER_EXTENSION_PATH"),
|
|
|
|
|
QLatin1String("cdb.exe -server tcp:port=1234"),
|
|
|
|
|
QLatin1String(cdbConnectionSyntax));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StartRemoteCdbDialog::StartRemoteCdbDialog(QWidget *parent) :
|
|
|
|
|
QDialog(parent), m_okButton(0), m_lineEdit(new QLineEdit)
|
|
|
|
|
{
|
|
|
|
|
setWindowTitle(tr("Start a CDB Remote Session"));
|
|
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
|
|
|
|
|
|
|
|
|
QGroupBox *groupBox = new QGroupBox;
|
|
|
|
|
QFormLayout *formLayout = new QFormLayout;
|
|
|
|
|
QLabel *helpLabel = new QLabel(cdbRemoteHelp());
|
|
|
|
|
helpLabel->setWordWrap(true);
|
|
|
|
|
helpLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
|
|
|
|
formLayout->addRow(helpLabel);
|
|
|
|
|
QLabel *label = new QLabel(tr("&Connection:"));
|
|
|
|
|
label->setBuddy(m_lineEdit);
|
|
|
|
|
m_lineEdit->setMinimumWidth(400);
|
|
|
|
|
connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString)));
|
|
|
|
|
formLayout->addRow(label, m_lineEdit);
|
|
|
|
|
groupBox->setLayout(formLayout);
|
|
|
|
|
|
|
|
|
|
QVBoxLayout *vLayout = new QVBoxLayout;
|
|
|
|
|
vLayout->addWidget(groupBox);
|
|
|
|
|
QDialogButtonBox *box = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
|
|
|
|
|
vLayout->addWidget(box);
|
|
|
|
|
m_okButton = box->button(QDialogButtonBox::Ok);
|
|
|
|
|
connect(m_lineEdit, SIGNAL(returnPressed()), m_okButton, SLOT(animateClick()));
|
|
|
|
|
m_okButton->setEnabled(false);
|
|
|
|
|
connect(box, SIGNAL(accepted()), this, SLOT(accept()));
|
|
|
|
|
connect(box, SIGNAL(rejected()), this, SLOT(reject()));
|
|
|
|
|
|
|
|
|
|
setLayout(vLayout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StartRemoteCdbDialog::accept()
|
|
|
|
|
{
|
|
|
|
|
if (!m_lineEdit->text().isEmpty())
|
|
|
|
|
QDialog::accept();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StartRemoteCdbDialog::~StartRemoteCdbDialog()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StartRemoteCdbDialog::textChanged(const QString &t)
|
|
|
|
|
{
|
|
|
|
|
m_okButton->setEnabled(!t.isEmpty());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString StartRemoteCdbDialog::connection() const
|
|
|
|
|
{
|
|
|
|
|
const QString rc = m_lineEdit->text();
|
|
|
|
|
// Transform an IP:POrt ('localhost:1234') specification into full spec
|
|
|
|
|
QRegExp ipRegexp(QLatin1String("([\\w\\.\\-_]+):([0-9]{1,4})"));
|
|
|
|
|
QTC_ASSERT(ipRegexp.isValid(), return QString());
|
|
|
|
|
if (ipRegexp.exactMatch(rc))
|
|
|
|
|
return QString::fromAscii("tcp:server=%1,port=%2").arg(ipRegexp.cap(1), ipRegexp.cap(2));
|
|
|
|
|
return rc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StartRemoteCdbDialog::setConnection(const QString &c)
|
|
|
|
|
{
|
|
|
|
|
m_lineEdit->setText(c);
|
|
|
|
|
m_okButton->setEnabled(!c.isEmpty());
|
|
|
|
|
}
|
|
|
|
|
|
2009-08-19 14:41:51 +02:00
|
|
|
AddressDialog::AddressDialog(QWidget *parent) :
|
|
|
|
|
QDialog(parent),
|
|
|
|
|
m_lineEdit(new QLineEdit),
|
|
|
|
|
m_box(new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel))
|
|
|
|
|
{
|
2010-09-17 11:03:43 +02:00
|
|
|
setWindowTitle(tr("Select Start Address"));
|
2009-08-19 14:41:51 +02:00
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
|
|
|
|
QHBoxLayout *hLayout = new QHBoxLayout;
|
|
|
|
|
hLayout->addWidget(new QLabel(tr("Enter an address: ")));
|
|
|
|
|
hLayout->addWidget(m_lineEdit);
|
|
|
|
|
QVBoxLayout *vLayout = new QVBoxLayout;
|
|
|
|
|
vLayout->addLayout(hLayout);
|
|
|
|
|
vLayout->addWidget(m_box);
|
|
|
|
|
setLayout(vLayout);
|
|
|
|
|
|
|
|
|
|
connect(m_box, SIGNAL(accepted()), this, SLOT(accept()));
|
|
|
|
|
connect(m_box, SIGNAL(rejected()), this, SLOT(reject()));
|
|
|
|
|
connect(m_lineEdit, SIGNAL(returnPressed()), this, SLOT(accept()));
|
|
|
|
|
connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(textChanged()));
|
|
|
|
|
|
|
|
|
|
setOkButtonEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AddressDialog::setOkButtonEnabled(bool v)
|
|
|
|
|
{
|
|
|
|
|
m_box->button(QDialogButtonBox::Ok)->setEnabled(v);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AddressDialog::isOkButtonEnabled() const
|
|
|
|
|
{
|
|
|
|
|
return m_box->button(QDialogButtonBox::Ok)->isEnabled();
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-04 11:58:54 +02:00
|
|
|
void AddressDialog::setAddress(quint64 a)
|
|
|
|
|
{
|
|
|
|
|
m_lineEdit->setText(QLatin1String("0x")
|
|
|
|
|
+ QString::number(a, 16));
|
|
|
|
|
}
|
|
|
|
|
|
2009-08-19 14:41:51 +02:00
|
|
|
quint64 AddressDialog::address() const
|
|
|
|
|
{
|
|
|
|
|
return m_lineEdit->text().toULongLong(0, 16);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AddressDialog::accept()
|
|
|
|
|
{
|
|
|
|
|
if (isOkButtonEnabled())
|
|
|
|
|
QDialog::accept();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AddressDialog::textChanged()
|
|
|
|
|
{
|
|
|
|
|
setOkButtonEnabled(isValid());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AddressDialog::isValid() const
|
|
|
|
|
{
|
|
|
|
|
const QString text = m_lineEdit->text();
|
|
|
|
|
bool ok = false;
|
|
|
|
|
text.toULongLong(&ok, 16);
|
|
|
|
|
return ok;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-01 15:41:08 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// StartRemoteEngineDialog
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
StartRemoteEngineDialog::StartRemoteEngineDialog(QWidget *parent) :
|
|
|
|
|
QDialog(parent) ,
|
|
|
|
|
m_ui(new Ui::StartRemoteEngineDialog)
|
|
|
|
|
{
|
2011-02-24 16:50:15 +01:00
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
|
|
|
|
m_ui->setupUi(this);
|
|
|
|
|
m_ui->host->setCompleter(new HistoryCompleter(m_ui->host));
|
|
|
|
|
m_ui->username->setCompleter(new HistoryCompleter(m_ui->username));
|
|
|
|
|
m_ui->enginepath->setCompleter(new HistoryCompleter(m_ui->enginepath));
|
|
|
|
|
m_ui->inferiorpath->setCompleter(new HistoryCompleter(m_ui->inferiorpath));
|
|
|
|
|
connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
|
|
|
|
connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
2010-12-01 15:41:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StartRemoteEngineDialog::~StartRemoteEngineDialog()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString StartRemoteEngineDialog::host() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->host->text();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString StartRemoteEngineDialog::username() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->username->text();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString StartRemoteEngineDialog::password() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->password->text();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString StartRemoteEngineDialog::inferiorPath() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->inferiorpath->text();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString StartRemoteEngineDialog::enginePath() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->enginepath->text();
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-04 14:47:45 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Debugger
|