forked from qt-creator/qt-creator
QNX: Add support for listing processes for pure QNX devices
Change-Id: Id2d9bd6b7f5ce56ff0d7ece30bb93a69969beecf Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com> Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com> Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Tobias Nätterlund
parent
3c1b5213b5
commit
1d792a9a15
@@ -31,6 +31,11 @@
|
|||||||
|
|
||||||
#include "qnxdeviceconfiguration.h"
|
#include "qnxdeviceconfiguration.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/devicesupport/sshdeviceprocesslist.h>
|
||||||
|
|
||||||
|
#include <QRegExp>
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
using namespace Qnx;
|
using namespace Qnx;
|
||||||
using namespace Qnx::Internal;
|
using namespace Qnx::Internal;
|
||||||
|
|
||||||
@@ -85,6 +90,51 @@ class QnxPortsGatheringMethod : public ProjectExplorer::PortsGatheringMethod
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class QnxDeviceProcessList : public ProjectExplorer::SshDeviceProcessList
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QnxDeviceProcessList(const ProjectExplorer::IDevice::ConstPtr &device, QObject *parent)
|
||||||
|
: SshDeviceProcessList(device, parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString listProcessesCommandLine() const
|
||||||
|
{
|
||||||
|
return QLatin1String("pidin -F \"%a %A '/%n'\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<ProjectExplorer::DeviceProcess> buildProcessList(const QString &listProcessesReply) const
|
||||||
|
{
|
||||||
|
QList<ProjectExplorer::DeviceProcess> processes;
|
||||||
|
QStringList lines = listProcessesReply.split(QLatin1Char('\n'));
|
||||||
|
if (lines.isEmpty())
|
||||||
|
return processes;
|
||||||
|
|
||||||
|
lines.pop_front(); // drop headers
|
||||||
|
QRegExp re(QLatin1String("\\s*(\\d+)\\s+(.*)'(.*)'"));
|
||||||
|
|
||||||
|
foreach (const QString& line, lines) {
|
||||||
|
if (re.exactMatch(line)) {
|
||||||
|
const QStringList captures = re.capturedTexts();
|
||||||
|
if (captures.size() == 4) {
|
||||||
|
const int pid = captures[1].toInt();
|
||||||
|
const QString args = captures[2];
|
||||||
|
const QString exe = captures[3];
|
||||||
|
ProjectExplorer::DeviceProcess deviceProcess;
|
||||||
|
deviceProcess.pid = pid;
|
||||||
|
deviceProcess.exe = exe.trimmed();
|
||||||
|
deviceProcess.cmdLine = args.trimmed();
|
||||||
|
processes.append(deviceProcess);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
qSort(processes);
|
||||||
|
return processes;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
QnxDeviceConfiguration::QnxDeviceConfiguration()
|
QnxDeviceConfiguration::QnxDeviceConfiguration()
|
||||||
: RemoteLinux::LinuxDevice()
|
: RemoteLinux::LinuxDevice()
|
||||||
{
|
{
|
||||||
@@ -130,3 +180,8 @@ ProjectExplorer::PortsGatheringMethod::Ptr QnxDeviceConfiguration::portsGatherin
|
|||||||
{
|
{
|
||||||
return ProjectExplorer::PortsGatheringMethod::Ptr(new QnxPortsGatheringMethod);
|
return ProjectExplorer::PortsGatheringMethod::Ptr(new QnxPortsGatheringMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProjectExplorer::DeviceProcessList *QnxDeviceConfiguration::createProcessListModel(QObject *parent) const
|
||||||
|
{
|
||||||
|
return new QnxDeviceProcessList(sharedFromThis(), parent);
|
||||||
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public:
|
|||||||
|
|
||||||
ProjectExplorer::DeviceProcessSupport::Ptr processSupport() const;
|
ProjectExplorer::DeviceProcessSupport::Ptr processSupport() const;
|
||||||
ProjectExplorer::PortsGatheringMethod::Ptr portsGatheringMethod() const;
|
ProjectExplorer::PortsGatheringMethod::Ptr portsGatheringMethod() const;
|
||||||
bool canCreateProcessModel() const { return false; } // Override LinuxDevice implementation.
|
ProjectExplorer::DeviceProcessList *createProcessListModel(QObject *parent) const;
|
||||||
|
|
||||||
QString displayType() const;
|
QString displayType() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user