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();
|
||||
}
|
||||
|
||||
|
@@ -85,6 +85,8 @@ private:
|
||||
|
||||
void createFullBacktrace();
|
||||
|
||||
void handleDoInterruptInferior(const QString &errorMessage);
|
||||
|
||||
typedef QPair<QString, QString> SourcePathMapping;
|
||||
struct NormalizedSourceFileName // Struct for caching mapped/normalized source files.
|
||||
{
|
||||
@@ -175,6 +177,7 @@ private:
|
||||
//! Debugger accessible (expecting commands)
|
||||
bool m_accessible = false;
|
||||
StopMode m_stopMode = NoStopRequested;
|
||||
ProjectExplorer::DeviceProcessSignalOperation::Ptr m_signalOperation;
|
||||
int m_nextCommandToken = 0;
|
||||
QHash<int, DebuggerCommand> m_commandForToken;
|
||||
QString m_currentBuiltinResponse;
|
||||
|
Reference in New Issue
Block a user