1 //===-- HostInfoBase.h ------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef lldb_Host_HostInfoBase_h_
11 #define lldb_Host_HostInfoBase_h_
13 #include "lldb/Utility/ArchSpec.h"
14 #include "lldb/Utility/FileSpec.h"
15 #include "lldb/lldb-enumerations.h"
17 #include "llvm/ADT/StringRef.h"
23 namespace lldb_private {
29 // Static class, unconstructable.
34 static void Initialize();
35 static void Terminate();
37 //------------------------------------------------------------------
38 /// Gets the host target triple as a const string.
41 /// A const string object containing the host target triple.
42 //------------------------------------------------------------------
43 static llvm::StringRef GetTargetTriple();
45 //------------------------------------------------------------------
46 /// Gets the host architecture.
49 /// A const architecture object that represents the host
51 //------------------------------------------------------------------
52 enum ArchitectureKind {
53 eArchKindDefault, // The overall default architecture that applications will
55 eArchKind32, // If this host supports 32 bit programs, return the default 32
57 eArchKind64 // If this host supports 64 bit programs, return the default 64
61 static const ArchSpec &
62 GetArchitecture(ArchitectureKind arch_kind = eArchKindDefault);
64 static llvm::Optional<ArchitectureKind> ParseArchitectureKind(llvm::StringRef kind);
66 /// Returns the directory containing the lldb shared library. Only the
67 /// directory member of the FileSpec is filled in.
68 static FileSpec GetShlibDir();
70 /// Returns the directory containing the support executables (debugserver,
71 /// ...). Only the directory member of the FileSpec is filled in.
72 static FileSpec GetSupportExeDir();
74 /// Returns the directory containing the lldb headers. Only the directory
75 /// member of the FileSpec is filled in.
76 static FileSpec GetHeaderDir();
78 /// Returns the directory containing the system plugins. Only the directory
79 /// member of the FileSpec is filled in.
80 static FileSpec GetSystemPluginDir();
82 /// Returns the directory containing the user plugins. Only the directory
83 /// member of the FileSpec is filled in.
84 static FileSpec GetUserPluginDir();
86 /// Returns the proces temporary directory. This directory will be cleaned up
87 /// when this process exits. Only the directory member of the FileSpec is
89 static FileSpec GetProcessTempDir();
91 /// Returns the global temporary directory. This directory will **not** be
92 /// cleaned up when this process exits. Only the directory member of the
93 /// FileSpec is filled in.
94 static FileSpec GetGlobalTempDir();
96 //---------------------------------------------------------------------------
97 /// If the triple does not specify the vendor, os, and environment parts, we
98 /// "augment" these using information from the host and return the resulting
100 //---------------------------------------------------------------------------
101 static ArchSpec GetAugmentedArchSpec(llvm::StringRef triple);
104 static bool ComputeSharedLibraryDirectory(FileSpec &file_spec);
105 static bool ComputeSupportExeDirectory(FileSpec &file_spec);
106 static bool ComputeProcessTempFileDirectory(FileSpec &file_spec);
107 static bool ComputeGlobalTempFileDirectory(FileSpec &file_spec);
108 static bool ComputeTempFileBaseDirectory(FileSpec &file_spec);
109 static bool ComputeHeaderDirectory(FileSpec &file_spec);
110 static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
111 static bool ComputeUserPluginsDirectory(FileSpec &file_spec);
113 static void ComputeHostArchitectureSupport(ArchSpec &arch_32,