LLDB mainline
lldb_private::platform_gdb_server::PlatformRemoteGDBServer Class Reference

#include <PlatformRemoteGDBServer.h>

Inheritance diagram for lldb_private::platform_gdb_server::PlatformRemoteGDBServer:
[legend]

Public Member Functions

 PlatformRemoteGDBServer ()
 Default Constructor.
 ~PlatformRemoteGDBServer () override
 Destructor.
llvm::StringRef GetPluginName () override
bool GetModuleSpec (const FileSpec &module_file_spec, const ArchSpec &arch, ModuleSpec &module_spec) override
llvm::StringRef GetDescription () override
Status GetFileWithUUID (const FileSpec &platform_file, const UUID *uuid_ptr, FileSpec &local_file) override
 Locate a file for a platform.
bool GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &proc_info) override
uint32_t FindProcesses (const ProcessInstanceInfoMatch &match_info, ProcessInstanceInfoList &process_infos) override
 Attach to an existing process by process name.
Status LaunchProcess (ProcessLaunchInfo &launch_info) override
 Launch a new process on a platform, not necessarily for debugging, it could be just for running the process.
Status KillProcess (const lldb::pid_t pid) override
 Kill process on a platform.
lldb::ProcessSP DebugProcess (ProcessLaunchInfo &launch_info, Debugger &debugger, Target &target, Status &error) override
 Subclasses do not need to implement this function as it uses the Platform::LaunchProcess() followed by Platform::Attach ().
lldb::ProcessSP Attach (ProcessAttachInfo &attach_info, Debugger &debugger, Target *target, Status &error) override
 Attach to an existing process using a process ID.
std::vector< ArchSpecGetSupportedArchitectures (const ArchSpec &process_host_arch) override
 Get the platform's supported architectures in the order in which they should be searched.
size_t GetSoftwareBreakpointTrapOpcode (Target &target, BreakpointSite *bp_site) override
bool GetRemoteOSVersion () override
std::optional< std::string > GetRemoteOSBuildString () override
std::optional< std::string > GetRemoteOSKernelDescription () override
ArchSpec GetRemoteSystemArchitecture () override
FileSpec GetRemoteWorkingDirectory () override
bool SetRemoteWorkingDirectory (const FileSpec &working_dir) override
const char * GetHostname () override
UserIDResolverGetUserIDResolver () override
bool IsConnected () const override
Status ConnectRemote (Args &args) override
Status DisconnectRemote () override
Status MakeDirectory (const FileSpec &file_spec, uint32_t file_permissions) override
Status GetFilePermissions (const FileSpec &file_spec, uint32_t &file_permissions) override
Status SetFilePermissions (const FileSpec &file_spec, uint32_t file_permissions) override
lldb::user_id_t OpenFile (const FileSpec &file_spec, File::OpenOptions flags, uint32_t mode, Status &error) override
bool CloseFile (lldb::user_id_t fd, Status &error) override
uint64_t ReadFile (lldb::user_id_t fd, uint64_t offset, void *data_ptr, uint64_t len, Status &error) override
uint64_t WriteFile (lldb::user_id_t fd, uint64_t offset, const void *data, uint64_t len, Status &error) override
lldb::user_id_t GetFileSize (const FileSpec &file_spec) override
void AutoCompleteDiskFileOrDirectory (CompletionRequest &request, bool only_dir) override
Status PutFile (const FileSpec &source, const FileSpec &destination, uint32_t uid=UINT32_MAX, uint32_t gid=UINT32_MAX) override
Status CreateSymlink (const FileSpec &src, const FileSpec &dst) override
bool GetFileExists (const FileSpec &file_spec) override
Status Unlink (const FileSpec &path) override
Status RunShellCommand (llvm::StringRef shell, llvm::StringRef command, const FileSpec &working_dir, int *status_ptr, int *signo_ptr, std::string *command_output, const lldb_private::Timeout< std::micro > &timeout) override
void CalculateTrapHandlerSymbolNames () override
 Ask the Platform subclass to fill in the list of trap handler names.
llvm::ErrorOr< llvm::MD5::MD5Result > CalculateMD5 (const FileSpec &file_spec) override
const lldb::UnixSignalsSPGetRemoteUnixSignals () override
size_t ConnectToWaitingProcesses (lldb_private::Debugger &debugger, lldb_private::Status &error) override
 Connect to all processes waiting for a debugger to attach.
virtual size_t GetPendingGdbServerList (std::vector< std::string > &connection_urls)
Public Member Functions inherited from lldb_private::Platform
 Platform (bool is_host_platform)
 Default Constructor.
 ~Platform () override
 The destructor is virtual since this class is designed to be inherited from by the plug-in instance.
virtual Status ResolveExecutable (const ModuleSpec &module_spec, lldb::ModuleSP &exe_module_sp, const FileSpecList *module_search_paths_ptr)
 Set the target's executable based off of the existing architecture information in target given a path to an executable exe_file.
virtual Status ResolveSymbolFile (Target &target, const ModuleSpec &sym_spec, FileSpec &sym_file)
 Find a symbol file given a symbol file module specification.
virtual bool ResolveRemotePath (const FileSpec &platform_path, FileSpec &resolved_platform_path)
 Resolves the FileSpec to a (possibly) remote path.
virtual llvm::VersionTuple GetOSVersion (Process *process=nullptr)
 Get the OS version from a connected platform.
bool SetOSVersion (llvm::VersionTuple os_version)
std::optional< std::string > GetOSBuildString ()
std::optional< std::string > GetOSKernelDescription ()
llvm::StringRef GetName ()
virtual ConstString GetFullNameForDylib (ConstString basename)
virtual void GetStatus (Stream &strm)
 Report the current status for this platform.
virtual FileSpecList LocateExecutableScriptingResources (Target *target, Module &module, Stream &feedback_stream)
virtual Status GetSharedModule (const ModuleSpec &module_spec, Process *process, lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, llvm::SmallVectorImpl< lldb::ModuleSP > *old_modules, bool *did_create_ptr)
void CallLocateModuleCallbackIfSet (const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, FileSpec &symbol_file_spec, bool *did_create_ptr)
virtual Status ShellExpandArguments (ProcessLaunchInfo &launch_info)
 Perform expansion of the command-line for this launch info This can potentially involve wildcard expansion environment variable replacement, and whatever other argument magic the platform defines as part of its typical user experience.
virtual bool IsCompatibleArchitecture (const ArchSpec &arch, const ArchSpec &process_host_arch, ArchSpec::MatchType match, ArchSpec *compatible_arch_ptr)
 Lets a platform answer if it is compatible with a given architecture and the target triple contained within.
virtual bool CanDebugProcess ()
 Not all platforms will support debugging a process by spawning somehow halted for a debugger (specified using the "eLaunchFlagDebug" launch flag) and then attaching.
virtual lldb::ProcessSP ConnectProcess (llvm::StringRef connect_url, llvm::StringRef plugin_name, Debugger &debugger, Target *target, Status &error)
virtual lldb::ProcessSP ConnectProcessSynchronous (llvm::StringRef connect_url, llvm::StringRef plugin_name, Debugger &debugger, Stream &stream, Target *target, Status &error)
ProcessInstanceInfoList GetAllProcesses ()
virtual lldb::BreakpointSP SetThreadCreationBreakpoint (Target &target)
virtual lldb_private::ConstString GetSDKDirectory (lldb_private::Target &target)
virtual llvm::Expected< std::pair< XcodeSDK, bool > > GetSDKPathFromDebugInfo (Module &module)
 Search each CU associated with the specified 'module' for the SDK paths the CUs were compiled against.
virtual llvm::Expected< std::string > ResolveSDKPathFromDebugInfo (Module &module)
 Returns the full path of the most appropriate SDK for the specified 'module'.
virtual llvm::Expected< XcodeSDKGetSDKPathFromDebugInfo (CompileUnit &unit)
 Search CU for the SDK path the CUs was compiled against.
virtual llvm::Expected< std::string > ResolveSDKPathFromDebugInfo (CompileUnit &unit)
 Returns the full path of the most appropriate SDK for the specified compile unit.
bool IsHost () const
bool IsRemote () const
const ArchSpecGetSystemArchitecture ()
void SetSystemArchitecture (const ArchSpec &arch)
ArchSpec GetAugmentedArchSpec (llvm::StringRef triple)
 If the triple contains not specify the vendor, os, and environment parts, we "augment" these using information from the platform and return the resulting ArchSpec object.
size_t GetMaxUserIDNameLength () const
size_t GetMaxGroupIDNameLength () const
const std::string & GetSDKRootDirectory () const
void SetSDKRootDirectory (std::string dir)
const std::string & GetSDKBuild () const
void SetSDKBuild (std::string sdk_build)
virtual bool SupportsModules ()
virtual void AddClangModuleCompilationOptions (Target *target, std::vector< std::string > &options)
FileSpec GetWorkingDirectory ()
bool SetWorkingDirectory (const FileSpec &working_dir)
virtual bool ModuleIsExcludedForUnconstrainedSearches (Target &target, const lldb::ModuleSP &module_sp)
virtual Status GetFile (const FileSpec &source, const FileSpec &destination)
virtual Status Install (const FileSpec &src, const FileSpec &dst)
 Install a file or directory to the remote system.
