Commit 9739b8df authored by hjk's avatar hjk Committed by hjk
Browse files

debugger/remotelinux: new dialog to attach to remote process



Change-Id: I221534561f4bbd299d494ecc902092e2e709770c
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@nokia.com>
parent 676739a8
......@@ -364,6 +364,7 @@ using namespace Core;
using namespace Debugger::Constants;
using namespace ProjectExplorer;
using namespace TextEditor;
using namespace ExtensionSystem;
namespace CC = Core::Constants;
namespace PE = ProjectExplorer::Constants;
......@@ -730,10 +731,11 @@ public slots:
void debugProjectBreakMain();
void startExternalApplication();
void startRemoteCdbSession();
void startRemoteApplication();
void startRemoteProcess();
void startRemoteServer();
bool queryRemoteParameters(DebuggerStartParameters &sp, bool useScript);
void attachToRemoteServer();
//void attachToRemoteProcess();
void attachToRemoteProcess();
void attachToQmlPort();
void startRemoteEngine();
void attachExternalApplication();
......@@ -1024,6 +1026,8 @@ public slots:
// FIXME: Remove.
void maybeEnrichParameters(DebuggerStartParameters *sp);
void gdbServerStarted(const QString &channel, const QString &sysroot, const QString &localExecutable);
public:
DebuggerMainWindow *m_mainWindow;
DebuggerRunControlFactory *m_debuggerRunControlFactory;
......@@ -1037,9 +1041,10 @@ public:
QAction *m_debugWithoutDeployAction;
QAction *m_startExternalProcessAction;
QAction *m_startRemoteProcessAction;
QAction *m_startRemoteServerAction;
QAction *m_attachToRemoteProcessAction;
QAction *m_attachToQmlPortAction;
QAction *m_attachToRemoteServerAction;
//QAction *m_attachToRemoteProcessAction;
QAction *m_startRemoteCdbAction;
QAction *m_startRemoteLldbAction;
QAction *m_attachExternalAction;
......@@ -1510,7 +1515,7 @@ void DebuggerPluginPrivate::attachExternalApplication()
startDebugger(rc);
}
void DebuggerPluginPrivate::attachExternalApplication(ProjectExplorer::RunControl *rc)
void DebuggerPluginPrivate::attachExternalApplication(RunControl *rc)
{
DebuggerStartParameters sp;
sp.attachPID = rc->applicationProcessHandle().pid();
......@@ -1571,11 +1576,8 @@ void DebuggerPluginPrivate::startRemoteCdbSession()
const QString connectionKey = _("CdbRemoteConnection");
DebuggerStartParameters sp;
Abi hostAbi = Abi::hostAbi();
sp.toolChainAbi = ProjectExplorer::Abi(hostAbi.architecture(),
ProjectExplorer::Abi::WindowsOS,
ProjectExplorer::Abi::WindowsMsvc2010Flavor,
ProjectExplorer::Abi::PEFormat,
hostAbi.wordWidth());
sp.toolChainAbi = Abi(hostAbi.architecture(), Abi::WindowsOS,
Abi::WindowsMsvc2010Flavor, Abi::PEFormat, hostAbi.wordWidth());
sp.startMode = AttachToRemoteServer;
StartRemoteCdbDialog dlg(mainWindow());
QString previousConnection = configValue(connectionKey).toString();
......@@ -1644,7 +1646,7 @@ bool DebuggerPluginPrivate::queryRemoteParameters(DebuggerStartParameters &sp, b
sp.displayName = tr("Remote: \"%1\"").arg(sp.remoteChannel);
sp.debuggerCommand = dlg.debugger(); // Override toolchain-detection.
if (!sp.debuggerCommand.isEmpty())
sp.toolChainAbi = ProjectExplorer::Abi();
sp.toolChainAbi = Abi();
sp.overrideStartScript = dlg.overrideStartScript();
sp.useServerStartScript = dlg.useServerStartScript();
sp.serverStartScript = dlg.serverStartScript();
......@@ -1653,7 +1655,7 @@ bool DebuggerPluginPrivate::queryRemoteParameters(DebuggerStartParameters &sp, b
return true;
}
void DebuggerPluginPrivate::startRemoteApplication()
void DebuggerPluginPrivate::startRemoteProcess()
{
DebuggerStartParameters sp;
sp.startMode = StartRemoteProcess;
......@@ -1675,21 +1677,71 @@ void DebuggerPluginPrivate::attachToRemoteServer()
startDebugger(rc);
}
/*
void DebuggerPluginPrivate::attachToRemoteProcess()
{
startRemoteServer();
}
DebuggerStartParameters sp;
if (!queryRemoteParameters(sp, false))
void DebuggerPluginPrivate::startRemoteServer()
{
PluginManager *pm = PluginManager::instance();
QTC_ASSERT(pm, return);
QObject *rl = pm->getObjectByName(_("RemoteLinuxPlugin"));
QTC_ASSERT(rl, return);
QMetaObject::invokeMethod(rl, "startGdbServer", Qt::QueuedConnection);
// Will call back gdbServerStarted() below.
}
void DebuggerPluginPrivate::gdbServerStarted(const QString &channel,
const QString &sysroot, const QString &remoteCommandLine)
{
QString binary = remoteCommandLine.section(QLatin1Char(' '), 0, 0);
QString localExecutable;
QString candidate = sysroot + QLatin1Char('/') + binary;
if (QFileInfo(candidate).exists())
localExecutable = candidate;
if (localExecutable.isEmpty()) {
candidate = sysroot + QLatin1String("/usr/bin/") + binary;
if (QFileInfo(candidate).exists())
localExecutable = candidate;
}
if (localExecutable.isEmpty()) {
candidate = sysroot + QLatin1String("/bin/") + binary;
if (QFileInfo(candidate).exists())
localExecutable = candidate;
}
if (localExecutable.isEmpty()) {
QMessageBox::warning(mainWindow(), tr("Warning"),
tr("Cannot find local executable for remote process \"%1\".")
.arg(remoteCommandLine));
return;
}
QList<Abi> abis = Abi::abisOfBinary(localExecutable);
if (abis.isEmpty()) {
QMessageBox::warning(mainWindow(), tr("Warning"),
tr("Cannot find abi for remote process \"%1\".")
.arg(remoteCommandLine));
return;
}
sp.startMode = AttachToRemoteProcess;
DebuggerStartParameters sp;
sp.toolChainAbi = abis.at(0);
//sp.remoteArchitecture = abis.at(0).toString();
sp.displayName = tr("Remote: \"%1\"").arg(channel);
sp.remoteChannel = channel;
sp.sysroot = sysroot;
sp.executable = localExecutable;
sp.startMode = AttachToRemoteServer;
sp.useServerStartScript = false;
sp.serverStartScript.clear();
sp.overrideStartScript.clear();
sp.useServerStartScript = false;
sp.serverStartScript.clear();
//sp.debugInfoLocation = dlg.debugInfoLocation();
if (RunControl *rc = createDebugger(sp))
startDebugger(rc);
}
*/
void DebuggerPluginPrivate::attachToQmlPort()
{
......@@ -1730,11 +1782,11 @@ void DebuggerPluginPrivate::attachToQmlPort()
//
// get files from all the projects in the session
//
ProjectExplorer::SessionManager *sessionManager = ProjectExplorer::ProjectExplorerPlugin::instance()->session();
SessionManager *sessionManager = ProjectExplorerPlugin::instance()->session();
QList<Project *> projects = sessionManager->projects();
if (Project *startupProject = ProjectExplorer::ProjectExplorerPlugin::instance()->startupProject()) {
if (Project *startupProject = ProjectExplorerPlugin::instance()->startupProject()) {
// startup project first
projects.removeOne(ProjectExplorer::ProjectExplorerPlugin::instance()->startupProject());
projects.removeOne(ProjectExplorerPlugin::instance()->startupProject());
projects.insert(0, startupProject);
}
QStringList sourceFiles;
......@@ -2260,7 +2312,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
m_attachToCoreAction->setEnabled(true);
m_startRemoteProcessAction->setEnabled(true);
m_attachToRemoteServerAction->setEnabled(true);
//m_attachToRemoteProcessAction->setEnabled(true);
m_attachToRemoteProcessAction->setEnabled(true);
const bool isCore = engine->startParameters().startMode == AttachCore;
const bool stopped = state == InferiorStopOk;
......@@ -2728,7 +2780,7 @@ QString DebuggerPluginPrivate::debuggerForAbi(const Abi &abi, DebuggerEngineType
searchAbis.push_back(abi);
// Pick the right tool chain in case cdb/gdb were started with other tool chains.
// Also, lldb should be preferred over gdb.
if (abi.os() == ProjectExplorer::Abi::WindowsOS) {
if (abi.os() == Abi::WindowsOS) {
switch (et) {
case CdbEngineType:
searchAbis.clear();
......@@ -2800,7 +2852,7 @@ void DebuggerPluginPrivate::extensionsInitialized()
connect(core, SIGNAL(coreAboutToClose()), this, SLOT(coreShutdown()));
Core::ActionManager *am = core->actionManager();
ActionManager *am = core->actionManager();
QTC_ASSERT(am, return);
m_plugin->addObject(this);
......@@ -2972,7 +3024,7 @@ void DebuggerPluginPrivate::extensionsInitialized()
m_mainWindow->createDockWidget(CppLanguage, m_threadsWindow);
m_mainWindow->createDockWidget(QmlLanguage, m_scriptConsoleWindow);
QSplitter *localsAndWatchers = new Core::MiniSplitter(Qt::Vertical);
QSplitter *localsAndWatchers = new MiniSplitter(Qt::Vertical);
localsAndWatchers->setObjectName(DOCKWIDGET_WATCHERS);
localsAndWatchers->setWindowTitle(m_localsWindow->windowTitle());
localsAndWatchers->addWidget(m_localsWindow);
......@@ -3034,15 +3086,19 @@ void DebuggerPluginPrivate::extensionsInitialized()
act = m_startRemoteProcessAction = new QAction(this);
act->setText(tr("Start and Debug Remote Application..."));
connect(act, SIGNAL(triggered()), SLOT(startRemoteApplication()));
connect(act, SIGNAL(triggered()), SLOT(startRemoteProcess()));
act = m_attachToRemoteServerAction = new QAction(this);
act->setText(tr("Attach to Remote Debug Server..."));
connect(act, SIGNAL(triggered()), SLOT(attachToRemoteServer()));
//act = m_attachToRemoteProcessAction = new QAction(this);
//act->setText(tr("Attach to Running Remote Process..."));
//connect(act, SIGNAL(triggered()), SLOT(attachToRemoteProcess()));
act = m_startRemoteServerAction = new QAction(this);
act->setText(tr("Start Remote Debug Server..."));
connect(act, SIGNAL(triggered()), SLOT(startRemoteServer()));
act = m_attachToRemoteProcessAction = new QAction(this);
act->setText(tr("Attach to Running Remote Process..."));
connect(act, SIGNAL(triggered()), SLOT(attachToRemoteProcess()));
act = m_attachToQmlPortAction = new QAction(this);
act->setText(tr("Attach to QML Port..."));
......@@ -3108,16 +3164,20 @@ void DebuggerPluginPrivate::extensionsInitialized()
cmd->setAttribute(Command::CA_Hide);
mstart->addAction(cmd, Constants::G_MANUAL_REMOTE);
//cmd = am->registerAction(m_attachToRemoteProcessAction,
// "Debugger.AttachToRemoteProcess", globalcontext);
//cmd->setAttribute(Command::CA_Hide);
//mstart->addAction(cmd, Constants::G_AUTOMATIC_REMOTE);
cmd = am->registerAction(m_startRemoteProcessAction,
"Debugger.StartRemoteProcess", globalcontext);
cmd->setAttribute(Command::CA_Hide);
mstart->addAction(cmd, Constants::G_AUTOMATIC_REMOTE);
cmd = am->registerAction(m_startRemoteServerAction,
"Debugger.StartRemoteServer", globalcontext);
cmd->setDefaultText(tr("Start Gdbserver"));
mstart->addAction(cmd, Debugger::Constants::G_MANUAL_REMOTE);
cmd = am->registerAction(m_attachToRemoteProcessAction,
"Debugger.AttachToRemoteProcess", globalcontext);
cmd->setDefaultText(tr("Attach to Remote Process"));
mstart->addAction(cmd, Debugger::Constants::G_AUTOMATIC_REMOTE);
#ifdef WITH_LLDB
cmd = am->registerAction(m_startRemoteLldbAction,
......@@ -3292,7 +3352,7 @@ void DebuggerPluginPrivate::extensionsInitialized()
// Debugger.AddToWatch is enough.
}
QList<Core::IOptionsPage *> engineOptionPages;
QList<IOptionsPage *> engineOptionPages;
if (m_cmdLineEnabledEngines & GdbEngineType)
addGdbOptionPages(&engineOptionPages);
addCdbOptionPages(&engineOptionPages);
......@@ -3305,7 +3365,8 @@ void DebuggerPluginPrivate::extensionsInitialized()
// addScriptOptionPages(&engineOptionPages);
//if (m_cmdLineEnabledEngines & TcfEngineType)
// addTcfOptionPages(&engineOptionPages);
foreach (Core::IOptionsPage *op, engineOptionPages)
foreach (IOptionsPage *op, engineOptionPages)
m_plugin->addAutoReleasedObject(op);
m_plugin->addAutoReleasedObject(new DebuggingHelperOptionPage);
......@@ -3313,7 +3374,7 @@ void DebuggerPluginPrivate::extensionsInitialized()
SLOT(onModeChanged(Core::IMode*)));
connect(ICore::instance(), SIGNAL(coreAboutToOpen()),
SLOT(onCoreAboutToOpen()));
connect(ProjectExplorer::ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()),
connect(ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()),
this, SLOT(updateDebugWithoutDeployMenu()));
// Debug mode setup
......@@ -3399,6 +3460,9 @@ void DebuggerPluginPrivate::extensionsInitialized()
SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
SLOT(onCurrentProjectChanged(ProjectExplorer::Project*)));
m_commonOptionsPage = new CommonOptionsPage(m_globalDebuggerOptions);
m_plugin->addAutoReleasedObject(m_commonOptionsPage);
QTC_CHECK(m_coreSettings);
m_globalDebuggerOptions->fromSettings(m_coreSettings);
m_watchersWindow->setVisible(false);
......@@ -3494,12 +3558,12 @@ DebuggerPlugin::~DebuggerPlugin()
bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
ICore *core = ICore::instance();
QTC_ASSERT(core, return true);
QTC_ASSERT(core, return false);
// Menu groups
const Context globalcontext(CC::C_GLOBAL);
Core::ActionManager *am = core->actionManager();
ActionManager *am = core->actionManager();
ActionContainer *mstart = am->actionContainer(PE::M_DEBUG_STARTDEBUGGING);
mstart->appendGroup(Constants::G_START_LOCAL);
......@@ -3526,7 +3590,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
return theDebuggerCore->initialize(arguments, errorMessage);
}
ExtensionSystem::IPlugin::ShutdownFlag DebuggerPlugin::aboutToShutdown()
IPlugin::ShutdownFlag DebuggerPlugin::aboutToShutdown()
{
theDebuggerCore->aboutToShutdown();
return SynchronousShutdown;
......
......@@ -512,7 +512,9 @@ static QList<DebuggerEngineType> engineTypes(const DebuggerStartParameters &sp)
return result;
}
if (sp.startMode != AttachToRemoteServer && !sp.executable.isEmpty())
if (sp.startMode != AttachToRemoteServer
&& sp.startMode != AttachToRemoteProcess
&& !sp.executable.isEmpty())
result = enginesForExecutable(sp.executable);
if (!result.isEmpty())
return result;
......
......@@ -213,6 +213,7 @@ SshConnectionParameters LinuxDeviceConfiguration::sshParameters() const
}
LinuxDeviceConfiguration::DeviceType LinuxDeviceConfiguration::deviceType() const
{
return d->deviceType;
}
......
......@@ -127,8 +127,7 @@ FORMS += \
linuxdeviceconfigurationssettingswidget.ui \
sshkeycreationdialog.ui \
remotelinuxdeployconfigurationwidget.ui \
profilesupdatedialog.ui \
startgdbserverdialog.ui
profilesupdatedialog.ui
RESOURCES += remotelinux.qrc
......
......@@ -62,6 +62,7 @@ namespace Internal {
RemoteLinuxPlugin::RemoteLinuxPlugin()
{
setObjectName(QLatin1String("RemoteLinuxPlugin"));
}
bool RemoteLinuxPlugin::initialize(const QStringList &arguments,
......@@ -72,6 +73,7 @@ bool RemoteLinuxPlugin::initialize(const QStringList &arguments,
LinuxDeviceConfigurations::instance(this);
addObject(this);
addAutoReleasedObject(new LinuxDeviceConfigurationsSettingsPage);
addAutoReleasedObject(new GenericLinuxDeviceConfigurationFactory);
addAutoReleasedObject(new RemoteLinuxRunConfigurationFactory);
......@@ -89,6 +91,7 @@ bool RemoteLinuxPlugin::initialize(const QStringList &arguments,
void RemoteLinuxPlugin::extensionsInitialized()
{
/*
using namespace Core;
ICore *core = ICore::instance();
ActionManager *am = core->actionManager();
......@@ -111,6 +114,7 @@ void RemoteLinuxPlugin::extensionsInitialized()
cmd->setDefaultText(tr("Attach to Remote Process"));
mstart->addAction(cmd, Debugger::Constants::G_AUTOMATIC_REMOTE);
connect(act, SIGNAL(triggered()), SLOT(startGdbServer()));
*/
}
void RemoteLinuxPlugin::startGdbServer()
......
......@@ -110,6 +110,11 @@ int AbstractRemoteLinuxProcessList::pidAt(int row) const
return d->remoteProcesses.at(row).pid;
}
QString AbstractRemoteLinuxProcessList::commandLineAt(int row) const
{
return d->remoteProcesses.at(row).cmdLine;
}
int AbstractRemoteLinuxProcessList::rowCount(const QModelIndex &parent) const
{
return parent.isValid() ? 0 : d->remoteProcesses.count();
......
......@@ -54,6 +54,7 @@ public:
void update();
void killProcess(int row);
int pidAt(int row) const;
QString commandLineAt(int row) const;
signals:
void error(const QString &errorMsg);
......
......@@ -31,7 +31,6 @@
**************************************************************************/
#include "startgdbserverdialog.h"
#include "ui_startgdbserverdialog.h"
#include "remotelinuxprocesslist.h"
#include "linuxdeviceconfiguration.h"
......@@ -39,15 +38,44 @@
#include "remotelinuxusedportsgatherer.h"
#include "portlist.h"
#include <coreplugin/icore.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/pathchooser.h>
#include <utils/qtcassert.h>
#include <utils/ssh/sshconnection.h>
#include <utils/ssh/sshremoteprocessrunner.h>
#include <utils/qtcassert.h>
#include <QtCore/QVariant>
#include <QtCore/QSettings>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QComboBox>
#include <QtGui/QDialog>
#include <QtGui/QDialogButtonBox>
#include <QtGui/QFormLayout>
#include <QtGui/QGridLayout>
#include <QtGui/QHBoxLayout>
#include <QtGui/QHeaderView>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QtGui/QMessageBox>
#include <QtGui/QPushButton>
#include <QtGui/QSortFilterProxyModel>
#include <QtGui/QComboBox>
#include <QtGui/QSpacerItem>
#include <QtGui/QTableView>
#include <QtGui/QTextBrowser>
#include <QtGui/QVBoxLayout>
using namespace Core;
using namespace Utils;
const char LastSysroot[] = "RemoteLinux/LastSysroot";
const char LastDevice[] = "RemoteLinux/LastDevice";
const char LastProcessName[] = "RemoteLinux/LastProcessName";
//const char LastLocalExecutable[] = "RemoteLinux/LastLocalExecutable";
namespace RemoteLinux {
namespace Internal {
......@@ -55,54 +83,126 @@ namespace Internal {
class StartGdbServerDialogPrivate
{
public:
StartGdbServerDialogPrivate() : processList(0) {}
StartGdbServerDialogPrivate(StartGdbServerDialog *q);
LinuxDeviceConfiguration::ConstPtr currentDevice() const
{
LinuxDeviceConfigurations *devices = LinuxDeviceConfigurations::instance();
return devices->deviceAt(ui.deviceComboBox->currentIndex());
return devices->deviceAt(deviceComboBox->currentIndex());
}
StartGdbServerDialog *q;
AbstractRemoteLinuxProcessList *processList;
QSortFilterProxyModel proxyModel;
Ui::StartGdbServerDialog ui;
QComboBox *deviceComboBox;
QLineEdit *processFilterLineEdit;
QTableView *tableView;
QPushButton *attachProcessButton;
QTextBrowser *textBrowser;
QPushButton *closeButton;
PathChooser *sysrootPathChooser;
RemoteLinuxUsedPortsGatherer gatherer;
Utils::SshRemoteProcessRunner runner;
SshRemoteProcessRunner runner;
QSettings *settings;
QString remoteCommandLine;
};
StartGdbServerDialogPrivate::StartGdbServerDialogPrivate(StartGdbServerDialog *q)
: q(q), processList(0)
{
settings = ICore::instance()->settings();
deviceComboBox = new QComboBox(q);
sysrootPathChooser = new PathChooser(q);
sysrootPathChooser->setExpectedKind(PathChooser::Directory);
sysrootPathChooser->setPromptDialogTitle(StartGdbServerDialog::tr("Select Sysroot"));
sysrootPathChooser->setPath(settings->value(LastSysroot).toString());
//executablePathChooser = new PathChooser(q);
//executablePathChooser->setExpectedKind(PathChooser::File);
//executablePathChooser->setPromptDialogTitle(StartGdbServerDialog::tr("Select Executable"));
//executablePathChooser->setPath(settings->value(LastLocalExecutable).toString());
processFilterLineEdit = new QLineEdit(q);
processFilterLineEdit->setText(settings->value(LastProcessName).toString());
processFilterLineEdit->selectAll();
tableView = new QTableView(q);
tableView->setShowGrid(false);
tableView->setSortingEnabled(true);
tableView->horizontalHeader()->setDefaultSectionSize(100);
tableView->horizontalHeader()->setStretchLastSection(true);
tableView->verticalHeader()->setVisible(false);
tableView->setSelectionMode(QAbstractItemView::SingleSelection);
attachProcessButton = new QPushButton(q);
attachProcessButton->setText(StartGdbServerDialog::tr("&Attach to Selected Process"));
closeButton = new QPushButton(q);
closeButton->setText(StartGdbServerDialog::tr("Close"));
textBrowser = new QTextBrowser(q);
textBrowser->setEnabled(false);
QFormLayout *formLayout = new QFormLayout();
formLayout->addRow(StartGdbServerDialog::tr("Device:"), deviceComboBox);
formLayout->addRow(StartGdbServerDialog::tr("Sysroot:"), sysrootPathChooser);
formLayout->addRow(StartGdbServerDialog::tr("&Filter by process name:"),
processFilterLineEdit);
QHBoxLayout *horizontalLayout2 = new QHBoxLayout();
horizontalLayout2->addStretch(1);
horizontalLayout2->addWidget(attachProcessButton);
horizontalLayout2->addWidget(closeButton);
formLayout->addRow(tableView);
formLayout->addRow(textBrowser);
formLayout->addRow(horizontalLayout2);
q->setLayout(formLayout);
}
} // namespace Internal
StartGdbServerDialog::StartGdbServerDialog(QWidget *parent) :
QDialog(parent),
d(new Internal::StartGdbServerDialogPrivate)
d(new Internal::StartGdbServerDialogPrivate(this))
{
setWindowTitle(tr("List of Remote Processes"));
LinuxDeviceConfigurations *devices = LinuxDeviceConfigurations::instance();
d->ui.setupUi(this);
d->ui.deviceComboBox->setModel(devices);
QObject::connect(d->closeButton, SIGNAL(clicked()), this, SLOT(reject()));
d->deviceComboBox->setModel(devices);
d->deviceComboBox->setCurrentIndex(d->settings->value(LastDevice).toInt());
connect(&d->gatherer, SIGNAL(error(QString)), SLOT(portGathererError(QString)));
connect(&d->gatherer, SIGNAL(portListReady()), SLOT(portListReady()));
if (devices->rowCount() == 0) {
d->ui.tableView->setEnabled(false);
d->tableView->setEnabled(false);
} else {
d->ui.tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
d->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
d->proxyModel.setDynamicSortFilter(true);
d->proxyModel.setFilterKeyColumn(1);
d->ui.tableView->setModel(&d->proxyModel);
connect(d->ui.processFilterLineEdit, SIGNAL(textChanged(QString)),
d->tableView->setModel(&d->proxyModel);
connect(d->processFilterLineEdit, SIGNAL(textChanged(QString)),
&d->proxyModel, SLOT(setFilterRegExp(QString)));
connect(d->ui.tableView->selectionModel(),
connect(d->tableView->selectionModel(),
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
SLOT(handleSelectionChanged()));
connect(d->ui.updateListButton, SIGNAL(clicked()),
SLOT(updateProcessList()));
connect(d->ui.attachProcessButton, SIGNAL(clicked()), SLOT(attachToProcess()));
SLOT(updateButtons()));
//connect(d->updateListButton, SIGNAL(clicked()),
// SLOT(updateProcessList()));
connect(d->attachProcessButton, SIGNAL(clicked()), SLOT(attachToProcess()));
connect(&d->proxyModel, SIGNAL(layoutChanged()),
SLOT(handleProcessListUpdated()));
connect(d->ui.deviceComboBox, SIGNAL(currentIndexChanged(int)),
connect(d->deviceComboBox, SIGNAL(currentIndexChanged(int)),
SLOT(attachToDevice(int)));
handleSelectionChanged();
attachToDevice(0);
updateButtons();
attachToDevice(d->deviceComboBox->currentIndex());