forked from qt-creator/qt-creator
Debugger: Fix interrupting remote cdb process
Since we can use the ctrlc stub for cdb now we also can use the interrupt functionality to force the debugger to halt. This also works for remote sessions. Fixes: QTCREATORBUG-21657 Change-Id: I049aea781e984c31ac5744f87f9590f910234679 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -805,32 +805,9 @@ void CdbEngine::interruptInferior()
|
|||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "CdbEngine::interruptInferior()" << stateName(state());
|
qDebug() << "CdbEngine::interruptInferior()" << stateName(state());
|
||||||
|
|
||||||
if (!canInterruptInferior()) {
|
|
||||||
// Restore running state if inferior can't be stoped.
|
|
||||||
showMessage(tr("Interrupting is not possible in remote sessions."), LogError);
|
|
||||||
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorStopOk")
|
|
||||||
notifyInferiorStopOk();
|
|
||||||
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorRunRequested")
|
|
||||||
notifyInferiorRunRequested();
|
|
||||||
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorRunOk")
|
|
||||||
notifyInferiorRunOk();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
doInterruptInferior();
|
doInterruptInferior();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbEngine::handleDoInterruptInferior(const QString &errorMessage)
|
|
||||||
{
|
|
||||||
if (errorMessage.isEmpty()) {
|
|
||||||
showMessage("Interrupted " + QString::number(inferiorPid()));
|
|
||||||
} else {
|
|
||||||
showMessage(errorMessage, LogError);
|
|
||||||
notifyInferiorStopFailed();
|
|
||||||
}
|
|
||||||
m_signalOperation->disconnect(this);
|
|
||||||
m_signalOperation.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CdbEngine::doInterruptInferior(const InterruptCallback &callback)
|
void CdbEngine::doInterruptInferior(const InterruptCallback &callback)
|
||||||
{
|
{
|
||||||
const bool requestInterrupt = m_stopMode == NoStopRequested;
|
const bool requestInterrupt = m_stopMode == NoStopRequested;
|
||||||
@@ -847,15 +824,7 @@ void CdbEngine::doInterruptInferior(const InterruptCallback &callback)
|
|||||||
if (!requestInterrupt)
|
if (!requestInterrupt)
|
||||||
return; // we already requested a stop no need to interrupt twice
|
return; // we already requested a stop no need to interrupt twice
|
||||||
showMessage(QString("Interrupting process %1...").arg(inferiorPid()), LogMisc);
|
showMessage(QString("Interrupting process %1...").arg(inferiorPid()), LogMisc);
|
||||||
QTC_ASSERT(!m_signalOperation, notifyInferiorStopFailed(); return);
|
m_process.interrupt();
|
||||||
QTC_ASSERT(device(), notifyInferiorRunFailed(); return);
|
|
||||||
m_signalOperation = device()->signalOperation();
|
|
||||||
QTC_ASSERT(m_signalOperation, notifyInferiorStopFailed(); return;);
|
|
||||||
connect(m_signalOperation.data(), &DeviceProcessSignalOperation::finished,
|
|
||||||
this, &CdbEngine::handleDoInterruptInferior);
|
|
||||||
|
|
||||||
m_signalOperation->setDebuggerCommand(runParameters().debugger.command.executable());
|
|
||||||
m_signalOperation->interruptProcess(inferiorPid());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbEngine::executeRunToLine(const ContextData &data)
|
void CdbEngine::executeRunToLine(const ContextData &data)
|
||||||
|
@@ -113,8 +113,6 @@ private:
|
|||||||
|
|
||||||
void createFullBacktrace();
|
void createFullBacktrace();
|
||||||
|
|
||||||
void handleDoInterruptInferior(const QString &errorMessage);
|
|
||||||
|
|
||||||
typedef QPair<QString, QString> SourcePathMapping;
|
typedef QPair<QString, QString> SourcePathMapping;
|
||||||
struct NormalizedSourceFileName // Struct for caching mapped/normalized source files.
|
struct NormalizedSourceFileName // Struct for caching mapped/normalized source files.
|
||||||
{
|
{
|
||||||
@@ -207,7 +205,6 @@ private:
|
|||||||
//! Debugger accessible (expecting commands)
|
//! Debugger accessible (expecting commands)
|
||||||
bool m_accessible = false;
|
bool m_accessible = false;
|
||||||
StopMode m_stopMode = NoStopRequested;
|
StopMode m_stopMode = NoStopRequested;
|
||||||
ProjectExplorer::DeviceProcessSignalOperation::Ptr m_signalOperation;
|
|
||||||
int m_nextCommandToken = 0;
|
int m_nextCommandToken = 0;
|
||||||
QHash<int, DebuggerCommand> m_commandForToken;
|
QHash<int, DebuggerCommand> m_commandForToken;
|
||||||
QString m_currentBuiltinResponse;
|
QString m_currentBuiltinResponse;
|
||||||
|
Reference in New Issue
Block a user