void SymbolMap::UpdateActiveSymbols() { // return; (slow in debug mode) std::lock_guard<std::recursive_mutex> guard(lock_); activeFunctions.clear(); activeLabels.clear(); activeData.clear(); // On startup and shutdown, we can skip the rest. Tiny optimization. if (activeModuleEnds.empty() || (functions.empty() && labels.empty() && data.empty())) { return; } std::map<int, u32> activeModuleIndexes; for (auto it = activeModuleEnds.begin(), end = activeModuleEnds.end(); it != end; ++it) { activeModuleIndexes[it->second.index] = it->second.start; } for (auto it = functions.begin(), end = functions.end(); it != end; ++it) { const auto mod = activeModuleIndexes.find(it->second.module); if (it->second.module == 0) { activeFunctions.insert(std::make_pair(it->second.start, it->second)); } else if (mod != activeModuleIndexes.end()) { activeFunctions.insert(std::make_pair(mod->second + it->second.start, it->second)); } } for (auto it = labels.begin(), end = labels.end(); it != end; ++it) { const auto mod = activeModuleIndexes.find(it->second.module); if (it->second.module == 0) { activeLabels.insert(std::make_pair(it->second.addr, it->second)); } else if (mod != activeModuleIndexes.end()) { activeLabels.insert(std::make_pair(mod->second + it->second.addr, it->second)); } } for (auto it = data.begin(), end = data.end(); it != end; ++it) { const auto mod = activeModuleIndexes.find(it->second.module); if (it->second.module == 0) { activeData.insert(std::make_pair(it->second.start, it->second)); } else if (mod != activeModuleIndexes.end()) { activeData.insert(std::make_pair(mod->second + it->second.start, it->second)); } } AssignFunctionIndices(); activeNeedUpdate_ = false; }
void SymbolMap::UpdateActiveSymbols() { lock_guard guard(lock_); std::map<int, u32> activeModuleIndexes; for (auto it = activeModuleEnds.begin(), end = activeModuleEnds.end(); it != end; ++it) { activeModuleIndexes[it->second.index] = it->second.start; } activeFunctions.clear(); activeLabels.clear(); activeData.clear(); for (auto it = functions.begin(), end = functions.end(); it != end; ++it) { const auto mod = activeModuleIndexes.find(it->second.module); if (it->second.module == 0) { activeFunctions.insert(std::make_pair(it->second.start, it->second)); } else if (mod != activeModuleIndexes.end()) { activeFunctions.insert(std::make_pair(mod->second + it->second.start, it->second)); } } for (auto it = labels.begin(), end = labels.end(); it != end; ++it) { const auto mod = activeModuleIndexes.find(it->second.module); if (it->second.module == 0) { activeLabels.insert(std::make_pair(it->second.addr, it->second)); } else if (mod != activeModuleIndexes.end()) { activeLabels.insert(std::make_pair(mod->second + it->second.addr, it->second)); } } for (auto it = data.begin(), end = data.end(); it != end; ++it) { const auto mod = activeModuleIndexes.find(it->second.module); if (it->second.module == 0) { activeData.insert(std::make_pair(it->second.start, it->second)); } else if (mod != activeModuleIndexes.end()) { activeData.insert(std::make_pair(mod->second + it->second.start, it->second)); } } AssignFunctionIndices(); }
void SymbolMap::SortSymbols() { lock_guard guard(lock_); AssignFunctionIndices(); }
void SymbolMap::SortSymbols() { std::lock_guard<std::recursive_mutex> guard(lock_); AssignFunctionIndices(); }