virtual Environment GetEnvironment ()
virtual MmapArgList GetMmapArgumentList (const ArchSpec &arch, lldb::addr_t addr, lldb::addr_t length, unsigned prot, unsigned flags, lldb::addr_t fd, lldb::addr_t offset)
virtual bool GetSupportsRSync ()
virtual void SetSupportsRSync (bool flag)
virtual const char * GetRSyncOpts ()
virtual void SetRSyncOpts (const char *opts)
virtual const char * GetRSyncPrefix ()
virtual void SetRSyncPrefix (const char *prefix)
virtual bool GetSupportsSSH ()
virtual void SetSupportsSSH (bool flag)
virtual const char * GetSSHOpts ()
virtual void SetSSHOpts (const char *opts)
virtual bool GetIgnoresRemoteHostname ()
virtual void SetIgnoresRemoteHostname (bool flag)
virtual lldb_private::OptionGroupOptionsGetConnectionOptions (CommandInterpreter &interpreter)
virtual lldb_private::Status RunShellCommand (llvm::StringRef command, const FileSpec &working_dir, int *status_ptr, int *signo_ptr, std::string *command_output, const Timeout< std::micro > &timeout)
virtual void SetLocalCacheDirectory (const char *local)
virtual const char * GetLocalCacheDirectory ()
virtual std::string GetPlatformSpecificConnectionInformation ()
virtual uint32_t GetResumeCountForLaunchInfo (ProcessLaunchInfo &launch_info)
lldb::UnixSignalsSP GetUnixSignals ()
virtual std::string GetQueueNameForThreadQAddress (Process *process, lldb::addr_t dispatch_qaddr)
 Locate a queue name given a thread's qaddr.
virtual lldb::queue_id_t GetQueueIDForThreadQAddress (Process *process, lldb::addr_t dispatch_qaddr)
 Locate a queue ID given a thread's qaddr.
virtual const std::vector< ConstString > & GetTrapHandlerSymbolNames ()
 Provide a list of trap handler function names for this platform.
virtual lldb::UnwindPlanSP GetTrapHandlerUnwindPlan (const llvm::Triple &triple, ConstString name)
 Try to get a specific unwind plan for a named trap handler.
virtual FileSpec LocateExecutable (const char *basename)
 Find a support executable that may not live within in the standard locations related to LLDB.
virtual uint32_t GetDefaultMemoryCacheLineSize ()
 Allow the platform to set preferred memory cache line size.
uint32_t LoadImage (lldb_private::Process *process, const lldb_private::FileSpec &local_file, const lldb_private::FileSpec &remote_file, lldb_private::Status &error)
 Load a shared library into this process.
uint32_t LoadImageUsingPaths (lldb_private::Process *process, const lldb_private::FileSpec &library_name, const std::vector< std::string > &paths, lldb_private::Status &error, lldb_private::FileSpec *loaded_path)
 Load a shared library specified by base name into this process, looking by hand along a set of paths.
virtual uint32_t DoLoadImage (lldb_private::Process *process, const lldb_private::FileSpec &remote_file, const std::vector< std::string > *paths, lldb_private::Status &error, lldb_private::FileSpec *loaded_path=nullptr)
virtual Status UnloadImage (lldb_private::Process *process, uint32_t image_token)
virtual llvm::Expected< StructuredData::DictionarySPFetchExtendedCrashInformation (lldb_private::Process &process)
 Gather all of crash informations into a structured data dictionary.
virtual bool LoadPlatformBinaryAndSetup (Process *process, lldb::addr_t addr, bool notify)
 Detect a binary in memory that will determine which Platform and DynamicLoader should be used in this target/process, and update the Platform/DynamicLoader.
virtual CompilerType GetSiginfoType (const llvm::Triple &triple)
virtual lldb::StopInfoSP GetStopInfoFromSiginfo (Thread &thread)
virtual Args GetExtraStartupCommands ()
void SetLocateModuleCallback (LocateModuleCallback callback)
 Set locate module callback.
LocateModuleCallback GetLocateModuleCallback () const
Public Member Functions inherited from lldb_private::PluginInterface
 PluginInterface ()=default
virtual ~PluginInterface ()=default
 PluginInterface (const PluginInterface &)=delete
PluginInterfaceoperator= (const PluginInterface &)=delete

Static Public Member Functions

static void Initialize ()
static void Terminate ()
static lldb::PlatformSP CreateInstance (bool force, const ArchSpec *arch)
static llvm::StringRef GetPluginNameStatic ()
static llvm::StringRef GetDescriptionStatic ()
Static Public Member Functions inherited from lldb_private::Platform
static void Initialize ()
static void Terminate ()
static PlatformPropertiesGetGlobalPlatformProperties ()
static lldb::PlatformSP GetHostPlatform ()
 Get the native host platform plug-in.
static const char * GetHostPlatformName ()
static void SetHostPlatform (const lldb::PlatformSP &platform_sp)
static lldb::PlatformSP Create (llvm::StringRef name)
static ArchSpec GetAugmentedArchSpec (Platform *platform, llvm::StringRef triple)
 Augments the triple either with information from platform or the host system (if platform is null).

Protected Member Functions

virtual bool LaunchGDBServer (lldb::pid_t &pid, std::string &connect_url)
virtual bool KillSpawnedProcess (lldb::pid_t pid)
virtual std::string MakeUrl (const char *scheme, const char *hostname, uint16_t port, const char *path)
Protected Member Functions inherited from lldb_private::Platform
lldb::ProcessSP DoConnectProcess (llvm::StringRef connect_url, llvm::StringRef plugin_name, Debugger &debugger, Stream *stream, Target *target, Status &error)
 Private implementation of connecting to a process.
Status GetCachedExecutable (ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr)
virtual Status DownloadModuleSlice (const FileSpec &src_file_spec, const uint64_t src_offset, const uint64_t src_size, const FileSpec &dst_file_spec)
virtual Status DownloadSymbolFile (const lldb::ModuleSP &module_sp, const FileSpec &dst_file_spec)
virtual const char * GetCacheHostname ()

Protected Attributes

std::unique_ptr< process_gdb_remote::GDBRemoteCommunicationClientm_gdb_client_up
std::string m_platform_description
std::string m_platform_scheme
std::string m_platform_hostname
lldb::UnixSignalsSP m_remote_signals_sp
Protected Attributes inherited from lldb_private::Platform
bool m_is_host
bool m_os_version_set_while_connected
bool m_system_arch_set_while_connected
std::string m_sdk_sysroot
std::string m_sdk_build
FileSpec m_working_dir
std::string m_hostname
llvm::VersionTuple m_os_version
ArchSpec m_system_arch
std::mutex m_mutex
size_t m_max_uid_name_len
size_t m_max_gid_name_len
bool m_supports_rsync
std::string m_rsync_opts
std::string m_rsync_prefix
bool m_supports_ssh
std::string m_ssh_opts
bool m_ignores_remote_hostname
std::string m_local_cache_directory
std::vector< ConstStringm_trap_handlers
bool m_calculated_trap_handlers
const std::unique_ptr< ModuleCachem_module_cache
LocateModuleCallback m_locate_module_callback

Private Member Functions

std::string MakeGdbServerUrl (const std::string &platform_scheme, const std::string &platform_hostname, uint16_t port, const char *socket_name)
std::optional< std::string > DoGetUserName (UserIDResolver::id_t uid) override
std::optional< std::string > DoGetGroupName (UserIDResolver::id_t uid) override
 PlatformRemoteGDBServer (const PlatformRemoteGDBServer &)=delete
const PlatformRemoteGDBServeroperator= (const PlatformRemoteGDBServer &)=delete
Private Member Functions inherited from lldb_private::UserIDResolver
virtual ~UserIDResolver ()
std::optional< llvm::StringRef > GetUserName (id_t uid)
std::optional< llvm::StringRef > GetGroupName (id_t gid)

Private Attributes

std::vector< ArchSpecm_supported_architectures

Additional Inherited Members

Public Types inherited from lldb_private::Platform
typedef std::function< Status(const ModuleSpec &module_spec, FileSpec &module_file_spec, FileSpec &symbol_file_spec)> LocateModuleCallback
Protected Types inherited from lldb_private::Platform
typedef std::map< uint32_t, ConstStringIDToNameMap
Static Protected Member Functions inherited from lldb_private::Platform
static std::vector< ArchSpecCreateArchList (llvm::ArrayRef< llvm::Triple::ArchType > archs, llvm::Triple::OSType os)
 Create a list of ArchSpecs with the given OS and a architectures.
Private Types inherited from lldb_private::UserIDResolver
typedef uint32_t id_t
Static Private Member Functions inherited from lldb_private::UserIDResolver
static UserIDResolverGetNoopResolver ()
 Returns a resolver which returns a failure value for each query.

Detailed Description

Definition at line 23 of file PlatformRemoteGDBServer.h.

Constructor & Destructor Documentation

◆ PlatformRemoteGDBServer() [1/2]

PlatformRemoteGDBServer::PlatformRemoteGDBServer ( )

Default Constructor.

Definition at line 139 of file PlatformRemoteGDBServer.cpp.

References lldb_private::Platform::Platform().

Referenced by CreateInstance(), Initialize(), operator=(), and PlatformRemoteGDBServer().

◆ ~PlatformRemoteGDBServer()

PlatformRemoteGDBServer::~PlatformRemoteGDBServer ( )
overridedefault

Destructor.

The destructor is virtual since this class is designed to be inherited from by the plug-in instance.

◆ PlatformRemoteGDBServer() [2/2]

lldb_private::platform_gdb_server::PlatformRemoteGDBServer::PlatformRemoteGDBServer ( const PlatformRemoteGDBServer & )
privatedelete

Member Function Documentation

◆ Attach()

lldb::ProcessSP PlatformRemoteGDBServer::Attach ( ProcessAttachInfo & attach_info,
Debugger & debugger,
Target * target,
Status & error )
overridevirtual

Attach to an existing process using a process ID.

Each platform subclass needs to implement this function and attempt to attach to the process with the process ID of pid. The platform subclass should return an appropriate ProcessSP subclass that is attached to the process, or an empty shared pointer with an appropriate error.

Returns
An appropriate ProcessSP containing a valid shared pointer to the default Process subclass for the platform that is attached to the process, or an empty shared pointer with an appropriate error fill into the error object.

Implements lldb_private::Platform.

Definition at line 484 of file PlatformRemoteGDBServer.cpp.

References lldb_private::Target::CreateProcess(), lldb_private::TargetList::CreateTarget(), lldb_private::eLoadDependentsNo, error(), lldb_private::Status::FromErrorString(), lldb_private::Status::FromErrorStringWithFormat(), lldb_private::ProcessInfo::GetHijackListener(), GetHostname(), lldb_private::ProcessAttachInfo::GetListenerForProcess(), lldb_private::ProcessInfo::GetShadowListener(), lldb_private::Debugger::GetTargetList(), IsConnected(), lldb_private::Platform::IsRemote(), KillSpawnedProcess(), LaunchGDBServer(), and LLDB_INVALID_PROCESS_ID.

◆ AutoCompleteDiskFileOrDirectory()

void PlatformRemoteGDBServer::AutoCompleteDiskFileOrDirectory ( CompletionRequest & request,
bool only_dir )
overridevirtual

Reimplemented from lldb_private::Platform.

Definition at line 603 of file PlatformRemoteGDBServer.cpp.

References IsConnected(), and m_gdb_client_up.

◆ CalculateMD5()

llvm::ErrorOr< llvm::MD5::MD5Result > PlatformRemoteGDBServer::CalculateMD5 ( const FileSpec & file_spec)
overridevirtual

Reimplemented from lldb_private::Platform.

Definition at line 682 of file PlatformRemoteGDBServer.cpp.

References IsConnected(), and m_gdb_client_up.

◆ CalculateTrapHandlerSymbolNames()

void PlatformRemoteGDBServer::CalculateTrapHandlerSymbolNames ( )
overridevirtual

Ask the Platform subclass to fill in the list of trap handler names.

For most Unix user process environments, this will be a single function name, _sigtramp. More specialized environments may have additional handler names. The unwinder code needs to know when a trap handler is on the stack because the unwind rules for the frame that caused the trap are different.

The base class Platform ivar m_trap_handlers should be updated by the Platform subclass when this method is called. If there are no predefined trap handlers, this method may be a no-op.

Implements lldb_private::Platform.

Definition at line 689 of file PlatformRemoteGDBServer.cpp.

References lldb_private::Platform::m_trap_handlers.

◆ CloseFile()

bool PlatformRemoteGDBServer::CloseFile ( lldb::user_id_t fd,
Status & error )
overridevirtual

◆ ConnectRemote()

◆ ConnectToWaitingProcesses()

size_t PlatformRemoteGDBServer::ConnectToWaitingProcesses ( lldb_private::Debugger & debugger,
lldb_private::Status & error )
overridevirtual

Connect to all processes waiting for a debugger to attach.

If the platform have a list of processes waiting for a debugger to connect to them then connect to all of these pending processes.

Parameters
[in]debuggerThe debugger used for the connect.
[out]errorIf an error occurred during the connect then this object will contain the error message.
Returns
The number of processes we are successfully connected to.

Reimplemented from lldb_private::Platform.

Definition at line 814 of file PlatformRemoteGDBServer.cpp.

References lldb_private::Platform::ConnectProcess(), error(), and GetPendingGdbServerList().

◆ CreateInstance()

◆ CreateSymlink()

Status PlatformRemoteGDBServer::CreateSymlink ( const FileSpec & src,
const FileSpec & dst )
overridevirtual

◆ DebugProcess()

lldb::ProcessSP PlatformRemoteGDBServer::DebugProcess ( ProcessLaunchInfo & launch_info,
Debugger & debugger,
Target & target,
Status & error )
overridevirtual

Subclasses do not need to implement this function as it uses the Platform::LaunchProcess() followed by Platform::Attach ().

Remote platforms will want to subclass this function in order to be able to intercept STDIO and possibly launch a separate process that will debug the debuggee.

