]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.h
MFV r329766: 8962 zdb should work on non-idle pools
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / Plugins / Platform / POSIX / PlatformPOSIX.h
1 //===-- PlatformPOSIX.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_PlatformPOSIX_h_
11 #define liblldb_PlatformPOSIX_h_
12
13 // C Includes
14 // C++ Includes
15 #include <map>
16 #include <memory>
17
18 // Other libraries and framework includes
19 // Project includes
20 #include "lldb/Interpreter/Options.h"
21 #include "lldb/Target/Platform.h"
22
23 class PlatformPOSIX : public lldb_private::Platform {
24 public:
25   PlatformPOSIX(bool is_host);
26
27   ~PlatformPOSIX() override;
28
29   //------------------------------------------------------------
30   // lldb_private::Platform functions
31   //------------------------------------------------------------
32
33   bool GetModuleSpec(const lldb_private::FileSpec &module_file_spec,
34                      const lldb_private::ArchSpec &arch,
35                      lldb_private::ModuleSpec &module_spec) override;
36
37   lldb_private::OptionGroupOptions *
38   GetConnectionOptions(lldb_private::CommandInterpreter &interpreter) override;
39
40   const char *GetHostname() override;
41
42   const char *GetUserName(uint32_t uid) override;
43
44   const char *GetGroupName(uint32_t gid) override;
45
46   lldb_private::Status PutFile(const lldb_private::FileSpec &source,
47                                const lldb_private::FileSpec &destination,
48                                uint32_t uid = UINT32_MAX,
49                                uint32_t gid = UINT32_MAX) override;
50
51   lldb::user_id_t OpenFile(const lldb_private::FileSpec &file_spec,
52                            uint32_t flags, uint32_t mode,
53                            lldb_private::Status &error) override;
54
55   bool CloseFile(lldb::user_id_t fd, lldb_private::Status &error) override;
56
57   uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst,
58                     uint64_t dst_len, lldb_private::Status &error) override;
59
60   uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src,
61                      uint64_t src_len, lldb_private::Status &error) override;
62
63   lldb::user_id_t GetFileSize(const lldb_private::FileSpec &file_spec) override;
64
65   lldb_private::Status
66   CreateSymlink(const lldb_private::FileSpec &src,
67                 const lldb_private::FileSpec &dst) override;
68
69   lldb_private::Status
70   GetFile(const lldb_private::FileSpec &source,
71           const lldb_private::FileSpec &destination) override;
72
73   lldb_private::FileSpec GetRemoteWorkingDirectory() override;
74
75   bool
76   SetRemoteWorkingDirectory(const lldb_private::FileSpec &working_dir) override;
77
78   bool GetRemoteOSVersion() override;
79
80   bool GetRemoteOSBuildString(std::string &s) override;
81
82   bool GetRemoteOSKernelDescription(std::string &s) override;
83
84   lldb_private::ArchSpec GetRemoteSystemArchitecture() override;
85
86   const lldb::UnixSignalsSP &GetRemoteUnixSignals() override;
87
88   size_t GetEnvironment(lldb_private::StringList &environment) override;
89
90   bool IsConnected() const override;
91
92   lldb_private::Status RunShellCommand(
93       const char *command,                       // Shouldn't be nullptr
94       const lldb_private::FileSpec &working_dir, // Pass empty FileSpec to use
95                                                  // the current working
96                                                  // directory
97       int *status_ptr, // Pass nullptr if you don't want the process exit status
98       int *signo_ptr,  // Pass nullptr if you don't want the signal that caused
99                        // the process to exit
100       std::string
101           *command_output, // Pass nullptr if you don't want the command output
102       uint32_t timeout_sec)
103       override; // Timeout in seconds to wait for shell program to finish
104
105   lldb_private::Status ResolveExecutable(
106       const lldb_private::ModuleSpec &module_spec, lldb::ModuleSP &module_sp,
107       const lldb_private::FileSpecList *module_search_paths_ptr) override;
108
109   lldb_private::Status
110   GetFileWithUUID(const lldb_private::FileSpec &platform_file,
111                   const lldb_private::UUID *uuid,
112                   lldb_private::FileSpec &local_file) override;
113
114   bool GetProcessInfo(lldb::pid_t pid, lldb_private::ProcessInstanceInfo &proc_info) override;
115
116   uint32_t FindProcesses(const lldb_private::ProcessInstanceInfoMatch &match_info,
117                          lldb_private::ProcessInstanceInfoList &process_infos) override;
118
119   lldb_private::Status MakeDirectory(const lldb_private::FileSpec &file_spec,
120                                      uint32_t mode) override;
121
122   lldb_private::Status
123   GetFilePermissions(const lldb_private::FileSpec &file_spec,
124                      uint32_t &file_permissions) override;
125
126   lldb_private::Status
127   SetFilePermissions(const lldb_private::FileSpec &file_spec,
128                      uint32_t file_permissions) override;
129
130   bool GetFileExists(const lldb_private::FileSpec &file_spec) override;
131
132   lldb_private::Status Unlink(const lldb_private::FileSpec &file_spec) override;
133
134   lldb_private::Status
135   LaunchProcess(lldb_private::ProcessLaunchInfo &launch_info) override;
136
137   lldb_private::Status KillProcess(const lldb::pid_t pid) override;
138
139   lldb::ProcessSP Attach(lldb_private::ProcessAttachInfo &attach_info,
140                          lldb_private::Debugger &debugger,
141                          lldb_private::Target *target, // Can be nullptr, if
142                                                        // nullptr create a new
143                                                        // target, else use
144                                                        // existing one
145                          lldb_private::Status &error) override;
146
147   lldb::ProcessSP DebugProcess(lldb_private::ProcessLaunchInfo &launch_info,
148                                lldb_private::Debugger &debugger,
149                                lldb_private::Target *target, // Can be nullptr,
150                                                              // if nullptr
151                                                              // create a new
152                                                              // target, else use
153                                                              // existing one
154                                lldb_private::Status &error) override;
155
156   std::string GetPlatformSpecificConnectionInformation() override;
157
158   bool CalculateMD5(const lldb_private::FileSpec &file_spec, uint64_t &low,
159                     uint64_t &high) override;
160
161   void CalculateTrapHandlerSymbolNames() override;
162
163   lldb_private::Status ConnectRemote(lldb_private::Args &args) override;
164
165   lldb_private::Status DisconnectRemote() override;
166
167   uint32_t DoLoadImage(lldb_private::Process *process,
168                        const lldb_private::FileSpec &remote_file,
169                        lldb_private::Status &error) override;
170
171   lldb_private::Status UnloadImage(lldb_private::Process *process,
172                                    uint32_t image_token) override;
173
174   lldb::ProcessSP ConnectProcess(llvm::StringRef connect_url,
175                                  llvm::StringRef plugin_name,
176                                  lldb_private::Debugger &debugger,
177                                  lldb_private::Target *target,
178                                  lldb_private::Status &error) override;
179
180   size_t ConnectToWaitingProcesses(lldb_private::Debugger &debugger,
181                                    lldb_private::Status &error) override;
182
183   lldb_private::ConstString GetFullNameForDylib(lldb_private::ConstString basename) override;
184
185 protected:
186   std::unique_ptr<lldb_private::OptionGroupPlatformRSync>
187       m_option_group_platform_rsync;
188   std::unique_ptr<lldb_private::OptionGroupPlatformSSH>
189       m_option_group_platform_ssh;
190   std::unique_ptr<lldb_private::OptionGroupPlatformCaching>
191       m_option_group_platform_caching;
192
193   std::map<lldb_private::CommandInterpreter *,
194            std::unique_ptr<lldb_private::OptionGroupOptions>>
195       m_options;
196   lldb::PlatformSP m_remote_platform_sp; // Allow multiple ways to connect to a
197                                          // remote POSIX-compliant OS
198
199   lldb_private::Status
200   EvaluateLibdlExpression(lldb_private::Process *process, const char *expr_cstr,
201                           llvm::StringRef expr_prefix,
202                           lldb::ValueObjectSP &result_valobj_sp);
203
204   virtual
205   llvm::StringRef GetLibdlFunctionDeclarations(lldb_private::Process *process);
206
207 private:
208   DISALLOW_COPY_AND_ASSIGN(PlatformPOSIX);
209 };
210
211 #endif // liblldb_PlatformPOSIX_h_