summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorTobias Nätterlund <tobias.naetterlund.qnx@kdab.com>2013-10-21 14:54:49 +0200
committerTobias Nätterlund <tobias.naetterlund@kdab.com>2013-10-23 14:30:55 +0200
commitf02197244ef4e25a713f063436fadd4cb7e3fcd4 (patch)
tree6a8050e56ddbbb417c72cb7924dfe6d7e30d3a50 /src/plugins
parent231dd3f622eb188dfc0b767393e3d8dcc99cc1bb (diff)
downloadqt-creator-f02197244ef4e25a713f063436fadd4cb7e3fcd4.tar.gz
QNX: Show warning when slog2info is not found on QNX >6.5
Change-Id: Ifa66184c51144d461c351fcdf40233c39c9cf507 Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/qnx/qnxdeviceconfiguration.cpp64
-rw-r--r--src/plugins/qnx/qnxdeviceconfiguration.h9
-rw-r--r--src/plugins/qnx/qnxdevicetester.cpp23
-rw-r--r--src/plugins/qnx/qnxdevicetester.h2
-rw-r--r--src/plugins/qnx/qnxruncontrol.cpp7
-rw-r--r--src/plugins/qnx/qnxruncontrol.h3
6 files changed, 102 insertions, 6 deletions
diff --git a/src/plugins/qnx/qnxdeviceconfiguration.cpp b/src/plugins/qnx/qnxdeviceconfiguration.cpp
index f5a26bd9bb..d9b64ed9a3 100644
--- a/src/plugins/qnx/qnxdeviceconfiguration.cpp
+++ b/src/plugins/qnx/qnxdeviceconfiguration.cpp
@@ -34,14 +34,22 @@
#include "qnxdeviceprocesslist.h"
#include "qnxdeviceprocesssignaloperation.h"
+#include <projectexplorer/devicesupport/sshdeviceprocess.h>
#include <ssh/sshconnection.h>
+#include <utils/qtcassert.h>
+#include <QApplication>
#include <QRegExp>
#include <QStringList>
+#include <QThread>
using namespace Qnx;
using namespace Qnx::Internal;
+namespace {
+const char QnxVersionKey[] = "QnxVersion";
+}
+
class QnxPortsGatheringMethod : public ProjectExplorer::PortsGatheringMethod
{
// TODO: The command is probably needlessly complicated because the parsing method
@@ -82,20 +90,22 @@ class QnxPortsGatheringMethod : public ProjectExplorer::PortsGatheringMethod
QnxDeviceConfiguration::QnxDeviceConfiguration()
: RemoteLinux::LinuxDevice()
+ , m_versionNumber(0)
{
}
QnxDeviceConfiguration::QnxDeviceConfiguration(const QString &name, Core::Id type, MachineType machineType, Origin origin, Core::Id id)
: RemoteLinux::LinuxDevice(name, type, machineType, origin, id)
+ , m_versionNumber(0)
{
}
QnxDeviceConfiguration::QnxDeviceConfiguration(const QnxDeviceConfiguration &other)
: RemoteLinux::LinuxDevice(other)
+ , m_versionNumber(other.m_versionNumber)
{
}
-
QnxDeviceConfiguration::Ptr QnxDeviceConfiguration::create()
{
return Ptr(new QnxDeviceConfiguration);
@@ -111,6 +121,58 @@ QString QnxDeviceConfiguration::displayType() const
return tr("QNX");
}
+int QnxDeviceConfiguration::qnxVersion() const
+{
+ if (m_versionNumber == 0)
+ updateVersionNumber();
+
+ return m_versionNumber;
+}
+
+void QnxDeviceConfiguration::updateVersionNumber() const
+{
+ QEventLoop eventLoop;
+ ProjectExplorer::SshDeviceProcess versionNumberProcess(sharedFromThis());
+ QObject::connect(&versionNumberProcess, SIGNAL(finished()), &eventLoop, SLOT(quit()));
+ QObject::connect(&versionNumberProcess, SIGNAL(error(QProcess::ProcessError)), &eventLoop, SLOT(quit()));
+
+ QStringList arguments;
+ arguments << QLatin1String("-r");
+ versionNumberProcess.start(QLatin1String("uname"), arguments);
+
+ bool isGuiThread = QThread::currentThread() == QCoreApplication::instance()->thread();
+ if (isGuiThread)
+ QApplication::setOverrideCursor(Qt::WaitCursor);
+
+ eventLoop.exec(QEventLoop::ExcludeUserInputEvents);
+
+ QByteArray output = versionNumberProcess.readAllStandardOutput();
+ QString versionMessage = QString::fromLatin1(output);
+ QRegExp versionNumberRegExp = QRegExp(QLatin1String("(\\d+)\\.(\\d+)\\.(\\d+)"));
+ if (versionNumberRegExp.indexIn(versionMessage) > -1 && versionNumberRegExp.captureCount() == 3) {
+ int major = versionNumberRegExp.cap(1).toInt();
+ int minor = versionNumberRegExp.cap(2).toInt();
+ int patch = versionNumberRegExp.cap(3).toInt();
+ m_versionNumber = (major << 16)|(minor<<8)|(patch);
+ }
+
+ if (isGuiThread)
+ QApplication::restoreOverrideCursor();
+}
+
+void QnxDeviceConfiguration::fromMap(const QVariantMap &map)
+{
+ m_versionNumber = map.value(QLatin1String(QnxVersionKey), 0).toInt();
+ RemoteLinux::LinuxDevice::fromMap(map);
+}
+
+QVariantMap QnxDeviceConfiguration::toMap() const
+{
+ QVariantMap map(RemoteLinux::LinuxDevice::toMap());
+ map.insert(QLatin1String(QnxVersionKey), m_versionNumber);
+ return map;
+}
+
ProjectExplorer::IDevice::Ptr QnxDeviceConfiguration::clone() const
{
return Ptr(new QnxDeviceConfiguration(*this));
diff --git a/src/plugins/qnx/qnxdeviceconfiguration.h b/src/plugins/qnx/qnxdeviceconfiguration.h
index ec67de55d9..5e9fb69070 100644
--- a/src/plugins/qnx/qnxdeviceconfiguration.h
+++ b/src/plugins/qnx/qnxdeviceconfiguration.h
@@ -58,6 +58,11 @@ public:
QString displayType() const;
+ int qnxVersion() const;
+
+ void fromMap(const QVariantMap &map);
+ QVariantMap toMap() const;
+
protected:
QnxDeviceConfiguration();
QnxDeviceConfiguration(const QString &name, Core::Id type, MachineType machineType,
@@ -67,6 +72,10 @@ protected:
QString interruptProcessByNameCommandLine(const QString &filePath) const;
QString killProcessByNameCommandLine(const QString &filePath) const;
+private:
+ void updateVersionNumber() const;
+
+ mutable int m_versionNumber;
};
} // namespace Internal
diff --git a/src/plugins/qnx/qnxdevicetester.cpp b/src/plugins/qnx/qnxdevicetester.cpp
index 723e8cc350..a229ae2046 100644
--- a/src/plugins/qnx/qnxdevicetester.cpp
+++ b/src/plugins/qnx/qnxdevicetester.cpp
@@ -30,6 +30,7 @@
****************************************************************************/
#include "qnxdevicetester.h"
+#include "qnxdeviceconfiguration.h"
#include <ssh/sshremoteprocessrunner.h>
#include <utils/qtcassert.h>
@@ -44,6 +45,10 @@ QnxDeviceTester::QnxDeviceTester(QObject *parent)
, m_currentCommandIndex(-1)
{
m_genericTester = new RemoteLinux::GenericLinuxDeviceTester(this);
+ connect(m_genericTester, SIGNAL(progressMessage(QString)), SIGNAL(progressMessage(QString)));
+ connect(m_genericTester, SIGNAL(errorMessage(QString)), SIGNAL(errorMessage(QString)));
+ connect(m_genericTester, SIGNAL(finished(ProjectExplorer::DeviceTester::TestResult)),
+ SLOT(handleGenericTestFinished(ProjectExplorer::DeviceTester::TestResult)));
m_processRunner = new QSsh::SshRemoteProcessRunner(this);
connect(m_processRunner, SIGNAL(connectionError()), SLOT(handleConnectionError()));
@@ -68,11 +73,6 @@ void QnxDeviceTester::testDevice(const ProjectExplorer::IDevice::ConstPtr &devic
m_deviceConfiguration = deviceConfiguration;
- connect(m_genericTester, SIGNAL(progressMessage(QString)), SIGNAL(progressMessage(QString)));
- connect(m_genericTester, SIGNAL(errorMessage(QString)), SIGNAL(errorMessage(QString)));
- connect(m_genericTester, SIGNAL(finished(ProjectExplorer::DeviceTester::TestResult)),
- SLOT(handleGenericTestFinished(ProjectExplorer::DeviceTester::TestResult)));
-
m_state = GenericTest;
m_genericTester->testDevice(deviceConfiguration);
}
@@ -107,6 +107,10 @@ void QnxDeviceTester::handleGenericTestFinished(TestResult result)
}
m_state = CommandsTest;
+
+ QnxDeviceConfiguration::ConstPtr qnxDevice = m_deviceConfiguration.dynamicCast<const QnxDeviceConfiguration>();
+ m_commandsToTest.append(versionSpecificCommandsToTest(qnxDevice->qnxVersion()));
+
testNextCommand();
}
@@ -161,3 +165,12 @@ void QnxDeviceTester::setFinished()
disconnect(m_processRunner, 0, this, 0);
emit finished(m_result);
}
+
+QStringList QnxDeviceTester::versionSpecificCommandsToTest(int versionNumber) const
+{
+ QStringList result;
+ if (versionNumber > 0x060500)
+ result << QLatin1String("slog2info");
+
+ return result;
+}
diff --git a/src/plugins/qnx/qnxdevicetester.h b/src/plugins/qnx/qnxdevicetester.h
index 834f6a601e..d0a4a8a286 100644
--- a/src/plugins/qnx/qnxdevicetester.h
+++ b/src/plugins/qnx/qnxdevicetester.h
@@ -68,6 +68,8 @@ private:
void testNextCommand();
void setFinished();
+ QStringList versionSpecificCommandsToTest(int versionNumber) const;
+
RemoteLinux::GenericLinuxDeviceTester *m_genericTester;
ProjectExplorer::IDevice::ConstPtr m_deviceConfiguration;
ProjectExplorer::DeviceTester::TestResult m_result;
diff --git a/src/plugins/qnx/qnxruncontrol.cpp b/src/plugins/qnx/qnxruncontrol.cpp
index 0f717d83be..53a32ac8e8 100644
--- a/src/plugins/qnx/qnxruncontrol.cpp
+++ b/src/plugins/qnx/qnxruncontrol.cpp
@@ -58,6 +58,8 @@ QnxRunControl::QnxRunControl(ProjectExplorer::RunConfiguration *runConfig)
m_slog2Info = new Slog2InfoRunner(applicationId, qnxDevice, this);
connect(m_slog2Info, SIGNAL(output(QString,Utils::OutputFormat)), this, SLOT(appendMessage(QString,Utils::OutputFormat)));
connect(this, SIGNAL(started()), m_slog2Info, SLOT(start()));
+ if (qnxDevice->qnxVersion() > 0x060500)
+ connect(m_slog2Info, SIGNAL(commandMissing()), this, SLOT(printMissingWarning()));
}
ProjectExplorer::RunControl::StopResult QnxRunControl::stop()
@@ -65,3 +67,8 @@ ProjectExplorer::RunControl::StopResult QnxRunControl::stop()
m_slog2Info->stop();
return RemoteLinuxRunControl::stop();
}
+
+void QnxRunControl::printMissingWarning()
+{
+ appendMessage(tr("Warning: \"slog2info\" is not found on the device, debug output not available!"), Utils::ErrorMessageFormat);
+}
diff --git a/src/plugins/qnx/qnxruncontrol.h b/src/plugins/qnx/qnxruncontrol.h
index 20368e6089..c3e44777e5 100644
--- a/src/plugins/qnx/qnxruncontrol.h
+++ b/src/plugins/qnx/qnxruncontrol.h
@@ -47,6 +47,9 @@ public:
RemoteLinux::RemoteLinuxRunControl::StopResult stop();
+private slots:
+ void printMissingWarning();
+
private:
Slog2InfoRunner *m_slog2Info;
};