Reimplemented from lldb_private::Platform.

Definition at line 407 of file PlatformRemoteGDBServer.cpp.

References lldb_private::Target::CreateProcess(), error(), lldb_private::Status::FromErrorString(), lldb_private::Status::FromErrorStringWithFormat(), lldb_private::ProcessInfo::GetHijackListener(), GetHostname(), lldb_private::ProcessInfo::GetListener(), lldb_private::ProcessInfo::GetShadowListener(), IsConnected(), lldb_private::Platform::IsRemote(), KillSpawnedProcess(), LaunchGDBServer(), and LLDB_INVALID_PROCESS_ID.

◆ DisconnectRemote()

Status PlatformRemoteGDBServer::DisconnectRemote ( )
overridevirtual

Reimplemented from lldb_private::Platform.

Definition at line 271 of file PlatformRemoteGDBServer.cpp.

References error(), m_gdb_client_up, and m_remote_signals_sp.

◆ DoGetGroupName()

std::optional< std::string > PlatformRemoteGDBServer::DoGetGroupName ( UserIDResolver::id_t uid)
overrideprivatevirtual

Implements lldb_private::UserIDResolver.

Definition at line 295 of file PlatformRemoteGDBServer.cpp.

References m_gdb_client_up.

◆ DoGetUserName()

std::optional< std::string > PlatformRemoteGDBServer::DoGetUserName ( UserIDResolver::id_t uid)
overrideprivatevirtual

Implements lldb_private::UserIDResolver.

Definition at line 287 of file PlatformRemoteGDBServer.cpp.

References m_gdb_client_up.

◆ FindProcesses()

uint32_t PlatformRemoteGDBServer::FindProcesses ( const ProcessInstanceInfoMatch & match_info,
ProcessInstanceInfoList & proc_infos )
overridevirtual

Attach to an existing process by process name.

This function is not meant to be overridden by Process subclasses. It will first call Process::WillAttach (const char *) and if that returns true, Process::DoAttach (const char *) will be called to actually do the attach. If DoAttach returns true, then Process::DidAttach() will be called.

Parameters
[in]process_nameA process name to match against the current process list.
Returns
Returns pid if attaching was successful, or LLDB_INVALID_PROCESS_ID if attaching fails.

Reimplemented from lldb_private::Platform.

Definition at line 302 of file PlatformRemoteGDBServer.cpp.

References m_gdb_client_up.

◆ GetDescription()

llvm::StringRef PlatformRemoteGDBServer::GetDescription ( )
overridevirtual

◆ GetDescriptionStatic()

llvm::StringRef PlatformRemoteGDBServer::GetDescriptionStatic ( )
static

Definition at line 84 of file PlatformRemoteGDBServer.cpp.

Referenced by GetDescription(), and Initialize().

◆ GetFileExists()

bool PlatformRemoteGDBServer::GetFileExists ( const FileSpec & file_spec)
overridevirtual

Reimplemented from lldb_private::Platform.

Definition at line 659 of file PlatformRemoteGDBServer.cpp.

References IsConnected(), and m_gdb_client_up.

◆ GetFilePermissions()

Status PlatformRemoteGDBServer::GetFilePermissions ( const FileSpec & file_spec,
uint32_t & file_permissions )
overridevirtual

◆ GetFileSize()

lldb::user_id_t PlatformRemoteGDBServer::GetFileSize ( const FileSpec & file_spec)
overridevirtual

Reimplemented from lldb_private::Platform.

Definition at line 597 of file PlatformRemoteGDBServer.cpp.

References IsConnected(), LLDB_INVALID_UID, and m_gdb_client_up.

◆ GetFileWithUUID()

Status PlatformRemoteGDBServer::GetFileWithUUID ( const FileSpec & platform_file,
const UUID * uuid_ptr,
FileSpec & local_file )
overridevirtual

Locate a file for a platform.

The default implementation of this function will return the same file patch in local_file as was in platform_file.

Parameters
[in]platform_fileThe platform file path to locate and cache locally.
[in]uuid_ptrIf we know the exact UUID of the file we are looking for, it can be specified. If it is not specified, we might now know the exact file. The UUID is usually some sort of MD5 checksum for the file and is sometimes known by dynamic linkers/loaders. If the UUID is known, it is best to supply it to platform file queries to ensure we are finding the correct file, not just a file at the correct path.
[out]local_fileA locally cached version of the platform file. For platforms that describe the current host computer, this will just be the same file. For remote platforms, this file might come from and SDK directory, or might need to be sync'ed over to the current machine for efficient debugging access.
Returns
An error object.

Reimplemented from lldb_private::Platform.

Definition at line 130 of file PlatformRemoteGDBServer.cpp.

References lldb_private::Status.

◆ GetHostname()

