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

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

#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
 Destructor. 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)
 
bool GetOSBuildString (std::string &s)
 
bool GetOSKernelDescription (std::string &s)
 
ConstString GetName ()
 
virtual const char * GetHostname ()
 
virtual ConstString GetFullNameForDylib (ConstString basename)
 
virtual const char * GetDescription ()=0
 
virtual void GetStatus (Stream &strm)
 Report the current status for this platform. More...
 
virtual bool GetRemoteOSVersion ()
 
virtual bool GetRemoteOSBuildString (std::string &s)
 
virtual bool GetRemoteOSKernelDescription (std::string &s)
 
virtual ArchSpec GetRemoteSystemArchitecture ()
 
virtual FileSpec GetRemoteWorkingDirectory ()
 
virtual bool SetRemoteWorkingDirectory (const FileSpec &working_dir)
 
virtual std::vector< std::string > GetSystemIncludeDirectories (lldb::LanguageType lang)
 Retrieve the system include directories on this platform for the given language. More...
 
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, lldb::ModuleSP *old_module_sp_ptr, 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 bool GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch)=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, lldb_private::Debugger &debugger, lldb_private::Target *target, lldb_private::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::string & GetRemoteURL () 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, uint32_t 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 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 (const char *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 int32_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 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...
 
- Public Member Functions inherited from lldb_private::PluginInterface
virtual ~PluginInterface ()
 
virtual ConstString GetPluginName ()=0
 
virtual uint32_t GetPluginVersion ()=0
 

Static Public Member Functions

static void Initialize ()
 
static void Terminate ()
 
static const PlatformPropertiesSPGetGlobalPlatformProperties ()
 
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

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, Platform &remote_platform)
 
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

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
 

Detailed Description

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

Definition at line 67 of file Platform.h.

Member Typedef Documentation

◆ IDToNameMap

Definition at line 859 of file Platform.h.

Constructor & Destructor Documentation

◆ Platform()

Platform::Platform ( bool  is_host_platform)

Default Constructor.

Definition at line 379 of file Platform.cpp.

References lldb_private::GetLogIfAllCategoriesSet(), LIBLLDB_LOG_OBJECT, and lldb_private::Log::Printf().

◆ ~Platform()

Platform::~Platform ( )
override

Destructor.

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

Definition at line 397 of file Platform.cpp.

References lldb_private::GetLogIfAllCategoriesSet(), LIBLLDB_LOG_OBJECT, and lldb_private::Log::Printf().

Member Function Documentation

◆ AddClangModuleCompilationOptions()

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

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

Parameters
[in]pidThe process ID that we should attempt to attach to.
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::platform_gdb_server::PlatformRemoteGDBServer, lldb_private::PlatformWindows, lldb_private::platform_freebsd::PlatformFreeBSD, and PlatformPOSIX.

Referenced by DebugProcess().

◆ 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, lldb_private::PlatformWindows, PlatformDarwin, PlatformPOSIX, lldb_private::platform_linux::PlatformLinux, lldb_private::platform_freebsd::PlatformFreeBSD, lldb_private::platform_netbsd::PlatformNetBSD, and lldb_private::platform_openbsd::PlatformOpenBSD.

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 368 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,
lldb_private::Debugger debugger,
lldb_private::Target target,
lldb_private::Status error 
)
virtual

◆ 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 PlatformPOSIX.

Definition at line 1823 of file Platform.cpp.

References lldb_private::Status::Clear().

◆ Create() [1/2]

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

◆ Create() [2/2]

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

◆ 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

◆ 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 1750 of file Platform.cpp.

References LLDB_INVALID_IMAGE_TOKEN, and lldb_private::Status::SetErrorString().

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

◆ Find()

PlatformSP Platform::Find ( ConstString  name)
static

Definition at line 268 of file Platform.cpp.

References GetPlatformList(), and GetPlatformListMutex().

◆ 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, PlatformiOSSimulator, PlatformAppleTVSimulator, PlatformAppleWatchSimulator, and lldb_private::platform_gdb_server::PlatformRemoteGDBServer.

Definition at line 1000 of file Platform.cpp.

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

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

◆ GetAugmentedArchSpec() [1/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 372 of file Platform.cpp.

References GetAugmentedArchSpec().

Referenced by lldb_private::OptionGroupArchitecture::GetArchitecture(), GetAugmentedArchSpec(), lldb_private::CommandObjectDisassemble::CommandOptions::SetOptionValue(), and lldb_private::ProcessLaunchCommandOptions::SetOptionValue().

◆ GetAugmentedArchSpec() [2/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 937 of file Platform.cpp.

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

◆ GetCachedExecutable()

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

◆ GetCacheHostname()

const char * Platform::GetCacheHostname ( )
protectedvirtual

Reimplemented in lldb_private::platform_android::PlatformAndroid.

Definition at line 1700 of file Platform.cpp.

References GetHostname().

Referenced by GetCachedExecutable().

◆ GetConnectionOptions()

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

Reimplemented in PlatformPOSIX.

Definition at line 622 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 740 of file Platform.h.

◆ GetDescription()

virtual const char* lldb_private::Platform::GetDescription ( )
pure virtual

◆ GetEnvironment()

Environment Platform::GetEnvironment ( )
virtual

Reimplemented in lldb_private::RemoteAwarePlatform.

Definition at line 1502 of file Platform.cpp.

◆ GetFile()

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

Reimplemented in PlatformMacOSX, lldb_private::platform_android::PlatformAndroid, and PlatformPOSIX.

Definition at line 1293 of file Platform.cpp.

Referenced by BringInRemoteFile().

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

Definition at line 167 of file Platform.cpp.

◆ GetFullNameForDylib()

ConstString Platform::GetFullNameForDylib ( ConstString  basename)
virtual

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

Definition at line 818 of file Platform.cpp.

References basename().

◆ GetGlobalPlatformProperties()

const PlatformPropertiesSP & 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 128 of file Platform.cpp.

References GetHostPlatformSP().

Referenced by lldb_private::Debugger::FindTargetWithProcess().

◆ 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 478 of file Platform.h.

◆ GetMaxUserIDNameLength()

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

Definition at line 475 of file Platform.h.

◆ 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

◆ GetModuleSpec()

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

◆ GetName()

ConstString Platform::GetName ( )

◆ GetOSBuildString()

bool Platform::GetOSBuildString ( std::string &  s)

Definition at line 492 of file Platform.cpp.

References GetRemoteOSBuildString(), and IsHost().

Referenced by GetStatus().

◆ GetOSKernelDescription()

bool Platform::GetOSKernelDescription ( std::string &  s)

Definition at line 505 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 450 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

Definition at line 1186 of file Platform.cpp.

References Create(), and lldb_private::ArchSpec::IsValid().

Referenced by lldb_private::Target::SetArchitecture().

◆ GetPlatformSpecificConnectionInformation()

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

Reimplemented in PlatformPOSIX.

Definition at line 641 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 697 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 674 of file Platform.h.

◆ GetRemoteOSBuildString()

virtual bool lldb_private::Platform::GetRemoteOSBuildString ( std::string &  s)
inlinevirtual

◆ GetRemoteOSKernelDescription()

virtual bool lldb_private::Platform::GetRemoteOSKernelDescription ( std::string &  s)
inlinevirtual

◆ GetRemoteOSVersion()

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

◆ 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 448 of file Platform.h.

◆ GetRemoteWorkingDirectory()

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

◆ GetResumeCountForLaunchInfo()

virtual int32_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 484 of file Platform.h.

◆ GetSDKDirectory()

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

Reimplemented in PlatformMacOSX.

Definition at line 444 of file Platform.h.

◆ GetSDKRootDirectory()

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

◆ GetSharedModule()

Status Platform::GetSharedModule ( const ModuleSpec module_spec,
Process process,
lldb::ModuleSP &  module_sp,
const FileSpecList *  module_search_paths_ptr,
lldb::ModuleSP *  old_module_sp_ptr,
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 611 of file Platform.h.

Referenced by PlatformPOSIX::GetPlatformSpecificConnectionInformation().

◆ GetStatus()

void Platform::GetStatus ( Stream strm)
virtual

◆ GetSupportedArchitectureAtIndex()

virtual bool lldb_private::Platform::GetSupportedArchitectureAtIndex ( uint32_t  idx,
ArchSpec arch 
)
pure virtual

◆ GetSupportsRSync()

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

◆ GetSupportsSSH()

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

Definition at line 607 of file Platform.h.

Referenced by PlatformPOSIX::GetPlatformSpecificConnectionInformation().

◆ GetSystemArchitecture()

const ArchSpec & Platform::GetSystemArchitecture ( )

◆ GetSystemIncludeDirectories()

virtual std::vector<std::string> lldb_private::Platform::GetSystemIncludeDirectories ( lldb::LanguageType  lang)
inlinevirtual

Retrieve the system include directories on this platform for the given language.

Parameters
[in]langThe language for which the include directories should be queried.
[out]directoriesThe include directories for this system.

Reimplemented in lldb_private::platform_linux::PlatformLinux.

Definition at line 269 of file Platform.h.

◆ 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 1504 of file Platform.cpp.

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

◆ 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 636 of file Platform.cpp.

References lldb_private::FileSpec::AppendPathComponent(), CreateSymlink(), lldb_private::FileSystem::EnumerateDirectory(), 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, MakeDirectory(), lldb_private::Log::Printf(), PutFile(), lldb_private::FileSystem::Readlink(), RecurseCopy_Callback(), lldb_private::ConstString::SetCString(), lldb_private::Status::SetErrorString(), lldb_private::Status::SetErrorStringWithFormat(), lldb_private::Status, and lldb_private::Status::Success().

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 1197 of file Platform.cpp.

References lldb_private::ArchSpec::Clear(), GetSupportedArchitectureAtIndex(), 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 450 of file Platform.h.

Referenced by PlatformPOSIX::Attach(), lldb_private::platform_freebsd::PlatformFreeBSD::Attach(), lldb_private::PlatformWindows::Attach(), lldb_private::RemoteAwarePlatform::CalculateMD5(), CalculateMD5(), lldb_private::platform_linux::PlatformLinux::CanDebugProcess(), lldb_private::platform_netbsd::PlatformNetBSD::CanDebugProcess(), lldb_private::RemoteAwarePlatform::CloseFile(), lldb_private::platform_android::PlatformAndroid::ConnectRemote(), lldb_private::PlatformWindows::ConnectRemote(), PlatformPOSIX::ConnectRemote(), ConnectRemote(), lldb_private::RemoteAwarePlatform::CreateSymlink(), lldb_private::platform_netbsd::PlatformNetBSD::DebugProcess(), PlatformPOSIX::DebugProcess(), lldb_private::platform_linux::PlatformLinux::DebugProcess(), lldb_private::PlatformWindows::DisconnectRemote(), PlatformPOSIX::DisconnectRemote(), DisconnectRemote(), lldb_private::RemoteAwarePlatform::FindProcesses(), FindProcesses(), GetCachedExecutable(), 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(), PlatformMacOSX::GetDescription(), PlatformPOSIX::GetFile(), lldb_private::platform_android::PlatformAndroid::GetFile(), lldb_private::RemoteAwarePlatform::GetFileExists(), GetFilePermissions(), lldb_private::RemoteAwarePlatform::GetFileSize(), lldb_private::RemoteAwarePlatform::GetHostname(), GetHostname(), GetOSBuildString(), GetOSKernelDescription(), GetOSVersion(), PlatformMacOSX::GetPluginName(), lldb_private::platform_android::PlatformAndroid::GetPluginName(), lldb_private::RemoteAwarePlatform::GetProcessInfo(), GetProcessInfo(), PlatformDarwin::GetSharedModuleWithLocalCache(), lldb_private::platform_linux::PlatformLinux::GetStatus(), lldb_private::platform_netbsd::PlatformNetBSD::GetStatus(), lldb_private::platform_openbsd::PlatformOpenBSD::GetStatus(), lldb_private::platform_freebsd::PlatformFreeBSD::GetStatus(), GetStatus(), lldb_private::platform_netbsd::PlatformNetBSD::GetSupportedArchitectureAtIndex(), lldb_private::platform_freebsd::PlatformFreeBSD::GetSupportedArchitectureAtIndex(), lldb_private::platform_openbsd::PlatformOpenBSD::GetSupportedArchitectureAtIndex(), lldb_private::platform_linux::PlatformLinux::GetSupportedArchitectureAtIndex(), GetSystemArchitecture(), GetUnixSignals(), lldb_private::RemoteAwarePlatform::GetUserIDResolver(), GetWorkingDirectory(), lldb_private::RemoteAwarePlatform::IsConnected(), lldb_private::RemoteAwarePlatform::KillProcess(), KillProcess(), lldb_private::platform_freebsd::PlatformFreeBSD::LaunchProcess(), lldb_private::RemoteAwarePlatform::LaunchProcess(), LaunchProcess(), MakeDirectory(), lldb_private::RemoteAwarePlatform::OpenFile(), PlatformPOSIX::PutFile(), lldb_private::platform_android::PlatformAndroid::PutFile(), lldb_private::RemoteAwarePlatform::ReadFile(), lldb_private::PlatformWindows::ResolveExecutable(), PlatformPOSIX::ResolveExecutable(), lldb_private::RemoteAwarePlatform::RunShellCommand(), RunShellCommand(), SetFilePermissions(), SetOSVersion(), SetWorkingDirectory(), ShellExpandArguments(), lldb_private::RemoteAwarePlatform::Unlink(), and lldb_private::RemoteAwarePlatform::WriteFile().

◆ 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 1713 of file Platform.cpp.

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

◆ 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]path_listThe 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 1759 of file Platform.cpp.

References DoLoadImage(), 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 735 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 175 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 508 of file Platform.h.

◆ OpenFile()

virtual lldb::user_id_t lldb_private::Platform::OpenFile ( const FileSpec file_spec,
uint32_t  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::platform_gdb_server::PlatformRemoteGDBServer, and lldb_private::PlatformWindows.

Definition at line 854 of file Platform.cpp.

References lldb_private::ModuleSpec::GetArchitecture(), lldb_private::ModuleSpec::GetFileSpec(), lldb_private::FileSpec::GetPath(), lldb_private::ModuleList::GetSharedModule(), GetSupportedArchitectureAtIndex(), lldb_private::FileSystem::Instance(), lldb_private::ArchSpec::IsValid(), lldb_private::Status::SetErrorStringWithFormat(), and lldb_private::Status::Success().

Referenced by GetCachedExecutable().

◆ 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 896 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 886 of file Platform.cpp.

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

◆ RunShellCommand()

lldb_private::Status Platform::RunShellCommand ( const char *  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 156 of file Platform.cpp.

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

◆ SetIgnoresRemoteHostname()

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

Definition at line 617 of file Platform.h.

Referenced by PlatformPOSIX::ConnectRemote().

◆ SetLocalCacheDirectory()

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

Definition at line 1357 of file Platform.cpp.

References m_local_cache_directory.

Referenced by PlatformPOSIX::ConnectRemote().

◆ SetOSVersion()

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

Definition at line 831 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 599 of file Platform.h.

Referenced by PlatformPOSIX::ConnectRemote().

◆ SetRSyncPrefix()

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

Definition at line 603 of file Platform.h.

Referenced by PlatformPOSIX::ConnectRemote().

◆ SetSDKBuild()

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

Definition at line 486 of file Platform.h.

◆ SetSDKRootDirectory()

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

Definition at line 482 of file Platform.h.

◆ SetSSHOpts()

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

Definition at line 613 of file Platform.h.

Referenced by PlatformPOSIX::ConnectRemote().

◆ SetSupportsRSync()

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

Definition at line 595 of file Platform.h.

Referenced by PlatformPOSIX::ConnectRemote().

◆ SetSupportsSSH()

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

Definition at line 609 of file Platform.h.

Referenced by PlatformPOSIX::ConnectRemote().

◆ SetSystemArchitecture()

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

Definition at line 463 of file Platform.h.

References lldb_private::ArchSpec::IsValid().

◆ SetThreadCreationBreakpoint()

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

Reimplemented in PlatformDarwin.

Definition at line 1438 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 1062 of file Platform.cpp.

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

Referenced by LaunchProcess().

◆ SupportsModules()

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

Reimplemented in PlatformDarwin.

Definition at line 491 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 1776 of file Platform.cpp.

References lldb_private::Status.

◆ 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 873 of file Platform.h.

Referenced by GetTrapHandlerSymbolNames().

◆ m_ignores_remote_hostname

bool lldb_private::Platform::m_ignores_remote_hostname
protected

◆ m_is_host

bool lldb_private::Platform::m_is_host
protected

Definition at line 841 of file Platform.h.

◆ m_local_cache_directory

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

Definition at line 871 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 864 of file Platform.h.

◆ m_max_uid_name_len

size_t lldb_private::Platform::m_max_uid_name_len
protected

Definition at line 863 of file Platform.h.

◆ m_module_cache

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

Definition at line 874 of file Platform.h.

Referenced by GetCachedExecutable().

◆ 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 847 of file Platform.h.

Referenced by GetOSVersion().

◆ m_remote_url

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

Definition at line 854 of file Platform.h.

◆ m_rsync_opts

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

◆ m_rsync_prefix

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

◆ 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

◆ m_supports_rsync

bool lldb_private::Platform::m_supports_rsync
protected

Definition at line 865 of file Platform.h.

◆ m_supports_ssh

bool lldb_private::Platform::m_supports_ssh
protected

Definition at line 868 of file Platform.h.

◆ m_system_arch

ArchSpec lldb_private::Platform::m_system_arch
protected

Definition at line 858 of file Platform.h.

Referenced by GetSystemArchitecture().

◆ m_system_arch_set_while_connected

bool lldb_private::Platform::m_system_arch_set_while_connected
protected

Definition at line 848 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: