1 //===-- LocateSymbolFile.h --------------------------------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_SYMBOL_LOCATESYMBOLFILE_H
10 #define LLDB_SYMBOL_LOCATESYMBOLFILE_H
11 
12 #include <cstdint>
13 
14 #include "lldb/Utility/FileSpec.h"
15 #include "lldb/Utility/FileSpecList.h"
16 #include "lldb/Utility/Status.h"
17 #include "lldb/lldb-forward.h"
18 
19 namespace lldb_private {
20 
21 class ArchSpec;
22 class ModuleSpec;
23 class UUID;
24 
25 class Symbols {
26 public:
27   // Locate the executable file given a module specification.
28   //
29   // Locating the file should happen only on the local computer or using the
30   // current computers global settings.
31   static ModuleSpec LocateExecutableObjectFile(const ModuleSpec &module_spec);
32 
33   // Locate the symbol file given a module specification.
34   //
35   // Locating the file should happen only on the local computer or using the
36   // current computers global settings.
37   static FileSpec
38   LocateExecutableSymbolFile(const ModuleSpec &module_spec,
39                              const FileSpecList &default_search_paths);
40 
41   static FileSpec FindSymbolFileInBundle(const FileSpec &dsym_bundle_fspec,
42                                          const lldb_private::UUID *uuid,
43                                          const ArchSpec *arch);
44 
45   // Locate the object and symbol file given a module specification.
46   //
47   // Locating the file can try to download the file from a corporate build
48   // repository, or using any other means necessary to locate both the
49   // unstripped object file and the debug symbols. The force_lookup argument
50   // controls whether the external program is called unconditionally to find
51   // the symbol file, or if the user's settings are checked to see if they've
52   // enabled the external program before calling.
53   //
54   static bool DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
55                                           Status &error,
56                                           bool force_lookup = true,
57                                           bool copy_executable = true);
58 
59   /// Locate the symbol file for the given UUID on a background thread. This
60   /// function returns immediately. Under the hood it uses the debugger's
61   /// thread pool to call DownloadObjectAndSymbolFile. If a symbol file is
62   /// found, this will notify all target which contain the module with the
63   /// given UUID.
64   static void DownloadSymbolFileAsync(const UUID &uuid);
65 };
66 
67 } // namespace lldb_private
68 
69 #endif // LLDB_SYMBOL_LOCATESYMBOLFILE_H
70