| 209 | |
| 210 | |
| 211 | void 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 | |
| 253 | bool DebugStackListModel::setData(const QModelIndex& index, const QVariant& value, int role) |
no test coverage detected