forked from qt-creator/qt-creator
Debugger: Remove unused WatchItem::state flag
Lately it was only set and read for debugging purposes. A mechanism similar to the ChildrenNeeded state is still needed and available through WatchItem::wantsChildren. Change-Id: I78c85d65bc35810be420bd0418db9675473697cd Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
@@ -615,7 +615,6 @@ void QmlInspectorAgent::addWatchData(const ObjectReference &obj,
|
|||||||
objWatch->type = obj.className();
|
objWatch->type = obj.className();
|
||||||
objWatch->value = "object";
|
objWatch->value = "object";
|
||||||
objWatch->wantsChildren = true;
|
objWatch->wantsChildren = true;
|
||||||
objWatch->setAllUnneeded();
|
|
||||||
|
|
||||||
m_qmlEngine->watchHandler()->insertItem(objWatch);
|
m_qmlEngine->watchHandler()->insertItem(objWatch);
|
||||||
addObjectWatch(objWatch->id);
|
addObjectWatch(objWatch->id);
|
||||||
@@ -645,7 +644,6 @@ void QmlInspectorAgent::addWatchData(const ObjectReference &obj,
|
|||||||
propertiesWatch->id = objDebugId;
|
propertiesWatch->id = objDebugId;
|
||||||
propertiesWatch->value = "list";
|
propertiesWatch->value = "list";
|
||||||
propertiesWatch->wantsChildren = true;
|
propertiesWatch->wantsChildren = true;
|
||||||
propertiesWatch->setAllUnneeded();
|
|
||||||
|
|
||||||
foreach (const PropertyReference &property, obj.properties()) {
|
foreach (const PropertyReference &property, obj.properties()) {
|
||||||
const QString propertyName = property.name();
|
const QString propertyName = property.name();
|
||||||
@@ -659,7 +657,6 @@ void QmlInspectorAgent::addWatchData(const ObjectReference &obj,
|
|||||||
propertyWatch->type = property.valueTypeName();
|
propertyWatch->type = property.valueTypeName();
|
||||||
propertyWatch->value = property.value().toString();
|
propertyWatch->value = property.value().toString();
|
||||||
propertyWatch->wantsChildren = false;
|
propertyWatch->wantsChildren = false;
|
||||||
propertyWatch->setAllUnneeded();
|
|
||||||
propertiesWatch->appendChild(propertyWatch);
|
propertiesWatch->appendChild(propertyWatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -109,7 +109,6 @@ bool isIntOrFloatType(const QString &type)
|
|||||||
|
|
||||||
WatchItem::WatchItem() :
|
WatchItem::WatchItem() :
|
||||||
id(WatchItem::InvalidId),
|
id(WatchItem::InvalidId),
|
||||||
state(InitialState),
|
|
||||||
address(0),
|
address(0),
|
||||||
origaddr(0),
|
origaddr(0),
|
||||||
size(0),
|
size(0),
|
||||||
@@ -135,7 +134,6 @@ bool WatchItem::isVTablePointer() const
|
|||||||
|
|
||||||
void WatchItem::setError(const QString &msg)
|
void WatchItem::setError(const QString &msg)
|
||||||
{
|
{
|
||||||
setAllUnneeded();
|
|
||||||
value = msg;
|
value = msg;
|
||||||
wantsChildren = false;
|
wantsChildren = false;
|
||||||
valueEnabled = false;
|
valueEnabled = false;
|
||||||
@@ -178,8 +176,6 @@ void WatchItem::setValue(const QString &value0)
|
|||||||
// column. No need to duplicate it here.
|
// column. No need to duplicate it here.
|
||||||
if (value.startsWith('(' + type + ") 0x"))
|
if (value.startsWith('(' + type + ") 0x"))
|
||||||
value = value.section(QLatin1Char(' '), -1, -1);
|
value = value.section(QLatin1Char(' '), -1, -1);
|
||||||
|
|
||||||
setValueUnneeded();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum GuessChildrenResult { HasChildren, HasNoChildren, HasPossiblyChildren };
|
enum GuessChildrenResult { HasChildren, HasNoChildren, HasPossiblyChildren };
|
||||||
@@ -257,8 +253,6 @@ QString WatchItem::toString() const
|
|||||||
if (!exp.isEmpty())
|
if (!exp.isEmpty())
|
||||||
str << "exp=\"" << exp << doubleQuoteComma;
|
str << "exp=\"" << exp << doubleQuoteComma;
|
||||||
|
|
||||||
if (isValueNeeded())
|
|
||||||
str << "value=<needed>,";
|
|
||||||
if (!value.isEmpty())
|
if (!value.isEmpty())
|
||||||
str << "value=\"" << value << doubleQuoteComma;
|
str << "value=\"" << value << doubleQuoteComma;
|
||||||
|
|
||||||
@@ -272,8 +266,6 @@ QString WatchItem::toString() const
|
|||||||
|
|
||||||
str << "wantsChildren=\"" << (wantsChildren ? "true" : "false") << doubleQuoteComma;
|
str << "wantsChildren=\"" << (wantsChildren ? "true" : "false") << doubleQuoteComma;
|
||||||
|
|
||||||
if (isChildrenNeeded())
|
|
||||||
str << "children=<needed>,";
|
|
||||||
str.flush();
|
str.flush();
|
||||||
if (res.endsWith(QLatin1Char(',')))
|
if (res.endsWith(QLatin1Char(',')))
|
||||||
res.truncate(res.size() - 1);
|
res.truncate(res.size() - 1);
|
||||||
@@ -340,7 +332,6 @@ public:
|
|||||||
child->type = childType;
|
child->type = childType;
|
||||||
child->address = addrbase + i * addrstep;
|
child->address = addrbase + i * addrstep;
|
||||||
child->valueEditable = true;
|
child->valueEditable = true;
|
||||||
child->setAllUnneeded();
|
|
||||||
item->appendChild(child);
|
item->appendChild(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -404,8 +395,6 @@ static bool sortByName(const WatchItem *a, const WatchItem *b)
|
|||||||
|
|
||||||
void WatchItem::parseHelper(const GdbMi &input, bool maySort)
|
void WatchItem::parseHelper(const GdbMi &input, bool maySort)
|
||||||
{
|
{
|
||||||
setChildrenUnneeded();
|
|
||||||
|
|
||||||
GdbMi mi = input["type"];
|
GdbMi mi = input["type"];
|
||||||
if (mi.isValid())
|
if (mi.isValid())
|
||||||
setType(mi.data());
|
setType(mi.data());
|
||||||
@@ -445,11 +434,8 @@ void WatchItem::parseHelper(const GdbMi &input, bool maySort)
|
|||||||
|
|
||||||
mi = input["value"];
|
mi = input["value"];
|
||||||
QString enc = input["valueencoded"].data();
|
QString enc = input["valueencoded"].data();
|
||||||
if (mi.isValid() || !enc.isEmpty()) {
|
if (mi.isValid() || !enc.isEmpty())
|
||||||
setValue(decodeData(mi.data(), enc));
|
setValue(decodeData(mi.data(), enc));
|
||||||
} else {
|
|
||||||
setValueNeeded();
|
|
||||||
}
|
|
||||||
|
|
||||||
mi = input["size"];
|
mi = input["size"];
|
||||||
if (mi.isValid())
|
if (mi.isValid())
|
||||||
|
|||||||
@@ -60,26 +60,9 @@ public:
|
|||||||
|
|
||||||
WatchItem *parentItem() const;
|
WatchItem *parentItem() const;
|
||||||
|
|
||||||
enum State
|
|
||||||
{
|
|
||||||
ValueNeeded = 2,
|
|
||||||
ChildrenNeeded = 8,
|
|
||||||
|
|
||||||
InitialState = ValueNeeded | ChildrenNeeded
|
|
||||||
};
|
|
||||||
|
|
||||||
static const qint64 InvalidId = -1;
|
static const qint64 InvalidId = -1;
|
||||||
|
|
||||||
void setAllUnneeded() { state = State(0); }
|
void setHasChildren(bool c) { wantsChildren = c; }
|
||||||
|
|
||||||
bool isValueNeeded() const { return state & ValueNeeded; }
|
|
||||||
void setValueNeeded() { state = State(state | ValueNeeded); }
|
|
||||||
void setValueUnneeded() { state = State(state & ~ValueNeeded); }
|
|
||||||
|
|
||||||
bool isChildrenNeeded() const { return state & ChildrenNeeded; }
|
|
||||||
void setChildrenNeeded() { state = State(state | ChildrenNeeded); }
|
|
||||||
void setChildrenUnneeded() { state = State(state & ~ChildrenNeeded); }
|
|
||||||
void setHasChildren(bool c) { wantsChildren = c; if (!c) setChildrenUnneeded(); }
|
|
||||||
|
|
||||||
bool isValid() const { return !iname.isEmpty(); }
|
bool isValid() const { return !iname.isEmpty(); }
|
||||||
bool isVTablePointer() const;
|
bool isVTablePointer() const;
|
||||||
@@ -99,7 +82,6 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
qint64 id; // Token for the engine for internal mapping
|
qint64 id; // Token for the engine for internal mapping
|
||||||
qint32 state; // 'needed' flags;
|
|
||||||
QString iname; // Internal name sth like 'local.baz.public.a'
|
QString iname; // Internal name sth like 'local.baz.public.a'
|
||||||
QString exp; // The expression
|
QString exp; // The expression
|
||||||
QString name; // Displayed name
|
QString name; // Displayed name
|
||||||
|
|||||||
@@ -1220,12 +1220,10 @@ void WatchModel::fetchMore(const QModelIndex &idx)
|
|||||||
WatchItem *item = nonRootItemForIndex(idx);
|
WatchItem *item = nonRootItemForIndex(idx);
|
||||||
if (item) {
|
if (item) {
|
||||||
m_expandedINames.insert(item->iname);
|
m_expandedINames.insert(item->iname);
|
||||||
if (item->children().isEmpty()) {
|
if (item->children().isEmpty())
|
||||||
item->setChildrenNeeded();
|
|
||||||
m_engine->expandItem(item->iname);
|
m_engine->expandItem(item->iname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool WatchModel::hasChildren(const QModelIndex &idx) const
|
bool WatchModel::hasChildren(const QModelIndex &idx) const
|
||||||
{
|
{
|
||||||
@@ -2088,7 +2086,6 @@ void WatchHandler::watchExpression(const QString &exp, const QString &name)
|
|||||||
saveWatchers();
|
saveWatchers();
|
||||||
|
|
||||||
if (m_model->m_engine->state() == DebuggerNotReady) {
|
if (m_model->m_engine->state() == DebuggerNotReady) {
|
||||||
item->setAllUnneeded();
|
|
||||||
item->setValue(QString(QLatin1Char(' ')));
|
item->setValue(QString(QLatin1Char(' ')));
|
||||||
item->update();
|
item->update();
|
||||||
} else {
|
} else {
|
||||||
@@ -2111,7 +2108,6 @@ void WatchHandler::updateWatchExpression(WatchItem *item, const QString &newExp)
|
|||||||
|
|
||||||
saveWatchers();
|
saveWatchers();
|
||||||
if (m_model->m_engine->state() == DebuggerNotReady) {
|
if (m_model->m_engine->state() == DebuggerNotReady) {
|
||||||
item->setAllUnneeded();
|
|
||||||
item->setValue(QString(QLatin1Char(' ')));
|
item->setValue(QString(QLatin1Char(' ')));
|
||||||
item->update();
|
item->update();
|
||||||
} else {
|
} else {
|
||||||
@@ -2290,12 +2286,10 @@ void WatchHandler::fetchMore(const QString &iname) const
|
|||||||
{
|
{
|
||||||
if (WatchItem *item = m_model->findItem(iname)) {
|
if (WatchItem *item = m_model->findItem(iname)) {
|
||||||
m_model->m_expandedINames.insert(iname);
|
m_model->m_expandedINames.insert(iname);
|
||||||
if (item->children().isEmpty()) {
|
if (item->children().isEmpty())
|
||||||
item->setChildrenNeeded();
|
|
||||||
m_model->m_engine->expandItem(iname);
|
m_model->m_engine->expandItem(iname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
WatchItem *WatchHandler::findItem(const QString &iname) const
|
WatchItem *WatchHandler::findItem(const QString &iname) const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user