diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index af1334c1cec..35e8cca3ca4 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -4669,31 +4669,11 @@ void GdbEngine::doUpdateLocals(const UpdateParameters ¶ms) DebuggerCommand cmd("showData"); watchHandler()->appendFormatRequests(&cmd); + watchHandler()->appendWatchersAndTooltipRequests(&cmd); cmd.arg("stringcutoff", action(MaximalStringLength)->value().toByteArray()); cmd.arg("displaystringlimit", action(DisplayStringLimit)->value().toByteArray()); - // Re-create tooltip items that are not filters on existing local variables in - // the tooltip model. - cmd.beginList("watchers"); - DebuggerToolTipContexts toolTips = DebuggerToolTipManager::pendingTooltips(this); - foreach (const DebuggerToolTipContext &p, toolTips) { - cmd.beginGroup(); - cmd.arg("iname", p.iname); - cmd.arg("exp", p.expression.toLatin1().toHex()); - cmd.endGroup(); - } - - QHashIterator it(WatchHandler::watcherNames()); - while (it.hasNext()) { - it.next(); - cmd.beginGroup(); - cmd.arg("iname", "watch." + QByteArray::number(it.value())); - cmd.arg("exp", it.key().toHex()); - cmd.endGroup(); - } - cmd.endList(); - const static bool alwaysVerbose = !qgetenv("QTC_DEBUGGER_PYTHON_VERBOSE").isEmpty(); cmd.arg("passExceptions", alwaysVerbose); diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp index ceb135f3135..8b8e0823fb1 100644 --- a/src/plugins/debugger/lldb/lldbengine.cpp +++ b/src/plugins/debugger/lldb/lldbengine.cpp @@ -826,6 +826,7 @@ void LldbEngine::doUpdateLocals(const UpdateParameters ¶ms) DebuggerCommand cmd("fetchLocals"); cmd.arg("nativeMixed", isNativeMixedActive()); watchHandler()->appendFormatRequests(&cmd); + watchHandler()->appendWatchersAndTooltipRequests(&cmd); const static bool alwaysVerbose = !qgetenv("QTC_DEBUGGER_PYTHON_VERBOSE").isEmpty(); cmd.arg("passexceptions", alwaysVerbose); @@ -835,29 +836,6 @@ void LldbEngine::doUpdateLocals(const UpdateParameters ¶ms) cmd.arg("partialVariable", params.partialVariable); cmd.arg("sortStructMembers", boolSetting(SortStructMembers)); - cmd.beginList("watchers"); - - // Watchers - QHashIterator it(WatchHandler::watcherNames()); - while (it.hasNext()) { - it.next(); - cmd.beginGroup(); - cmd.arg("iname", "watch." + QByteArray::number(it.value())); - cmd.arg("exp", it.key().toHex()); - cmd.endGroup(); - } - - // Tooltips - DebuggerToolTipContexts toolTips = DebuggerToolTipManager::pendingTooltips(this); - foreach (const DebuggerToolTipContext &p, toolTips) { - cmd.beginGroup(); - cmd.arg("iname", p.iname); - cmd.arg("exp", p.expression.toLatin1().toHex()); - cmd.endGroup(); - } - - cmd.endList(); - //cmd.arg("resultvarname", m_resultVarName); m_lastDebuggableCommand = cmd; diff --git a/src/plugins/debugger/pdb/pdbengine.cpp b/src/plugins/debugger/pdb/pdbengine.cpp index 8cf784eaae7..976cf958770 100644 --- a/src/plugins/debugger/pdb/pdbengine.cpp +++ b/src/plugins/debugger/pdb/pdbengine.cpp @@ -571,34 +571,12 @@ void PdbEngine::updateLocals() DebuggerCommand cmd("updateData"); cmd.arg("nativeMixed", isNativeMixedActive()); watchHandler()->appendFormatRequests(&cmd); + watchHandler()->appendWatchersAndTooltipRequests(&cmd); const static bool alwaysVerbose = !qgetenv("QTC_DEBUGGER_PYTHON_VERBOSE").isEmpty(); cmd.arg("passexceptions", alwaysVerbose); cmd.arg("fancy", boolSetting(UseDebuggingHelpers)); - cmd.beginList("watchers"); - - // Watchers - QHashIterator it(WatchHandler::watcherNames()); - while (it.hasNext()) { - it.next(); - cmd.beginGroup(); - cmd.arg("iname", "watch." + QByteArray::number(it.value())); - cmd.arg("exp", it.key().toHex()); - cmd.endGroup(); - } - - // Tooltips - DebuggerToolTipContexts toolTips = DebuggerToolTipManager::pendingTooltips(this); - foreach (const DebuggerToolTipContext &p, toolTips) { - cmd.beginGroup(); - cmd.arg("iname", p.iname); - cmd.arg("exp", p.expression.toLatin1().toHex()); - cmd.endGroup(); - } - - cmd.endList(); - //cmd.arg("resultvarname", m_resultVarName); //m_lastDebuggableCommand = cmd; //m_lastDebuggableCommand.args.replace("\"passexceptions\":0", "\"passexceptions\":1"); diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index a53a8eda149..ad6fbbf5d24 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -37,6 +37,7 @@ #include "debuggerengine.h" #include "debuggerinternalconstants.h" #include "debuggerprotocol.h" +#include "debuggertooltipmanager.h" #include "simplifytype.h" #include "imageviewer.h" #include "watchutils.h" @@ -1621,6 +1622,28 @@ void WatchHandler::appendFormatRequests(DebuggerCommand *cmd) cmd->endGroup(); } +void WatchHandler::appendWatchersAndTooltipRequests(DebuggerCommand *cmd) +{ + cmd->beginList("watchers"); + DebuggerToolTipContexts toolTips = DebuggerToolTipManager::pendingTooltips(m_model->m_engine); + foreach (const DebuggerToolTipContext &p, toolTips) { + cmd->beginGroup(); + cmd->arg("iname", p.iname); + cmd->arg("exp", p.expression.toLatin1().toHex()); + cmd->endGroup(); + } + + QHashIterator it(WatchHandler::watcherNames()); + while (it.hasNext()) { + it.next(); + cmd->beginGroup(); + cmd->arg("iname", "watch." + QByteArray::number(it.value())); + cmd->arg("exp", it.key().toHex()); + cmd->endGroup(); + } + cmd->endList(); +} + void WatchHandler::addDumpers(const GdbMi &dumpers) { foreach (const GdbMi &dumper, dumpers.children()) { diff --git a/src/plugins/debugger/watchhandler.h b/src/plugins/debugger/watchhandler.h index 65a37e06ec4..7a746e82b84 100644 --- a/src/plugins/debugger/watchhandler.h +++ b/src/plugins/debugger/watchhandler.h @@ -130,6 +130,9 @@ public: static QStringList watchedExpressions(); static QHash watcherNames(); + void appendFormatRequests(DebuggerCommand *cmd); + void appendWatchersAndTooltipRequests(DebuggerCommand *cmd); + QByteArray typeFormatRequests() const; QByteArray individualFormatRequests() const; @@ -150,7 +153,6 @@ public: void setCurrentItem(const QByteArray &iname); void updateWatchersWindow(); - void appendFormatRequests(DebuggerCommand *cmd); void insertItem(WatchItem *item); // Takes ownership. void removeItemByIName(const QByteArray &iname);