const char * PlatformRemoteGDBServer::GetHostname ( )
overridevirtual

Reimplemented from lldb_private::Platform.

Definition at line 278 of file PlatformRemoteGDBServer.cpp.

References m_gdb_client_up, and lldb_private::Platform::m_hostname.

Referenced by Attach(), ConnectRemote(), and DebugProcess().

◆ GetModuleSpec()

bool PlatformRemoteGDBServer::GetModuleSpec ( const FileSpec & module_file_spec,
const ArchSpec & arch,
ModuleSpec & module_spec )
overridevirtual

◆ GetPendingGdbServerList()

size_t PlatformRemoteGDBServer::GetPendingGdbServerList ( std::vector< std::string > & connection_urls)
virtual

◆ GetPluginName()

llvm::StringRef lldb_private::platform_gdb_server::PlatformRemoteGDBServer::GetPluginName ( )
inlineoverridevirtual

Implements lldb_private::PluginInterface.

Definition at line 40 of file PlatformRemoteGDBServer.h.

References GetPluginNameStatic().

◆ GetPluginNameStatic()

llvm::StringRef lldb_private::platform_gdb_server::PlatformRemoteGDBServer::GetPluginNameStatic ( )
inlinestatic

Definition at line 31 of file PlatformRemoteGDBServer.h.

Referenced by GetPluginName(), and Initialize().

◆ GetProcessInfo()

bool PlatformRemoteGDBServer::GetProcessInfo ( lldb::pid_t pid,
ProcessInstanceInfo & proc_info )
overridevirtual

Reimplemented from lldb_private::Platform.

Definition at line 310 of file PlatformRemoteGDBServer.cpp.

References m_gdb_client_up.

◆ GetRemoteOSBuildString()

std::optional< std::string > PlatformRemoteGDBServer::GetRemoteOSBuildString ( )
overridevirtual

Reimplemented from lldb_private::Platform.

Definition at line 161 of file PlatformRemoteGDBServer.cpp.

References m_gdb_client_up.

◆ GetRemoteOSKernelDescription()

std::optional< std::string > PlatformRemoteGDBServer::GetRemoteOSKernelDescription ( )
overridevirtual

Reimplemented from lldb_private::Platform.

Definition at line 168 of file PlatformRemoteGDBServer.cpp.

References m_gdb_client_up.

◆ GetRemoteOSVersion()

bool PlatformRemoteGDBServer::GetRemoteOSVersion ( )
overridevirtual

Reimplemented from lldb_private::Platform.

Definition at line 155 of file PlatformRemoteGDBServer.cpp.

References m_gdb_client_up, and lldb_private::Platform::m_os_version.

◆ GetRemoteSystemArchitecture()

ArchSpec PlatformRemoteGDBServer::GetRemoteSystemArchitecture ( )
overridevirtual

Reimplemented from lldb_private::Platform.

Definition at line 175 of file PlatformRemoteGDBServer.cpp.

References m_gdb_client_up.

Referenced by GetRemoteUnixSignals(), and LaunchGDBServer().

◆ GetRemoteUnixSignals()

◆ GetRemoteWorkingDirectory()

FileSpec PlatformRemoteGDBServer::GetRemoteWorkingDirectory ( )
overridevirtual

◆ GetSoftwareBreakpointTrapOpcode()

size_t PlatformRemoteGDBServer::GetSoftwareBreakpointTrapOpcode ( Target & target,
BreakpointSite * bp_site )
overridevirtual

Reimplemented from lldb_private::Platform.

Definition at line 148 of file PlatformRemoteGDBServer.cpp.

◆ GetSupportedArchitectures()

std::vector< ArchSpec > lldb_private::platform_gdb_server::PlatformRemoteGDBServer::GetSupportedArchitectures ( const ArchSpec & process_host_arch)
inlineoverridevirtual

Get the platform's supported architectures in the order in which they should be searched.

Parameters
[in]process_host_archThe process host architecture if it's known. An invalid ArchSpec represents that the process host architecture is unknown.

Implements lldb_private::Platform.

Definition at line 70 of file PlatformRemoteGDBServer.h.

References m_supported_architectures.

◆ GetUserIDResolver()

UserIDResolver & lldb_private::platform_gdb_server::PlatformRemoteGDBServer::GetUserIDResolver ( )
inlineoverridevirtual

Reimplemented from lldb_private::Platform.

Definition at line 94 of file PlatformRemoteGDBServer.h.

◆ Initialize()

◆ IsConnected()

◆ KillProcess()

Status PlatformRemoteGDBServer::KillProcess ( const lldb::pid_t pid)
overridevirtual

Kill process on a platform.

Reimplemented from lldb_private::Platform.

Definition at line 399 of file PlatformRemoteGDBServer.cpp.

