Commit b89afac9 authored by hjk's avatar hjk

Utils: Rename winQPidToPid to qPidToPid

... and make it a no-op on non-Windows. Saves #ifdefs.

Change-Id: Ie791f7b9f1a425325d0b889e73758c5f7f7e6ad2
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@digia.com>
parent 80e657b3
......@@ -1473,3 +1473,17 @@ void QtcProcess::ArgIterator::appendArg(const QString &str)
m_str->insert(m_pos, QLatin1Char(' ') + qstr);
m_pos += qstr.length() + 1;
}
namespace Utils {
QTCREATOR_UTILS_EXPORT unsigned long qPidToPid(const Q_PID qpid)
{
#ifdef Q_OS_WIN
const PROCESS_INFORMATION *processInfo = reinterpret_cast<const PROCESS_INFORMATION*>(qpid);
return processInfo->dwProcessId;
#else
return qpid;
#endif
}
} // namespace Utils
......@@ -155,6 +155,10 @@ private:
#endif
};
}
// Converts the Q_PID into a integer value. This is a no-op
// except on Windows.
QTCREATOR_UTILS_EXPORT unsigned long qPidToPid(const Q_PID qpid);
} // namespace Utils
#endif // QTCPROCESS_H
......@@ -177,12 +177,6 @@ QTCREATOR_UTILS_EXPORT QString normalizePathName(const QString &name)
return canonicalName;
}
QTCREATOR_UTILS_EXPORT unsigned long winQPidToPid(const Q_PID qpid)
{
const PROCESS_INFORMATION *processInfo = reinterpret_cast<const PROCESS_INFORMATION*>(qpid);
return processInfo->dwProcessId;
}
QTCREATOR_UTILS_EXPORT bool winIs64BitSystem()
{
SYSTEM_INFO systemInfo;
......
......@@ -59,6 +59,8 @@ QTCREATOR_UTILS_EXPORT QString getLongPathName(const QString &name);
// Returns long name with canonical capitalization.
QTCREATOR_UTILS_EXPORT QString normalizePathName(const QString &name);
// Converts the Q_PID into a integer value. This is a no-op
// except on Windows.
QTCREATOR_UTILS_EXPORT unsigned long winQPidToPid(const Q_PID qpid);
QTCREATOR_UTILS_EXPORT bool winIs64BitSystem();
......
......@@ -754,11 +754,8 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa
arg(QDir::toNativeSeparators(executable), m_process.errorString());
return false;
}
#ifdef Q_OS_WIN
const unsigned long pid = Utils::winQPidToPid(m_process.pid());
#else
const unsigned long pid = 0;
#endif
const unsigned long pid = Utils::qPidToPid(m_process.pid());
showMessage(QString::fromLatin1("%1 running as %2").
arg(QDir::toNativeSeparators(executable)).arg(pid), LogMisc);
m_hasDebuggee = true;
......
......@@ -32,9 +32,7 @@
#include "procinterrupt.h"
#include "debuggerconstants.h"
#ifdef Q_OS_WIN
#include <utils/winutils.h>
#endif
#include <utils/qtcprocess.h>
namespace Debugger {
namespace Internal {
......@@ -84,12 +82,7 @@ void LocalGdbProcess::kill()
bool LocalGdbProcess::interrupt()
{
long pid;
#ifdef Q_OS_WIN
pid = Utils::winQPidToPid(m_gdbProc.pid());
#else
pid = m_gdbProc.pid();
#endif
long pid = Utils::qPidToPid(m_gdbProc.pid());
return interruptProcess(pid, GdbEngineType, &m_errorString);
}
......
......@@ -135,11 +135,7 @@ void ValgrindProcess::run(const QString &valgrindExecutable, const QStringList &
m_localProcess.setCommand(valgrindExecutable, m_arguments);
m_localProcess.start();
m_localProcess.waitForStarted();
#ifdef Q_OS_WIN
m_pid = Utils::winQPidToPid(m_localProcess.pid());
#else
m_pid = m_localProcess.pid();
#endif
m_pid = Utils::qPidToPid(m_localProcess.pid());
} else {
m_remote.m_valgrindExe = valgrindExecutable;
m_remote.m_debuggee = debuggeeExecutable;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment