forked from qt-creator/qt-creator
Debugger: Improve exit handling.
This commit is contained in:
@@ -1466,13 +1466,18 @@ void DebuggerEngine::quitDebugger()
|
||||
{
|
||||
showMessage("QUIT DEBUGGER REQUESTED");
|
||||
d->m_targetState = DebuggerFinished;
|
||||
if (state() == InferiorStopOk) {
|
||||
switch (state()) {
|
||||
case InferiorStopOk:
|
||||
case InferiorStopFailed:
|
||||
d->queueShutdownInferior();
|
||||
} else if (state() == InferiorRunOk) {
|
||||
break;
|
||||
case InferiorRunOk:
|
||||
d->doInterruptInferior();
|
||||
} else {
|
||||
break;
|
||||
default:
|
||||
// FIXME: We should disable the actions connected to that
|
||||
notifyInferiorIll();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -953,6 +953,8 @@ public slots:
|
||||
|
||||
void executeDebuggerCommand();
|
||||
|
||||
QList<DebuggerRunControl *> runControls() const { return m_snapshotHandler->runControls(); }
|
||||
|
||||
public:
|
||||
DebuggerState m_state;
|
||||
uint m_capabilities;
|
||||
@@ -1651,13 +1653,15 @@ void DebuggerPluginPrivate::onCurrentProjectChanged(ProjectExplorer::Project *pr
|
||||
QTC_ASSERT(activeRc, /**/);
|
||||
}
|
||||
for (int i = 0, n = m_snapshotHandler->size(); i != n; ++i) {
|
||||
DebuggerRunControl *runControl = m_snapshotHandler->at(i);
|
||||
RunConfiguration *rc = runControl->runConfiguration();
|
||||
if (rc == activeRc) {
|
||||
m_snapshotHandler->setCurrentIndex(i);
|
||||
DebuggerEngine *engine = runControl->engine();
|
||||
updateState(engine);
|
||||
return;
|
||||
// Run controls might be deleted during exit.
|
||||
if (DebuggerRunControl *runControl = m_snapshotHandler->at(i)) {
|
||||
RunConfiguration *rc = runControl->runConfiguration();
|
||||
if (rc == activeRc) {
|
||||
m_snapshotHandler->setCurrentIndex(i);
|
||||
DebuggerEngine *engine = runControl->engine();
|
||||
updateState(engine);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// No corresponding debugger found. So we are ready to start one.
|
||||
|
@@ -286,10 +286,22 @@ void SnapshotHandler::setCurrentIndex(int index)
|
||||
reset();
|
||||
}
|
||||
|
||||
DebuggerRunControl *SnapshotHandler::at(int i)
|
||||
DebuggerRunControl *SnapshotHandler::at(int i) const
|
||||
{
|
||||
return m_snapshots.at(i).data();
|
||||
}
|
||||
|
||||
QList<DebuggerRunControl*> SnapshotHandler::runControls() const
|
||||
{
|
||||
// Return unique list of run controls
|
||||
QList<DebuggerRunControl*> rc;
|
||||
rc.reserve(m_snapshots.size());
|
||||
foreach(const QPointer<DebuggerRunControl> &runControlPtr, m_snapshots)
|
||||
if (DebuggerRunControl *runControl = runControlPtr)
|
||||
if (!rc.contains(runControl))
|
||||
rc.push_back(runControl);
|
||||
return rc;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Debugger
|
||||
|
@@ -67,7 +67,8 @@ public:
|
||||
void removeSnapshot(DebuggerRunControl *rc);
|
||||
void setCurrentIndex(int index);
|
||||
int size() const { return m_snapshots.size(); }
|
||||
DebuggerRunControl *at(int i);
|
||||
DebuggerRunControl *at(int i) const;
|
||||
QList<DebuggerRunControl*> runControls() const;
|
||||
|
||||
private:
|
||||
// QAbstractTableModel
|
||||
|
Reference in New Issue
Block a user