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 as a const string.
39 /// A const string object containing the host target triple.
40 static llvm::StringRef GetTargetTriple();
42 /// Gets the host architecture.
45 /// A const architecture object that represents the host
47 enum ArchitectureKind {
48 eArchKindDefault, // The overall default architecture that applications will
50 eArchKind32, // If this host supports 32 bit programs, return the default 32
52 eArchKind64 // If this host supports 64 bit programs, return the default 64
56 static const ArchSpec &
57 GetArchitecture(ArchitectureKind arch_kind = eArchKindDefault);
59 static llvm::Optional<ArchitectureKind> ParseArchitectureKind(llvm::StringRef kind);
61 /// Returns the directory containing the lldb shared library. Only the
62 /// directory member of the FileSpec is filled in.
63 static FileSpec GetShlibDir();
65 /// Returns the directory containing the support executables (debugserver,
66 /// ...). Only the directory member of the FileSpec is filled in.
67 static FileSpec GetSupportExeDir();
69 /// Returns the directory containing the lldb headers. Only the directory
70 /// member of the FileSpec is filled in.
71 static FileSpec GetHeaderDir();
73 /// Returns the directory containing the system plugins. Only the directory
74 /// member of the FileSpec is filled in.
75 static FileSpec GetSystemPluginDir();
77 /// Returns the directory containing the user plugins. Only the directory
78 /// member of the FileSpec is filled in.
79 static FileSpec GetUserPluginDir();
81 /// Returns the proces temporary directory. This directory will be cleaned up
82 /// when this process exits. Only the directory member of the FileSpec is
84 static FileSpec GetProcessTempDir();
86 /// Returns the global temporary directory. This directory will **not** be
87 /// cleaned up when this process exits. Only the directory member of the
88 /// FileSpec is filled in.
89 static FileSpec GetGlobalTempDir();
91 /// If the triple does not specify the vendor, os, and environment parts, we
92 /// "augment" these using information from the host and return the resulting
94 static ArchSpec GetAugmentedArchSpec(llvm::StringRef triple);
96 static bool ComputePathRelativeToLibrary(FileSpec &file_spec,
100 static bool ComputeSharedLibraryDirectory(FileSpec &file_spec);
101 static bool ComputeSupportExeDirectory(FileSpec &file_spec);
102 static bool ComputeProcessTempFileDirectory(FileSpec &file_spec);
103 static bool ComputeGlobalTempFileDirectory(FileSpec &file_spec);
104 static bool ComputeTempFileBaseDirectory(FileSpec &file_spec);
105 static bool ComputeHeaderDirectory(FileSpec &file_spec);
106 static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
107 static bool ComputeUserPluginsDirectory(FileSpec &file_spec);
109 static void ComputeHostArchitectureSupport(ArchSpec &arch_32,