Commit 77661e37 authored by hjk's avatar hjk

Utils: Remove qPidToPid() adapter function

Since Qt 5.3, there's a QProcess::processId() providing direct access.

Change-Id: Ia9c143c7a92ec61d1aa36ff3f4670ba72a509634
Reviewed-by: default avatarTim Jenssen <tim.jenssen@theqtcompany.com>
Reviewed-by: default avatarDavid Schulz <david.schulz@theqtcompany.com>
parent 1a8faab3
......@@ -1487,16 +1487,6 @@ void QtcProcess::ArgIterator::appendArg(const QString &str)
m_pos += qstr.length() + 1;
}
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
}
QtcProcess::Arguments QtcProcess::Arguments::createWindowsArgs(const QString &args)
{
Arguments result;
......
......@@ -157,10 +157,6 @@ private:
bool m_useCtrlCStub;
};
// 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
......@@ -67,7 +67,7 @@ void GdbServerProviderProcess::start(const QString &executable, const QStringLis
void GdbServerProviderProcess::interrupt()
{
device()->signalOperation()->interruptProcess(Utils::qPidToPid(m_process->pid()));
device()->signalOperation()->interruptProcess(m_process->processId());
}
void GdbServerProviderProcess::terminate()
......
......@@ -640,7 +640,7 @@ bool CdbEngine::launchCDB(const DebuggerRunParameters &sp, QString *errorMessage
return false;
}
const unsigned long pid = Utils::qPidToPid(m_process.pid());
const qint64 pid = m_process.processId();
showMessage(QString::fromLatin1("%1 running as %2").
arg(QDir::toNativeSeparators(executable)).arg(pid), LogMisc);
m_hasDebuggee = true;
......
......@@ -50,7 +50,7 @@ namespace Debugger {
// Do not add anything that needs implementation in a .cpp file.
const int InvalidPort = -1;
const int InvalidPid = -1;
const qint64 InvalidPid = -1;
class DEBUGGER_EXPORT RemoteSetupResult
{
......@@ -64,7 +64,7 @@ public:
int gdbServerPort;
int qmlServerPort;
int inferiorPid;
qint64 inferiorPid;
bool success;
QString reason;
};
......
......@@ -438,7 +438,7 @@ void GdbRemoteServerEngine::interruptInferior2()
} else if (m_isQnxGdb && HostOsInfo::isWindowsHost()) {
m_gdbProc.interrupt();
} else {
long pid = Utils::qPidToPid(m_gdbProc.pid());
qint64 pid = m_gdbProc.processId();
bool ok = interruptProcess(pid, GdbEngineType, &m_errorString);
if (!ok) {
// FIXME: Extra state needed?
......
......@@ -37,7 +37,7 @@
using namespace Debugger::Internal;
static inline QString msgCannotInterrupt(int pid, const QString &why)
static inline QString msgCannotInterrupt(qint64 pid, const QString &why)
{
return QString::fromLatin1("Cannot interrupt process %1: %2").arg(pid).arg(why);
}
......@@ -80,7 +80,7 @@ static BOOL isWow64Process(HANDLE hproc)
}
// Open the process and break into it
bool Debugger::Internal::interruptProcess(int pID, int engineType, QString *errorMessage, const bool engineExecutableIs64Bit)
bool Debugger::Internal::interruptProcess(qint64 pID, int engineType, QString *errorMessage, const bool engineExecutableIs64Bit)
{
bool ok = false;
HANDLE inferior = NULL;
......@@ -88,7 +88,7 @@ bool Debugger::Internal::interruptProcess(int pID, int engineType, QString *erro
const DWORD rights = PROCESS_QUERY_INFORMATION|PROCESS_SET_INFORMATION
|PROCESS_VM_OPERATION|PROCESS_VM_WRITE|PROCESS_VM_READ
|PROCESS_DUP_HANDLE|PROCESS_TERMINATE|PROCESS_CREATE_THREAD|PROCESS_SUSPEND_RESUME;
inferior = OpenProcess(rights, FALSE, pID);
inferior = OpenProcess(rights, FALSE, DWORD(pID));
if (inferior == NULL) {
*errorMessage = QString::fromLatin1("Cannot open process %1: %2").
arg(pID).arg(Utils::winErrorMessage(GetLastError()));
......@@ -188,7 +188,7 @@ GDB 32bit | Api | Api | NA | Win32
#include <errno.h>
#include <string.h>
bool Debugger::Internal::interruptProcess(int pID, int /* engineType */,
bool Debugger::Internal::interruptProcess(qint64 pID, int /* engineType */,
QString *errorMessage, const bool /*engineExecutableIs64Bit*/)
{
if (pID <= 0) {
......
......@@ -36,7 +36,7 @@
namespace Debugger {
namespace Internal {
bool interruptProcess(int pID, int engineType, QString *errorMessage,
bool interruptProcess(qint64 pID, int engineType, QString *errorMessage,
const bool engineExecutableIs64Bit = false);
} // Internal
......
......@@ -138,7 +138,7 @@ void IosAnalyzeSupport::handleServerPorts(int gdbServerPort, int qmlPort)
m_qmlPort = qmlPort;
}
void IosAnalyzeSupport::handleGotInferiorPid(Q_PID pid, int qmlPort)
void IosAnalyzeSupport::handleGotInferiorPid(qint64 pid, int qmlPort)
{
Q_UNUSED(pid);
m_qmlPort = qmlPort;
......
......@@ -60,7 +60,7 @@ public:
private:
void qmlServerReady();
void handleServerPorts(int gdbServerFd, int qmlPort);
void handleGotInferiorPid(Q_PID, int qmlPort);
void handleGotInferiorPid(qint64 pid, int qmlPort);
void handleRemoteProcessFinished(bool cleanEnd);
void handleRemoteOutput(const QString &output);
......
......@@ -197,11 +197,11 @@ void IosDebugSupport::handleServerPorts(int gdbServerPort, int qmlPort)
m_runControl->notifyEngineRemoteSetupFinished(result);
}
void IosDebugSupport::handleGotInferiorPid(Q_PID pid, int qmlPort)
void IosDebugSupport::handleGotInferiorPid(qint64 pid, int qmlPort)
{
RemoteSetupResult result;
result.qmlServerPort = qmlPort;
result.inferiorPid = int(Utils::qPidToPid(pid));
result.inferiorPid = pid;
result.success = pid > 0;
if (!result.success)
result.reason = tr("Got an invalid process id.");
......
......@@ -56,7 +56,7 @@ public:
private:
void handleServerPorts(int gdbServerFd, int qmlPort);
void handleGotInferiorPid(Q_PID, int qmlPort);
void handleGotInferiorPid(qint64, int qmlPort);
void handleRemoteProcessFinished(bool cleanEnd);
void handleRemoteOutput(const QString &output);
......
......@@ -191,7 +191,7 @@ void IosRunner::handleGotServerPorts(IosToolHandler *handler, const QString &bun
}
void IosRunner::handleGotInferiorPid(IosToolHandler *handler, const QString &bundlePath,
const QString &deviceId, Q_PID pid)
const QString &deviceId, qint64 pid)
{
Q_UNUSED(bundlePath); Q_UNUSED(deviceId);
m_pid = pid;
......
......@@ -72,7 +72,7 @@ public slots:
signals:
void didStartApp(Ios::IosToolHandler::OpStatus status);
void gotServerPorts(int gdbPort, int qmlPort);
void gotInferiorPid(Q_PID pid, int);
void gotInferiorPid(qint64 pid, int);
void appOutput(const QString &output);
void errorMsg(const QString &msg);
void finished(bool cleanExit);
......@@ -83,7 +83,7 @@ private:
void handleGotServerPorts(Ios::IosToolHandler *handler, const QString &bundlePath,
const QString &deviceId, int gdbPort, int qmlPort);
void handleGotInferiorPid(Ios::IosToolHandler *handler, const QString &bundlePath,
const QString &deviceId, Q_PID pid);
const QString &deviceId, qint64 pid);
void handleAppOutput(Ios::IosToolHandler *handler, const QString &output);
void handleErrorMsg(Ios::IosToolHandler *handler, const QString &msg);
void handleToolExited(Ios::IosToolHandler *handler, int code);
......@@ -99,7 +99,7 @@ private:
bool m_cleanExit;
quint16 m_qmlPort;
Q_PID m_pid;
qint64 m_pid;
};
} // namespace Internal
......
......@@ -148,7 +148,7 @@ public:
IosToolHandler::OpStatus status);
void gotServerPorts(const QString &bundlePath, const QString &deviceId, int gdbPort,
int qmlPort);
void gotInferiorPid(const QString &bundlePath, const QString &deviceId, Q_PID pid);
void gotInferiorPid(const QString &bundlePath, const QString &deviceId, qint64 pid);
void deviceInfo(const QString &deviceId, const IosToolHandler::Dict &info);
void appOutput(const QString &output);
void errorMsg(const QString &msg);
......@@ -318,7 +318,7 @@ void IosToolHandlerPrivate::gotServerPorts(const QString &bundlePath,
}
void IosToolHandlerPrivate::gotInferiorPid(const QString &bundlePath, const QString &deviceId,
Q_PID pid)
qint64 pid)
{
emit q->gotInferiorPid(q, bundlePath, deviceId, pid);
}
......@@ -504,7 +504,7 @@ void IosToolHandlerPrivate::processXml()
case ParserState::Exit:
break;
case ParserState::InferiorPid:
gotInferiorPid(bundlePath, deviceId, Q_PID(p.chars.toInt()));
gotInferiorPid(bundlePath, deviceId, p.chars.toLongLong());
break;
case ParserState::ServerPorts:
break;
......
......@@ -80,7 +80,7 @@ signals:
void gotServerPorts(Ios::IosToolHandler *handler, const QString &bundlePath,
const QString &deviceId, int gdbPort, int qmlPort);
void gotInferiorPid(Ios::IosToolHandler *handler, const QString &bundlePath,
const QString &deviceId, Q_PID pid);
const QString &deviceId, qint64 pid);
void deviceInfo(Ios::IosToolHandler *handler, const QString &deviceId,
const Ios::IosToolHandler::Dict &info);
void appOutput(Ios::IosToolHandler *handler, const QString &output);
......
......@@ -212,7 +212,7 @@ qint64 ApplicationLauncher::applicationPID() const
if (d->m_currentMode == Console)
return d->m_consoleProcess.applicationPID();
else
return Utils::qPidToPid(d->m_guiProcess.pid());
return d->m_guiProcess.processId();
}
QString ApplicationLauncher::errorString() const
......
......@@ -58,7 +58,7 @@ void DesktopDeviceProcess::start(const QString &executable, const QStringList &a
void DesktopDeviceProcess::interrupt()
{
device()->signalOperation()->interruptProcess(Utils::qPidToPid(m_process->pid()));
device()->signalOperation()->interruptProcess(m_process->processId());
}
void DesktopDeviceProcess::terminate()
......
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