forked from qt-creator/qt-creator
Merge remote branch 'origin/1.3'
Conflicts: src/plugins/cpptools/cppcodecompletion.cpp src/plugins/debugger/gdb/remotegdbadapter.cpp
This commit is contained in:
@@ -61,6 +61,8 @@
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/fancymainwindow.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <cplusplus/CppDocument.h>
|
||||
#include <cpptools/cppmodelmanagerinterface.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QDir>
|
||||
@@ -99,43 +101,35 @@
|
||||
// gdbserver, the trk client etc are referred to as 'Adapter',
|
||||
// whereas the debugged process is referred to as 'Inferior'.
|
||||
//
|
||||
// 0 == DebuggerNotReady
|
||||
// 0 == DebuggerNotReady
|
||||
// |
|
||||
// EngineStarting
|
||||
// EngineStarting
|
||||
// |
|
||||
// AdapterStarting --> AdapterStartFailed --> 0
|
||||
// AdapterStarting --> AdapterStartFailed --> 0
|
||||
// |
|
||||
// AdapterStarted
|
||||
// |
|
||||
// InferiorStarting --> InferiorStartFailed --> 0
|
||||
// |
|
||||
// (core) | (attach) (remote)
|
||||
// .-----------------<-|->--------------------.
|
||||
// | v |
|
||||
// InferiorUnrunnable | |
|
||||
// | | v
|
||||
// | | (plain)
|
||||
// | | (trk)
|
||||
// | |
|
||||
// | | .------------------------------------.
|
||||
// | | v |
|
||||
// | InferiorRunningRequested v |
|
||||
// | | | |
|
||||
// | .---- InferiorRunning | |
|
||||
// | | | | |
|
||||
// | | InferiorStopping | |
|
||||
// | | | | |
|
||||
// | v v | |
|
||||
// | |<--- InferiorStopped <-----------' |
|
||||
// | | | |
|
||||
// | | `---------------------------------------'
|
||||
// | |
|
||||
// | '---> InferiorShuttingDown -> InferiorShutdownFailed
|
||||
// | |
|
||||
// | InferiorShutDown
|
||||
// | |
|
||||
// | v
|
||||
// '------------> AdapterShuttingDown -> AdapterShutdownFailed --> 0
|
||||
// AdapterStarted ------------------------------------.
|
||||
// | v
|
||||
// InferiorStarting ----> InferiorStartFailed -------->|
|
||||
// | |
|
||||
// (core) | (attach) (term) (remote) |
|
||||
// .-----------------<-|->------------------. |
|
||||
// | v | |
|
||||
// InferiorUnrunnable | (plain) | |
|
||||
// | | (trk) | |
|
||||
// | | | |
|
||||
// | .--> InferiorRunningRequested | |
|
||||
// | | | | |
|
||||
// | | InferiorRunning | |
|
||||
// | | | | |
|
||||
// | | InferiorStopping | |
|
||||
// | | | | |
|
||||
// | '------ InferiorStopped <-----------' |
|
||||
// | | v
|
||||
// | InferiorShuttingDown -> InferiorShutdownFailed ---->|
|
||||
// | | |
|
||||
// | InferiorShutDown |
|
||||
// | | |
|
||||
// '--------> EngineShuttingDown <--------------------------------'
|
||||
// |
|
||||
// 0
|
||||
//
|
||||
@@ -206,8 +200,7 @@ static const char *stateName(int s)
|
||||
SN(InferiorShuttingDown)
|
||||
SN(InferiorShutDown)
|
||||
SN(InferiorShutdownFailed)
|
||||
SN(AdapterShuttingDown)
|
||||
SN(AdapterShutdownFailed)
|
||||
SN(EngineShuttingDown)
|
||||
}
|
||||
return "<unknown>";
|
||||
#undef SN
|
||||
@@ -290,6 +283,8 @@ struct DebuggerManagerPrivate
|
||||
|
||||
IDebuggerEngine *m_engine;
|
||||
DebuggerState m_state;
|
||||
|
||||
CPlusPlus::Snapshot m_codeModelSnapshot;
|
||||
};
|
||||
|
||||
DebuggerManager *DebuggerManagerPrivate::instance = 0;
|
||||
@@ -610,6 +605,18 @@ WatchHandler *DebuggerManager::watchHandler() const
|
||||
return d->m_watchHandler;
|
||||
}
|
||||
|
||||
const CPlusPlus::Snapshot &DebuggerManager::cppCodeModelSnapshot() const
|
||||
{
|
||||
if (d->m_codeModelSnapshot.isEmpty() && theDebuggerAction(UseCodeModel)->isChecked())
|
||||
d->m_codeModelSnapshot = CppTools::CppModelManagerInterface::instance()->snapshot();
|
||||
return d->m_codeModelSnapshot;
|
||||
}
|
||||
|
||||
void DebuggerManager::clearCppCodeModelSnapshot()
|
||||
{
|
||||
d->m_codeModelSnapshot.clear();
|
||||
}
|
||||
|
||||
SourceFilesWindow *DebuggerManager::sourceFileWindow() const
|
||||
{
|
||||
return d->m_sourceFilesWindow;
|
||||
@@ -1013,6 +1020,7 @@ void DebuggerManager::exitDebugger()
|
||||
// in turn will handle the cleanup.
|
||||
if (d->m_engine && state() != DebuggerNotReady)
|
||||
d->m_engine->exitDebugger();
|
||||
d->m_codeModelSnapshot.clear();
|
||||
}
|
||||
|
||||
DebuggerStartParametersPtr DebuggerManager::startParameters() const
|
||||
@@ -1544,7 +1552,7 @@ static bool isAllowedTransition(int from, int to)
|
||||
case AdapterStarting:
|
||||
return to == AdapterStarted || to == AdapterStartFailed;
|
||||
case AdapterStarted:
|
||||
return to == InferiorStarting;
|
||||
return to == InferiorStarting || to == EngineShuttingDown;
|
||||
case AdapterStartFailed:
|
||||
return to == DebuggerNotReady;
|
||||
|
||||
@@ -1552,37 +1560,38 @@ static bool isAllowedTransition(int from, int to)
|
||||
return to == InferiorRunningRequested || to == InferiorStopped
|
||||
|| to == InferiorStartFailed || to == InferiorUnrunnable;
|
||||
case InferiorStartFailed:
|
||||
return to == DebuggerNotReady;
|
||||
return to == EngineShuttingDown;
|
||||
|
||||
case InferiorRunningRequested:
|
||||
return to == InferiorRunning;
|
||||
return to == InferiorRunning || to == InferiorStopped;
|
||||
case InferiorRunning:
|
||||
return to == InferiorStopping || to == InferiorShuttingDown;
|
||||
return to == InferiorStopping;
|
||||
|
||||
case InferiorStopping:
|
||||
return to == InferiorStopped || to == InferiorStopFailed;
|
||||
case InferiorStopped:
|
||||
return to == InferiorRunningRequested || to == InferiorShuttingDown;
|
||||
case InferiorStopFailed:
|
||||
return to == DebuggerNotReady;
|
||||
return to == EngineShuttingDown;
|
||||
|
||||
case InferiorUnrunnable:
|
||||
return to == AdapterShuttingDown;
|
||||
return to == EngineShuttingDown;
|
||||
case InferiorShuttingDown:
|
||||
return to == InferiorShutDown || to == InferiorShutdownFailed;
|
||||
case InferiorShutDown:
|
||||
return to == AdapterShuttingDown;
|
||||
return to == EngineShuttingDown;
|
||||
case InferiorShutdownFailed:
|
||||
return to == EngineShuttingDown;
|
||||
|
||||
case AdapterShuttingDown:
|
||||
case EngineShuttingDown:
|
||||
return to == DebuggerNotReady;
|
||||
|
||||
default:
|
||||
qDebug() << "UNKNOWN STATE: " << from;
|
||||
}
|
||||
|
||||
qDebug() << "UNKNOWN STATE:" << from;
|
||||
return false;
|
||||
}
|
||||
|
||||
void DebuggerManager::setState(DebuggerState state)
|
||||
void DebuggerManager::setState(DebuggerState state, bool forced)
|
||||
{
|
||||
//STATE_DEBUG("STATUS CHANGE: FROM " << stateName(d->m_state)
|
||||
// << " TO " << stateName(state));
|
||||
@@ -1591,7 +1600,7 @@ void DebuggerManager::setState(DebuggerState state)
|
||||
.arg(stateName(d->m_state)).arg(d->m_state).arg(stateName(state)).arg(state);
|
||||
//if (!((d->m_state == -1 && state == 0) || (d->m_state == 0 && state == 0)))
|
||||
// qDebug() << msg;
|
||||
if (!isAllowedTransition(d->m_state, state))
|
||||
if (!forced && !isAllowedTransition(d->m_state, state))
|
||||
qDebug() << "UNEXPECTED STATE TRANSITION: " << msg;
|
||||
|
||||
showDebuggerOutput(LogDebug, msg);
|
||||
@@ -1685,8 +1694,7 @@ bool DebuggerManager::debuggerActionsEnabled() const
|
||||
case InferiorShuttingDown:
|
||||
case InferiorShutDown:
|
||||
case InferiorShutdownFailed:
|
||||
case AdapterShuttingDown:
|
||||
case AdapterShutdownFailed:
|
||||
case EngineShuttingDown:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
@@ -1763,9 +1771,9 @@ DebuggerState IDebuggerEngine::state() const
|
||||
return m_manager->state();
|
||||
}
|
||||
|
||||
void IDebuggerEngine::setState(DebuggerState state)
|
||||
void IDebuggerEngine::setState(DebuggerState state, bool forced)
|
||||
{
|
||||
m_manager->setState(state);
|
||||
m_manager->setState(state, forced);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user