forked from qt-creator/qt-creator
make breakpoint and watchers view more robust when switching sessions
This commit is contained in:
@@ -781,6 +781,15 @@ void BreakHandler::loadSessionData()
|
|||||||
loadBreakpoints();
|
loadBreakpoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BreakHandler::removeSessionData()
|
||||||
|
{
|
||||||
|
Iterator it = m_storage.begin(), et = m_storage.end();
|
||||||
|
for ( ; it != et; ++it)
|
||||||
|
it->destroyMarker();
|
||||||
|
m_storage.clear();
|
||||||
|
layoutChanged();
|
||||||
|
}
|
||||||
|
|
||||||
void BreakHandler::breakByFunction(const QString &functionName)
|
void BreakHandler::breakByFunction(const QString &functionName)
|
||||||
{
|
{
|
||||||
// One breakpoint per function is enough for now. This does not handle
|
// One breakpoint per function is enough for now. This does not handle
|
||||||
@@ -801,7 +810,9 @@ void BreakHandler::breakByFunction(const QString &functionName)
|
|||||||
QIcon BreakHandler::icon(BreakpointId id) const
|
QIcon BreakHandler::icon(BreakpointId id) const
|
||||||
{
|
{
|
||||||
ConstIterator it = m_storage.find(id);
|
ConstIterator it = m_storage.find(id);
|
||||||
QTC_ASSERT(it != m_storage.end(), return pendingBreakPointIcon());
|
QTC_ASSERT(it != m_storage.end(),
|
||||||
|
qDebug() << "NO ICON FOR ID" << id;
|
||||||
|
return pendingBreakPointIcon());
|
||||||
return it->icon();
|
return it->icon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ public:
|
|||||||
|
|
||||||
void loadSessionData();
|
void loadSessionData();
|
||||||
void saveSessionData();
|
void saveSessionData();
|
||||||
|
void removeSessionData();
|
||||||
|
|
||||||
QAbstractItemModel *model() { return this; }
|
QAbstractItemModel *model() { return this; }
|
||||||
|
|
||||||
|
|||||||
@@ -977,7 +977,7 @@ public slots:
|
|||||||
for (int i = 0, n = m_snapshotHandler->size(); i != n; ++i) {
|
for (int i = 0, n = m_snapshotHandler->size(); i != n; ++i) {
|
||||||
if (DebuggerRunControl *runControl = m_snapshotHandler->at(i)) {
|
if (DebuggerRunControl *runControl = m_snapshotHandler->at(i)) {
|
||||||
DebuggerEngine *engine = runControl->engine();
|
DebuggerEngine *engine = runControl->engine();
|
||||||
engine->watchHandler()->synchronizeWatchers();
|
engine->watchHandler()->updateWatchers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3000,11 +3000,11 @@ void DebuggerPluginPrivate::sessionLoaded()
|
|||||||
{
|
{
|
||||||
m_breakHandler->loadSessionData();
|
m_breakHandler->loadSessionData();
|
||||||
dummyEngine()->watchHandler()->loadSessionData();
|
dummyEngine()->watchHandler()->loadSessionData();
|
||||||
synchronizeWatchers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::aboutToUnloadSession()
|
void DebuggerPluginPrivate::aboutToUnloadSession()
|
||||||
{
|
{
|
||||||
|
m_breakHandler->removeSessionData();
|
||||||
// Stop debugging the active project when switching sessions.
|
// Stop debugging the active project when switching sessions.
|
||||||
// Note that at startup, session switches may occur, which interfere
|
// Note that at startup, session switches may occur, which interfere
|
||||||
// with command-line debugging startup.
|
// with command-line debugging startup.
|
||||||
|
|||||||
@@ -1212,8 +1212,8 @@ QByteArray WatchHandler::watcherName(const QByteArray &exp)
|
|||||||
void WatchHandler::watchExpression(const QString &exp)
|
void WatchHandler::watchExpression(const QString &exp)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_engine, return);
|
QTC_ASSERT(m_engine, return);
|
||||||
// Do not insert multiple placeholders.
|
// Do not insert the same entry more then once.
|
||||||
if (exp.isEmpty() && m_watcherNames.contains(QByteArray()))
|
if (m_watcherNames.value(exp.toLatin1()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// FIXME: 'exp' can contain illegal characters
|
// FIXME: 'exp' can contain illegal characters
|
||||||
@@ -1343,11 +1343,11 @@ void WatchHandler::removeWatchExpression(const QString &exp0)
|
|||||||
if (item->exp == exp) {
|
if (item->exp == exp) {
|
||||||
m_watchers->destroyItem(item);
|
m_watchers->destroyItem(item);
|
||||||
saveWatchers();
|
saveWatchers();
|
||||||
|
updateWatchersWindow();
|
||||||
|
emitAllChanged();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
emitAllChanged();
|
|
||||||
updateWatchersWindow();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::updateWatchersWindow()
|
void WatchHandler::updateWatchersWindow()
|
||||||
@@ -1356,27 +1356,6 @@ void WatchHandler::updateWatchersWindow()
|
|||||||
debuggerCore()->updateWatchersWindow();
|
debuggerCore()->updateWatchersWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::updateWatchers()
|
|
||||||
{
|
|
||||||
// Copy over all watchers and mark all watchers as incomplete.
|
|
||||||
foreach (const QByteArray &exp, m_watcherNames.keys()) {
|
|
||||||
WatchData data;
|
|
||||||
data.iname = watcherName(exp);
|
|
||||||
data.setAllNeeded();
|
|
||||||
data.name = exp;
|
|
||||||
data.exp = exp;
|
|
||||||
insertData(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void WatchHandler::loadWatchers()
|
|
||||||
{
|
|
||||||
m_watcherNames.clear();
|
|
||||||
QVariant value = debuggerCore()->sessionValue("Watchers");
|
|
||||||
foreach (const QString &exp, value.toStringList())
|
|
||||||
watchExpression(exp);
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList WatchHandler::watchedExpressions()
|
QStringList WatchHandler::watchedExpressions()
|
||||||
{
|
{
|
||||||
// Filter out invalid watchers.
|
// Filter out invalid watchers.
|
||||||
@@ -1432,16 +1411,26 @@ void WatchHandler::saveSessionData()
|
|||||||
|
|
||||||
void WatchHandler::loadSessionData()
|
void WatchHandler::loadSessionData()
|
||||||
{
|
{
|
||||||
loadWatchers();
|
|
||||||
loadTypeFormats();
|
loadTypeFormats();
|
||||||
|
m_watcherNames.clear();
|
||||||
|
QVariant value = debuggerCore()->sessionValue("Watchers");
|
||||||
|
foreach (WatchItem *item, m_watchers->rootItem()->children)
|
||||||
|
m_watchers->destroyItem(item);
|
||||||
|
foreach (const QString &exp, value.toStringList())
|
||||||
|
watchExpression(exp);
|
||||||
|
updateWatchersWindow();
|
||||||
|
emitAllChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::synchronizeWatchers()
|
void WatchHandler::updateWatchers()
|
||||||
{
|
{
|
||||||
|
foreach (WatchItem *item, m_watchers->rootItem()->children)
|
||||||
|
m_watchers->destroyItem(item);
|
||||||
|
// Copy over all watchers and mark all watchers as incomplete.
|
||||||
foreach (const QByteArray &exp, m_watcherNames.keys()) {
|
foreach (const QByteArray &exp, m_watcherNames.keys()) {
|
||||||
WatchData data;
|
WatchData data;
|
||||||
data.iname = watcherName(exp);
|
data.iname = watcherName(exp);
|
||||||
data.setAllUnneeded();
|
data.setAllNeeded();
|
||||||
data.name = exp;
|
data.name = exp;
|
||||||
data.exp = exp;
|
data.exp = exp;
|
||||||
insertData(data);
|
insertData(data);
|
||||||
|
|||||||
@@ -182,7 +182,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
friend class WatchModel;
|
friend class WatchModel;
|
||||||
|
|
||||||
void loadWatchers();
|
|
||||||
void saveWatchers();
|
void saveWatchers();
|
||||||
static void loadTypeFormats();
|
static void loadTypeFormats();
|
||||||
static void saveTypeFormats();
|
static void saveTypeFormats();
|
||||||
|
|||||||
Reference in New Issue
Block a user