diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index 1aff3a94b93..e1d41052c6e 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -376,6 +376,7 @@ CdbEngine::CdbEngine(const DebuggerStartParameters &sp, const OptionsPtr &option m_operateByInstruction(true), // Default CDB setting m_notifyEngineShutdownOnTermination(false), m_hasDebuggee(false), + m_cdbIs64Bit(false), m_elapsedLogTime(0), m_sourceStepInto(false), m_watchPointX(0), @@ -641,13 +642,13 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa return false; } - const bool is64bit = + m_cdbIs64Bit = #ifdef Q_OS_WIN Utils::winIs64BitBinary(executable); #else false; #endif - const QFileInfo extensionFi(CdbEngine::extensionLibraryName(is64bit)); + const QFileInfo extensionFi(CdbEngine::extensionLibraryName(m_cdbIs64Bit)); if (!extensionFi.isFile()) { *errorMessage = QString::fromLatin1("Internal error: The extension %1 cannot be found."). arg(QDir::toNativeSeparators(extensionFi.absoluteFilePath())); @@ -1163,7 +1164,9 @@ bool CdbEngine::doInterruptInferior(SpecialStopMode sm) showMessage(QString::fromLatin1("Interrupting process %1...").arg(inferiorPid()), LogMisc); QString errorMessage; - const bool ok = interruptProcess(inferiorPid(), CdbEngineType, &errorMessage); + + const bool ok = interruptProcess(inferiorPid(), CdbEngineType, + &errorMessage, m_cdbIs64Bit); if (!ok) { m_specialStopMode = oldSpecialMode; showMessage(errorMessage, LogError); diff --git a/src/plugins/debugger/cdb/cdbengine.h b/src/plugins/debugger/cdb/cdbengine.h index b9a4eca4a9b..faa52543b3c 100644 --- a/src/plugins/debugger/cdb/cdbengine.h +++ b/src/plugins/debugger/cdb/cdbengine.h @@ -265,6 +265,7 @@ private: bool m_operateByInstruction; bool m_notifyEngineShutdownOnTermination; bool m_hasDebuggee; + bool m_cdbIs64Bit; QTime m_logTime; mutable int m_elapsedLogTime; QByteArray m_extensionMessageBuffer; diff --git a/src/plugins/debugger/procinterrupt.cpp b/src/plugins/debugger/procinterrupt.cpp index 54a250437c0..fa9a313ccde 100644 --- a/src/plugins/debugger/procinterrupt.cpp +++ b/src/plugins/debugger/procinterrupt.cpp @@ -78,7 +78,7 @@ static BOOL isWow64Process(HANDLE hproc) } // Open the process and break into it -bool Debugger::Internal::interruptProcess(int pID, int engineType, QString *errorMessage) +bool Debugger::Internal::interruptProcess(int pID, int engineType, QString *errorMessage, const bool engineExecutableIs64Bit) { bool ok = false; HANDLE inferior = NULL; @@ -98,9 +98,10 @@ bool Debugger::Internal::interruptProcess(int pID, int engineType, QString *erro // Qt-Creator compiled 64 bit // Windows must be 64 bit // CDB 64 bit: use DebugBreakProcess for 32 an 64 bit processes. - // CDB 32 bit: untested + // TODO: CDB 32 bit: inferior 32 bit can not use DebugBreakProcess, we need a win32interrupt.exe // GDB: not supported const bool useDebugBreakApi= true; + Q_UNUSED(engineExecutableIs64Bit) #else // Qt-Creator compiled 32 bit: @@ -115,8 +116,9 @@ bool Debugger::Internal::interruptProcess(int pID, int engineType, QString *erro // works in theory for other WOW64 processes, the break appears // as a WOW64 breakpoint, which CDB is configured to ignore since // it also triggers on module loading. - // CDB 32 bit: untested - useDebugBreakApi = false; + // CDB 32 bit: 32 bit applications can not be interrupted using the win64interrupt.exe + // So we need to find out which bitness the currently used cdb has. + useDebugBreakApi = !engineExecutableIs64Bit; } else { // GDB: Use win64interrupt for native 64bit processes only (it fails // for WOW64 processes. @@ -165,7 +167,7 @@ bool Debugger::Internal::interruptProcess(int pID, int engineType, QString *erro #include bool Debugger::Internal::interruptProcess(int pID, int /* engineType */, - QString *errorMessage) + QString *errorMessage, const bool /*engineExecutableIs64Bit*/) { if (pID <= 0) { *errorMessage = msgCannotInterrupt(pID, QString::fromLatin1("Invalid process id.")); diff --git a/src/plugins/debugger/procinterrupt.h b/src/plugins/debugger/procinterrupt.h index 43826827163..df3c1facbb9 100644 --- a/src/plugins/debugger/procinterrupt.h +++ b/src/plugins/debugger/procinterrupt.h @@ -35,7 +35,8 @@ namespace Debugger { namespace Internal { -bool interruptProcess(int pID, int engineType, QString *errorMessage); +bool interruptProcess(int pID, int engineType, QString *errorMessage, + const bool engineExecutableIs64Bit = false); } // Internal } // GdbDebugger