ProjectExplorer: Introduce DeviceProcessSignalOperation.

Every device can now return a DeviceProcessSignalOperation,
which allows to kill or interrupt processes running on the
device.

Change-Id: Idaa04ebc767e09ca167fa033ed93860b9b81479e
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Reviewed-by: David Kaspar <dkaspar@blackberry.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
David Schulz
2013-09-16 15:30:30 +02:00
parent ca15d0aa95
commit a06af35631
32 changed files with 703 additions and 216 deletions

View File

@@ -31,8 +31,10 @@
#include "qnxdeviceconfiguration.h"
#include "qnxdevicetester.h"
#include "qnxdeviceprocesssignaloperation.h"
#include <projectexplorer/devicesupport/sshdeviceprocesslist.h>
#include <ssh/sshconnection.h>
#include <QRegExp>
#include <QStringList>
@@ -40,30 +42,6 @@
using namespace Qnx;
using namespace Qnx::Internal;
class QnxDeviceProcessSupport : public RemoteLinux::LinuxDeviceProcessSupport
{
static QString signalProcessByNameCommandLine(const QString &filePath, int sig)
{
QString executable = filePath;
return QString::fromLatin1("for PID in $(ps -f -o pid,comm | grep %1 | awk '/%1/ {print $1}'); "
"do "
"kill -%2 $PID; "
"done").arg(executable.replace(QLatin1String("/"), QLatin1String("\\/"))).arg(sig);
}
QString killProcessByNameCommandLine(const QString &filePath) const
{
return QString::fromLatin1("%1; %2").arg(signalProcessByNameCommandLine(filePath, 15),
signalProcessByNameCommandLine(filePath, 9));
}
QString interruptProcessByNameCommandLine(const QString &filePath) const
{
return signalProcessByNameCommandLine(filePath, 2);
}
};
class QnxPortsGatheringMethod : public ProjectExplorer::PortsGatheringMethod
{
// TODO: The command is probably needlessly complicated because the parsing method
@@ -183,11 +161,6 @@ ProjectExplorer::IDevice::Ptr QnxDeviceConfiguration::clone() const
return Ptr(new QnxDeviceConfiguration(*this));
}
ProjectExplorer::DeviceProcessSupport::Ptr QnxDeviceConfiguration::processSupport() const
{
return ProjectExplorer::DeviceProcessSupport::Ptr(new QnxDeviceProcessSupport);
}
ProjectExplorer::PortsGatheringMethod::Ptr QnxDeviceConfiguration::portsGatheringMethod() const
{
return ProjectExplorer::PortsGatheringMethod::Ptr(new QnxPortsGatheringMethod);
@@ -202,3 +175,9 @@ ProjectExplorer::DeviceTester *QnxDeviceConfiguration::createDeviceTester() cons
{
return new QnxDeviceTester;
}
ProjectExplorer::DeviceProcessSignalOperation::Ptr QnxDeviceConfiguration::signalOperation() const
{
return ProjectExplorer::DeviceProcessSignalOperation::Ptr(
new QnxDeviceProcessSignalOperation(sshParameters()));
}