| 364 | } |
| 365 | |
| 366 | void DebugSession::rawUpdate(IRawModelUpdate *data) |
| 367 | { |
| 368 | threadIds.clear(); |
| 369 | |
| 370 | for (auto thread : data->threads) { |
| 371 | threadIds.push_back(thread.id); |
| 372 | if (threads.find(thread.id) == threads.end()) { |
| 373 | // save the new thread. |
| 374 | threads.insert(std::pair<dapNumber, Thread *>(thread.id, new Thread(this, thread.name, thread.id))); |
| 375 | } else if (!thread.name.empty()) { |
| 376 | // update thread name. |
| 377 | auto oldThread = threads.find(thread.id); |
| 378 | if (oldThread != threads.end()) { |
| 379 | oldThread->second->name = thread.name; |
| 380 | } |
| 381 | } |
| 382 | } |
| 383 | |
| 384 | // Remove all old threads which are no longer part of the update |
| 385 | for (auto t = threads.begin(); t != threads.end();) { |
| 386 | auto it = std::find(threadIds.begin(), threadIds.end(), t->first); |
| 387 | if (it == threadIds.end()) { |
| 388 | t = threads.erase(t); |
| 389 | } else { |
| 390 | ++t; |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | auto stoppedDetails = data->stoppedDetails; |
| 395 | if (stoppedDetails) { |
| 396 | if (stoppedDetails->allThreadsStopped) { |
| 397 | for (auto thread : threads) { |
| 398 | if (thread.second->threadId == stoppedDetails->threadId.value()) { |
| 399 | thread.second->stoppedDetails = stoppedDetails; |
| 400 | thread.second->stopped = true; |
| 401 | thread.second->clearCallStack(); |
| 402 | } |
| 403 | } |
| 404 | } else { |
| 405 | if (stoppedDetails->threadId) { |
| 406 | auto thread = threads.find(stoppedDetails->threadId.value()); |
| 407 | if (thread != threads.end()) { |
| 408 | thread->second->stoppedDetails = stoppedDetails; |
| 409 | thread->second->clearCallStack(); |
| 410 | thread->second->stopped = true; |
| 411 | } |
| 412 | } |
| 413 | } |
| 414 | } |
| 415 | } |
| 416 | |
| 417 | dap::array<IRawStoppedDetails *> &DebugSession::getStoppedDetails() |
| 418 | { |
no test coverage detected