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