Commit 7ac99044 authored by hjk's avatar hjk

Debugger: Merge watcher request creation

... of {Gdb,Lldb,Pdb}Engine. Code is the same nowadays.

Change-Id: I874b1ddfd813c15cc16c9b91bd894c7c42b56e93
Reviewed-by: default avatarNiels Weber <niels.weber@theqtcompany.com>
Reviewed-by: default avatarDavid Schulz <david.schulz@theqtcompany.com>
parent 1cb811eb
......@@ -4669,31 +4669,11 @@ void GdbEngine::doUpdateLocals(const UpdateParameters &params)
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<QByteArray, int> 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);
......
......@@ -826,6 +826,7 @@ void LldbEngine::doUpdateLocals(const UpdateParameters &params)
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 &params)
cmd.arg("partialVariable", params.partialVariable);
cmd.arg("sortStructMembers", boolSetting(SortStructMembers));
cmd.beginList("watchers");
// Watchers
QHashIterator<QByteArray, int> 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;
......
......@@ -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<QByteArray, int> 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");
......
......@@ -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<QByteArray, int> 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()) {
......
......@@ -130,6 +130,9 @@ public:
static QStringList watchedExpressions();
static QHash<QByteArray, int> 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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment