1061da546Spatrick //===-- LocateSymbolFile.h --------------------------------------*- C++ -*-===//
2061da546Spatrick //
3061da546Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4061da546Spatrick // See https://llvm.org/LICENSE.txt for license information.
5061da546Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6061da546Spatrick //
7061da546Spatrick //===----------------------------------------------------------------------===//
8061da546Spatrick 
9dda28197Spatrick #ifndef LLDB_SYMBOL_LOCATESYMBOLFILE_H
10dda28197Spatrick #define LLDB_SYMBOL_LOCATESYMBOLFILE_H
11061da546Spatrick 
12be691f3bSpatrick #include <cstdint>
13061da546Spatrick 
14061da546Spatrick #include "lldb/Core/FileSpecList.h"
15061da546Spatrick #include "lldb/Utility/FileSpec.h"
16*f6aab3d8Srobert #include "lldb/Utility/Status.h"
17*f6aab3d8Srobert #include "lldb/lldb-forward.h"
18061da546Spatrick 
19061da546Spatrick namespace lldb_private {
20061da546Spatrick 
21061da546Spatrick class ArchSpec;
22061da546Spatrick class ModuleSpec;
23061da546Spatrick class UUID;
24061da546Spatrick 
25061da546Spatrick class Symbols {
26061da546Spatrick public:
27061da546Spatrick   // Locate the executable file given a module specification.
28061da546Spatrick   //
29061da546Spatrick   // Locating the file should happen only on the local computer or using the
30061da546Spatrick   // current computers global settings.
31061da546Spatrick   static ModuleSpec LocateExecutableObjectFile(const ModuleSpec &module_spec);
32061da546Spatrick 
33061da546Spatrick   // Locate the symbol file given a module specification.
34061da546Spatrick   //
35061da546Spatrick   // Locating the file should happen only on the local computer or using the
36061da546Spatrick   // current computers global settings.
37061da546Spatrick   static FileSpec
38061da546Spatrick   LocateExecutableSymbolFile(const ModuleSpec &module_spec,
39061da546Spatrick                              const FileSpecList &default_search_paths);
40061da546Spatrick 
41061da546Spatrick   static FileSpec FindSymbolFileInBundle(const FileSpec &dsym_bundle_fspec,
42061da546Spatrick                                          const lldb_private::UUID *uuid,
43061da546Spatrick                                          const ArchSpec *arch);
44061da546Spatrick 
45061da546Spatrick   // Locate the object and symbol file given a module specification.
46061da546Spatrick   //
47061da546Spatrick   // Locating the file can try to download the file from a corporate build
48061da546Spatrick   // repository, or using any other means necessary to locate both the
49061da546Spatrick   // unstripped object file and the debug symbols. The force_lookup argument
50061da546Spatrick   // controls whether the external program is called unconditionally to find
51061da546Spatrick   // the symbol file, or if the user's settings are checked to see if they've
52061da546Spatrick   // enabled the external program before calling.
53061da546Spatrick   //
54061da546Spatrick   static bool DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
55*f6aab3d8Srobert                                           Status &error,
56*f6aab3d8Srobert                                           bool force_lookup = true,
57*f6aab3d8Srobert                                           bool copy_executable = true);
58*f6aab3d8Srobert 
59*f6aab3d8Srobert   /// Locate the symbol file for the given UUID on a background thread. This
60*f6aab3d8Srobert   /// function returns immediately. Under the hood it uses the debugger's
61*f6aab3d8Srobert   /// thread pool to call DownloadObjectAndSymbolFile. If a symbol file is
62*f6aab3d8Srobert   /// found, this will notify all target which contain the module with the
63*f6aab3d8Srobert   /// given UUID.
64*f6aab3d8Srobert   static void DownloadSymbolFileAsync(const UUID &uuid);
65061da546Spatrick };
66061da546Spatrick 
67061da546Spatrick } // namespace lldb_private
68061da546Spatrick 
69dda28197Spatrick #endif // LLDB_SYMBOL_LOCATESYMBOLFILE_H
70