1 //===-- HostInfoBase.h ------------------------------------------*- C++ -*-===//
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 #ifndef lldb_Host_HostInfoBase_h_
10 #define lldb_Host_HostInfoBase_h_
12 #include "lldb/Utility/ArchSpec.h"
13 #include "lldb/Utility/FileSpec.h"
14 #include "lldb/Utility/UserIDResolver.h"
15 #include "lldb/lldb-enumerations.h"
16 #include "llvm/ADT/StringRef.h"
22 namespace lldb_private {
28 // Static class, unconstructable.
33 static void Initialize();
34 static void Terminate();
36 /// Gets the host target triple.
39 /// The host target triple.
40 static llvm::Triple GetTargetTriple();
42 enum ArchitectureKind {
43 eArchKindDefault, // The overall default architecture that applications will
45 eArchKind32, // If this host supports 32 bit programs, return the default 32
47 eArchKind64 // If this host supports 64 bit programs, return the default 64
51 static const ArchSpec &
52 GetArchitecture(ArchitectureKind arch_kind = eArchKindDefault);
54 static llvm::Optional<ArchitectureKind> ParseArchitectureKind(llvm::StringRef kind);
56 /// Returns the directory containing the lldb shared library. Only the
57 /// directory member of the FileSpec is filled in.
58 static FileSpec GetShlibDir();
60 /// Returns the directory containing the support executables (debugserver,
61 /// ...). Only the directory member of the FileSpec is filled in.
62 static FileSpec GetSupportExeDir();
64 /// Returns the directory containing the lldb headers. Only the directory
65 /// member of the FileSpec is filled in.
66 static FileSpec GetHeaderDir();
68 /// Returns the directory containing the system plugins. Only the directory
69 /// member of the FileSpec is filled in.
70 static FileSpec GetSystemPluginDir();
72 /// Returns the directory containing the user plugins. Only the directory
73 /// member of the FileSpec is filled in.
74 static FileSpec GetUserPluginDir();
76 /// Returns the proces temporary directory. This directory will be cleaned up
77 /// when this process exits. Only the directory member of the FileSpec is
79 static FileSpec GetProcessTempDir();
81 /// Returns the global temporary directory. This directory will **not** be
82 /// cleaned up when this process exits. Only the directory member of the
83 /// FileSpec is filled in.
84 static FileSpec GetGlobalTempDir();
86 /// If the triple does not specify the vendor, os, and environment parts, we
87 /// "augment" these using information from the host and return the resulting
89 static ArchSpec GetAugmentedArchSpec(llvm::StringRef triple);
91 static bool ComputePathRelativeToLibrary(FileSpec &file_spec,
95 static bool ComputeSharedLibraryDirectory(FileSpec &file_spec);
96 static bool ComputeSupportExeDirectory(FileSpec &file_spec);
97 static bool ComputeProcessTempFileDirectory(FileSpec &file_spec);
98 static bool ComputeGlobalTempFileDirectory(FileSpec &file_spec);
99 static bool ComputeTempFileBaseDirectory(FileSpec &file_spec);
100 static bool ComputeHeaderDirectory(FileSpec &file_spec);
101 static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
102 static bool ComputeUserPluginsDirectory(FileSpec &file_spec);
104 static void ComputeHostArchitectureSupport(ArchSpec &arch_32,