1 //===-- PlatformNetBSD.h ----------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_PlatformNetBSD_h_
11 #define liblldb_PlatformNetBSD_h_
15 // Other libraries and framework includes
17 #include "lldb/Target/Platform.h"
19 namespace lldb_private {
20 namespace platform_netbsd {
22 class PlatformNetBSD : public Platform {
24 PlatformNetBSD(bool is_host);
26 ~PlatformNetBSD() override = default;
28 //------------------------------------------------------------
30 //------------------------------------------------------------
31 static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
33 static void Initialize();
35 static void Terminate();
37 static ConstString GetPluginNameStatic(bool is_host);
39 static const char *GetDescriptionStatic(bool is_host);
41 //------------------------------------------------------------
42 // lldb_private::PluginInterface functions
43 //------------------------------------------------------------
44 ConstString GetPluginName() override { return GetPluginNameStatic(IsHost()); }
46 uint32_t GetPluginVersion() override { return 1; }
48 const char *GetDescription() override {
49 return GetDescriptionStatic(IsHost());
52 //------------------------------------------------------------
53 // lldb_private::Platform functions
54 //------------------------------------------------------------
55 bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch,
56 ModuleSpec &module_spec) override;
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;
63 Error ResolveExecutable(const ModuleSpec &module_spec,
64 lldb::ModuleSP &module_sp,
65 const FileSpecList *module_search_paths_ptr) override;
67 bool GetRemoteOSVersion() override;
69 bool GetRemoteOSBuildString(std::string &s) override;
71 bool GetRemoteOSKernelDescription(std::string &s) override;
73 // Remote Platform subclasses need to override this function
74 ArchSpec GetRemoteSystemArchitecture() override;
76 bool IsConnected() const override;
78 Error ConnectRemote(Args &args) override;
80 Error DisconnectRemote() override;
82 const char *GetHostname() override;
84 const char *GetUserName(uint32_t uid) override;
86 const char *GetGroupName(uint32_t gid) override;
88 bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info) override;
90 uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info,
91 ProcessInstanceInfoList &process_infos) override;
93 Error LaunchProcess(ProcessLaunchInfo &launch_info) override;
95 lldb::ProcessSP Attach(ProcessAttachInfo &attach_info, Debugger &debugger,
96 Target *target, Error &error) override;
98 // NetBSD processes can not be launched by spawning and attaching.
99 bool CanDebugProcess() override { return false; }
101 // Only on PlatformMacOSX:
102 Error GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid,
103 FileSpec &local_file) override;
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;
111 bool GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) override;
113 void GetStatus(Stream &strm) override;
115 void CalculateTrapHandlerSymbolNames() override;
118 lldb::PlatformSP m_remote_platform_sp; // Allow multiple ways to connect to a
122 DISALLOW_COPY_AND_ASSIGN(PlatformNetBSD);
125 } // namespace platform_netbsd
126 } // namespace lldb_private
128 #endif // liblldb_PlatformNetBSD_h_