LLDB  mainline
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | List of all members
lldb_private::Platform Class Referenceabstract

#include "lldb/Target/Platform.h"

Inheritance diagram for lldb_private::Platform:
Inheritance graph
[legend]
Collaboration diagram for lldb_private::Platform:
Collaboration graph
[legend]

Public Member Functions

 Platform (bool is_host_platform)
 Default Constructor. More...
 
 ~Platform () override
 The destructor is virtual since this class is designed to be inherited from by the plug-in instance. More...
 
virtual Status ResolveExecutable (const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr)
 Find a platform plugin for a given process. More...
 
virtual Status ResolveSymbolFile (Target &target, const ModuleSpec &sym_spec, FileSpec &sym_file)
 Find a symbol file given a symbol file module specification. More...
 
virtual bool ResolveRemotePath (const FileSpec &platform_path, FileSpec &resolved_platform_path)
 Resolves the FileSpec to a (possibly) remote path. More...
 
virtual llvm::VersionTuple GetOSVersion (Process *process=nullptr)
 Get the OS version from a connected platform. More...
 
bool SetOSVersion (llvm::VersionTuple os_version)
 
llvm::Optional< std::stringGetOSBuildString ()
 
llvm::Optional< std::stringGetOSKernelDescription ()
 
ConstString GetName ()
 
virtual const char * GetHostname ()
 
virtual ConstString GetFullNameForDylib (ConstString basename)
 
virtual llvm::StringRef GetDescription ()=0
 
virtual void GetStatus (Stream &strm)
 Report the current status for this platform. More...
 
virtual bool GetRemoteOSVersion ()
 
virtual llvm::Optional< std::stringGetRemoteOSBuildString ()
 
virtual llvm::Optional< std::stringGetRemoteOSKernelDescription ()
 
virtual ArchSpec GetRemoteSystemArchitecture ()
 
virtual FileSpec GetRemoteWorkingDirectory ()
 
virtual bool SetRemoteWorkingDirectory (const FileSpec &working_dir)
 
virtual UserIDResolverGetUserIDResolver ()=0
 
virtual Status GetFileWithUUID (const FileSpec &platform_file, const UUID *uuid_ptr, FileSpec &local_file)
 Locate a file for a platform. More...
 
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)
 
virtual bool GetModuleSpec (const FileSpec &module_file_spec, const ArchSpec &arch, ModuleSpec &module_spec)
 
virtual Status ConnectRemote (Args &args)
 
virtual Status DisconnectRemote ()
 
virtual std::vector< ArchSpecGetSupportedArchitectures ()=0
 Get the platform's supported architectures in the order in which they should be searched. More...
 
virtual size_t GetSoftwareBreakpointTrapOpcode (Target &target, BreakpointSite *bp_site)
 
virtual Status LaunchProcess (ProcessLaunchInfo &launch_info)
 Launch a new process on a platform, not necessarily for debugging, it could be just for running the process. More...
 
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. More...
 
virtual Status KillProcess (const lldb::pid_t pid)
 Kill process on a platform. More...
 
virtual bool IsCompatibleArchitecture (const ArchSpec &arch, bool exact_arch_match, ArchSpec *compatible_arch_ptr)
 Lets a platform answer if it is compatible with a given architecture and the target triple contained within. More...
 
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. More...
 
virtual lldb::ProcessSP DebugProcess (ProcessLaunchInfo &launch_info, Debugger &debugger, Target &target, Status &error)
 Subclasses do not need to implement this function as it uses the Platform::LaunchProcess() followed by Platform::Attach (). More...
 
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)
 
virtual lldb::ProcessSP Attach (ProcessAttachInfo &attach_info, Debugger &debugger, Target *target, Status &error)=0
 Attach to an existing process using a process ID. More...
 
virtual uint32_t FindProcesses (const ProcessInstanceInfoMatch &match_info, ProcessInstanceInfoList &proc_infos)
 Attach to an existing process by process name. More...
 
virtual bool GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &proc_info)
 
virtual lldb::BreakpointSP SetThreadCreationBreakpoint (Target &target)
 
virtual lldb_private::ConstString GetSDKDirectory (lldb_private::Target &target)
 
const std::stringGetRemoteURL () const
 
bool IsHost () const
 
bool IsRemote () const
 
virtual bool IsConnected () 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. More...
 
size_t GetMaxUserIDNameLength () const
 
size_t GetMaxGroupIDNameLength () const
 
ConstString GetSDKRootDirectory () const
 
void SetSDKRootDirectory (ConstString dir)
 
ConstString GetSDKBuild () const
 
void SetSDKBuild (ConstString 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 MakeDirectory (const FileSpec &file_spec, uint32_t permissions)
 
virtual Status GetFilePermissions (const FileSpec &file_spec, uint32_t &file_permissions)
 
virtual Status SetFilePermissions (const FileSpec &file_spec, uint32_t file_permissions)
 
virtual lldb::user_id_t OpenFile (const FileSpec &file_spec, File::OpenOptions flags, uint32_t mode, Status &error)
 
virtual bool CloseFile (lldb::user_id_t fd, Status &error)
 
virtual lldb::user_id_t GetFileSize (const FileSpec &file_spec)
 
virtual void AutoCompleteDiskFileOrDirectory (CompletionRequest &request, bool only_dir)
 
virtual uint64_t ReadFile (lldb::user_id_t fd, uint64_t offset, void *dst, uint64_t dst_len, Status &error)
 
virtual uint64_t WriteFile (lldb::user_id_t fd, uint64_t offset, const void *src, uint64_t src_len, Status &error)
 
virtual Status GetFile (const FileSpec &source, const FileSpec &destination)
 
virtual Status PutFile (const FileSpec &source, const FileSpec &destination, uint32_t uid=UINT32_MAX, uint32_t gid=UINT32_MAX)
 
virtual Status CreateSymlink (const FileSpec &src, const FileSpec &dst)
 
virtual Status Install (const FileSpec &src, const FileSpec &dst)
 Install a file or directory to the remote system. More...
 
virtual Environment GetEnvironment ()
 
virtual bool GetFileExists (const lldb_private::FileSpec &file_spec)
 
virtual Status Unlink (const FileSpec &file_spec)
 
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 lldb_private::Status RunShellCommand (llvm::StringRef shell, 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 bool CalculateMD5 (const FileSpec &file_spec, uint64_t &low, uint64_t &high)
 
virtual uint32_t GetResumeCountForLaunchInfo (ProcessLaunchInfo &launch_info)
 
virtual const lldb::UnixSignalsSP & GetRemoteUnixSignals ()
 
lldb::UnixSignalsSP GetUnixSignals ()
 
virtual std::string GetQueueNameForThreadQAddress (Process *process, lldb::addr_t dispatch_qaddr)
 Locate a queue name given a thread's qaddr. More...
 
virtual lldb::queue_id_t GetQueueIDForThreadQAddress (Process *process, lldb::addr_t dispatch_qaddr)
 Locate a queue ID given a thread's qaddr. More...
 
virtual const std::vector< ConstString > & GetTrapHandlerSymbolNames ()
 Provide a list of trap handler function names for this platform. More...
 
virtual lldb::UnwindPlanSP GetTrapHandlerUnwindPlan (const llvm::Triple &triple, ConstString name)
 Try to get a specific unwind plan for a named trap handler. More...
 
virtual FileSpec LocateExecutable (const char *basename)
 Find a support executable that may not live within in the standard locations related to LLDB. More...
 
virtual uint32_t GetDefaultMemoryCacheLineSize ()
 Allow the platform to set preferred memory cache line size. More...
 
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. More...
 
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. More...
 
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 size_t ConnectToWaitingProcesses (lldb_private::Debugger &debugger, lldb_private::Status &error)
 Connect to all processes waiting for a debugger to attach. More...
 
virtual llvm::Expected< StructuredData::DictionarySPFetchExtendedCrashInformation (lldb_private::Process &process)
 Gather all of crash informations into a structured data dictionary. More...
 
- Public Member Functions inherited from lldb_private::PluginInterface
 PluginInterface ()=default
 
virtual ~PluginInterface ()=default
 
virtual llvm::StringRef GetPluginName ()=0
 
 PluginInterface (const PluginInterface &)=delete
 
PluginInterfaceoperator= (const PluginInterface &)=delete
 

Static Public Member Functions

static void Initialize ()
 
static void Terminate ()
 
static PlatformPropertiesGetGlobalPlatformProperties ()
 
static lldb::PlatformSP GetHostPlatform ()
 Get the native host platform plug-in. More...
 
static lldb::PlatformSP GetPlatformForArchitecture (const ArchSpec &arch, ArchSpec *platform_arch_ptr)
 
static const char * GetHostPlatformName ()
 
static void SetHostPlatform (const lldb::PlatformSP &platform_sp)
 
static lldb::PlatformSP Find (ConstString name)
 
static lldb::PlatformSP Create (ConstString name, Status &error)
 
static lldb::PlatformSP Create (const ArchSpec &arch, ArchSpec *platform_arch_ptr, Status &error)
 
static ArchSpec GetAugmentedArchSpec (Platform *platform, llvm::StringRef triple)
 Augments the triple either with information from platform or the host system (if platform is null). More...
 

Protected Types

typedef std::map< uint32_t, ConstStringIDToNameMap
 

Protected Member Functions

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. More...
 
virtual void CalculateTrapHandlerSymbolNames ()=0
 Ask the Platform subclass to fill in the list of trap handler names. More...
 
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 ()
 
virtual Status ResolveRemoteExecutable (const ModuleSpec &module_spec, lldb::ModuleSP &exe_module_sp, const FileSpecList *module_search_paths_ptr)
 

Static Protected Member Functions

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. More...
 

Protected Attributes

bool m_is_host
 
bool m_os_version_set_while_connected
 
bool m_system_arch_set_while_connected
 
ConstString m_sdk_sysroot
 
ConstString m_sdk_build
 
FileSpec m_working_dir
 
std::string m_remote_url
 
std::string m_name
 
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
 

Private Types

typedef std::function< Status(const ModuleSpec &)> ModuleResolver
 

Private Member Functions

Status GetRemoteSharedModule (const ModuleSpec &module_spec, Process *process, lldb::ModuleSP &module_sp, const ModuleResolver &module_resolver, bool *did_create_ptr)
 
bool GetCachedSharedModule (const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, bool *did_create_ptr)
 
FileSpec GetModuleCacheRoot ()
 

Detailed Description

A plug-in interface definition class for debug platform that includes many platform abilities such as:

Definition at line 71 of file Platform.h.

Member Typedef Documentation

◆ IDToNameMap

Definition at line 897 of file Platform.h.

◆ ModuleResolver

typedef std::function<Status(const ModuleSpec &)> lldb_private::Platform::ModuleResolver
private

Definition at line 946 of file Platform.h.

Constructor & Destructor Documentation

◆ Platform()

Platform::Platform ( bool  is_host_platform)

Default Constructor.

Definition at line 385 of file Platform.cpp.

References lldb_private::GetLogIfAllCategoriesSet(), LIBLLDB_LOG_OBJECT, and LLDB_LOGF.

◆ ~Platform()

Platform::~Platform ( )
overridedefault

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

Member Function Documentation

◆ AddClangModuleCompilationOptions()

void Platform::AddClangModuleCompilationOptions ( Target target,
std::vector< std::string > &  options 
)
virtual

Reimplemented in PlatformAppleSimulator, PlatformMacOSX, and PlatformRemoteDarwinDevice.

Definition at line 500 of file Platform.cpp.

◆ Attach()

virtual lldb::ProcessSP lldb_private::Platform::Attach ( ProcessAttachInfo attach_info,
Debugger debugger,
Target target,
Status error 
)
pure virtual

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.

Implemented in lldb_private::PlatformQemuUser, lldb_private::platform_gdb_server::PlatformRemoteGDBServer, lldb_private::PlatformWindows, and PlatformPOSIX.

Referenced by DebugProcess().

◆ AutoCompleteDiskFileOrDirectory()

virtual void lldb_private::Platform::AutoCompleteDiskFileOrDirectory ( CompletionRequest request,
bool  only_dir 
)
inlinevirtual

Reimplemented in lldb_private::platform_gdb_server::PlatformRemoteGDBServer.

Definition at line 506 of file Platform.h.

◆ CalculateMD5()

bool Platform::CalculateMD5 ( const FileSpec file_spec,
uint64_t &  low,
uint64_t &  high 
)
virtual

◆ CalculateTrapHandlerSymbolNames()

virtual void lldb_private::Platform::CalculateTrapHandlerSymbolNames ( )
protectedpure virtual

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.

Implemented in lldb_private::platform_gdb_server::PlatformRemoteGDBServer, PlatformDarwin, lldb_private::PlatformWindows, PlatformPOSIX, lldb_private::platform_linux::PlatformLinux, lldb_private::platform_netbsd::PlatformNetBSD, lldb_private::platform_freebsd::PlatformFreeBSD, lldb_private::platform_openbsd::PlatformOpenBSD, and lldb_private::PlatformQemuUser.

Referenced by GetTrapHandlerSymbolNames().

◆ CanDebugProcess()

virtual bool lldb_private::Platform::CanDebugProcess ( )
inlinevirtual

Not all platforms will support debugging a process by spawning somehow halted for a debugger (specified using the "eLaunchFlagDebug" launch flag) and then attaching.

If your platform doesn't support this, override this function and return false.

Reimplemented in lldb_private::PlatformWindows, lldb_private::platform_linux::PlatformLinux, lldb_private::platform_netbsd::PlatformNetBSD, lldb_private::platform_freebsd::PlatformFreeBSD, and lldb_private::platform_openbsd::PlatformOpenBSD.

Definition at line 342 of file Platform.h.

◆ CloseFile()

virtual bool lldb_private::Platform::CloseFile ( lldb::user_id_t  fd,
Status error 
)
inlinevirtual

◆ ConnectProcess()

lldb::ProcessSP Platform::ConnectProcess ( llvm::StringRef  connect_url,
llvm::StringRef  plugin_name,
Debugger debugger,
Target target,
Status error 
)
virtual

◆ ConnectProcessSynchronous()

lldb::ProcessSP Platform::ConnectProcessSynchronous ( llvm::StringRef  connect_url,
llvm::StringRef  plugin_name,
Debugger debugger,
Stream stream,
Target target,
Status error 
)
virtual

Definition at line 1821 of file Platform.cpp.

References DoConnectProcess(), and error().

◆ ConnectRemote()

Status Platform::ConnectRemote ( Args args)
virtual

◆ ConnectToWaitingProcesses()

size_t Platform::ConnectToWaitingProcesses ( lldb_private::Debugger debugger,
lldb_private::Status error 
)
virtual

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 in lldb_private::platform_gdb_server::PlatformRemoteGDBServer, and lldb_private::RemoteAwarePlatform.

Definition at line 1888 of file Platform.cpp.

References error().

Referenced by lldb_private::RemoteAwarePlatform::ConnectToWaitingProcesses().

◆ Create() [1/2]

PlatformSP Platform::Create ( const ArchSpec arch,
ArchSpec platform_arch_ptr,
Status error 
)
static

◆ Create() [2/2]

PlatformSP Platform::Create ( ConstString  name,
Status error 
)
static

◆ CreateArchList()

std::vector< ArchSpec > Platform::CreateArchList ( llvm::ArrayRef< llvm::Triple::ArchType >  archs,
llvm::Triple::OSType  os 
)
staticprotected

◆ CreateSymlink()

Status Platform::CreateSymlink ( const FileSpec src,
const FileSpec dst 
)
virtual

◆ DebugProcess()

lldb::ProcessSP Platform::DebugProcess ( ProcessLaunchInfo launch_info,
Debugger debugger,
Target target,
Status error 
)
virtual

◆ DisconnectRemote()

Status Platform::DisconnectRemote ( )
virtual

◆ DoConnectProcess()

lldb::ProcessSP Platform::DoConnectProcess ( llvm::StringRef  connect_url,
llvm::StringRef  plugin_name,
Debugger debugger,
Stream stream,
Target target,
Status error 
)
protected

◆ DoLoadImage()

uint32_t Platform::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

Reimplemented in PlatformPOSIX.

Definition at line 1782 of file Platform.cpp.

References error(), and LLDB_INVALID_IMAGE_TOKEN.

Referenced by LoadImage(), and LoadImageUsingPaths().

◆ DownloadModuleSlice()

Status Platform::DownloadModuleSlice ( const FileSpec src_file_spec,
const uint64_t  src_offset,
const uint64_t  src_size,
const FileSpec dst_file_spec 
)
protectedvirtual

◆ DownloadSymbolFile()

Status Platform::DownloadSymbolFile ( const lldb::ModuleSP &  module_sp,
const FileSpec dst_file_spec 
)
protectedvirtual

Reimplemented in lldb_private::platform_android::PlatformAndroid.

Definition at line 1720 of file Platform.cpp.

Referenced by GetCachedSharedModule().

◆ FetchExtendedCrashInformation()

virtual llvm::Expected<StructuredData::DictionarySP> lldb_private::Platform::FetchExtendedCrashInformation ( lldb_private::Process process)
inlinevirtual

Gather all of crash informations into a structured data dictionary.

If the platform have a crashed process with crash information entries, gather all the entries into an structured data dictionary or return a nullptr. This dictionary is generic and extensible, as it contains an array for each different type of crash information.

Parameters
[in]processThe crashed process.
Returns
A structured data dictionary containing at each entry, the crash information type as the entry key and the matching an array as the entry value. nullptr if not implemented or if the process has no crash information entry. error if an error occured.

Reimplemented in PlatformDarwin.

Definition at line 862 of file Platform.h.

◆ Find()

PlatformSP Platform::Find ( ConstString  name)
static

Definition at line 274 of file Platform.cpp.

References GetPlatformList(), and GetPlatformListMutex().

Referenced by lldb::SBDebugger::SetCurrentPlatform().

◆ FindProcesses()

uint32_t Platform::FindProcesses ( const ProcessInstanceInfoMatch match_info,
ProcessInstanceInfoList proc_infos 
)
virtual

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 in lldb_private::RemoteAwarePlatform, lldb_private::platform_gdb_server::PlatformRemoteGDBServer, and PlatformAppleSimulator.

Definition at line 1044 of file Platform.cpp.

References lldb_private::Host::FindProcesses(), and IsHost().

Referenced by lldb_private::RemoteAwarePlatform::FindProcesses().

◆ GetAugmentedArchSpec() [1/2]

ArchSpec Platform::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.

Definition at line 980 of file Platform.cpp.

References lldb_private::ArchSpec::ContainsOnlyArch(), lldb_private::ArchSpec::GetTriple(), IsCompatibleArchitecture(), and lldb_private::ArchSpec::IsValid().

◆ GetAugmentedArchSpec() [2/2]

ArchSpec Platform::GetAugmentedArchSpec ( Platform platform,
llvm::StringRef  triple 
)
static

Augments the triple either with information from platform or the host system (if platform is null).

Definition at line 378 of file Platform.cpp.

References GetAugmentedArchSpec().

Referenced by lldb::SBDebugger::CreateTargetWithFileAndArch(), lldb::SBDebugger::FindTargetWithFileAndArch(), GetAugmentedArchSpec(), and lldb_private::CommandObjectDisassemble::CommandOptions::SetOptionValue().

◆ GetCachedExecutable()

Status Platform::GetCachedExecutable ( ModuleSpec module_spec,
lldb::ModuleSP &  module_sp,
const FileSpecList *  module_search_paths_ptr 
)
protected

◆ GetCachedSharedModule()

bool Platform::GetCachedSharedModule ( const ModuleSpec module_spec,
lldb::ModuleSP &  module_sp,
bool *  did_create_ptr 
)
private

◆ GetCacheHostname()

const char * Platform::GetCacheHostname ( )
protectedvirtual

Reimplemented in lldb_private::platform_android::PlatformAndroid.

Definition at line 1732 of file Platform.cpp.

References GetHostname().

Referenced by GetCachedSharedModule().

◆ GetConnectionOptions()

virtual lldb_private::OptionGroupOptions* lldb_private::Platform::GetConnectionOptions ( CommandInterpreter interpreter)
inlinevirtual

Reimplemented in PlatformPOSIX.

Definition at line 599 of file Platform.h.

◆ GetDefaultMemoryCacheLineSize()

virtual uint32_t lldb_private::Platform::GetDefaultMemoryCacheLineSize ( )
inlinevirtual

Allow the platform to set preferred memory cache line size.

If non-zero (and the user has not set cache line size explicitly), this value will be used as the cache line size for memory reads.

Reimplemented in lldb_private::platform_android::PlatformAndroid.

Definition at line 746 of file Platform.h.

◆ GetDescription()

virtual llvm::StringRef lldb_private::Platform::GetDescription ( )
pure virtual

◆ GetEnvironment()

Environment Platform::GetEnvironment ( )
virtual

Reimplemented in lldb_private::RemoteAwarePlatform, and lldb_private::PlatformQemuUser.

Definition at line 1533 of file Platform.cpp.

◆ GetFile()

Status Platform::GetFile ( const FileSpec source,
const FileSpec destination 
)
virtual

◆ GetFileExists()

bool Platform::GetFileExists ( const lldb_private::FileSpec file_spec)
virtual

◆ GetFilePermissions()

Status Platform::GetFilePermissions ( const FileSpec file_spec,
uint32_t file_permissions 
)
virtual

◆ GetFileSize()

virtual lldb::user_id_t lldb_private::Platform::GetFileSize ( const FileSpec file_spec)
inlinevirtual

◆ GetFileWithUUID()

Status Platform::GetFileWithUUID ( const FileSpec platform_file,
const UUID uuid_ptr,
FileSpec local_file 
)
virtual

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 in PlatformRemoteMacOSX, lldb_private::platform_gdb_server::PlatformRemoteGDBServer, and lldb_private::RemoteAwarePlatform.

Definition at line 174 of file Platform.cpp.

◆ GetFullNameForDylib()

ConstString Platform::GetFullNameForDylib ( ConstString  basename)
virtual

Reimplemented in PlatformDarwin, PlatformPOSIX, and lldb_private::PlatformWindows.

Definition at line 797 of file Platform.cpp.

◆ GetGlobalPlatformProperties()

PlatformProperties & Platform::GetGlobalPlatformProperties ( )
static

◆ GetHostname()

const char * Platform::GetHostname ( )
virtual

◆ GetHostPlatform()

PlatformSP Platform::GetHostPlatform ( )
static

Get the native host platform plug-in.

There should only be one of these for each host that LLDB runs upon that should be statically compiled in and registered using preprocessor macros or other similar build mechanisms in a PlatformSubclass::Initialize() function.

This platform will be used as the default platform when launching or attaching to processes unless another platform is specified.

There should only be one of these for each host that LLDB runs upon that should be statically compiled in and registered using preprocessor macros or other similar build mechanisms.

This platform will be used as the default platform when launching or attaching to processes unless another platform is specified.

Definition at line 135 of file Platform.cpp.

References GetHostPlatformSP().

Referenced by lldb_private::Debugger::Debugger(), and lldb::SBDebugger::GetAvailablePlatformInfoAtIndex().

◆ GetHostPlatformName()

const char * Platform::GetHostPlatformName ( )
static

◆ GetIgnoresRemoteHostname()

virtual bool lldb_private::Platform::GetIgnoresRemoteHostname ( )
inlinevirtual

◆ GetLocalCacheDirectory()

const char * Platform::GetLocalCacheDirectory ( )
virtual

◆ GetMaxGroupIDNameLength()

size_t lldb_private::Platform::GetMaxGroupIDNameLength ( ) const
inline

Definition at line 451 of file Platform.h.

References m_max_gid_name_len.

◆ GetMaxUserIDNameLength()

size_t lldb_private::Platform::GetMaxUserIDNameLength ( ) const
inline

Definition at line 448 of file Platform.h.

References m_max_uid_name_len.

◆ GetMmapArgumentList()

MmapArgList Platform::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

◆ GetModuleCacheRoot()

FileSpec Platform::GetModuleCacheRoot ( )
private

◆ GetModuleSpec()

bool Platform::GetModuleSpec ( const FileSpec module_file_spec,
const ArchSpec arch,
ModuleSpec module_spec 
)
virtual

◆ GetName()

ConstString Platform::GetName ( )

Definition at line 786 of file Platform.cpp.

References lldb_private::PluginInterface::GetPluginName().

Referenced by GetModuleCacheRoot(), ReadFile(), and WriteFile().

◆ GetOSBuildString()

llvm::Optional< std::string > Platform::GetOSBuildString ( )

Definition at line 488 of file Platform.cpp.

References GetRemoteOSBuildString(), and IsHost().

Referenced by GetStatus().

◆ GetOSKernelDescription()

llvm::Optional< std::string > Platform::GetOSKernelDescription ( )

Definition at line 494 of file Platform.cpp.

References GetRemoteOSKernelDescription(), and IsHost().

Referenced by GetStatus().

◆ GetOSVersion()

llvm::VersionTuple Platform::GetOSVersion ( Process process = nullptr)
virtual

Get the OS version from a connected platform.

Some platforms might not be connected to a remote platform, but can figure out the OS version for a process. This is common for simulator platforms that will run native programs on the current host, but the simulator might be simulating a different OS. The process parameter might be specified to help to determine the OS version.

Reimplemented in PlatformDarwin.

Definition at line 446 of file Platform.cpp.

References lldb_private::Process::GetHostOSVersion(), GetRemoteOSVersion(), IsConnected(), IsHost(), m_mutex, m_os_version, and m_os_version_set_while_connected.

Referenced by GetStatus().

◆ GetPlatformForArchitecture()

lldb::PlatformSP Platform::GetPlatformForArchitecture ( const ArchSpec arch,
ArchSpec platform_arch_ptr 
)
static

◆ GetPlatformSpecificConnectionInformation()

virtual std::string lldb_private::Platform::GetPlatformSpecificConnectionInformation ( )
inlinevirtual

Reimplemented in PlatformPOSIX.

Definition at line 629 of file Platform.h.

Referenced by GetStatus().

◆ GetProcessInfo()

bool Platform::GetProcessInfo ( lldb::pid_t  pid,
ProcessInstanceInfo proc_info 
)
virtual

◆ GetQueueIDForThreadQAddress()

virtual lldb::queue_id_t lldb_private::Platform::GetQueueIDForThreadQAddress ( Process process,
lldb::addr_t  dispatch_qaddr 
)
inlinevirtual

Locate a queue ID given a thread's qaddr.

On a system using libdispatch ("Grand Central Dispatch") style queues, a thread may be associated with a GCD queue or not, and a queue may be associated with multiple threads. The process/thread must provide a way to find the "dispatch_qaddr" for each thread, and from that dispatch_qaddr this Platform method will locate the queue ID and provide that.

Parameters
[in]processA process is required for reading memory.
[in]dispatch_qaddrThe dispatch_qaddr for this thread.
Returns
The queue_id for this thread, if this thread is associated with a dispatch queue. Else LLDB_INVALID_QUEUE_ID is returned.

Definition at line 685 of file Platform.h.

References LLDB_INVALID_QUEUE_ID.

◆ GetQueueNameForThreadQAddress()

virtual std::string lldb_private::Platform::GetQueueNameForThreadQAddress ( Process process,
lldb::addr_t  dispatch_qaddr 
)
inlinevirtual

Locate a queue name given a thread's qaddr.

On a system using libdispatch ("Grand Central Dispatch") style queues, a thread may be associated with a GCD queue or not, and a queue may be associated with multiple threads. The process/thread must provide a way to find the "dispatch_qaddr" for each thread, and from that dispatch_qaddr this Platform method will locate the queue name and provide that.

Parameters
[in]processA process is required for reading memory.
[in]dispatch_qaddrThe dispatch_qaddr for this thread.
Returns
The name of the queue, if there is one. An empty string means that this thread is not associated with a dispatch queue.

Definition at line 662 of file Platform.h.

◆ GetRemoteOSBuildString()

virtual llvm::Optional<std::string> lldb_private::Platform::GetRemoteOSBuildString ( )
inlinevirtual

◆ GetRemoteOSKernelDescription()

virtual llvm::Optional<std::string> lldb_private::Platform::GetRemoteOSKernelDescription ( )
inlinevirtual

◆ GetRemoteOSVersion()

virtual bool lldb_private::Platform::GetRemoteOSVersion ( )
inlinevirtual

◆ GetRemoteSharedModule()

Status Platform::GetRemoteSharedModule ( const ModuleSpec module_spec,
Process process,
lldb::ModuleSP &  module_sp,
const ModuleResolver module_resolver,
bool *  did_create_ptr 
)
private

◆ GetRemoteSystemArchitecture()

virtual ArchSpec lldb_private::Platform::GetRemoteSystemArchitecture ( )
inlinevirtual

◆ GetRemoteUnixSignals()

const UnixSignalsSP & Platform::GetRemoteUnixSignals ( )
virtual

◆ GetRemoteURL()

const std::string& lldb_private::Platform::GetRemoteURL ( ) const
inline

Definition at line 421 of file Platform.h.

References m_remote_url.

◆ GetRemoteWorkingDirectory()

virtual FileSpec lldb_private::Platform::GetRemoteWorkingDirectory ( )
inlinevirtual

◆ GetResumeCountForLaunchInfo()

virtual uint32_t lldb_private::Platform::GetResumeCountForLaunchInfo ( ProcessLaunchInfo launch_info)
inlinevirtual

◆ GetRSyncOpts()

virtual const char* lldb_private::Platform::GetRSyncOpts ( )
inlinevirtual

◆ GetRSyncPrefix()

virtual const char* lldb_private::Platform::GetRSyncPrefix ( )
inlinevirtual

◆ GetSDKBuild()

ConstString lldb_private::Platform::GetSDKBuild ( ) const
inline

Definition at line 457 of file Platform.h.

References m_sdk_build.

◆ GetSDKDirectory()

virtual lldb_private::ConstString lldb_private::Platform::GetSDKDirectory ( lldb_private::Target target)
inlinevirtual

Reimplemented in PlatformMacOSX.

Definition at line 417 of file Platform.h.

◆ GetSDKRootDirectory()

ConstString lldb_private::Platform::GetSDKRootDirectory ( ) const
inline

Definition at line 453 of file Platform.h.

References m_sdk_sysroot.

◆ GetSharedModule()

Status Platform::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 
)
virtual

◆ GetSoftwareBreakpointTrapOpcode()

size_t Platform::GetSoftwareBreakpointTrapOpcode ( Target target,
BreakpointSite bp_site 
)
virtual

◆ GetSSHOpts()

virtual const char* lldb_private::Platform::GetSSHOpts ( )
inlinevirtual

Definition at line 588 of file Platform.h.

References m_ssh_opts.

Referenced by PlatformPOSIX::GetPlatformSpecificConnectionInformation().

◆ GetStatus()

void Platform::GetStatus ( Stream strm)
virtual

◆ GetSupportedArchitectures()

virtual std::vector<ArchSpec> lldb_private::Platform::GetSupportedArchitectures ( )
pure virtual

◆ GetSupportsRSync()

virtual bool lldb_private::Platform::GetSupportsRSync ( )
inlinevirtual

◆ GetSupportsSSH()

virtual bool lldb_private::Platform::GetSupportsSSH ( )
inlinevirtual

Definition at line 584 of file Platform.h.

References m_supports_ssh.

Referenced by PlatformPOSIX::GetPlatformSpecificConnectionInformation().

◆ GetSystemArchitecture()

const ArchSpec & Platform::GetSystemArchitecture ( )

◆ GetTrapHandlerSymbolNames()

const std::vector< ConstString > & Platform::GetTrapHandlerSymbolNames ( )
virtual

Provide a list of trap handler function names for this platform.

The unwinder needs to treat trap handlers specially – the stack frame may not be aligned correctly for a trap handler (the kernel often won't perturb the stack pointer, or won't re-align it properly, in the process of calling the handler) and the frame above the handler needs to be treated by the unwinder's "frame 0" rules instead of its "middle of the stack frame" rules.

In a user process debugging scenario, the list of trap handlers is typically just "_sigtramp".

The Platform base class provides the m_trap_handlers ivar but it does not populate it. Subclasses should add the names of the asynchronous signal handler routines as needed. For most Unix platforms, add _sigtramp.

Returns
A list of symbol names. The list may be empty.

Definition at line 1535 of file Platform.cpp.

References CalculateTrapHandlerSymbolNames(), m_calculated_trap_handlers, m_mutex, and m_trap_handlers.

◆ GetTrapHandlerUnwindPlan()

virtual lldb::UnwindPlanSP lldb_private::Platform::GetTrapHandlerUnwindPlan ( const llvm::Triple &  triple,
ConstString  name 
)
inlinevirtual

Try to get a specific unwind plan for a named trap handler.

The default is not to have specific unwind plans for trap handlers.

Parameters
[in]tripleTriple of the current target.
[in]nameName of the trap handler function.
Returns
A specific unwind plan for that trap handler, or an empty shared pointer. The latter means there is no specific plan, unwind as normal.

Reimplemented in lldb_private::platform_linux::PlatformLinux.

Definition at line 724 of file Platform.h.

◆ GetUnixSignals()

UnixSignalsSP Platform::GetUnixSignals ( )

◆ GetUserIDResolver()

virtual UserIDResolver& lldb_private::Platform::GetUserIDResolver ( )
pure virtual

◆ GetWorkingDirectory()

FileSpec Platform::GetWorkingDirectory ( )

◆ Initialize()

void Platform::Initialize ( )
static

◆ Install()

Status Platform::Install ( const FileSpec src,
const FileSpec dst 
)
virtual

Install a file or directory to the remote system.

Install is similar to Platform::PutFile(), but it differs in that if an application/framework/shared library is installed on a remote platform and the remote platform requires something to be done to register the application/framework/shared library, then this extra registration can be done.

Parameters
[in]srcThe source file/directory to install on the remote system.
[in]dstThe destination file/directory where src will be installed. If dst has no filename specified, then its filename will be set from src. It dst has no directory specified, it will use the platform working directory. If dst has a directory specified, but the directory path is relative, the platform working directory will be prepended to the relative directory.
Returns
An error object that describes anything that went wrong.

Definition at line 620 of file Platform.cpp.

References lldb_private::FileSpec::AppendPathComponent(), CreateSymlink(), lldb_private::FileSystem::EnumerateDirectory(), error(), RecurseCopyBaton::error, lldb_private::ConstString::GetCString(), lldb_private::FileSpec::GetCString(), lldb_private::FileSpec::GetDirectory(), lldb_private::FileSpec::GetFilename(), lldb_private::GetLogIfAnyCategoriesSet(), lldb_private::FileSpec::GetPath(), lldb_private::FileSystem::GetPermissions(), GetSupportsRSync(), GetWorkingDirectory(), lldb_private::FileSystem::Instance(), LIBLLDB_LOG_PLATFORM, LLDB_LOGF, MakeDirectory(), PutFile(), lldb_private::FileSystem::Readlink(), RecurseCopy_Callback(), lldb_private::ConstString::SetCString(), and string().

Referenced by LoadImage().

◆ IsCompatibleArchitecture()

bool Platform::IsCompatibleArchitecture ( const ArchSpec arch,
bool  exact_arch_match,
ArchSpec compatible_arch_ptr 
)
virtual

Lets a platform answer if it is compatible with a given architecture and the target triple contained within.

Definition at line 1227 of file Platform.cpp.

References lldb_private::ArchSpec::Clear(), GetSupportedArchitectures(), lldb_private::ArchSpec::IsCompatibleMatch(), lldb_private::ArchSpec::IsExactMatch(), and lldb_private::ArchSpec::IsValid().

Referenced by GetAugmentedArchSpec().

◆ IsConnected()

virtual bool lldb_private::Platform::IsConnected ( ) const
inlinevirtual

◆ IsHost()

bool lldb_private::Platform::IsHost ( ) const
inline

Definition at line 423 of file Platform.h.

References m_is_host.

Referenced by PlatformPOSIX::Attach(), lldb_private::PlatformWindows::Attach(), CalculateMD5(), lldb_private::platform_freebsd::PlatformFreeBSD::CanDebugProcess(), lldb_private::platform_linux::PlatformLinux::CanDebugProcess(), lldb_private::platform_netbsd::PlatformNetBSD::CanDebugProcess(), lldb_private::PlatformWindows::ConnectRemote(), lldb_private::platform_android::PlatformAndroid::ConnectRemote(), PlatformPOSIX::ConnectRemote(), ConnectRemote(), PlatformPOSIX::DebugProcess(), PlatformDarwin::DebugProcess(), lldb_private::PlatformWindows::DisconnectRemote(), PlatformPOSIX::DisconnectRemote(), DisconnectRemote(), FindProcesses(), GetCachedSharedModule(), lldb_private::platform_freebsd::PlatformFreeBSD::GetDescription(), lldb_private::platform_linux::PlatformLinux::GetDescription(), lldb_private::platform_netbsd::PlatformNetBSD::GetDescription(), lldb_private::platform_openbsd::PlatformOpenBSD::GetDescription(), lldb_private::PlatformWindows::GetDescription(), PlatformPOSIX::GetFile(), lldb_private::platform_android::PlatformAndroid::GetFile(), GetFilePermissions(), GetHostname(), GetOSBuildString(), GetOSKernelDescription(), GetOSVersion(), lldb_private::platform_freebsd::PlatformFreeBSD::GetPluginName(), lldb_private::platform_linux::PlatformLinux::GetPluginName(), lldb_private::platform_netbsd::PlatformNetBSD::GetPluginName(), lldb_private::platform_openbsd::PlatformOpenBSD::GetPluginName(), lldb_private::PlatformWindows::GetPluginName(), lldb_private::platform_android::PlatformAndroid::GetPluginName(), GetProcessInfo(), PlatformDarwin::GetSharedModuleWithLocalCache(), lldb_private::platform_netbsd::PlatformNetBSD::GetStatus(), lldb_private::platform_linux::PlatformLinux::GetStatus(), lldb_private::platform_freebsd::PlatformFreeBSD::GetStatus(), lldb_private::platform_openbsd::PlatformOpenBSD::GetStatus(), GetStatus(), GetSystemArchitecture(), GetUnixSignals(), GetWorkingDirectory(), IsConnected(), KillProcess(), LaunchProcess(), MakeDirectory(), PlatformPOSIX::PutFile(), lldb_private::platform_android::PlatformAndroid::PutFile(), RunShellCommand(), SetFilePermissions(), SetOSVersion(), SetSystemArchitecture(), SetWorkingDirectory(), and ShellExpandArguments().

◆ IsRemote()

bool lldb_private::Platform::IsRemote ( ) const
inline

◆ KillProcess()

Status Platform::KillProcess ( const lldb::pid_t  pid)
virtual

◆ LaunchProcess()

Status Platform::LaunchProcess ( ProcessLaunchInfo launch_info)
virtual

◆ LoadImage()

uint32_t Platform::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.

Try and load a shared library into the current process. This call might fail in the dynamic loader plug-in says it isn't safe to try and load shared libraries at the moment.

Parameters
[in]processThe process to load the image.
[in]local_fileThe file spec that points to the shared library that you want to load if the library is located on the host. The library will be copied over to the location specified by remote_file or into the current working directory with the same filename if the remote_file isn't specified.
[in]remote_fileIf local_file is specified then the location where the library should be copied over from the host. If local_file isn't specified, then the path for the shared library on the target what you want to load.
[out]errorAn error object that gets filled in with any errors that might occur when trying to load the shared library.
Returns
A token that represents the shared library that can be later used to unload the shared library. A value of LLDB_INVALID_IMAGE_TOKEN will be returned if the shared library can't be opened.

Definition at line 1745 of file Platform.cpp.

References lldb_private::FileSpec::AppendPathComponent(), lldb_private::ConstString::AsCString(), DoLoadImage(), error(), lldb_private::FileSpec::GetFilename(), GetWorkingDirectory(), Install(), IsRemote(), and LLDB_INVALID_IMAGE_TOKEN.

◆ LoadImageUsingPaths()

uint32_t Platform::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.

Parameters
[in]processThe process to load the image.
[in]library_nameThe name of the library to look for. If library_name is an absolute path, the basename will be extracted and searched for along the paths. This emulates the behavior of the loader when given an install name and a set (e.g. DYLD_LIBRARY_PATH provided) of alternate paths.
[in]pathsThe list of paths to use to search for the library. First match wins.
[out]errorAn error object that gets filled in with any errors that might occur when trying to load the shared library.
[out]loaded_pathIf non-null, the path to the dylib that was successfully loaded is stored in this path.
Returns
A token that represents the shared library which can be passed to UnloadImage. A value of LLDB_INVALID_IMAGE_TOKEN will be returned if the shared library can't be opened.

Definition at line 1791 of file Platform.cpp.

References DoLoadImage(), error(), lldb_private::FileSpec::GetFilename(), lldb_private::FileSpec::GetPathStyle(), lldb_private::ConstString::GetStringRef(), and lldb_private::FileSpec::IsAbsolute().

◆ LocateExecutable()

virtual FileSpec lldb_private::Platform::LocateExecutable ( const char *  basename)
inlinevirtual

Find a support executable that may not live within in the standard locations related to LLDB.

Executable might exist within the Platform SDK directories, or in standard tool directories within the current IDE that is running LLDB.

Parameters
[in]basenameThe basename of the executable to locate in the current platform.
Returns
A FileSpec pointing to the executable on disk, or an invalid FileSpec if the executable cannot be found.

Reimplemented in PlatformDarwin.

Definition at line 741 of file Platform.h.

Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunication::StartDebugserverProcess().

◆ LocateExecutableScriptingResources()

FileSpecList Platform::LocateExecutableScriptingResources ( Target target,
Module module,
Stream feedback_stream 
)
virtual

Reimplemented in PlatformDarwin.

Definition at line 182 of file Platform.cpp.

◆ MakeDirectory()

Status Platform::MakeDirectory ( const FileSpec file_spec,
uint32_t  permissions 
)
virtual

◆ ModuleIsExcludedForUnconstrainedSearches()

virtual bool lldb_private::Platform::ModuleIsExcludedForUnconstrainedSearches ( Target target,
const lldb::ModuleSP &  module_sp 
)
inlinevirtual

Reimplemented in PlatformDarwin.

Definition at line 481 of file Platform.h.

◆ OpenFile()

virtual lldb::user_id_t lldb_private::Platform::OpenFile ( const FileSpec file_spec,
File::OpenOptions  flags,
uint32_t  mode,
Status error 
)
inlinevirtual

◆ PutFile()

Status Platform::PutFile ( const FileSpec source,
const FileSpec destination,
uint32_t  uid = UINT32_MAX,
uint32_t  gid = UINT32_MAX 
)
virtual

◆ ReadFile()

virtual uint64_t lldb_private::Platform::ReadFile ( lldb::user_id_t  fd,
uint64_t  offset,
void *  dst,
uint64_t  dst_len,
Status error 
)
inlinevirtual

◆ ResolveExecutable()

Status Platform::ResolveExecutable ( const ModuleSpec module_spec,
lldb::ModuleSP &  module_sp,
const FileSpecList *  module_search_paths_ptr 
)
virtual

Find a platform plugin for a given process.

Scans the installed Platform plug-ins and tries to find an instance that can be used for process

Parameters
[in]processThe process for which to try and locate a platform plug-in instance.
[in]plugin_nameAn optional name of a specific platform plug-in that should be used. If nullptr, pick the best plug-in. Set the target's executable based off of the existing architecture information in target given a path to an executable exe_file.

Each platform knows the architectures that it supports and can select the correct architecture slice within exe_file by inspecting the architecture in target. If the target had an architecture specified, then in can try and obey that request and optionally fail if the architecture doesn't match up. If no architecture is specified, the platform should select the default architecture from exe_file. Any application bundles or executable wrappers can also be inspected for the actual application binary within the bundle that should be used.

Returns
Returns true if this Platform plug-in was able to find a suitable executable, false otherwise.

Reimplemented in lldb_private::RemoteAwarePlatform.

Definition at line 832 of file Platform.cpp.

References error(), lldb_private::ModuleSpec::GetArchitecture(), lldb_private::ModuleSpec::GetFileSpec(), lldb_private::FileSpec::GetPath(), lldb_private::ModuleList::GetSharedModule(), GetSupportedArchitectures(), lldb_private::FileSystem::Instance(), and lldb_private::ArchSpec::IsValid().

◆ ResolveRemoteExecutable()

Status Platform::ResolveRemoteExecutable ( const ModuleSpec module_spec,
lldb::ModuleSP &  exe_module_sp,
const FileSpecList *  module_search_paths_ptr 
)
protectedvirtual

◆ ResolveRemotePath()

bool Platform::ResolveRemotePath ( const FileSpec platform_path,
FileSpec resolved_platform_path 
)
virtual

Resolves the FileSpec to a (possibly) remote path.

Remote platforms must override this to resolve to a path on the remote side.

Definition at line 939 of file Platform.cpp.

References lldb_private::FileSystem::Instance(), and lldb_private::FileSystem::Resolve().

◆ ResolveSymbolFile()

Status Platform::ResolveSymbolFile ( Target target,
const ModuleSpec sym_spec,
FileSpec sym_file 
)
virtual

Find a symbol file given a symbol file module specification.

Each platform might have tricks to find symbol files for an executable given information in a symbol file ModuleSpec. Some platforms might also support symbol files that are bundles and know how to extract the right symbol file given a bundle.

Parameters
[in]targetThe target in which we are trying to resolve the symbol file. The target has a list of modules that we might be able to use in order to help find the right symbol file. If the "m_file" or "m_platform_file" entries in the sym_spec are filled in, then we might be able to locate a module in the target, extract its UUID and locate a symbol file. If just the "m_uuid" is specified, then we might be able to find the module in the target that matches that UUID and pair the symbol file along with it. If just "m_symbol_file" is specified, we can use a variety of tricks to locate the symbols in an SDK, PDK, or other development kit location.
[in]sym_specA module spec that describes some information about the symbol file we are trying to resolve. The ModuleSpec might contain the following: m_file - A full or partial path to an executable from the target (might be empty). m_platform_file - Another executable hint that contains the path to the file as known on the local/remote platform. m_symbol_file - A full or partial path to a symbol file or symbol bundle that should be used when trying to resolve the symbol file. m_arch - The architecture we are looking for when resolving the symbol file. m_uuid - The UUID of the executable and symbol file. This can often be used to match up an executable with a symbol file, or resolve an symbol file in a symbol file bundle.
[out]sym_fileThe resolved symbol file spec if the returned error indicates success.
Returns
Returns an error that describes success or failure.

Reimplemented in PlatformDarwin.

Definition at line 929 of file Platform.cpp.

References error(), lldb_private::ModuleSpec::GetSymbolFileSpec(), and lldb_private::FileSystem::Instance().

◆ RunShellCommand() [1/2]

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

Reimplemented in lldb_private::RemoteAwarePlatform.

Definition at line 1344 of file Platform.cpp.

Referenced by chown_file().

◆ RunShellCommand() [2/2]

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

◆ SetFilePermissions()

Status Platform::SetFilePermissions ( const FileSpec file_spec,
uint32_t  file_permissions 
)
virtual

◆ SetHostPlatform()

void Platform::SetHostPlatform ( const lldb::PlatformSP &  platform_sp)
static

Definition at line 163 of file Platform.cpp.

References GetHostPlatformSP(), GetPlatformList(), and GetPlatformListMutex().

◆ SetIgnoresRemoteHostname()

virtual void lldb_private::Platform::SetIgnoresRemoteHostname ( bool  flag)
inlinevirtual

Definition at line 594 of file Platform.h.

References m_ignores_remote_hostname.

Referenced by PlatformPOSIX::ConnectRemote().

◆ SetLocalCacheDirectory()

void Platform::SetLocalCacheDirectory ( const char *  local)
virtual

Definition at line 1388 of file Platform.cpp.

References m_local_cache_directory.

Referenced by PlatformPOSIX::ConnectRemote().

◆ SetOSVersion()

bool Platform::SetOSVersion ( llvm::VersionTuple  os_version)

Definition at line 809 of file Platform.cpp.

References IsConnected(), IsHost(), and m_os_version.

◆ SetRemoteWorkingDirectory()

bool Platform::SetRemoteWorkingDirectory ( const FileSpec working_dir)
virtual

◆ SetRSyncOpts()

virtual void lldb_private::Platform::SetRSyncOpts ( const char *  opts)
inlinevirtual

Definition at line 576 of file Platform.h.

References m_rsync_opts.

Referenced by PlatformPOSIX::ConnectRemote().

◆ SetRSyncPrefix()

virtual void lldb_private::Platform::SetRSyncPrefix ( const char *  prefix)
inlinevirtual

Definition at line 580 of file Platform.h.

References m_rsync_prefix.

Referenced by PlatformPOSIX::ConnectRemote().

◆ SetSDKBuild()

void lldb_private::Platform::SetSDKBuild ( ConstString  sdk_build)
inline

Definition at line 459 of file Platform.h.

References m_sdk_build.

◆ SetSDKRootDirectory()

void lldb_private::Platform::SetSDKRootDirectory ( ConstString  dir)
inline

Definition at line 455 of file Platform.h.

References m_sdk_sysroot.

◆ SetSSHOpts()

virtual void lldb_private::Platform::SetSSHOpts ( const char *  opts)
inlinevirtual

Definition at line 590 of file Platform.h.

References m_ssh_opts.

Referenced by PlatformPOSIX::ConnectRemote().

◆ SetSupportsRSync()

virtual void lldb_private::Platform::SetSupportsRSync ( bool  flag)
inlinevirtual

Definition at line 572 of file Platform.h.

References m_supports_rsync.

Referenced by PlatformPOSIX::ConnectRemote().

◆ SetSupportsSSH()

virtual void lldb_private::Platform::SetSupportsSSH ( bool  flag)
inlinevirtual

Definition at line 586 of file Platform.h.

References m_supports_ssh.

Referenced by PlatformPOSIX::ConnectRemote().

◆ SetSystemArchitecture()

void lldb_private::Platform::SetSystemArchitecture ( const ArchSpec arch)
inline

◆ SetThreadCreationBreakpoint()

lldb::BreakpointSP Platform::SetThreadCreationBreakpoint ( lldb_private::Target target)
virtual

Reimplemented in PlatformDarwin.

Definition at line 1469 of file Platform.cpp.

◆ SetWorkingDirectory()

bool Platform::SetWorkingDirectory ( const FileSpec working_dir)

◆ ShellExpandArguments()

Status Platform::ShellExpandArguments ( ProcessLaunchInfo launch_info)
virtual

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.

Definition at line 1102 of file Platform.cpp.

References IsHost(), and lldb_private::Host::ShellExpandArguments().

Referenced by LaunchProcess().

◆ SupportsModules()

virtual bool lldb_private::Platform::SupportsModules ( )
inlinevirtual

Reimplemented in PlatformDarwin.

Definition at line 464 of file Platform.h.

◆ Terminate()

void Platform::Terminate ( )
static

◆ Unlink()

Status Platform::Unlink ( const FileSpec file_spec)
virtual

◆ UnloadImage()

Status Platform::UnloadImage ( lldb_private::Process process,
uint32_t  image_token 
)
virtual

Reimplemented in PlatformPOSIX.

Definition at line 1808 of file Platform.cpp.

◆ WriteFile()

virtual uint64_t lldb_private::Platform::WriteFile ( lldb::user_id_t  fd,
uint64_t  offset,
const void *  src,
uint64_t  src_len,
Status error 
)
inlinevirtual

Member Data Documentation

◆ m_calculated_trap_handlers

bool lldb_private::Platform::m_calculated_trap_handlers
protected

Definition at line 911 of file Platform.h.

Referenced by GetTrapHandlerSymbolNames().

◆ m_ignores_remote_hostname

bool lldb_private::Platform::m_ignores_remote_hostname
protected

Definition at line 908 of file Platform.h.

Referenced by GetIgnoresRemoteHostname(), and SetIgnoresRemoteHostname().

◆ m_is_host

bool lldb_private::Platform::m_is_host
protected

Definition at line 879 of file Platform.h.

Referenced by IsHost(), and IsRemote().

◆ m_local_cache_directory

std::string lldb_private::Platform::m_local_cache_directory
protected

Definition at line 909 of file Platform.h.

Referenced by GetLocalCacheDirectory(), and SetLocalCacheDirectory().

◆ m_max_gid_name_len

size_t lldb_private::Platform::m_max_gid_name_len
protected

Definition at line 902 of file Platform.h.

Referenced by GetMaxGroupIDNameLength().

◆ m_max_uid_name_len

size_t lldb_private::Platform::m_max_uid_name_len
protected

Definition at line 901 of file Platform.h.

Referenced by GetMaxUserIDNameLength().

◆ m_module_cache

const std::unique_ptr<ModuleCache> lldb_private::Platform::m_module_cache
protected

Definition at line 912 of file Platform.h.

Referenced by GetCachedSharedModule().

◆ m_mutex

std::mutex lldb_private::Platform::m_mutex
protected

◆ m_name

std::string lldb_private::Platform::m_name
protected

◆ m_os_version

llvm::VersionTuple lldb_private::Platform::m_os_version
protected

◆ m_os_version_set_while_connected

bool lldb_private::Platform::m_os_version_set_while_connected
protected

Definition at line 885 of file Platform.h.

Referenced by GetOSVersion(), and SetSystemArchitecture().

◆ m_remote_url

std::string lldb_private::Platform::m_remote_url
protected

Definition at line 892 of file Platform.h.

Referenced by GetRemoteURL().

◆ m_rsync_opts

std::string lldb_private::Platform::m_rsync_opts
protected

Definition at line 904 of file Platform.h.

Referenced by GetRSyncOpts(), and SetRSyncOpts().

◆ m_rsync_prefix

std::string lldb_private::Platform::m_rsync_prefix
protected

Definition at line 905 of file Platform.h.

Referenced by GetRSyncPrefix(), and SetRSyncPrefix().

◆ m_sdk_build

ConstString lldb_private::Platform::m_sdk_build
protected

◆ m_sdk_sysroot

ConstString lldb_private::Platform::m_sdk_sysroot
protected

◆ m_ssh_opts

std::string lldb_private::Platform::m_ssh_opts
protected

Definition at line 907 of file Platform.h.

Referenced by GetSSHOpts(), and SetSSHOpts().

◆ m_supports_rsync

bool lldb_private::Platform::m_supports_rsync
protected

Definition at line 903 of file Platform.h.

Referenced by GetSupportsRSync(), and SetSupportsRSync().

◆ m_supports_ssh

bool lldb_private::Platform::m_supports_ssh
protected

Definition at line 906 of file Platform.h.

Referenced by GetSupportsSSH(), and SetSupportsSSH().

◆ m_system_arch

ArchSpec lldb_private::Platform::m_system_arch
protected

Definition at line 896 of file Platform.h.

Referenced by GetSystemArchitecture(), and SetSystemArchitecture().

◆ m_system_arch_set_while_connected

bool lldb_private::Platform::m_system_arch_set_while_connected
protected

Definition at line 886 of file Platform.h.

Referenced by GetSystemArchitecture().

◆ m_trap_handlers

std::vector<ConstString> lldb_private::Platform::m_trap_handlers
protected

◆ m_working_dir

FileSpec lldb_private::Platform::m_working_dir
protected

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