1 //===-- symbolLocator.cpp -------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "lldb/Symbol/SymbolLocator.h"
11 #include "lldb/Core/Debugger.h"
12 #include "lldb/Core/PluginManager.h"
13 #include "lldb/Host/Host.h"
15 #include "llvm/ADT/SmallSet.h"
16 #include "llvm/Support/ThreadPool.h"
19 using namespace lldb_private
;
21 void SymbolLocator::DownloadSymbolFileAsync(const UUID
&uuid
) {
22 static llvm::SmallSet
<UUID
, 8> g_seen_uuids
;
23 static std::mutex g_mutex
;
27 std::lock_guard
<std::mutex
> guard(g_mutex
);
28 if (g_seen_uuids
.count(uuid
))
30 g_seen_uuids
.insert(uuid
);
34 ModuleSpec module_spec
;
35 module_spec
.GetUUID() = uuid
;
36 if (!PluginManager::DownloadObjectAndSymbolFile(module_spec
, error
,
37 /*force_lookup=*/true,
38 /*copy_executable=*/true))
44 Debugger::ReportSymbolChange(module_spec
);
47 switch (ModuleList::GetGlobalModuleListProperties().GetSymbolAutoDownload()) {
48 case eSymbolDownloadOff
:
50 case eSymbolDownloadBackground
:
51 Debugger::GetThreadPool().async(lookup
);
53 case eSymbolDownloadForeground
: