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 { 24 public: 25 PlatformNetBSD (bool is_host); 26 27 ~PlatformNetBSD() override = default; 28 29 //------------------------------------------------------------ 30 // Class functions 31 //------------------------------------------------------------ 32 static lldb::PlatformSP 33 CreateInstance(bool force, const ArchSpec *arch); 34 35 static void 36 Initialize (); 37 38 static void 39 Terminate (); 40 41 static ConstString 42 GetPluginNameStatic (bool is_host); 43 44 static const char * 45 GetDescriptionStatic (bool is_host); 46 47 //------------------------------------------------------------ 48 // lldb_private::PluginInterface functions 49 //------------------------------------------------------------ 50 ConstString 51 GetPluginName() override 52 { 53 return GetPluginNameStatic (IsHost()); 54 } 55 56 uint32_t 57 GetPluginVersion() override 58 { 59 return 1; 60 } 61 62 const char * 63 GetDescription () override 64 { 65 return GetDescriptionStatic(IsHost()); 66 } 67 68 //------------------------------------------------------------ 69 // lldb_private::Platform functions 70 //------------------------------------------------------------ 71 bool 72 GetModuleSpec(const FileSpec& module_file_spec, 73 const ArchSpec& arch, 74 ModuleSpec &module_spec) override; 75 76 Error 77 RunShellCommand(const char *command, 78 const FileSpec &working_dir, 79 int *status_ptr, 80 int *signo_ptr, 81 std::string *command_output, 82 uint32_t timeout_sec) override; 83 84 Error 85 ResolveExecutable(const ModuleSpec &module_spec, 86 lldb::ModuleSP &module_sp, 87 const FileSpecList *module_search_paths_ptr) override; 88 89 bool 90 GetRemoteOSVersion () override; 91 92 bool 93 GetRemoteOSBuildString (std::string &s) override; 94 95 bool 96 GetRemoteOSKernelDescription (std::string &s) override; 97 98 // Remote Platform subclasses need to override this function 99 ArchSpec 100 GetRemoteSystemArchitecture() override; 101 102 bool 103 IsConnected () const override; 104 105 Error 106 ConnectRemote(Args& args) override; 107 108 Error 109 DisconnectRemote() override; 110 111 const char * 112 GetHostname () override; 113 114 const char * 115 GetUserName (uint32_t uid) override; 116 117 const char * 118 GetGroupName (uint32_t gid) override; 119 120 bool 121 GetProcessInfo(lldb::pid_t pid, 122 ProcessInstanceInfo &proc_info) override; 123 124 uint32_t 125 FindProcesses(const ProcessInstanceInfoMatch &match_info, 126 ProcessInstanceInfoList &process_infos) override; 127 128 Error 129 LaunchProcess(ProcessLaunchInfo &launch_info) override; 130 131 lldb::ProcessSP 132 Attach(ProcessAttachInfo &attach_info, 133 Debugger &debugger, 134 Target *target, 135 Error &error) override; 136 137 // NetBSD processes can not be launched by spawning and attaching. 138 bool 139 CanDebugProcess () override { return false; } 140 141 // Only on PlatformMacOSX: 142 Error 143 GetFileWithUUID(const FileSpec &platform_file, 144 const UUID* uuid, FileSpec &local_file) override; 145 146 Error 147 GetSharedModule(const ModuleSpec &module_spec, 148 Process* process, 149 lldb::ModuleSP &module_sp, 150 const FileSpecList *module_search_paths_ptr, 151 lldb::ModuleSP *old_module_sp_ptr, 152 bool *did_create_ptr) override; 153 154 bool 155 GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) override; 156 157 void 158 GetStatus(Stream &strm) override; 159 160 void 161 CalculateTrapHandlerSymbolNames () override; 162 163 protected: 164 lldb::PlatformSP m_remote_platform_sp; // Allow multiple ways to connect to a remote netbsd OS 165 166 private: 167 DISALLOW_COPY_AND_ASSIGN (PlatformNetBSD); 168 }; 169 170 } // namespace platform_netbsd 171 } // namespace lldb_private 172 173 #endif // liblldb_PlatformNetBSD_h_ 174