forked from qt-creator/qt-creator
Debugger: Split updateWatchData() paths
There are two cases that do not coincide in asynchronous engines such as the QmlEngine: Inserting a new watch item, and expanding the children of an existing item. Change-Id: Ic98a5f1e89aca37146039a241de737c407606e83 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
@@ -1976,13 +1976,18 @@ bool DebuggerEngine::canHandleToolTip(const DebuggerToolTipContext &context) con
|
|||||||
return state() == InferiorStopOk && context.isCppEditor;
|
return state() == InferiorStopOk && context.isCppEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::updateWatchData(const QByteArray &iname)
|
void DebuggerEngine::updateItem(const QByteArray &iname)
|
||||||
{
|
{
|
||||||
UpdateParameters params;
|
UpdateParameters params;
|
||||||
params.partialVariable = iname;
|
params.partialVariable = iname;
|
||||||
doUpdateLocals(params);
|
doUpdateLocals(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DebuggerEngine::expandItem(const QByteArray &iname)
|
||||||
|
{
|
||||||
|
updateItem(iname);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|
||||||
|
|||||||
@@ -191,7 +191,8 @@ public:
|
|||||||
DebuggerRunParameters &runParameters();
|
DebuggerRunParameters &runParameters();
|
||||||
|
|
||||||
virtual bool canHandleToolTip(const DebuggerToolTipContext &) const;
|
virtual bool canHandleToolTip(const DebuggerToolTipContext &) const;
|
||||||
virtual void updateWatchData(const QByteArray &iname);
|
virtual void expandItem(const QByteArray &iname); // Called when item in tree gets expanded.
|
||||||
|
virtual void updateItem(const QByteArray &iname); // Called for fresh watch items.
|
||||||
virtual void selectWatchData(const QByteArray &iname);
|
virtual void selectWatchData(const QByteArray &iname);
|
||||||
|
|
||||||
virtual void startDebugger(DebuggerRunControl *runControl);
|
virtual void startDebugger(DebuggerRunControl *runControl);
|
||||||
|
|||||||
@@ -1222,7 +1222,7 @@ static void slotTooltipOverrideRequested
|
|||||||
m_tooltips.push_back(tooltip);
|
m_tooltips.push_back(tooltip);
|
||||||
tooltip->setState(PendingUnshown);
|
tooltip->setState(PendingUnshown);
|
||||||
if (engine->canHandleToolTip(context)) {
|
if (engine->canHandleToolTip(context)) {
|
||||||
engine->updateWatchData(context.iname);
|
engine->updateItem(context.iname);
|
||||||
} else {
|
} else {
|
||||||
ToolTip::show(point, DebuggerToolTipManager::tr("Expression too complex"),
|
ToolTip::show(point, DebuggerToolTipManager::tr("Expression too complex"),
|
||||||
Internal::mainWindow());
|
Internal::mainWindow());
|
||||||
|
|||||||
@@ -394,7 +394,7 @@ void PdbEngine::assignValueInDebugger(WatchItem *, const QString &expression, co
|
|||||||
updateLocals();
|
updateLocals();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PdbEngine::updateWatchData(const QByteArray &iname)
|
void PdbEngine::updateItem(const QByteArray &iname)
|
||||||
{
|
{
|
||||||
Q_UNUSED(iname);
|
Q_UNUSED(iname);
|
||||||
updateAll();
|
updateAll();
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ private:
|
|||||||
|
|
||||||
bool supportsThreads() const { return true; }
|
bool supportsThreads() const { return true; }
|
||||||
bool isSynchronous() const { return true; }
|
bool isSynchronous() const { return true; }
|
||||||
void updateWatchData(const QByteArray &iname);
|
void updateItem(const QByteArray &iname);
|
||||||
|
|
||||||
QString mainPythonFile() const;
|
QString mainPythonFile() const;
|
||||||
QString pythonInterpreter() const;
|
QString pythonInterpreter() const;
|
||||||
|
|||||||
@@ -114,12 +114,12 @@ bool QmlCppEngine::canHandleToolTip(const DebuggerToolTipContext &ctx) const
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlCppEngine::updateWatchData(const QByteArray &iname)
|
void QmlCppEngine::updateItem(const QByteArray &iname)
|
||||||
{
|
{
|
||||||
if (iname.startsWith("inspect."))
|
if (iname.startsWith("inspect."))
|
||||||
m_qmlEngine->updateWatchData(iname);
|
m_qmlEngine->updateItem(iname);
|
||||||
else
|
else
|
||||||
m_activeEngine->updateWatchData(iname);
|
m_activeEngine->updateItem(iname);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlCppEngine::selectWatchData(const QByteArray &iname)
|
void QmlCppEngine::selectWatchData(const QByteArray &iname)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public:
|
|||||||
|
|
||||||
bool canDisplayTooltip() const;
|
bool canDisplayTooltip() const;
|
||||||
bool canHandleToolTip(const DebuggerToolTipContext &) const;
|
bool canHandleToolTip(const DebuggerToolTipContext &) const;
|
||||||
void updateWatchData(const QByteArray &iname);
|
void updateItem(const QByteArray &iname);
|
||||||
void selectWatchData(const QByteArray &iname);
|
void selectWatchData(const QByteArray &iname);
|
||||||
|
|
||||||
void watchPoint(const QPoint &);
|
void watchPoint(const QPoint &);
|
||||||
|
|||||||
@@ -969,26 +969,31 @@ void QmlEngine::assignValueInDebugger(WatchItem *item,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::updateWatchData(const QByteArray &iname)
|
void QmlEngine::expandItem(const QByteArray &iname)
|
||||||
{
|
{
|
||||||
const WatchItem *item = watchHandler()->findItem(iname);
|
const WatchItem *item = watchHandler()->findItem(iname);
|
||||||
// invalid expressions or out of scope variables
|
QTC_ASSERT(item, return);
|
||||||
if (!item)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (item->isInspect()) {
|
if (item->isInspect()) {
|
||||||
d->inspectorAdapter.agent()->updateWatchData(*item);
|
d->inspectorAdapter.agent()->updateWatchData(*item);
|
||||||
} else {
|
} else {
|
||||||
if (!item->name.isEmpty()) {
|
LookupItems items;
|
||||||
if (item->isChildrenNeeded() && watchHandler()->isExpandedIName(item->iname)) {
|
items.insert(int(item->id), {item->iname, item->name});
|
||||||
LookupItems items;
|
d->lookup(items);
|
||||||
items.insert(int(item->id), {item->iname, item->name});
|
|
||||||
d->lookup(items);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlEngine::updateItem(const QByteArray &iname)
|
||||||
|
{
|
||||||
|
const WatchItem *item = watchHandler()->findItem(iname);
|
||||||
|
QTC_ASSERT(item, return);
|
||||||
|
|
||||||
|
QString exp = QString::fromUtf8(item->exp);
|
||||||
|
d->evaluate(exp, [this, exp](const QVariantMap &response) {
|
||||||
|
d->handleEvaluateWatcher(response, exp);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void QmlEngine::selectWatchData(const QByteArray &iname)
|
void QmlEngine::selectWatchData(const QByteArray &iname)
|
||||||
{
|
{
|
||||||
const WatchItem *item = watchHandler()->findItem(iname);
|
const WatchItem *item = watchHandler()->findItem(iname);
|
||||||
|
|||||||
@@ -129,7 +129,8 @@ private:
|
|||||||
void reloadSourceFiles();
|
void reloadSourceFiles();
|
||||||
void reloadFullStack() {}
|
void reloadFullStack() {}
|
||||||
|
|
||||||
void updateWatchData(const QByteArray &iname);
|
void updateItem(const QByteArray &iname);
|
||||||
|
void expandItem(const QByteArray &iname);
|
||||||
void selectWatchData(const QByteArray &iname);
|
void selectWatchData(const QByteArray &iname);
|
||||||
void executeDebuggerCommand(const QString &command, DebuggerLanguages languages);
|
void executeDebuggerCommand(const QString &command, DebuggerLanguages languages);
|
||||||
bool evaluateScript(const QString &expression);
|
bool evaluateScript(const QString &expression);
|
||||||
|
|||||||
@@ -683,7 +683,7 @@ void WatchItem::fetchMore()
|
|||||||
model->m_fetchTriggered.insert(iname);
|
model->m_fetchTriggered.insert(iname);
|
||||||
if (children().isEmpty()) {
|
if (children().isEmpty()) {
|
||||||
setChildrenNeeded();
|
setChildrenNeeded();
|
||||||
model->m_engine->updateWatchData(iname);
|
model->m_engine->expandItem(iname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -940,12 +940,12 @@ bool WatchModel::setData(const QModelIndex &idx, const QVariant &value, int role
|
|||||||
|
|
||||||
case LocalsTypeFormatRole:
|
case LocalsTypeFormatRole:
|
||||||
setTypeFormat(item->type, value.toInt());
|
setTypeFormat(item->type, value.toInt());
|
||||||
m_engine->updateWatchData(item->iname);
|
m_engine->updateLocals();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LocalsIndividualFormatRole: {
|
case LocalsIndividualFormatRole: {
|
||||||
setIndividualFormat(item->iname, value.toInt());
|
setIndividualFormat(item->iname, value.toInt());
|
||||||
m_engine->updateWatchData(item->iname);
|
m_engine->updateLocals();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1304,14 +1304,14 @@ void WatchHandler::watchExpression(const QString &exp0, const QString &name)
|
|||||||
item->exp = exp;
|
item->exp = exp;
|
||||||
item->name = name.isEmpty() ? exp0 : name;
|
item->name = name.isEmpty() ? exp0 : name;
|
||||||
item->iname = watcherName(exp);
|
item->iname = watcherName(exp);
|
||||||
|
m_model->insertItem(item);
|
||||||
saveWatchers();
|
saveWatchers();
|
||||||
|
|
||||||
if (m_model->m_engine->state() == DebuggerNotReady) {
|
if (m_model->m_engine->state() == DebuggerNotReady) {
|
||||||
item->setAllUnneeded();
|
item->setAllUnneeded();
|
||||||
item->setValue(QString(QLatin1Char(' ')));
|
item->setValue(QString(QLatin1Char(' ')));
|
||||||
m_model->insertItem(item);
|
|
||||||
} else {
|
} else {
|
||||||
m_model->m_engine->updateWatchData(item->iname);
|
m_model->m_engine->updateItem(item->iname);
|
||||||
}
|
}
|
||||||
updateWatchersWindow();
|
updateWatchersWindow();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user