diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp index f2c08d86a3ba..5f0056e4e74b 100644 --- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp +++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp @@ -134,21 +134,6 @@ Error PlatformFreeBSD::RunShellCommand(const char *command, } } -// From PlatformMacOSX only -Error PlatformFreeBSD::GetFileWithUUID(const FileSpec &platform_file, - const UUID *uuid_ptr, - FileSpec &local_file) { - if (IsRemote()) { - if (m_remote_platform_sp) - return m_remote_platform_sp->GetFileWithUUID(platform_file, uuid_ptr, - local_file); - } - - // Default to the local case - local_file = platform_file; - return Error(); -} - //------------------------------------------------------------------ /// Default Constructor //------------------------------------------------------------------ @@ -256,33 +241,6 @@ Error PlatformFreeBSD::DisconnectRemote() { return error; } -bool PlatformFreeBSD::GetProcessInfo(lldb::pid_t pid, - ProcessInstanceInfo &process_info) { - bool success = false; - if (IsHost()) { - success = Platform::GetProcessInfo(pid, process_info); - } else if (m_remote_platform_sp) { - success = m_remote_platform_sp->GetProcessInfo(pid, process_info); - } - return success; -} - -uint32_t -PlatformFreeBSD::FindProcesses(const ProcessInstanceInfoMatch &match_info, - ProcessInstanceInfoList &process_infos) { - uint32_t match_count = 0; - if (IsHost()) { - // Let the base class figure out the host details - match_count = Platform::FindProcesses(match_info, process_infos); - } else { - // If we are remote, we can only return results if we are connected - if (m_remote_platform_sp) - match_count = - m_remote_platform_sp->FindProcesses(match_info, process_infos); - } - return match_count; -} - const char *PlatformFreeBSD::GetUserName(uint32_t uid) { // Check the cache in Platform in case we have already looked this uid up const char *user_name = Platform::GetUserName(uid); diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h index b8068d509878..f2525e21e487 100644 --- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h +++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h @@ -84,11 +84,6 @@ public: const char *GetGroupName(uint32_t gid) override; - bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info) override; - - uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info, - ProcessInstanceInfoList &process_infos) override; - Error LaunchProcess(ProcessLaunchInfo &launch_info) override; lldb::ProcessSP Attach(ProcessAttachInfo &attach_info, Debugger &debugger, @@ -97,10 +92,6 @@ public: // FreeBSD processes can not be launched by spawning and attaching. bool CanDebugProcess() override { return false; } - // Only on PlatformMacOSX: - Error GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid, - FileSpec &local_file) override; - Error GetSharedModule(const ModuleSpec &module_spec, Process *process, lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, diff --git a/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp b/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp index a63c8b136bb0..4e57e2c52558 100644 --- a/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp +++ b/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp @@ -84,12 +84,6 @@ void PlatformKalimba::Terminate() { Platform::Terminate(); } -Error PlatformKalimba::GetFileWithUUID(const FileSpec & /*platform_file*/, - const UUID * /*uuid_ptr*/, - FileSpec & /*local_file*/) { - return Error(); -} - //------------------------------------------------------------------ /// Default Constructor //------------------------------------------------------------------ @@ -105,18 +99,6 @@ PlatformKalimba::PlatformKalimba(bool is_host) //------------------------------------------------------------------ PlatformKalimba::~PlatformKalimba() {} -bool PlatformKalimba::GetProcessInfo(lldb::pid_t pid, - ProcessInstanceInfo &process_info) { - bool success = false; - if (IsHost()) { - success = false; - } else { - if (m_remote_platform_sp) - success = m_remote_platform_sp->GetProcessInfo(pid, process_info); - } - return success; -} - bool PlatformKalimba::GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) { if (idx == 0) { diff --git a/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.h b/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.h index df4a09367c91..0c94ec9ec8f7 100644 --- a/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.h +++ b/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.h @@ -51,11 +51,6 @@ public: void GetStatus(Stream &strm) override; - Error GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid, - FileSpec &local_file) override; - - bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info) override; - bool GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) override; size_t GetSoftwareBreakpointTrapOpcode(Target &target, diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp index 80a5289551eb..4cabfc26b9bf 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -205,20 +205,6 @@ void PlatformLinux::Terminate() { PlatformPOSIX::Terminate(); } -Error PlatformLinux::GetFileWithUUID(const FileSpec &platform_file, - const UUID *uuid_ptr, - FileSpec &local_file) { - if (IsRemote()) { - if (m_remote_platform_sp) - return m_remote_platform_sp->GetFileWithUUID(platform_file, uuid_ptr, - local_file); - } - - // Default to the local case - local_file = platform_file; - return Error(); -} - //------------------------------------------------------------------ /// Default Constructor //------------------------------------------------------------------ @@ -226,42 +212,8 @@ PlatformLinux::PlatformLinux(bool is_host) : PlatformPOSIX(is_host) // This is the local host platform {} -//------------------------------------------------------------------ -/// Destructor. -/// -/// The destructor is virtual since this class is designed to be -/// inherited from by the plug-in instance. -//------------------------------------------------------------------ PlatformLinux::~PlatformLinux() = default; -bool PlatformLinux::GetProcessInfo(lldb::pid_t pid, - ProcessInstanceInfo &process_info) { - bool success = false; - if (IsHost()) { - success = Platform::GetProcessInfo(pid, process_info); - } else { - if (m_remote_platform_sp) - success = m_remote_platform_sp->GetProcessInfo(pid, process_info); - } - return success; -} - -uint32_t -PlatformLinux::FindProcesses(const ProcessInstanceInfoMatch &match_info, - ProcessInstanceInfoList &process_infos) { - uint32_t match_count = 0; - if (IsHost()) { - // Let the base class figure out the host details - match_count = Platform::FindProcesses(match_info, process_infos); - } else { - // If we are remote, we can only return results if we are connected - if (m_remote_platform_sp) - match_count = - m_remote_platform_sp->FindProcesses(match_info, process_infos); - } - return match_count; -} - bool PlatformLinux::GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) { if (IsHost()) { @@ -582,11 +534,3 @@ uint64_t PlatformLinux::ConvertMmapFlagsToPlatform(const ArchSpec &arch, return flags_platform; } -ConstString PlatformLinux::GetFullNameForDylib(ConstString basename) { - if (basename.IsEmpty()) - return basename; - - StreamString stream; - stream.Printf("lib%s.so", basename.GetCString()); - return ConstString(stream.GetString()); -} diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h index bb77161c79ac..8b9efbe33af0 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h @@ -53,14 +53,6 @@ public: void GetStatus(Stream &strm) override; - Error GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid, - FileSpec &local_file) override; - - bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info) override; - - uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info, - ProcessInstanceInfoList &process_infos) override; - bool GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) override; int32_t GetResumeCountForLaunchInfo(ProcessLaunchInfo &launch_info) override; @@ -76,8 +68,6 @@ public: uint64_t ConvertMmapFlagsToPlatform(const ArchSpec &arch, unsigned flags) override; - ConstString GetFullNameForDylib(ConstString basename) override; - private: DISALLOW_COPY_AND_ASSIGN(PlatformLinux); }; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index 9d29dbbdf889..27a42226b2f9 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -489,34 +489,6 @@ PlatformDarwin::GetSoftwareBreakpointTrapOpcode(Target &target, return 0; } -bool PlatformDarwin::GetProcessInfo(lldb::pid_t pid, - ProcessInstanceInfo &process_info) { - bool success = false; - if (IsHost()) { - success = Platform::GetProcessInfo(pid, process_info); - } else { - if (m_remote_platform_sp) - success = m_remote_platform_sp->GetProcessInfo(pid, process_info); - } - return success; -} - -uint32_t -PlatformDarwin::FindProcesses(const ProcessInstanceInfoMatch &match_info, - ProcessInstanceInfoList &process_infos) { - uint32_t match_count = 0; - if (IsHost()) { - // Let the base class figure out the host details - match_count = Platform::FindProcesses(match_info, process_infos); - } else { - // If we are remote, we can only return results if we are connected - if (m_remote_platform_sp) - match_count = - m_remote_platform_sp->FindProcesses(match_info, process_infos); - } - return match_count; -} - bool PlatformDarwin::ModuleIsExcludedForUnconstrainedSearches( lldb_private::Target &target, const lldb::ModuleSP &module_sp) { if (!module_sp) diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h index fe2ffec76baa..ffc8194f713e 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h @@ -51,16 +51,9 @@ public: lldb_private::Target &target, lldb_private::BreakpointSite *bp_site) override; - bool GetProcessInfo(lldb::pid_t pid, - lldb_private::ProcessInstanceInfo &proc_info) override; - lldb::BreakpointSP SetThreadCreationBreakpoint(lldb_private::Target &target) override; - uint32_t - FindProcesses(const lldb_private::ProcessInstanceInfoMatch &match_info, - lldb_private::ProcessInstanceInfoList &process_infos) override; - bool ModuleIsExcludedForUnconstrainedSearches( lldb_private::Target &target, const lldb::ModuleSP &module_sp) override; diff --git a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp index 20191bd0804d..2e6b913de9bd 100644 --- a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp +++ b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp @@ -126,21 +126,6 @@ Error PlatformNetBSD::RunShellCommand(const char *command, } } -// From PlatformMacOSX only -Error PlatformNetBSD::GetFileWithUUID(const FileSpec &platform_file, - const UUID *uuid_ptr, - FileSpec &local_file) { - if (IsRemote()) { - if (m_remote_platform_sp) - return m_remote_platform_sp->GetFileWithUUID(platform_file, uuid_ptr, - local_file); - } - - // Default to the local case - local_file = platform_file; - return Error(); -} - //------------------------------------------------------------------ /// Default Constructor //------------------------------------------------------------------ @@ -238,33 +223,6 @@ Error PlatformNetBSD::DisconnectRemote() { return error; } -bool PlatformNetBSD::GetProcessInfo(lldb::pid_t pid, - ProcessInstanceInfo &process_info) { - bool success = false; - if (IsHost()) { - success = Platform::GetProcessInfo(pid, process_info); - } else if (m_remote_platform_sp) { - success = m_remote_platform_sp->GetProcessInfo(pid, process_info); - } - return success; -} - -uint32_t -PlatformNetBSD::FindProcesses(const ProcessInstanceInfoMatch &match_info, - ProcessInstanceInfoList &process_infos) { - uint32_t match_count = 0; - if (IsHost()) { - // Let the base class figure out the host details - match_count = Platform::FindProcesses(match_info, process_infos); - } else { - // If we are remote, we can only return results if we are connected - if (m_remote_platform_sp) - match_count = - m_remote_platform_sp->FindProcesses(match_info, process_infos); - } - return match_count; -} - const char *PlatformNetBSD::GetUserName(uint32_t uid) { // Check the cache in Platform in case we have already looked this uid up const char *user_name = Platform::GetUserName(uid); diff --git a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h index 53c76f28fa12..dcd7daaba05d 100644 --- a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h +++ b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h @@ -81,11 +81,6 @@ public: const char *GetGroupName(uint32_t gid) override; - bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info) override; - - uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info, - ProcessInstanceInfoList &process_infos) override; - Error LaunchProcess(ProcessLaunchInfo &launch_info) override; lldb::ProcessSP Attach(ProcessAttachInfo &attach_info, Debugger &debugger, @@ -94,10 +89,6 @@ public: // NetBSD processes can not be launched by spawning and attaching. bool CanDebugProcess() override { return false; } - // Only on PlatformMacOSX: - Error GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid, - FileSpec &local_file) override; - Error GetSharedModule(const ModuleSpec &module_spec, Process *process, lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp index 0af4e5eb932a..6cff9e77b7e4 100644 --- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -250,6 +250,38 @@ Error PlatformPOSIX::ResolveExecutable(const ModuleSpec &module_spec, return error; } +Error PlatformPOSIX::GetFileWithUUID(const FileSpec &platform_file, + const UUID *uuid_ptr, + FileSpec &local_file) { + if (IsRemote() && m_remote_platform_sp) + return m_remote_platform_sp->GetFileWithUUID(platform_file, uuid_ptr, + local_file); + + // Default to the local case + local_file = platform_file; + return Error(); +} + +bool PlatformPOSIX::GetProcessInfo(lldb::pid_t pid, + ProcessInstanceInfo &process_info) { + if (IsHost()) + return Platform::GetProcessInfo(pid, process_info); + if (m_remote_platform_sp) + return m_remote_platform_sp->GetProcessInfo(pid, process_info); + return false; +} + +uint32_t +PlatformPOSIX::FindProcesses(const ProcessInstanceInfoMatch &match_info, + ProcessInstanceInfoList &process_infos) { + if (IsHost()) + return Platform::FindProcesses(match_info, process_infos); + if (m_remote_platform_sp) + return + m_remote_platform_sp->FindProcesses(match_info, process_infos); + return 0; +} + Error PlatformPOSIX::MakeDirectory(const FileSpec &file_spec, uint32_t file_permissions) { if (m_remote_platform_sp) @@ -1003,3 +1035,12 @@ size_t PlatformPOSIX::ConnectToWaitingProcesses(Debugger &debugger, return m_remote_platform_sp->ConnectToWaitingProcesses(debugger, error); return Platform::ConnectToWaitingProcesses(debugger, error); } + +ConstString PlatformPOSIX::GetFullNameForDylib(ConstString basename) { + if (basename.IsEmpty()) + return basename; + + StreamString stream; + stream.Printf("lib%s.so", basename.GetCString()); + return ConstString(stream.GetString()); +} diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.h b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.h index 13a4b88f5276..6c5c62797a6e 100644 --- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.h +++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.h @@ -105,6 +105,14 @@ public: lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr) override; + lldb_private::Error GetFileWithUUID(const lldb_private::FileSpec &platform_file, const lldb_private::UUID *uuid, + lldb_private::FileSpec &local_file) override; + + bool GetProcessInfo(lldb::pid_t pid, lldb_private::ProcessInstanceInfo &proc_info) override; + + uint32_t FindProcesses(const lldb_private::ProcessInstanceInfoMatch &match_info, + lldb_private::ProcessInstanceInfoList &process_infos) override; + lldb_private::Error MakeDirectory(const lldb_private::FileSpec &file_spec, uint32_t mode) override; @@ -169,6 +177,8 @@ public: size_t ConnectToWaitingProcesses(lldb_private::Debugger &debugger, lldb_private::Error &error) override; + lldb_private::ConstString GetFullNameForDylib(lldb_private::ConstString basename) override; + protected: std::unique_ptr m_option_group_platform_rsync;