Commit d5834692 authored by hjk's avatar hjk

Debugger: Keep watchers alphabetically ordered

Task-number: QTCREATORBUG-12308
Change-Id: Ifdffa20f3ccec6aa2c086ce83db3b4a8817e08ab
Reviewed-by: David Schulz's avatarDavid Schulz <david.schulz@qt.io>
parent 24ae8e04
......@@ -1254,8 +1254,6 @@ void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters)
runCommand(cmd);
} else {
typedef QHash<QString, int> WatcherHash;
const bool partialUpdate = !updateParameters.partialVariable.isEmpty();
const bool isWatch = isWatchIName(updateParameters.partialVariable);
......@@ -1325,10 +1323,9 @@ void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters)
if (!partialUpdate)
str << blankSeparator << "-W";
if (!partialUpdate || isWatch) {
const WatcherHash watcherHash = WatchHandler::watcherNames();
if (!watcherHash.isEmpty()) {
const WatcherHash::const_iterator cend = watcherHash.constEnd();
for (WatcherHash::const_iterator it = watcherHash.constBegin(); it != cend; ++it) {
const QMap<QString, int> watchers = WatchHandler::watcherNames();
if (!watchers.isEmpty()) {
for (auto it = watchers.constBegin(), cend = watchers.constEnd(); it != cend; ++it) {
str << blankSeparator << "-w " << "watch." + QString::number(it.value())
<< " \"" << it.key() << '"';
}
......
......@@ -88,7 +88,7 @@ enum { debugModel = 0 };
#define MODEL_DEBUG(s) do { if (debugModel) qDebug() << s; } while (0)
static QHash<QString, int> theWatcherNames;
static QMap<QString, int> theWatcherNames; // Keep order, QTCREATORBUG-12308.
static int theWatcherCount = 0;
static QHash<QString, int> theTypeFormats;
static QHash<QString, int> theIndividualFormats;
......@@ -2313,7 +2313,7 @@ QStringList WatchHandler::watchedExpressions()
{
// Filter out invalid watchers.
QStringList watcherNames;
QHashIterator<QString, int> it(theWatcherNames);
QMapIterator<QString, int> it(theWatcherNames);
while (it.hasNext()) {
it.next();
const QString &watcherName = it.key();
......@@ -2517,7 +2517,7 @@ void WatchHandler::appendWatchersAndTooltipRequests(DebuggerCommand *cmd)
foreach (const DebuggerToolTipContext &p, toolTips)
watchers.append(watcher(p.iname, p.expression));
QHashIterator<QString, int> it(WatchHandler::watcherNames());
QMapIterator<QString, int> it(WatchHandler::watcherNames());
while (it.hasNext()) {
it.next();
watchers.append(watcher("watch." + QString::number(it.value()), it.key()));
......@@ -2576,7 +2576,7 @@ void WatchHandler::setCurrentItem(const QString &iname)
}
}
QHash<QString, int> WatchHandler::watcherNames()
QMap<QString, int> WatchHandler::watcherNames()
{
return theWatcherNames;
}
......
......@@ -82,7 +82,7 @@ public:
QSet<QString> expandedINames() const;
static QStringList watchedExpressions();
static QHash<QString, int> watcherNames();
static QMap<QString, int> watcherNames();
void appendFormatRequests(DebuggerCommand *cmd);
void appendWatchersAndTooltipRequests(DebuggerCommand *cmd);
......
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