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/Core/ArchSpec.h"
14 #include "lldb/Host/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 /// Returns the number of CPUs on this current host.
41 /// Number of CPUs on this current host, or zero if the number
42 /// of CPUs can't be determined on this host.
43 //------------------------------------------------------------------
44 static uint32_t GetNumberCPUS();
46 //------------------------------------------------------------------
47 /// Returns the maximum length of a thread name on this platform.
50 /// Maximum length of a thread name on this platform.
51 //------------------------------------------------------------------
52 static uint32_t GetMaxThreadNameLength();
54 //------------------------------------------------------------------
55 /// Gets the host vendor string.
58 /// A const string object containing the host vendor name.
59 //------------------------------------------------------------------
60 static llvm::StringRef GetVendorString();
62 //------------------------------------------------------------------
63 /// Gets the host Operating System (OS) string.
66 /// A const string object containing the host OS name.
67 //------------------------------------------------------------------
68 static llvm::StringRef GetOSString();
70 //------------------------------------------------------------------
71 /// Gets the host target triple as a const string.
74 /// A const string object containing the host target triple.
75 //------------------------------------------------------------------
76 static llvm::StringRef GetTargetTriple();
78 //------------------------------------------------------------------
79 /// Gets the host architecture.
82 /// A const architecture object that represents the host
84 //------------------------------------------------------------------
85 enum ArchitectureKind {
86 eArchKindDefault, // The overall default architecture that applications will
88 eArchKind32, // If this host supports 32 bit programs, return the default 32
90 eArchKind64 // If this host supports 64 bit programs, return the default 64
94 static const ArchSpec &
95 GetArchitecture(ArchitectureKind arch_kind = eArchKindDefault);
97 //------------------------------------------------------------------
98 /// Find a resource files that are related to LLDB.
100 /// Operating systems have different ways of storing shared
101 /// libraries and related resources. This function abstracts the
102 /// access to these paths.
104 /// @param[in] path_type
105 /// The type of LLDB resource path you are looking for. If the
106 /// enumeration ends with "Dir", then only the \a file_spec's
107 /// directory member gets filled in.
109 /// @param[in] file_spec
110 /// A file spec that gets filled in with the appropriate path.
113 /// \b true if \a resource_path was resolved, \a false otherwise.
114 //------------------------------------------------------------------
115 static bool GetLLDBPath(lldb::PathType type, FileSpec &file_spec);
118 static bool ComputeSharedLibraryDirectory(FileSpec &file_spec);
119 static bool ComputeSupportExeDirectory(FileSpec &file_spec);
120 static bool ComputeProcessTempFileDirectory(FileSpec &file_spec);
121 static bool ComputeGlobalTempFileDirectory(FileSpec &file_spec);
122 static bool ComputeTempFileBaseDirectory(FileSpec &file_spec);
123 static bool ComputeHeaderDirectory(FileSpec &file_spec);
124 static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
125 static bool ComputeClangDirectory(FileSpec &file_spec);
126 static bool ComputeUserPluginsDirectory(FileSpec &file_spec);
128 static void ComputeHostArchitectureSupport(ArchSpec &arch_32,