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