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
31 // Static class, unconstructable.
36 static void Initialize();
38 //------------------------------------------------------------------
39 /// Returns the number of CPUs on this current host.
42 /// Number of CPUs on this current host, or zero if the number
43 /// of CPUs can't be determined on this host.
44 //------------------------------------------------------------------
45 static uint32_t GetNumberCPUS();
47 //------------------------------------------------------------------
48 /// Returns the maximum length of a thread name on this platform.
51 /// Maximum length of a thread name on this platform.
52 //------------------------------------------------------------------
53 static uint32_t GetMaxThreadNameLength();
55 //------------------------------------------------------------------
56 /// Gets the host vendor string.
59 /// A const string object containing the host vendor name.
60 //------------------------------------------------------------------
61 static llvm::StringRef GetVendorString();
63 //------------------------------------------------------------------
64 /// Gets the host Operating System (OS) string.
67 /// A const string object containing the host OS name.
68 //------------------------------------------------------------------
69 static llvm::StringRef GetOSString();
71 //------------------------------------------------------------------
72 /// Gets the host target triple as a const string.
75 /// A const string object containing the host target triple.
76 //------------------------------------------------------------------
77 static llvm::StringRef GetTargetTriple();
79 //------------------------------------------------------------------
80 /// Gets the host architecture.
83 /// A const architecture object that represents the host
85 //------------------------------------------------------------------
88 eArchKindDefault, // The overall default architecture that applications will run on this host
89 eArchKind32, // If this host supports 32 bit programs, return the default 32 bit arch
90 eArchKind64 // If this host supports 64 bit programs, return the default 64 bit arch
93 static const ArchSpec &GetArchitecture(ArchitectureKind arch_kind = eArchKindDefault);
95 //------------------------------------------------------------------
96 /// Find a resource files that are related to LLDB.
98 /// Operating systems have different ways of storing shared
99 /// libraries and related resources. This function abstracts the
100 /// access to these paths.
102 /// @param[in] path_type
103 /// The type of LLDB resource path you are looking for. If the
104 /// enumeration ends with "Dir", then only the \a file_spec's
105 /// directory member gets filled in.
107 /// @param[in] file_spec
108 /// A file spec that gets filled in with the appropriate path.
111 /// \b true if \a resource_path was resolved, \a false otherwise.
112 //------------------------------------------------------------------
113 static bool GetLLDBPath(lldb::PathType type, FileSpec &file_spec);
116 static bool ComputeSharedLibraryDirectory(FileSpec &file_spec);
117 static bool ComputeSupportExeDirectory(FileSpec &file_spec);
118 static bool ComputeTempFileDirectory(FileSpec &file_spec);
119 static bool ComputeHeaderDirectory(FileSpec &file_spec);
120 static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
121 static bool ComputeClangDirectory(FileSpec &file_spec);
122 static bool ComputeUserPluginsDirectory(FileSpec &file_spec);
124 static void ComputeHostArchitectureSupport(ArchSpec &arch_32, ArchSpec &arch_64);