1 //===-- PlatformWindows.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 liblldb_PlatformWindows_h_
11 #define liblldb_PlatformWindows_h_
12 
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17 #include "lldb/Target/Platform.h"
18 
19 namespace lldb_private
20 {
21 
22 class PlatformWindows : public Platform
23 {
24 public:
25     PlatformWindows(bool is_host);
26 
27     ~PlatformWindows() override;
28 
29     static void
30     Initialize();
31 
32     static void
33     Terminate();
34 
35     //------------------------------------------------------------
36     // lldb_private::PluginInterface functions
37     //------------------------------------------------------------
38     static lldb::PlatformSP
39     CreateInstance (bool force, const lldb_private::ArchSpec *arch);
40 
41     static lldb_private::ConstString
42     GetPluginNameStatic(bool is_host);
43 
44     static const char *
45     GetPluginDescriptionStatic(bool is_host);
46 
47     lldb_private::ConstString
48     GetPluginName() override;
49 
50     uint32_t
51     GetPluginVersion() override
52     {
53         return 1;
54     }
55 
56     //------------------------------------------------------------
57     // lldb_private::Platform functions
58     //------------------------------------------------------------
59     bool
60     GetModuleSpec (const lldb_private::FileSpec& module_file_spec,
61                    const lldb_private::ArchSpec& arch,
62                    lldb_private::ModuleSpec &module_spec) override;
63 
64     Error
65     ResolveExecutable(const lldb_private::ModuleSpec &module_spec,
66                       lldb::ModuleSP &module_sp,
67                       const FileSpecList *module_search_paths_ptr) override;
68 
69     const char *
70     GetDescription() override
71     {
72         return GetPluginDescriptionStatic(IsHost());
73     }
74 
75     bool
76     GetRemoteOSVersion() override;
77 
78     bool
79     GetRemoteOSBuildString(std::string &s) override;
80 
81     bool
82     GetRemoteOSKernelDescription(std::string &s) override;
83 
84     // Remote Platform subclasses need to override this function
85     lldb_private::ArchSpec
86     GetRemoteSystemArchitecture() override;
87 
88     bool
89     IsConnected() const override;
90 
91     lldb_private::Error
92     ConnectRemote(lldb_private::Args& args) override;
93 
94     lldb_private::Error
95     DisconnectRemote() override;
96 
97     const char *
98     GetHostname() override;
99 
100     const char *
101     GetUserName(uint32_t uid) override;
102 
103     const char *
104     GetGroupName(uint32_t gid) override;
105 
106     bool
107     GetProcessInfo(lldb::pid_t pid,
108                    lldb_private::ProcessInstanceInfo &proc_info) override;
109 
110     uint32_t
111     FindProcesses(const lldb_private::ProcessInstanceInfoMatch &match_info,
112                   lldb_private::ProcessInstanceInfoList &process_infos) override;
113 
114     lldb_private::Error
115     LaunchProcess(lldb_private::ProcessLaunchInfo &launch_info) override;
116 
117     lldb::ProcessSP
118     DebugProcess(lldb_private::ProcessLaunchInfo &launch_info, lldb_private::Debugger &debugger,
119                  lldb_private::Target *target, lldb_private::Error &error) override;
120 
121     lldb::ProcessSP
122     Attach(lldb_private::ProcessAttachInfo &attach_info, lldb_private::Debugger &debugger,
123            lldb_private::Target *target, lldb_private::Error &error) override;
124 
125     lldb_private::Error
126     GetFileWithUUID(const lldb_private::FileSpec &platform_file,
127                     const lldb_private::UUID* uuid, lldb_private::FileSpec &local_file) override;
128 
129     lldb_private::Error
130     GetSharedModule(const lldb_private::ModuleSpec &module_spec,
131                     lldb_private::Process* process,
132                     lldb::ModuleSP &module_sp,
133                     const lldb_private::FileSpecList *module_search_paths_ptr,
134                     lldb::ModuleSP *old_module_sp_ptr,
135                     bool *did_create_ptr) override;
136 
137     bool
138     GetSupportedArchitectureAtIndex(uint32_t idx, lldb_private::ArchSpec &arch) override;
139 
140     void
141     GetStatus(lldb_private::Stream &strm) override;
142 
143     bool CanDebugProcess() override;
144 
145     size_t GetEnvironment(StringList &env) override;
146 
147     // FIXME not sure what the _sigtramp equivalent would be on this platform
148     void
149     CalculateTrapHandlerSymbolNames () override
150     {
151     }
152 
153     ConstString
154     GetFullNameForDylib (ConstString basename) override;
155 
156 protected:
157     lldb::PlatformSP m_remote_platform_sp;
158 
159 private:
160     DISALLOW_COPY_AND_ASSIGN (PlatformWindows);
161 };
162 
163 } // namespace lldb_private
164 
165 #endif // liblldb_PlatformWindows_h_
166