Debugger: Introduce a cache for pre-rendered value columne entries

Change-Id: Ibdcac8a5ccaa3eab0723205b913056530c510280
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2023-02-24 12:17:03 +01:00
parent f2f5e4d030
commit 7f04a66546
2 changed files with 16 additions and 6 deletions

View File

@@ -78,6 +78,9 @@ public:
bool outdated = false; // \internal item is to be removed.
double time = 0; // Time used on the dumper side to produce this item
mutable QString valueCache; // Pre-computed displayed value
void updateValueCache() const; // implemented in watchhandler.cpp
private:
void parseHelper(const GdbMi &input, bool maySort);
};

View File

@@ -929,15 +929,22 @@ static QString displayName(const WatchItem *item)
return result;
}
static QString displayValue(const WatchItem *item)
void WatchItem::updateValueCache() const
{
QString result = truncateValue(formattedValue(item));
result = watchModel(item)->removeNamespaces(result);
if (result.isEmpty() && item->address)
result += QString::fromLatin1("@0x" + QByteArray::number(item->address, 16));
valueCache = truncateValue(formattedValue(this));
valueCache = watchModel(this)->removeNamespaces(valueCache);
if (valueCache.isEmpty() && this->address)
valueCache += QString::fromLatin1("@0x" + QByteArray::number(this->address, 16));
// if (origaddr)
// result += QString::fromLatin1(" (0x" + QByteArray::number(origaddr, 16) + ')');
return result;
}
static QString displayValue(const WatchItem *item)
{
if (item->valueCache.isEmpty())
item->updateValueCache();
return item->valueCache;
}
static QString displayType(const WatchItem *item)