]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Host/HostInfoBase.h
Update LLDB snapshot to upstream r225923 (git 2b588ecd)
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Host / HostInfoBase.h
1 //===-- HostInfoBase.h ------------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef lldb_Host_HostInfoBase_h_
11 #define lldb_Host_HostInfoBase_h_
12
13 #include "lldb/Core/ArchSpec.h"
14 #include "lldb/Host/FileSpec.h"
15 #include "lldb/lldb-enumerations.h"
16
17 #include "llvm/ADT/StringRef.h"
18
19 #include <stdint.h>
20
21 #include <string>
22
23 namespace lldb_private
24 {
25
26 class FileSpec;
27
28 class HostInfoBase
29 {
30   private:
31     // Static class, unconstructable.
32     HostInfoBase() {}
33     ~HostInfoBase() {}
34
35   public:
36     static void Initialize();
37
38     //------------------------------------------------------------------
39     /// Returns the number of CPUs on this current host.
40     ///
41     /// @return
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();
46
47     //------------------------------------------------------------------
48     /// Returns the maximum length of a thread name on this platform.
49     ///
50     /// @return
51     ///     Maximum length of a thread name on this platform.
52     //------------------------------------------------------------------
53     static uint32_t GetMaxThreadNameLength();
54
55     //------------------------------------------------------------------
56     /// Gets the host vendor string.
57     ///
58     /// @return
59     ///     A const string object containing the host vendor name.
60     //------------------------------------------------------------------
61     static llvm::StringRef GetVendorString();
62
63     //------------------------------------------------------------------
64     /// Gets the host Operating System (OS) string.
65     ///
66     /// @return
67     ///     A const string object containing the host OS name.
68     //------------------------------------------------------------------
69     static llvm::StringRef GetOSString();
70
71     //------------------------------------------------------------------
72     /// Gets the host target triple as a const string.
73     ///
74     /// @return
75     ///     A const string object containing the host target triple.
76     //------------------------------------------------------------------
77     static llvm::StringRef GetTargetTriple();
78
79     //------------------------------------------------------------------
80     /// Gets the host architecture.
81     ///
82     /// @return
83     ///     A const architecture object that represents the host
84     ///     architecture.
85     //------------------------------------------------------------------
86     enum ArchitectureKind
87     {
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
91     };
92
93     static const ArchSpec &GetArchitecture(ArchitectureKind arch_kind = eArchKindDefault);
94
95     //------------------------------------------------------------------
96     /// Find a resource files that are related to LLDB.
97     ///
98     /// Operating systems have different ways of storing shared
99     /// libraries and related resources. This function abstracts the
100     /// access to these paths.
101     ///
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.
106     ///
107     /// @param[in] file_spec
108     ///     A file spec that gets filled in with the appropriate path.
109     ///
110     /// @return
111     ///     \b true if \a resource_path was resolved, \a false otherwise.
112     //------------------------------------------------------------------
113     static bool GetLLDBPath(lldb::PathType type, FileSpec &file_spec);
114
115   protected:
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);
123
124     static void ComputeHostArchitectureSupport(ArchSpec &arch_32, ArchSpec &arch_64);
125 };
126 }
127
128 #endif