]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - source/Plugins/Platform/POSIX/PlatformPOSIX.h
Vendor import of (stripped) lldb trunk r242221:
[FreeBSD/FreeBSD.git] / 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
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 {
25 public:
26     PlatformPOSIX (bool is_host);
27     
28     virtual
29     ~PlatformPOSIX();
30     
31     //------------------------------------------------------------
32     // lldb_private::Platform functions
33     //------------------------------------------------------------
34
35     bool
36     GetModuleSpec (const lldb_private::FileSpec& module_file_spec,
37                    const lldb_private::ArchSpec& arch,
38                    lldb_private::ModuleSpec &module_spec) override;
39
40     lldb_private::OptionGroupOptions
41     *GetConnectionOptions(
42         lldb_private::CommandInterpreter &interpreter) override;
43
44     const char *
45     GetHostname () override;
46
47     const char *
48     GetUserName (uint32_t uid) override;
49
50     const char *
51     GetGroupName (uint32_t gid) override;
52
53     lldb_private::Error
54     PutFile (const lldb_private::FileSpec& source,
55              const lldb_private::FileSpec& destination,
56              uint32_t uid = UINT32_MAX,
57              uint32_t gid = UINT32_MAX) override;
58     
59     lldb::user_id_t
60     OpenFile (const lldb_private::FileSpec& file_spec,
61               uint32_t flags,
62               uint32_t mode,
63               lldb_private::Error &error) override;
64     
65     bool
66     CloseFile (lldb::user_id_t fd,
67                lldb_private::Error &error) override;
68     
69     uint64_t
70     ReadFile (lldb::user_id_t fd,
71               uint64_t offset,
72               void *dst,
73               uint64_t dst_len,
74               lldb_private::Error &error) override;
75     
76     uint64_t
77     WriteFile (lldb::user_id_t fd,
78                uint64_t offset,
79                const void* src,
80                uint64_t src_len,
81                lldb_private::Error &error) override;
82     
83     lldb::user_id_t
84     GetFileSize (const lldb_private::FileSpec& file_spec) override;
85
86     lldb_private::Error
87     CreateSymlink(const lldb_private::FileSpec &src,
88                   const lldb_private::FileSpec &dst) override;
89
90     lldb_private::Error
91     GetFile(const lldb_private::FileSpec &source,
92             const lldb_private::FileSpec &destination) override;
93
94     lldb_private::FileSpec
95     GetRemoteWorkingDirectory() override;
96     
97     bool
98     SetRemoteWorkingDirectory(const lldb_private::FileSpec &working_dir) override;
99
100     bool
101     GetRemoteOSVersion () override;
102
103     bool
104     GetRemoteOSBuildString (std::string &s) override;
105
106     bool
107     GetRemoteOSKernelDescription (std::string &s) override;
108
109     lldb_private::ArchSpec
110     GetRemoteSystemArchitecture () override;
111
112     const lldb::UnixSignalsSP &
113     GetRemoteUnixSignals() override;
114
115     size_t
116     GetEnvironment (lldb_private::StringList &environment) override;
117
118     bool
119     IsConnected () const override;
120
121     lldb_private::Error
122     RunShellCommand(const char *command,                       // Shouldn't be NULL
123                     const lldb_private::FileSpec &working_dir, // Pass empty FileSpec to use the current working directory
124                     int *status_ptr,                           // Pass NULL if you don't want the process exit status
125                     int *signo_ptr,                            // Pass NULL if you don't want the signal that caused the process to exit
126                     std::string *command_output,               // Pass NULL if you don't want the command output
127                     uint32_t timeout_sec) override;            // Timeout in seconds to wait for shell program to finish
128
129     lldb_private::Error
130     MakeDirectory(const lldb_private::FileSpec &file_spec, uint32_t mode) override;
131
132     lldb_private::Error
133     GetFilePermissions(const lldb_private::FileSpec &file_spec, uint32_t &file_permissions) override;
134
135     lldb_private::Error
136     SetFilePermissions(const lldb_private::FileSpec &file_spec, uint32_t file_permissions) override;
137
138     bool
139     GetFileExists (const lldb_private::FileSpec& file_spec) override;
140     
141     lldb_private::Error
142     Unlink(const lldb_private::FileSpec &file_spec) override;
143
144     lldb_private::Error
145     LaunchProcess (lldb_private::ProcessLaunchInfo &launch_info) override;
146
147     lldb_private::Error
148     KillProcess (const lldb::pid_t pid) override;
149
150     lldb::ProcessSP
151     Attach (lldb_private::ProcessAttachInfo &attach_info,
152             lldb_private::Debugger &debugger,
153             lldb_private::Target *target,       // Can be NULL, if NULL create a new target, else use existing one
154             lldb_private::Error &error) override;
155
156     lldb::ProcessSP
157     DebugProcess (lldb_private::ProcessLaunchInfo &launch_info,
158                   lldb_private::Debugger &debugger,
159                   lldb_private::Target *target,       // Can be NULL, if NULL create a new target, else use existing one
160                   lldb_private::Error &error) override;
161
162     std::string
163     GetPlatformSpecificConnectionInformation() override;
164     
165     bool
166     CalculateMD5 (const lldb_private::FileSpec& file_spec,
167                   uint64_t &low,
168                   uint64_t &high) override;
169
170     void
171     CalculateTrapHandlerSymbolNames () override;
172
173     lldb_private::Error
174     ConnectRemote (lldb_private::Args& args) override;
175
176     lldb_private::Error
177     DisconnectRemote () override;
178
179 protected:
180     std::unique_ptr<lldb_private::OptionGroupOptions> m_options;
181         
182     lldb::PlatformSP m_remote_platform_sp; // Allow multiple ways to connect to a remote POSIX-compliant OS
183     
184 private:
185     DISALLOW_COPY_AND_ASSIGN (PlatformPOSIX);
186     
187 };
188
189 #endif  // liblldb_PlatformPOSIX_h_