forked from qt-creator/qt-creator
Debugger: Save a few cycles in WatchData
Change-Id: Id2fc21fcc917969fa2f31864f4ff91f4df8c19d2 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -15,6 +15,10 @@
|
|||||||
|
|
||||||
namespace Debugger::Internal {
|
namespace Debugger::Internal {
|
||||||
|
|
||||||
|
const QStringView inameLocal = u"local.";
|
||||||
|
const QStringView inameWatch = u"watch.";
|
||||||
|
const QStringView inameInspect = u"inspect.";
|
||||||
|
|
||||||
bool isPointerType(const QStringView type)
|
bool isPointerType(const QStringView type)
|
||||||
{
|
{
|
||||||
return type.endsWith('*') || type.endsWith(u"* const");
|
return type.endsWith('*') || type.endsWith(u"* const");
|
||||||
@@ -308,7 +312,7 @@ void WatchItem::parseHelper(const GdbMi &input, bool maySort)
|
|||||||
if (mi.isValid()) {
|
if (mi.isValid()) {
|
||||||
address = mi.toAddress();
|
address = mi.toAddress();
|
||||||
if (exp.isEmpty()) {
|
if (exp.isEmpty()) {
|
||||||
if (iname.startsWith("local.") && iname.count('.') == 1)
|
if (iname.startsWith(inameLocal) && iname.count('.') == 1)
|
||||||
// Solve one common case of adding 'class' in
|
// Solve one common case of adding 'class' in
|
||||||
// *(class X*)0xdeadbeef for gdb.
|
// *(class X*)0xdeadbeef for gdb.
|
||||||
exp = name;
|
exp = name;
|
||||||
@@ -505,7 +509,7 @@ bool WatchItem::isLocal() const
|
|||||||
if (arrayIndex >= 0)
|
if (arrayIndex >= 0)
|
||||||
if (const WatchItem *p = parent())
|
if (const WatchItem *p = parent())
|
||||||
return p->isLocal();
|
return p->isLocal();
|
||||||
return iname.startsWith("local.");
|
return iname.startsWith(inameLocal);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WatchItem::isWatcher() const
|
bool WatchItem::isWatcher() const
|
||||||
@@ -513,7 +517,7 @@ bool WatchItem::isWatcher() const
|
|||||||
if (arrayIndex >= 0)
|
if (arrayIndex >= 0)
|
||||||
if (const WatchItem *p = parent())
|
if (const WatchItem *p = parent())
|
||||||
return p->isWatcher();
|
return p->isWatcher();
|
||||||
return iname.startsWith("watch.");
|
return iname.startsWith(inameWatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WatchItem::isInspect() const
|
bool WatchItem::isInspect() const
|
||||||
@@ -521,7 +525,7 @@ bool WatchItem::isInspect() const
|
|||||||
if (arrayIndex >= 0)
|
if (arrayIndex >= 0)
|
||||||
if (const WatchItem *p = parent())
|
if (const WatchItem *p = parent())
|
||||||
return p->isInspect();
|
return p->isInspect();
|
||||||
return iname.startsWith("inspect.");
|
return iname.startsWith(inameInspect);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString WatchItem::internalName() const
|
QString WatchItem::internalName() const
|
||||||
|
Reference in New Issue
Block a user