Path: blob/main/contrib/llvm-project/lldb/source/Symbol/SymbolLocator.cpp
39587 views
//===-- symbolLocator.cpp -------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "lldb/Symbol/SymbolLocator.h"910#include "lldb/Core/Debugger.h"11#include "lldb/Core/PluginManager.h"12#include "lldb/Host/Host.h"1314#include "llvm/ADT/SmallSet.h"15#include "llvm/Support/ThreadPool.h"1617using namespace lldb;18using namespace lldb_private;1920void SymbolLocator::DownloadSymbolFileAsync(const UUID &uuid) {21static llvm::SmallSet<UUID, 8> g_seen_uuids;22static std::mutex g_mutex;2324auto lookup = [=]() {25{26std::lock_guard<std::mutex> guard(g_mutex);27if (g_seen_uuids.count(uuid))28return;29g_seen_uuids.insert(uuid);30}3132Status error;33ModuleSpec module_spec;34module_spec.GetUUID() = uuid;35if (!PluginManager::DownloadObjectAndSymbolFile(module_spec, error,36/*force_lookup=*/true,37/*copy_executable=*/true))38return;3940if (error.Fail())41return;4243Debugger::ReportSymbolChange(module_spec);44};4546switch (ModuleList::GetGlobalModuleListProperties().GetSymbolAutoDownload()) {47case eSymbolDownloadOff:48break;49case eSymbolDownloadBackground:50Debugger::GetThreadPool().async(lookup);51break;52case eSymbolDownloadForeground:53lookup();54break;55};56}575859