References lldb_private::Status::FromErrorStringWithFormat(), KillSpawnedProcess(), and lldb_private::Status.

◆ KillSpawnedProcess()

bool PlatformRemoteGDBServer::KillSpawnedProcess ( lldb::pid_t pid)
protectedvirtual

◆ LaunchGDBServer()

bool PlatformRemoteGDBServer::LaunchGDBServer ( lldb::pid_t & pid,
std::string & connect_url )
protectedvirtual

◆ LaunchProcess()

◆ MakeDirectory()

Status PlatformRemoteGDBServer::MakeDirectory ( const FileSpec & file_spec,
uint32_t file_permissions )
overridevirtual

◆ MakeGdbServerUrl()

std::string PlatformRemoteGDBServer::MakeGdbServerUrl ( const std::string & platform_scheme,
const std::string & platform_hostname,
uint16_t port,
const char * socket_name )
private

Definition at line 782 of file PlatformRemoteGDBServer.cpp.

References MakeUrl().

Referenced by GetPendingGdbServerList(), and LaunchGDBServer().

◆ MakeUrl()

std::string PlatformRemoteGDBServer::MakeUrl ( const char * scheme,
const char * hostname,
uint16_t port,
const char * path )
protectedvirtual

◆ OpenFile()

lldb::user_id_t PlatformRemoteGDBServer::OpenFile ( const FileSpec & file_spec,
File::OpenOptions flags,
uint32_t mode,
Status & error )
overridevirtual

Reimplemented from lldb_private::Platform.

Definition at line 580 of file PlatformRemoteGDBServer.cpp.

References error(), IsConnected(), LLDB_INVALID_UID, and m_gdb_client_up.

◆ operator=()

const PlatformRemoteGDBServer & lldb_private::platform_gdb_server::PlatformRemoteGDBServer::operator= ( const PlatformRemoteGDBServer & )
privatedelete

◆ PutFile()

Status PlatformRemoteGDBServer::PutFile ( const FileSpec & source,
const FileSpec & destination,
uint32_t uid = UINT32_MAX,
uint32_t gid = UINT32_MAX )
overridevirtual

Reimplemented from lldb_private::Platform.

Definition at line 627 of file PlatformRemoteGDBServer.cpp.

References lldb_private::Platform::PutFile().

◆ ReadFile()

uint64_t PlatformRemoteGDBServer::ReadFile ( lldb::user_id_t fd,
uint64_t offset,
void * data_ptr,
uint64_t len,
Status & error )
overridevirtual

◆ RunShellCommand()

Status PlatformRemoteGDBServer::RunShellCommand ( llvm::StringRef shell,
llvm::StringRef command,
const FileSpec & working_dir,
int * status_ptr,
int * signo_ptr,
std::string * command_output,
const lldb_private::Timeout< std::micro > & timeout )
overridevirtual

◆ SetFilePermissions()

Status PlatformRemoteGDBServer::SetFilePermissions ( const FileSpec & file_spec,
uint32_t file_permissions )
overridevirtual

◆ SetRemoteWorkingDirectory()

bool PlatformRemoteGDBServer::SetRemoteWorkingDirectory ( const FileSpec & working_dir)
overridevirtual

◆ Terminate()

void PlatformRemoteGDBServer::Terminate ( )
static

◆ Unlink()

◆ WriteFile()

uint64_t PlatformRemoteGDBServer::WriteFile ( lldb::user_id_t fd,
uint64_t offset,
const void * data,
uint64_t len,
Status & error )
overridevirtual

Member Data Documentation

◆ m_gdb_client_up

◆ m_platform_description

std::string lldb_private::platform_gdb_server::PlatformRemoteGDBServer::m_platform_description
protected

Definition at line 163 of file PlatformRemoteGDBServer.h.

Referenced by GetDescription().

◆ m_platform_hostname

std::string lldb_private::platform_gdb_server::PlatformRemoteGDBServer::m_platform_hostname
protected

◆ m_platform_scheme

std::string lldb_private::platform_gdb_server::PlatformRemoteGDBServer::m_platform_scheme
protected

◆ m_remote_signals_sp

lldb::UnixSignalsSP lldb_private::platform_gdb_server::PlatformRemoteGDBServer::m_remote_signals_sp
protected

Definition at line 169 of file PlatformRemoteGDBServer.h.

Referenced by DisconnectRemote(), and GetRemoteUnixSignals().

◆ m_supported_architectures

std::vector<ArchSpec> lldb_private::platform_gdb_server::PlatformRemoteGDBServer::m_supported_architectures
private

Definition at line 191 of file PlatformRemoteGDBServer.h.

Referenced by ConnectRemote(), and GetSupportedArchitectures().


The documentation for this class was generated from the following files: