MCPcopy Create free account
hub / github.com/Vector35/debugger / updateRows

Method updateRows

ui/stackwidget.cpp:211–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209
210
211void DebugStackListModel::updateRows(std::vector<DebugStackItem> newRows)
212{
213 // TODO: This might cause performance problems. We can instead only update the chagned registers.
214 // However, the cost for that is we need to attach an index to each item and sort accordingly
215 std::map<ptrdiff_t, uint64_t> oldValues;
216 for (const DebugStackItem& item : m_items)
217 oldValues[item.offset()] = item.value();
218
219 beginResetModel();
220
221 m_items.clear();
222 if (newRows.empty())
223 {
224 endResetModel();
225 return;
226 }
227
228 for (const DebugStackItem& row : newRows)
229 {
230 auto iter = oldValues.find(row.offset());
231 DebugStackValueStatus status;
232 if (iter == oldValues.end())
233 {
234 status = DebugStackValueNormal;
235 }
236 else
237 {
238 if (iter->second == row.value())
239 {
240 status = DebugStackValueNormal;
241 }
242 else
243 {
244 status = DebugStackValueChanged;
245 }
246 }
247 m_items.emplace_back(row.offset(), row.address(), row.value(), row.hint(), status);
248 }
249 endResetModel();
250}
251
252
253bool DebugStackListModel::setData(const QModelIndex& index, const QVariant& value, int role)

Callers 1

notifyStackChangedMethod · 0.45

Calls 4

offsetMethod · 0.80
valueMethod · 0.45
addressMethod · 0.45
hintMethod · 0.45

Tested by

no test coverage detected