Debugger: Fix interrupting code.

- Windows: Always use DebugBreakProcess if Qt Creator is compiled
  64bit. Else always use win64interrupt.exe if Qt Creator
  is a WOW64 application.
- Remove redundant code (procinterrupt/hostutils, gdb adapters).
- Give interruptProcess an errorMessage parameter such that it can
  be used by all C++ engines and a proper error is displayed.
- Improve error messages.
- Build win64interrupt if target architecture is 64 bit (clean tools
  profile, add a profile), borrowing the check from
  qtcreatorcdbext.pro.

Change-Id: I2a6caf98e46051c49c84e1f3aac4c8d2aba66e8b
Reviewed-by: David Schulz <david.schulz@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
Friedemann Kleint
2012-02-02 09:30:22 +01:00
parent 1d3dc30153
commit 38510a482d
14 changed files with 185 additions and 125 deletions

View File

@@ -57,6 +57,7 @@
#include "gdb/gdbmi.h"
#include "shared/cdbsymbolpathlisteditor.h"
#include "shared/hostutils.h"
#include "procinterrupt.h"
#include <TranslationUnit.h>
@@ -1155,10 +1156,15 @@ void CdbEngine::interruptInferior()
{
if (debug)
qDebug() << "CdbEngine::interruptInferior()" << stateName(state());
if (canInterruptInferior()) {
doInterruptInferior(NoSpecialStop);
} else {
bool ok = false;
if (!canInterruptInferior()) {
showMessage(tr("Interrupting is not possible in remote sessions."), LogError);
} else {
ok = doInterruptInferior(NoSpecialStop);
}
// Restore running state if stop failed.
if (!ok) {
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorStopOk")
notifyInferiorStopOk();
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorRunRequested")
@@ -1175,20 +1181,19 @@ void CdbEngine::doInterruptInferiorCustomSpecialStop(const QVariant &v)
m_customSpecialStopData.push_back(v);
}
void CdbEngine::doInterruptInferior(SpecialStopMode sm)
bool CdbEngine::doInterruptInferior(SpecialStopMode sm)
{
#ifdef Q_OS_WIN
const SpecialStopMode oldSpecialMode = m_specialStopMode;
m_specialStopMode = sm;
QString errorMessage;
showMessage(QString::fromLatin1("Interrupting process %1...").arg(inferiorPid()), LogMisc);
if (!winDebugBreakProcess(inferiorPid(), &errorMessage, Utils::winIs64BitBinary(cdbBinary(startParameters())))) {
QString errorMessage;
const bool ok = interruptProcess(inferiorPid(), CdbEngineType, &errorMessage);
if (!ok) {
m_specialStopMode = oldSpecialMode;
showMessage(QString::fromLatin1("Cannot interrupt process %1: %2").arg(inferiorPid()).arg(errorMessage), LogError);
showMessage(errorMessage, LogError);
}
#else
Q_UNUSED(sm)
#endif
return ok;
}
void CdbEngine::executeRunToLine(const ContextData &data)