| 67 | |
| 68 | |
| 69 | void KCTriageView::loadImagesWithAddr(const std::vector<uint64_t>& addresses) { |
| 70 | if (!m_cache) |
| 71 | return; |
| 72 | |
| 73 | std::map<uint64_t, std::string> images; |
| 74 | for (const uint64_t& addr : addresses) |
| 75 | { |
| 76 | auto imageName = m_cache->GetImageNameForAddress(addr); |
| 77 | if (!imageName.empty() && !m_cache->IsImageLoaded(addr)) |
| 78 | { |
| 79 | images.insert({addr, imageName}); |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | // Don't create a worker action if we don't have any images. |
| 84 | if (images.empty()) |
| 85 | return; |
| 86 | |
| 87 | WorkerPriorityEnqueue([this, images]() { |
| 88 | size_t loadedImages = 0; |
| 89 | const std::string initialLoad = fmt::format("Loading images... (0/{})", images.size()); |
| 90 | auto imageLoadTask = BackgroundTask(initialLoad, true); |
| 91 | |
| 92 | for (const auto& [addr, imageName] : images) |
| 93 | { |
| 94 | if (imageLoadTask.IsCancelled()) |
| 95 | break; |
| 96 | std::string newLoad = fmt::format("Loading images... ({}/{})", loadedImages++, images.size()); |
| 97 | imageLoadTask.SetProgressText(newLoad); |
| 98 | if (m_cache->LoadImageWithInstallName(imageName)) |
| 99 | setImageLoaded(addr); |
| 100 | } |
| 101 | imageLoadTask.Finish(); |
| 102 | |
| 103 | // We have loaded images, lets make sure to update analysis! |
| 104 | this->m_data->AddAnalysisOption("linearsweep"); |
| 105 | this->m_data->UpdateAnalysis(); |
| 106 | }); |
| 107 | } |
| 108 | |
| 109 | |
| 110 | void KCTriageView::setImageLoaded(const uint64_t imageHeaderAddr) |
nothing calls this directly
no test coverage detected