Debugger: Don't clear unrelated views when updating locals

If the list of partial expressions is empty we need to tell the watch
handler that we are only updating the locals view, not e.g. the
inspector view.

Change-Id: Iedc74ffc66a8435faa272d053849b831f6b8cbbe
Task-number: QTCREATORBUG-16692
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Ulf Hermann
2016-11-03 13:28:28 +01:00
parent d8c6b2d434
commit d771ba8921
8 changed files with 15 additions and 9 deletions

View File

@@ -1217,7 +1217,7 @@ void CdbEngine::activateFrame(int index)
void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters) void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters)
{ {
if (m_pythonVersion > 0x030000) { if (m_pythonVersion > 0x030000) {
watchHandler()->notifyUpdateStarted(updateParameters.partialVariables()); watchHandler()->notifyUpdateStarted(updateParameters);
DebuggerCommand cmd("theDumper.fetchVariables", ScriptCommand); DebuggerCommand cmd("theDumper.fetchVariables", ScriptCommand);
watchHandler()->appendFormatRequests(&cmd); watchHandler()->appendFormatRequests(&cmd);
@@ -1270,7 +1270,7 @@ void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters)
return; return;
} }
watchHandler()->notifyUpdateStarted(updateParameters.partialVariables()); watchHandler()->notifyUpdateStarted(updateParameters);
/* Watchers: Forcibly discard old symbol group as switching from /* Watchers: Forcibly discard old symbol group as switching from
* thread 0/frame 0 -> thread 1/assembly -> thread 0/frame 0 will otherwise re-use it * thread 0/frame 0 -> thread 1/assembly -> thread 0/frame 0 will otherwise re-use it

View File

@@ -2061,7 +2061,7 @@ void DebuggerEngine::updateItem(const QString &iname)
WatchModelBase *model = handler->model(); WatchModelBase *model = handler->model();
QTC_CHECK(model); QTC_CHECK(model);
if (item && !model->hasChildren(model->indexForItem(item))) { if (item && !model->hasChildren(model->indexForItem(item))) {
handler->notifyUpdateStarted({iname}); handler->notifyUpdateStarted(UpdateParameters(iname));
item->setValue(decodeData({}, "notaccessible")); item->setValue(decodeData({}, "notaccessible"));
item->setHasChildren(false); item->setHasChildren(false);
item->outdated = false; item->outdated = false;

View File

@@ -122,7 +122,8 @@ public:
class UpdateParameters class UpdateParameters
{ {
public: public:
UpdateParameters() {} UpdateParameters(const QString &partialVariable = QString()) :
partialVariable(partialVariable) {}
QStringList partialVariables() const QStringList partialVariables() const
{ {

View File

@@ -4493,7 +4493,7 @@ void GdbEngine::doUpdateLocals(const UpdateParameters &params)
{ {
m_pendingBreakpointRequests = 0; m_pendingBreakpointRequests = 0;
watchHandler()->notifyUpdateStarted(params.partialVariables()); watchHandler()->notifyUpdateStarted(params);
DebuggerCommand cmd("fetchVariables", Discardable|InUpdateLocals|PythonCommand); DebuggerCommand cmd("fetchVariables", Discardable|InUpdateLocals|PythonCommand);
watchHandler()->appendFormatRequests(&cmd); watchHandler()->appendFormatRequests(&cmd);

View File

@@ -796,7 +796,7 @@ void LldbEngine::assignValueInDebugger(WatchItem *,
void LldbEngine::doUpdateLocals(const UpdateParameters &params) void LldbEngine::doUpdateLocals(const UpdateParameters &params)
{ {
watchHandler()->notifyUpdateStarted(params.partialVariables()); watchHandler()->notifyUpdateStarted(params);
DebuggerCommand cmd("fetchVariables"); DebuggerCommand cmd("fetchVariables");
watchHandler()->appendFormatRequests(&cmd); watchHandler()->appendFormatRequests(&cmd);

View File

@@ -2156,7 +2156,7 @@ void QmlEnginePrivate::handleFrame(const QVariantMap &response)
StackHandler *stackHandler = engine->stackHandler(); StackHandler *stackHandler = engine->stackHandler();
WatchHandler * watchHandler = engine->watchHandler(); WatchHandler * watchHandler = engine->watchHandler();
watchHandler->notifyUpdateStarted({"local"}); watchHandler->notifyUpdateStarted();
const int frameIndex = stackHandler->currentIndex(); const int frameIndex = stackHandler->currentIndex();
if (frameIndex < 0) if (frameIndex < 0)

View File

@@ -1999,8 +1999,12 @@ void WatchHandler::resetWatchers()
loadSessionData(); loadSessionData();
} }
void WatchHandler::notifyUpdateStarted(const QStringList &inames) void WatchHandler::notifyUpdateStarted(const UpdateParameters &updateParameters)
{ {
QStringList inames = updateParameters.partialVariables();
if (inames.isEmpty())
inames.append("local");
auto marker = [](WatchItem *item) { item->outdated = true; }; auto marker = [](WatchItem *item) { item->outdated = true; };
if (inames.isEmpty()) { if (inames.isEmpty()) {

View File

@@ -26,6 +26,7 @@
#pragma once #pragma once
#include "watchdata.h" #include "watchdata.h"
#include "debuggerengine.h"
#include <QVector> #include <QVector>
@@ -111,7 +112,7 @@ public:
void resetValueCache(); void resetValueCache();
void resetWatchers(); void resetWatchers();
void notifyUpdateStarted(const QStringList &inames = {}); void notifyUpdateStarted(const UpdateParameters &updateParameters = UpdateParameters());
void notifyUpdateFinished(); void notifyUpdateFinished();
void reexpandItems(); void reexpandItems();