forked from qt-creator/qt-creator
Debugger: Fix interrupting with cdb
It turns out sending ctrl+c events to cdb results in inconsistent behavior when trying to interrupt with the range from interrupting twice to not at all. Use the previous method of using signal operation for local debugging, and use the ctrl+c event only when cdb is attached to a remote server. Fixes: QTCREATORBUG-28279 Change-Id: Iccd2016685ba707b375aebfd88eccc253dde1d1d Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -763,6 +763,18 @@ void CdbEngine::interruptInferior()
|
||||
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)
|
||||
{
|
||||
const bool requestInterrupt = m_stopMode == NoStopRequested;
|
||||
@@ -779,6 +791,18 @@ void CdbEngine::doInterruptInferior(const InterruptCallback &callback)
|
||||
if (!requestInterrupt)
|
||||
return; // we already requested a stop no need to interrupt twice
|
||||
showMessage(QString("Interrupting process %1...").arg(inferiorPid()), LogMisc);
|
||||
|
||||
QTC_ASSERT(!m_signalOperation, notifyInferiorStopFailed(); return);
|
||||
if (m_effectiveStartMode != AttachToRemoteServer && device()) {
|
||||
m_signalOperation = device()->signalOperation();
|
||||
if (m_signalOperation) {
|
||||
connect(m_signalOperation.data(), &DeviceProcessSignalOperation::finished,
|
||||
this, &CdbEngine::handleDoInterruptInferior);
|
||||
m_signalOperation->setDebuggerCommand(runParameters().debugger.command.executable());
|
||||
m_signalOperation->interruptProcess(inferiorPid());
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_process.interrupt();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user