OpenCoverage

qv4datacollector.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7QV4::CppStackFrame *QV4DataCollector::findFrame(int frame)-
8{-
9 QV4::CppStackFrame *f = engine()->currentStackFrame;-
10 while (f
fDescription
TRUEevaluated 1544 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEnever evaluated
&& frame
frameDescription
TRUEevaluated 1200 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 344 times by 1 test
Evaluated by:
  • tst_qv4debugger
) {
0-1544
11 --frame;-
12 f = f->parent;-
13 }
executed 1200 times by 1 test: end of block
Executed by:
  • tst_qv4debugger
1200
14 return
executed 344 times by 1 test: return f;
Executed by:
  • tst_qv4debugger
f;
executed 344 times by 1 test: return f;
Executed by:
  • tst_qv4debugger
344
15}-
16-
17QV4::Heap::ExecutionContext *QV4DataCollector::findContext(int frame)-
18{-
19 QV4::CppStackFrame *f = findFrame(frame);-
20-
21 return
executed 172 times by 1 test: return f ? f->context()->d() : nullptr;
Executed by:
  • tst_qv4debugger
f ? f->context()->d() : nullptr;
executed 172 times by 1 test: return f ? f->context()->d() : nullptr;
Executed by:
  • tst_qv4debugger
172
22}-
23-
24QV4::Heap::ExecutionContext *QV4DataCollector::findScope(QV4::Heap::ExecutionContext *ctx, int scope)-
25{-
26 for (; scope > 0
scope > 0Description
TRUEevaluated 60 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_qv4debugger
&& ctx
ctxDescription
TRUEevaluated 60 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEnever evaluated
; --scope)
0-72
27 ctx = ctx->outer;
executed 60 times by 1 test: ctx = ctx->outer;
Executed by:
  • tst_qv4debugger
60
28-
29 return
executed 72 times by 1 test: return ctx;
Executed by:
  • tst_qv4debugger
ctx;
executed 72 times by 1 test: return ctx;
Executed by:
  • tst_qv4debugger
72
30}-
31-
32QVector<QV4::Heap::ExecutionContext::ContextType> QV4DataCollector::getScopeTypes(int frame)-
33{-
34 QVector<QV4::Heap::ExecutionContext::ContextType> types;-
35-
36 QV4::Heap::ExecutionContext *it = findFrame(frame)->context()->d();-
37-
38 for (; it
itDescription
TRUEevaluated 436 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 172 times by 1 test
Evaluated by:
  • tst_qv4debugger
; it = it->outer)
172-436
39 types.append(QV4::Heap::ExecutionContext::ContextType(it->type));
executed 436 times by 1 test: types.append(QV4::Heap::ExecutionContext::ContextType(it->type));
Executed by:
  • tst_qv4debugger
436
40-
41 return
executed 172 times by 1 test: return types;
Executed by:
  • tst_qv4debugger
types;
executed 172 times by 1 test: return types;
Executed by:
  • tst_qv4debugger
172
42}-
43-
44int QV4DataCollector::encodeScopeType(QV4::Heap::ExecutionContext::ContextType scopeType)-
45{-
46 switch (scopeType) {-
47 case
executed 100 times by 1 test: case QV4::Heap::ExecutionContext::Type_GlobalContext:
Executed by:
  • tst_qv4debugger
QV4::Heap::ExecutionContext::Type_GlobalContext:
executed 100 times by 1 test: case QV4::Heap::ExecutionContext::Type_GlobalContext:
Executed by:
  • tst_qv4debugger
100
48 break;
executed 100 times by 1 test: break;
Executed by:
  • tst_qv4debugger
100
49 case
never executed: case QV4::Heap::ExecutionContext::Type_WithContext:
QV4::Heap::ExecutionContext::Type_WithContext:
never executed: case QV4::Heap::ExecutionContext::Type_WithContext:
0
50 return
never executed: return 2;
2;
never executed: return 2;
0
51 case
executed 144 times by 1 test: case QV4::Heap::ExecutionContext::Type_CallContext:
Executed by:
  • tst_qv4debugger
QV4::Heap::ExecutionContext::Type_CallContext:
executed 144 times by 1 test: case QV4::Heap::ExecutionContext::Type_CallContext:
Executed by:
  • tst_qv4debugger
144
52 return
executed 144 times by 1 test: return 1;
Executed by:
  • tst_qv4debugger
1;
executed 144 times by 1 test: return 1;
Executed by:
  • tst_qv4debugger
144
53 case
never executed: case QV4::Heap::ExecutionContext::Type_QmlContext:
QV4::Heap::ExecutionContext::Type_QmlContext:
never executed: case QV4::Heap::ExecutionContext::Type_QmlContext:
0
54 return
never executed: return 3;
3;
never executed: return 3;
0
55 case
executed 60 times by 1 test: case QV4::Heap::ExecutionContext::Type_BlockContext:
Executed by:
  • tst_qv4debugger
QV4::Heap::ExecutionContext::Type_BlockContext:
executed 60 times by 1 test: case QV4::Heap::ExecutionContext::Type_BlockContext:
Executed by:
  • tst_qv4debugger
60
56 return
executed 60 times by 1 test: return 4;
Executed by:
  • tst_qv4debugger
4;
executed 60 times by 1 test: return 4;
Executed by:
  • tst_qv4debugger
60
57 }-
58 return
executed 100 times by 1 test: return 0;
Executed by:
  • tst_qv4debugger
0;
executed 100 times by 1 test: return 0;
Executed by:
  • tst_qv4debugger
100
59}-
60-
61QV4DataCollector::QV4DataCollector(QV4::ExecutionEngine *engine)-
62 : m_engine(engine), m_namesAsObjects(true), m_redundantRefs(true)-
63{-
64 m_values.set(engine, engine->newArrayObject());-
65}
executed 194 times by 3 tests: end of block
Executed by:
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qv4debugger
194
66-
67-
68QV4DataCollector::Ref QV4DataCollector::collect(const QV4::ScopedValue &value)-
69{-
70 Ref ref = addRef(value);-
71 if (m_redundantRefs
m_redundantRefsDescription
TRUEevaluated 134 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 110 times by 1 test
Evaluated by:
  • tst_qv4debugger
)
110-134
72 m_collectedRefs.append(ref);
executed 134 times by 1 test: m_collectedRefs.append(ref);
Executed by:
  • tst_qv4debugger
134
73 return
executed 244 times by 1 test: return ref;
Executed by:
  • tst_qv4debugger
ref;
executed 244 times by 1 test: return ref;
Executed by:
  • tst_qv4debugger
244
74}-
75-
76const QV4::Object *collectProperty(const QV4::ScopedValue &value, QV4::ExecutionEngine *engine,-
77 QJsonObject &dict)-
78{-
79 QV4::Scope scope(engine);-
80 QV4::ScopedValue typeString(scope, QV4::Runtime::method_typeofValue(engine, value));-
81 dict.insert(([]() noexcept -> QString { enum { Size = sizeof(u"" "type")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "type" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 684 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
qstring_literal_temp;
executed 684 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
}()), typeString->toQStringNoThrow());
684
82-
83 const QLatin1String valueKey("value");-
84 switch (value->type()) {-
85 case
never executed: case QV4::Value::Empty_Type:
QV4::Value::Empty_Type:
never executed: case QV4::Value::Empty_Type:
0
86 ((!"empty Value encountered") ? static_cast<void>(0) : qt_assert("!\"empty Value encountered\"", __FILE__, 138));-
87 return
never executed: return nullptr;
nullptr;
never executed: return nullptr;
0
88 case
executed 24 times by 1 test: case QV4::Value::Undefined_Type:
Executed by:
  • tst_qv4debugger
QV4::Value::Undefined_Type:
executed 24 times by 1 test: case QV4::Value::Undefined_Type:
Executed by:
  • tst_qv4debugger
24
89 dict.insert(valueKey, QJsonValue::Undefined);-
90 return
executed 24 times by 1 test: return nullptr;
Executed by:
  • tst_qv4debugger
nullptr;
executed 24 times by 1 test: return nullptr;
Executed by:
  • tst_qv4debugger
24
91 case
executed 12 times by 1 test: case QV4::Value::Null_Type:
Executed by:
  • tst_qv4debugger
QV4::Value::Null_Type:
executed 12 times by 1 test: case QV4::Value::Null_Type:
Executed by:
  • tst_qv4debugger
12
92 dict.insert(valueKey, QJsonValue::Null);-
93 return
executed 12 times by 1 test: return nullptr;
Executed by:
  • tst_qv4debugger
nullptr;
executed 12 times by 1 test: return nullptr;
Executed by:
  • tst_qv4debugger
12
94 case
never executed: case QV4::Value::Boolean_Type:
QV4::Value::Boolean_Type:
never executed: case QV4::Value::Boolean_Type:
0
95 dict.insert(valueKey, value->booleanValue());-
96 return
never executed: return nullptr;
nullptr;
never executed: return nullptr;
0
97 case
executed 346 times by 1 test: case QV4::Value::Managed_Type:
Executed by:
  • tst_qv4debugger
QV4::Value::Managed_Type:
executed 346 times by 1 test: case QV4::Value::Managed_Type:
Executed by:
  • tst_qv4debugger
346
98 if (const
const QV4::Str...QV4::String>()Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 332 times by 1 test
Evaluated by:
  • tst_qv4debugger
QV4::String *s = value->as<QV4::String>()
const QV4::Str...QV4::String>()Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 332 times by 1 test
Evaluated by:
  • tst_qv4debugger
) {
14-332
99 dict.insert(valueKey, s->toQString());-
100 }
executed 14 times by 1 test: end of block
Executed by:
  • tst_qv4debugger
else if (const
const QV4::Arr...ArrayObject>()Description
TRUEnever evaluated
FALSEevaluated 332 times by 1 test
Evaluated by:
  • tst_qv4debugger
QV4::ArrayObject *a = value->as<QV4::ArrayObject>()
const QV4::Arr...ArrayObject>()Description
TRUEnever evaluated
FALSEevaluated 332 times by 1 test
Evaluated by:
  • tst_qv4debugger
) {
0-332
101-
102-
103 dict.insert(valueKey, qint64(a->getLength()));-
104 return
never executed: return a;
a;
never executed: return a;
0
105 } else if (const
const QV4::Obj...QV4::Object>()Description
TRUEevaluated 332 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEnever evaluated
QV4::Object *o = value->as<QV4::Object>()
const QV4::Obj...QV4::Object>()Description
TRUEevaluated 332 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEnever evaluated
) {
0-332
106 int numProperties = 0;-
107 QV4::ObjectIterator it(scope, o, QV4::ObjectIterator::EnumerableOnly);-
108 QV4::PropertyAttributes attrs;-
109 uint index;-
110 QV4::ScopedProperty p(scope);-
111 QV4::ScopedString name(scope);-
112 while (true) {-
113 it.next(name.getRef(), &index, p, &attrs);-
114 if (attrs.isEmpty()
attrs.isEmpty()Description
TRUEevaluated 332 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 414 times by 1 test
Evaluated by:
  • tst_qv4debugger
)
332-414
115 break;
executed 332 times by 1 test: break;
Executed by:
  • tst_qv4debugger
332
116 else-
117 ++
executed 414 times by 1 test: ++numProperties;
Executed by:
  • tst_qv4debugger
numProperties;
executed 414 times by 1 test: ++numProperties;
Executed by:
  • tst_qv4debugger
414
118 }-
119 dict.insert(valueKey, numProperties);-
120 return
executed 332 times by 1 test: return o;
Executed by:
  • tst_qv4debugger
o;
executed 332 times by 1 test: return o;
Executed by:
  • tst_qv4debugger
332
121 } else {-
122 do { ((false) ? static_cast<void>(0) : qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached", __FILE__, 174)); __builtin_unreachable(); } while (false);-
123 }
never executed: end of block
0
124 return
executed 14 times by 1 test: return nullptr;
Executed by:
  • tst_qv4debugger
nullptr;
executed 14 times by 1 test: return nullptr;
Executed by:
  • tst_qv4debugger
14
125 case
executed 302 times by 1 test: case QV4::Value::Integer_Type:
Executed by:
  • tst_qv4debugger
QV4::Value::Integer_Type:
executed 302 times by 1 test: case QV4::Value::Integer_Type:
Executed by:
  • tst_qv4debugger
302
126 dict.insert(valueKey, value->integerValue());-
127 return
executed 302 times by 1 test: return nullptr;
Executed by:
  • tst_qv4debugger
nullptr;
executed 302 times by 1 test: return nullptr;
Executed by:
  • tst_qv4debugger
302
128 default
never executed: default:
:
never executed: default:
{
0
129 const double val = value->doubleValue();-
130 if (qIsFinite(val)
qIsFinite(val)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
131 dict.insert(valueKey, val);
never executed: dict.insert(valueKey, val);
0
132 else if (qIsNaN(val)
qIsNaN(val)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
133 dict.insert(valueKey, ([]() noexcept -> QString { enum { Size = sizeof(u"" "NaN")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "NaN" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
never executed: return qstring_literal_temp;
qstring_literal_temp;
never executed: return qstring_literal_temp;
}()));
never executed: dict.insert(valueKey, ([]() noexcept -> QString { enum { Size = sizeof(u"" "NaN")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "NaN" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()));
0
134 else if (val < 0
val < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
135 dict.insert(valueKey, ([]() noexcept -> QString { enum { Size = sizeof(u"" "-Infinity")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "-Infinity" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
never executed: return qstring_literal_temp;
qstring_literal_temp;
never executed: return qstring_literal_temp;
}()));
never executed: dict.insert(valueKey, ([]() noexcept -> QString { enum { Size = sizeof(u"" "-Infinity")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "-Infinity" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()));
0
136 else-
137 dict.insert(valueKey, ([]() noexcept -> QString { enum { Size = sizeof(u"" "Infinity")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Infinity" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
never executed: return qstring_literal_temp;
qstring_literal_temp;
never executed: return qstring_literal_temp;
}()));
never executed: dict.insert(valueKey, ([]() noexcept -> QString { enum { Size = sizeof(u"" "Infinity")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Infinity" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()));
0
138 return
never executed: return nullptr;
nullptr;
never executed: return nullptr;
0
139 }-
140 }-
141}-
142-
143QJsonObject QV4DataCollector::lookupRef(Ref ref, bool deep)-
144{-
145 QJsonObject dict;-
146-
147 if (m_namesAsObjects
m_namesAsObjectsDescription
TRUEevaluated 426 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEnever evaluated
) {
0-426
148 if (lookupSpecialRef(ref, &dict)
lookupSpecialRef(ref, &dict)Description
TRUEevaluated 116 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 310 times by 1 test
Evaluated by:
  • tst_qv4debugger
)
116-310
149 return
executed 116 times by 1 test: return dict;
Executed by:
  • tst_qv4debugger
dict;
executed 116 times by 1 test: return dict;
Executed by:
  • tst_qv4debugger
116
150 }
executed 310 times by 1 test: end of block
Executed by:
  • tst_qv4debugger
310
151-
152 if (m_redundantRefs
m_redundantRefsDescription
TRUEevaluated 266 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_qv4debugger
)
44-266
153 deep = true;
executed 266 times by 1 test: deep = true;
Executed by:
  • tst_qv4debugger
266
154-
155 dict.insert(([]() noexcept -> QString { enum { Size = sizeof(u"" "handle")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "handle" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 310 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
qstring_literal_temp;
executed 310 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
}()), qint64(ref));
310
156 QV4::Scope scope(engine());-
157 QV4::ScopedValue value(scope, getValue(ref));-
158-
159 const QV4::Object *object = collectProperty(value, engine(), dict);-
160 if (deep
deepDescription
TRUEevaluated 310 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEnever evaluated
&& object
objectDescription
TRUEevaluated 204 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 106 times by 1 test
Evaluated by:
  • tst_qv4debugger
)
0-310
161 dict.insert(([]() noexcept -> QString { enum { Size = sizeof(u"" "properties")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "properties" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 204 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
qstring_literal_temp;
executed 204 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
}()), collectProperties(object));
executed 204 times by 1 test: dict.insert(([]() noexcept -> QString { enum { Size = sizeof(u"" "properties")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "properties" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()), collectProperties(object));
Executed by:
  • tst_qv4debugger
204
162-
163 return
executed 310 times by 1 test: return dict;
Executed by:
  • tst_qv4debugger
dict;
executed 310 times by 1 test: return dict;
Executed by:
  • tst_qv4debugger
310
164}-
165-
166-
167QV4DataCollector::Ref QV4DataCollector::addFunctionRef(const QString &functionName)-
168{-
169 ((m_namesAsObjects) ? static_cast<void>(0) : qt_assert("m_namesAsObjects", __FILE__, 221));-
170 Ref ref = addRef(QV4::Primitive::emptyValue(), false);-
171-
172 QJsonObject dict;-
173 dict.insert(([]() noexcept -> QString { enum { Size = sizeof(u"" "handle")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "handle" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 100 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
qstring_literal_temp;
executed 100 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
}()), qint64(ref));
100
174 dict.insert(([]() noexcept -> QString { enum { Size = sizeof(u"" "type")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "type" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 100 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
qstring_literal_temp;
executed 100 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
}()), ([]() noexcept -> QString { enum { Size = sizeof(u"" "function")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "function" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 100 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
qstring_literal_temp;
executed 100 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
}()));
100
175 dict.insert(([]() noexcept -> QString { enum { Size = sizeof(u"" "name")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "name" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 100 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
qstring_literal_temp;
executed 100 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
}()), functionName);
100
176 m_specialRefs.insert(ref, dict);-
177 m_collectedRefs.append(ref);-
178-
179 return
executed 100 times by 1 test: return ref;
Executed by:
  • tst_qv4debugger
ref;
executed 100 times by 1 test: return ref;
Executed by:
  • tst_qv4debugger
100
180}-
181-
182-
183QV4DataCollector::Ref QV4DataCollector::addScriptRef(const QString &scriptName)-
184{-
185 ((m_namesAsObjects) ? static_cast<void>(0) : qt_assert("m_namesAsObjects", __FILE__, 237));-
186 Ref ref = addRef(QV4::Primitive::emptyValue(), false);-
187-
188 QJsonObject dict;-
189 dict.insert(([]() noexcept -> QString { enum { Size = sizeof(u"" "handle")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "handle" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 100 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
qstring_literal_temp;
executed 100 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
}()), qint64(ref));
100
190 dict.insert(([]() noexcept -> QString { enum { Size = sizeof(u"" "type")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "type" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 100 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
qstring_literal_temp;
executed 100 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
}()), ([]() noexcept -> QString { enum { Size = sizeof(u"" "script")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "script" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 100 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
qstring_literal_temp;
executed 100 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
}()));
100
191 dict.insert(([]() noexcept -> QString { enum { Size = sizeof(u"" "name")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "name" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 100 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
qstring_literal_temp;
executed 100 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
}()), scriptName);
100
192 m_specialRefs.insert(ref, dict);-
193 m_collectedRefs.append(ref);-
194-
195 return
executed 100 times by 1 test: return ref;
Executed by:
  • tst_qv4debugger
ref;
executed 100 times by 1 test: return ref;
Executed by:
  • tst_qv4debugger
100
196}-
197-
198bool QV4DataCollector::isValidRef(QV4DataCollector::Ref ref) const-
199{-
200 QV4::Scope scope(engine());-
201 QV4::ScopedObject array(scope, m_values.value());-
202 return
never executed: return ref < array->getLength();
ref < array->getLength();
never executed: return ref < array->getLength();
0
203}-
204-
205bool QV4DataCollector::collectScope(QJsonObject *dict, int frameNr, int scopeNr)-
206{-
207 QV4::Scope scope(engine());-
208-
209 QV4::Scoped<QV4::ExecutionContext> ctxt(scope, findScope(findContext(frameNr), scopeNr));-
210 if (!ctxt
!ctxtDescription
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_qv4debugger
)
0-72
211 return
never executed: return false;
false;
never executed: return false;
0
212-
213 QV4::ScopedObject scopeObject(scope, engine()->newObject());-
214 if (ctxt->d()->type == QV4::Heap::ExecutionContext::Type_CallContext
ctxt->d()->typ...pe_CallContextDescription
TRUEevaluated 72 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEnever evaluated
) {
0-72
215 QStringList names;-
216 Refs collectedRefs;-
217-
218 QV4::ScopedValue v(scope);-
219 QV4::Heap::InternalClass *ic = ctxt->internalClass();-
220 for (uint i = 0; i < ic->size
i < ic->sizeDescription
TRUEevaluated 224 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_qv4debugger
; ++i) {
72-224
221 QString name = ic->nameMap[i].toQString();-
222 names.append(name);-
223 v = static_cast<QV4::Heap::CallContext *>(ctxt->d())->locals[i];-
224 collectedRefs.append(collect(v));-
225 }
executed 224 times by 1 test: end of block
Executed by:
  • tst_qv4debugger
224
226-
227 ((names.size() == collectedRefs.size()) ? static_cast<void>(0) : qt_assert("names.size() == collectedRefs.size()", __FILE__, 279));-
228 QV4::ScopedString propName(scope);-
229 for (int i = 0, ei = collectedRefs.size(); i != ei
i != eiDescription
TRUEevaluated 224 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_qv4debugger
; ++i) {
72-224
230 propName = engine()->newString(names.at(i));-
231 scopeObject->put(propName, (v = getValue(collectedRefs.at(i))));-
232 }
executed 224 times by 1 test: end of block
Executed by:
  • tst_qv4debugger
224
233 }
executed 72 times by 1 test: end of block
Executed by:
  • tst_qv4debugger
72
234-
235 Ref scopeObjectRef = addRef(scopeObject);-
236 if (m_redundantRefs
m_redundantRefsDescription
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_qv4debugger
) {
32-40
237 dict->insert(([]() noexcept -> QString { enum { Size = sizeof(u"" "ref")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "ref" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 40 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
qstring_literal_temp;
executed 40 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
}()), qint64(scopeObjectRef));
40
238 m_collectedRefs.append(scopeObjectRef);-
239 }
executed 40 times by 1 test: end of block
Executed by:
  • tst_qv4debugger
else {
40
240 *dict = lookupRef(scopeObjectRef, true);-
241 }
executed 32 times by 1 test: end of block
Executed by:
  • tst_qv4debugger
32
242-
243 return
executed 72 times by 1 test: return true;
Executed by:
  • tst_qv4debugger
true;
executed 72 times by 1 test: return true;
Executed by:
  • tst_qv4debugger
72
244}-
245-
246QJsonObject toRef(QV4DataCollector::Ref ref) {-
247 QJsonObject dict;-
248 dict.insert(([]() noexcept -> QString { enum { Size = sizeof(u"" "ref")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "ref" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 200 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
qstring_literal_temp;
executed 200 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
}()), qint64(ref));
200
249 return
executed 200 times by 1 test: return dict;
Executed by:
  • tst_qv4debugger
dict;
executed 200 times by 1 test: return dict;
Executed by:
  • tst_qv4debugger
200
250}-
251-
252QJsonObject QV4DataCollector::buildFrame(const QV4::StackFrame &stackFrame, int frameNr)-
253{-
254 QJsonObject frame;-
255 frame[QLatin1String("index")] = frameNr;-
256 frame[QLatin1String("debuggerFrame")] = false;-
257 if (m_namesAsObjects
m_namesAsObjectsDescription
TRUEevaluated 100 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEnever evaluated
) {
0-100
258 frame[QLatin1String("func")] = toRef(addFunctionRef(stackFrame.function));-
259 frame[QLatin1String("script")] = toRef(addScriptRef(stackFrame.source));-
260 }
executed 100 times by 1 test: end of block
Executed by:
  • tst_qv4debugger
else {
100
261 frame[QLatin1String("func")] = stackFrame.function;-
262 frame[QLatin1String("script")] = stackFrame.source;-
263 }
never executed: end of block
0
264 frame[QLatin1String("line")] = stackFrame.line - 1;-
265 if (stackFrame.column >= 0
stackFrame.column >= 0Description
TRUEnever evaluated
FALSEevaluated 100 times by 1 test
Evaluated by:
  • tst_qv4debugger
)
0-100
266 frame[QLatin1String("column")] = stackFrame.column;
never executed: frame[QLatin1String("column")] = stackFrame.column;
0
267-
268 QJsonArray scopes;-
269 QV4::Scope scope(engine());-
270 QV4::ScopedContext ctxt(scope, findContext(frameNr));-
271 while (ctxt
ctxtDescription
TRUEevaluated 232 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 100 times by 1 test
Evaluated by:
  • tst_qv4debugger
) {
100-232
272 if (QV4::CallContext *cCtxt = ctxt->asCallContext()
QV4::CallConte...sCallContext()Description
TRUEevaluated 72 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 160 times by 1 test
Evaluated by:
  • tst_qv4debugger
) {
72-160
273 if (cCtxt->d()->activation
cCtxt->d()->activationDescription
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_qv4debugger
)
0-72
274 break;
never executed: break;
0
275 }
executed 72 times by 1 test: end of block
Executed by:
  • tst_qv4debugger
72
276 ctxt = ctxt->d()->outer;-
277 }
executed 232 times by 1 test: end of block
Executed by:
  • tst_qv4debugger
232
278-
279 if (ctxt
ctxtDescription
TRUEnever evaluated
FALSEevaluated 100 times by 1 test
Evaluated by:
  • tst_qv4debugger
) {
0-100
280 QV4::ScopedValue o(scope, ctxt->d()->activation);-
281 frame[QLatin1String("receiver")] = toRef(collect(o));-
282 }
never executed: end of block
0
283-
284-
285 QVector<QV4::Heap::ExecutionContext::ContextType> scopeTypes = getScopeTypes(frameNr);-
286 for (int i = 0, ei = scopeTypes.count(); i != ei
i != eiDescription
TRUEevaluated 232 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 100 times by 1 test
Evaluated by:
  • tst_qv4debugger
; ++i) {
100-232
287 int type = encodeScopeType(scopeTypes[i]);-
288 if (type == -1
type == -1Description
TRUEnever evaluated
FALSEevaluated 232 times by 1 test
Evaluated by:
  • tst_qv4debugger
)
0-232
289 continue;
never executed: continue;
0
290-
291 QJsonObject scope;-
292 scope[QLatin1String("index")] = i;-
293 scope[QLatin1String("type")] = type;-
294 scopes.push_back(scope);-
295 }
executed 232 times by 1 test: end of block
Executed by:
  • tst_qv4debugger
232
296-
297 frame[QLatin1String("scopes")] = scopes;-
298-
299 return
executed 100 times by 1 test: return frame;
Executed by:
  • tst_qv4debugger
frame;
executed 100 times by 1 test: return frame;
Executed by:
  • tst_qv4debugger
100
300}-
301-
302-
303QJsonArray QV4DataCollector::flushCollectedRefs()-
304{-
305 ((m_redundantRefs) ? static_cast<void>(0) : qt_assert("m_redundantRefs", __FILE__, 357));-
306 QJsonArray refs;-
307 std::sort(m_collectedRefs.begin(), m_collectedRefs.end());-
308 for (int i = 0, ei = m_collectedRefs.size(); i != ei
i != eiDescription
TRUEevaluated 330 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 108 times by 1 test
Evaluated by:
  • tst_qv4debugger
; ++i) {
108-330
309 QV4DataCollector::Ref ref = m_collectedRefs.at(i);-
310 if (i > 0
i > 0Description
TRUEevaluated 222 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 108 times by 1 test
Evaluated by:
  • tst_qv4debugger
&& ref == m_collectedRefs.at(i - 1)
ref == m_colle...Refs.at(i - 1)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 218 times by 1 test
Evaluated by:
  • tst_qv4debugger
)
4-222
311 continue;
executed 4 times by 1 test: continue;
Executed by:
  • tst_qv4debugger
4
312 refs.append(lookupRef(ref, true));-
313 }
executed 326 times by 1 test: end of block
Executed by:
  • tst_qv4debugger
326
314-
315 m_collectedRefs.clear();-
316 return
executed 108 times by 1 test: return refs;
Executed by:
  • tst_qv4debugger
refs;
executed 108 times by 1 test: return refs;
Executed by:
  • tst_qv4debugger
108
317}-
318-
319void QV4DataCollector::clear()-
320{-
321 m_values.set(engine(), engine()->newArrayObject());-
322 m_collectedRefs.clear();-
323 m_specialRefs.clear();-
324 m_namesAsObjects = true;-
325 m_redundantRefs = true;-
326}
executed 16 times by 1 test: end of block
Executed by:
  • tst_qqmldebugjs
16
327-
328QV4DataCollector::Ref QV4DataCollector::addRef(QV4::Value value, bool deduplicate)-
329{-
330 class ExceptionStateSaver-
331 {-
332 quint8 *hasExceptionLoc;-
333 quint8 hadException;-
334-
335 public:-
336 ExceptionStateSaver(QV4::ExecutionEngine *engine)-
337 : hasExceptionLoc(&engine->hasException)-
338 , hadException(false)-
339 { std::swap(*hasExceptionLoc, hadException); }
executed 644 times by 1 test: end of block
Executed by:
  • tst_qv4debugger
644
340-
341 ~ExceptionStateSaver()-
342 { std::swap(*hasExceptionLoc, hadException); }
executed 644 times by 1 test: end of block
Executed by:
  • tst_qv4debugger
644
343 };-
344-
345-
346 ExceptionStateSaver resetExceptionState(engine());-
347 QV4::Scope scope(engine());-
348 QV4::ScopedObject array(scope, m_values.value());-
349 if (deduplicate
deduplicateDescription
TRUEevaluated 444 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 200 times by 1 test
Evaluated by:
  • tst_qv4debugger
) {
200-444
350 for (Ref i = 0; i < array->getLength()
i < array->getLength()Description
TRUEevaluated 4858 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 208 times by 1 test
Evaluated by:
  • tst_qv4debugger
; ++i) {
208-4858
351 if (array->get(i) == value.rawValue()
array->get(i) ...lue.rawValue()Description
TRUEevaluated 260 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 4598 times by 1 test
Evaluated by:
  • tst_qv4debugger
&& !m_specialRefs.contains(i)
!m_specialRefs.contains(i)Description
TRUEevaluated 236 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qv4debugger
)
24-4598
352 return
executed 236 times by 1 test: return i;
Executed by:
  • tst_qv4debugger
i;
executed 236 times by 1 test: return i;
Executed by:
  • tst_qv4debugger
236
353 }
executed 4622 times by 1 test: end of block
Executed by:
  • tst_qv4debugger
4622
354 }
executed 208 times by 1 test: end of block
Executed by:
  • tst_qv4debugger
208
355 Ref ref = array->getLength();-
356 array->put(ref, value);-
357 ((array->getLength() - 1 == ref) ? static_cast<void>(0) : qt_assert("array->getLength() - 1 == ref", __FILE__, 409));-
358 return
executed 408 times by 1 test: return ref;
Executed by:
  • tst_qv4debugger
ref;
executed 408 times by 1 test: return ref;
Executed by:
  • tst_qv4debugger
408
359}-
360-
361QV4::ReturnedValue QV4DataCollector::getValue(Ref ref)-
362{-
363 QV4::Scope scope(engine());-
364 QV4::ScopedObject array(scope, m_values.value());-
365 ((ref < array->getLength()) ? static_cast<void>(0) : qt_assert("ref < array->getLength()", __FILE__, 417));-
366 return
executed 534 times by 1 test: return array->get(ref, nullptr);
Executed by:
  • tst_qv4debugger
array->get(ref, nullptr);
executed 534 times by 1 test: return array->get(ref, nullptr);
Executed by:
  • tst_qv4debugger
534
367}-
368-
369-
370bool QV4DataCollector::lookupSpecialRef(Ref ref, QJsonObject *dict)-
371{-
372 ((m_namesAsObjects) ? static_cast<void>(0) : qt_assert("m_namesAsObjects", __FILE__, 424));-
373 SpecialRefs::const_iterator it = m_specialRefs.constFind(ref);-
374 if (it == m_specialRefs.cend()
it == m_specialRefs.cend()Description
TRUEevaluated 310 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 116 times by 1 test
Evaluated by:
  • tst_qv4debugger
)
116-310
375 return
executed 310 times by 1 test: return false;
Executed by:
  • tst_qv4debugger
false;
executed 310 times by 1 test: return false;
Executed by:
  • tst_qv4debugger
310
376-
377 *dict = it.value();-
378 return
executed 116 times by 1 test: return true;
Executed by:
  • tst_qv4debugger
true;
executed 116 times by 1 test: return true;
Executed by:
  • tst_qv4debugger
116
379}-
380-
381QJsonArray QV4DataCollector::collectProperties(const QV4::Object *object)-
382{-
383 QJsonArray res;-
384-
385 QV4::Scope scope(engine());-
386 QV4::ObjectIterator it(scope, object, QV4::ObjectIterator::EnumerableOnly);-
387 QV4::ScopedValue name(scope);-
388 QV4::ScopedValue value(scope);-
389 while (true) {-
390 QV4::Value v;-
391 name = it.nextPropertyNameAsString(&v);-
392 if (name->isNull()
name->isNull()Description
TRUEevaluated 204 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 374 times by 1 test
Evaluated by:
  • tst_qv4debugger
)
204-374
393 break;
executed 204 times by 1 test: break;
Executed by:
  • tst_qv4debugger
204
394 QString key = name->toQStringNoThrow();-
395 value = v;-
396 res.append(collectAsJson(key, value));-
397 }
executed 374 times by 1 test: end of block
Executed by:
  • tst_qv4debugger
374
398-
399 return
executed 204 times by 1 test: return res;
Executed by:
  • tst_qv4debugger
res;
executed 204 times by 1 test: return res;
Executed by:
  • tst_qv4debugger
204
400}-
401-
402QJsonObject QV4DataCollector::collectAsJson(const QString &name, const QV4::ScopedValue &value)-
403{-
404 QJsonObject dict;-
405 if (!name.isNull()
!name.isNull()Description
TRUEevaluated 374 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEnever evaluated
)
0-374
406 dict.insert(([]() noexcept -> QString { enum { Size = sizeof(u"" "name")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "name" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 374 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
qstring_literal_temp;
executed 374 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
}()), name);
executed 374 times by 1 test: dict.insert(([]() noexcept -> QString { enum { Size = sizeof(u"" "name")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "name" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()), name);
Executed by:
  • tst_qv4debugger
374
407 if (value->isManaged()
value->isManaged()Description
TRUEevaluated 138 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 236 times by 1 test
Evaluated by:
  • tst_qv4debugger
&& !value->isString()
!value->isString()Description
TRUEevaluated 128 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qv4debugger
) {
10-236
408 Ref ref = addRef(value);-
409 dict.insert(([]() noexcept -> QString { enum { Size = sizeof(u"" "ref")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "ref" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
executed 128 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
qstring_literal_temp;
executed 128 times by 1 test: return qstring_literal_temp;
Executed by:
  • tst_qv4debugger
}()), qint64(ref));
128
410 if (m_redundantRefs
m_redundantRefsDescription
TRUEevaluated 90 times by 1 test
Evaluated by:
  • tst_qv4debugger
FALSEevaluated 38 times by 1 test
Evaluated by:
  • tst_qv4debugger
)
38-90
411 m_collectedRefs.append(ref);
executed 90 times by 1 test: m_collectedRefs.append(ref);
Executed by:
  • tst_qv4debugger
90
412 }
executed 128 times by 1 test: end of block
Executed by:
  • tst_qv4debugger
128
413-
414 collectProperty(value, engine(), dict);-
415 return
executed 374 times by 1 test: return dict;
Executed by:
  • tst_qv4debugger
dict;
executed 374 times by 1 test: return dict;
Executed by:
  • tst_qv4debugger
374
416}-
417-
418-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0