diff options
author | David Schulz <[email protected]> | 2012-01-16 15:24:04 +0100 |
---|---|---|
committer | hjk <[email protected]> | 2012-01-25 12:16:00 +0100 |
commit | e7e74db758ee3964ad8898eb398652f5db00a181 (patch) | |
tree | d87b84a64b3c13abbfe9023a05c37f1472b74269 /src/plugins/debugger/procinterrupt.cpp | |
parent | 1bb1c2884f02346b510bbf8d9b02c3db57701e9e (diff) |
Edit debugger so win64interrupt is called
when trying to debug a 64bit application under windows.
Task-number: QTCREATORBUG-2521
Change-Id: I38922a6bed09640ce88184e6913a9fbb1d7433de
Reviewed-by: Joerg Bornemann <[email protected]>
Reviewed-by: hjk <[email protected]>
Diffstat (limited to 'src/plugins/debugger/procinterrupt.cpp')
-rw-r--r-- | src/plugins/debugger/procinterrupt.cpp | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/plugins/debugger/procinterrupt.cpp b/src/plugins/debugger/procinterrupt.cpp index 291d50d60da..cf5a49150db 100644 --- a/src/plugins/debugger/procinterrupt.cpp +++ b/src/plugins/debugger/procinterrupt.cpp @@ -33,6 +33,7 @@ #include "procinterrupt.h" #include <QtCore/QProcess> // makes kill visible on Windows. +#include <QtCore/QFile> using namespace Debugger::Internal; @@ -40,8 +41,27 @@ using namespace Debugger::Internal; #define _WIN32_WINNT 0x0501 /* WinXP, needed for DebugBreakProcess() */ +#include <utils/winutils.h> #include <windows.h> +static BOOL isWow64Process(HANDLE hproc) +{ + BOOL ret = false; + typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); + LPFN_ISWOW64PROCESS fnIsWow64Process = NULL; + HMODULE hModule = GetModuleHandle(L"kernel32.dll"); + if (hModule == NULL) + return false; + + fnIsWow64Process = reinterpret_cast<LPFN_ISWOW64PROCESS>(GetProcAddress(hModule, "IsWow64Process")); + if (fnIsWow64Process == NULL) + return false; + + if (!fnIsWow64Process(hproc, &ret)) + return false; + return ret; +} + bool Debugger::Internal::interruptProcess(int pID) { if (pID <= 0) @@ -51,10 +71,18 @@ bool Debugger::Internal::interruptProcess(int pID) if (hproc == NULL) return false; - bool ok = DebugBreakProcess(hproc) != 0; + BOOL proc64bit = false; - CloseHandle(hproc); + if (Utils::winIs64BitSystem()) + proc64bit = !isWow64Process(hproc); + bool ok = false; + if (proc64bit) + ok = !QProcess::execute(QCoreApplication::applicationDirPath() + QString::fromLatin1("/win64interrupt.exe %1").arg(pID)); + else + ok = !DebugBreakProcess(hproc); + + CloseHandle(hproc); return ok; } |