]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - source/Plugins/Platform/NetBSD/PlatformNetBSD.h
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / source / Plugins / Platform / NetBSD / PlatformNetBSD.h
1 //===-- PlatformNetBSD.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_PlatformNetBSD_h_
11 #define liblldb_PlatformNetBSD_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 namespace platform_netbsd {
21
22 class PlatformNetBSD : public Platform {
23 public:
24   PlatformNetBSD(bool is_host);
25
26   ~PlatformNetBSD() override = default;
27
28   //------------------------------------------------------------
29   // Class functions
30   //------------------------------------------------------------
31   static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
32
33   static void Initialize();
34
35   static void Terminate();
36
37   static ConstString GetPluginNameStatic(bool is_host);
38
39   static const char *GetDescriptionStatic(bool is_host);
40
41   //------------------------------------------------------------
42   // lldb_private::PluginInterface functions
43   //------------------------------------------------------------
44   ConstString GetPluginName() override { return GetPluginNameStatic(IsHost()); }
45
46   uint32_t GetPluginVersion() override { return 1; }
47
48   const char *GetDescription() override {
49     return GetDescriptionStatic(IsHost());
50   }
51
52   //------------------------------------------------------------
53   // lldb_private::Platform functions
54   //------------------------------------------------------------
55   bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch,
56                      ModuleSpec &module_spec) override;
57
58   Error RunShellCommand(const char *command, const FileSpec &working_dir,
59                         int *status_ptr, int *signo_ptr,
60                         std::string *command_output,
61                         uint32_t timeout_sec) override;
62
63   Error ResolveExecutable(const ModuleSpec &module_spec,
64                           lldb::ModuleSP &module_sp,
65                           const FileSpecList *module_search_paths_ptr) override;
66
67   bool GetRemoteOSVersion() override;
68
69   bool GetRemoteOSBuildString(std::string &s) override;
70
71   bool GetRemoteOSKernelDescription(std::string &s) override;
72
73   // Remote Platform subclasses need to override this function
74   ArchSpec GetRemoteSystemArchitecture() override;
75
76   bool IsConnected() const override;
77
78   Error ConnectRemote(Args &args) override;
79
80   Error DisconnectRemote() override;
81
82   const char *GetHostname() override;
83
84   const char *GetUserName(uint32_t uid) override;
85
86   const char *GetGroupName(uint32_t gid) override;
87
88   bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info) override;
89
90   uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info,
91                          ProcessInstanceInfoList &process_infos) override;
92
93   Error LaunchProcess(ProcessLaunchInfo &launch_info) override;
94
95   lldb::ProcessSP Attach(ProcessAttachInfo &attach_info, Debugger &debugger,
96                          Target *target, Error &error) override;
97
98   // NetBSD processes can not be launched by spawning and attaching.
99   bool CanDebugProcess() override { return false; }
100
101   // Only on PlatformMacOSX:
102   Error GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid,
103                         FileSpec &local_file) override;
104
105   Error GetSharedModule(const ModuleSpec &module_spec, Process *process,
106                         lldb::ModuleSP &module_sp,
107                         const FileSpecList *module_search_paths_ptr,
108                         lldb::ModuleSP *old_module_sp_ptr,
109                         bool *did_create_ptr) override;
110
111   bool GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) override;
112
113   void GetStatus(Stream &strm) override;
114
115   void CalculateTrapHandlerSymbolNames() override;
116
117 protected:
118   lldb::PlatformSP m_remote_platform_sp; // Allow multiple ways to connect to a
119                                          // remote netbsd OS
120
121 private:
122   DISALLOW_COPY_AND_ASSIGN(PlatformNetBSD);
123 };
124
125 } // namespace platform_netbsd
126 } // namespace lldb_private
127
128 #endif // liblldb_PlatformNetBSD_h_