From 180a554d7efd100ff9138d097ba11018fcbf0dea Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Thu, 27 Mar 2025 14:47:31 -0400 Subject: RTTI: Add background task back and make it cancellable If the background task gets stuck, this is the commit to ponder at --- plugins/rtti/itanium.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'plugins/rtti/itanium.cpp') diff --git a/plugins/rtti/itanium.cpp b/plugins/rtti/itanium.cpp index c3a2be5d..122869cc 100644 --- a/plugins/rtti/itanium.cpp +++ b/plugins/rtti/itanium.cpp @@ -659,6 +659,7 @@ ItaniumRTTIProcessor::ItaniumRTTIProcessor(const Ref &view, bool use void ItaniumRTTIProcessor::ProcessRTTI() { + auto bgTask = new BackgroundTask("Scanning for Itanium RTTI...", true); auto start_time = std::chrono::high_resolution_clock::now(); auto addrSize = m_view->GetAddressSize(); uint64_t maxTypeInfoSize = TypeInfoSize(m_view); @@ -666,6 +667,8 @@ void ItaniumRTTIProcessor::ProcessRTTI() auto scan = [&](const Ref
§ion) { for (uint64_t currAddr = section->GetStart(); currAddr <= section->GetEnd() - maxTypeInfoSize; currAddr += addrSize) { + if (bgTask->IsCancelled()) + break; try { if (auto classInfo = ProcessRTTI(currAddr)) @@ -732,6 +735,7 @@ void ItaniumRTTIProcessor::ProcessRTTI() ); } + bgTask->Finish(); auto end_time = std::chrono::high_resolution_clock::now(); std::chrono::duration elapsed_time = end_time - start_time; m_logger->LogDebug("ProcessRTTI took %f seconds", elapsed_time.count()); @@ -740,6 +744,7 @@ void ItaniumRTTIProcessor::ProcessRTTI() void ItaniumRTTIProcessor::ProcessVFT() { + auto bgTask = new BackgroundTask("Scanning for Itanium VFTs...", true); BinaryReader optReader = BinaryReader(m_view); std::map> vftMap = {}; std::map> vftFinishedMap = {}; @@ -811,12 +816,15 @@ void ItaniumRTTIProcessor::ProcessVFT() for (const auto &[coLocatorAddr, vftAddrs]: vftMap) { + if (bgTask->IsCancelled()) + break; for (const auto& vftAddr: vftAddrs) { populateVftEntries(coLocatorAddr, vftAddr); } } + bgTask->Finish(); auto end_time = std::chrono::high_resolution_clock::now(); std::chrono::duration elapsed_time = end_time - start_time; m_logger->LogDebug("ProcessVFT took %f seconds", elapsed_time.count()); -- cgit v1.3.1