LLDB mainline
Public Types | 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

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]

Public Types

typedef std::function< Status(const ModuleSpec &module_spec, FileSpec &module_file_spec, FileSpec &symbol_file_spec)> LocateModuleCallback
 

Public Member Functions

 Platform (bool is_host_platform)
 Default Constructor.
 
 ~Platform () override
 The destructor is virtual since this class is designed to be inherited from by the plug-in instance.
 
virtual Status ResolveExecutable (const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr)
 Find a platform plugin for a given process.
 
virtual Status ResolveSymbolFile (Target &target, const ModuleSpec &sym_spec, FileSpec &sym_file)
 Find a symbol file given a symbol file module specification.
 
virtual bool ResolveRemotePath (const FileSpec &platform_path, FileSpec &resolved_platform_path)
 Resolves the FileSpec to a (possibly) remote path.
 
virtual llvm::VersionTuple GetOSVersion (Process *process=nullptr)
 Get the OS version from a connected platform.
 
bool SetOSVersion (llvm::VersionTuple os_version)
 
std::optional< std::string > GetOSBuildString ()
 
std::optional< std::string > GetOSKernelDescription ()
 
llvm::StringRef GetName ()
 
virtual 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.
 
virtual bool GetRemoteOSVersion ()
 
virtual std::optional< std::string > GetRemoteOSBuildString ()
 
virtual std::optional< std::string > GetRemoteOSKernelDescription ()
 
virtual ArchSpec GetRemoteSystemArchitecture ()
 
virtual FileSpec GetRemoteWorkingDirectory ()
 
virtual bool SetRemoteWorkingDirectory (const FileSpec &working_dir)
 
virtual UserIDResolverGetUserIDResolver ()
 
virtual Status GetFileWithUUID (const FileSpec &platform_file, const UUID *uuid_ptr, FileSpec &local_file)
 Locate a file for a platform.
 
virtual FileSpecList LocateExecutableScriptingResources (Target *target, Module &module, Stream &feedback_stream)
 
virtual Status GetSharedModule (const ModuleSpec &module_spec, Process *process, lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, llvm::SmallVectorImpl< lldb::ModuleSP > *old_modules, bool *did_create_ptr)
 
void CallLocateModuleCallbackIfSet (const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, FileSpec &symbol_file_spec, bool *did_create_ptr)
 
virtual 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 (const ArchSpec &process_host_arch)=0
 Get the platform's supported architectures in the order in which they should be searched.
 
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.
 
virtual Status ShellExpandArguments (ProcessLaunchInfo &launch_info)
 Perform expansion of the command-line for this launch info This can potentially involve wildcard expansion environment variable replacement, and whatever other argument magic the platform defines as part of its typical user experience.
 
virtual Status KillProcess (const lldb::pid_t pid)
 Kill process on a platform.
 
virtual bool IsCompatibleArchitecture (const ArchSpec &arch, const ArchSpec &process_host_arch, ArchSpec::MatchType match, ArchSpec *compatible_arch_ptr)
 Lets a platform answer if it is compatible with a given architecture and the target triple contained within.
 
virtual bool CanDebugProcess ()
 Not all platforms will support debugging a process by spawning somehow halted for a debugger (specified using the "eLaunchFlagDebug" launch flag) and then attaching.
 
virtual lldb::ProcessSP 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 ().
 
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.
 
virtual uint32_t FindProcesses (const ProcessInstanceInfoMatch &match_info, ProcessInstanceInfoList &proc_infos)
 Attach to an existing process by process name.
 
ProcessInstanceInfoList GetAllProcesses ()
 
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.
 
size_t GetMaxUserIDNameLength () const
 
size_t GetMaxGroupIDNameLength () const
 
const std::string & GetSDKRootDirectory () const
 
void SetSDKRootDirectory (std::string dir)
 
const std::string & GetSDKBuild () const
 
void SetSDKBuild (std::string sdk_build)
 
virtual bool SupportsModules ()
 
virtual void AddClangModuleCompilationOptions (Target *target, std::vector< std::string > &options)
 
FileSpec GetWorkingDirectory ()
 
bool SetWorkingDirectory (const FileSpec &working_dir)
 
virtual bool ModuleIsExcludedForUnconstrainedSearches (Target &target, const lldb::ModuleSP &module_sp)
 
virtual Status 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.
 
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::UnixSignalsSPGetRemoteUnixSignals ()
 
lldb::UnixSignalsSP GetUnixSignals ()
 
virtual std::string GetQueueNameForThreadQAddress (Process *process, lldb::addr_t dispatch_qaddr)
 Locate a queue name given a thread's qaddr.
 
virtual lldb::queue_id_t GetQueueIDForThreadQAddress (Process *process, lldb::addr_t dispatch_qaddr)
 Locate a queue ID given a thread's qaddr.
 
virtual const std::vector< ConstString > & GetTrapHandlerSymbolNames ()
 Provide a list of trap handler function names for this platform.
 
virtual lldb::UnwindPlanSP GetTrapHandlerUnwindPlan (const llvm::Triple &triple, ConstString name)
 Try to get a specific unwind plan for a named trap handler.
 
virtual FileSpec LocateExecutable (const char *basename)
 Find a support executable that may not live within in the standard locations related to LLDB.
 
virtual uint32_t GetDefaultMemoryCacheLineSize ()
 Allow the platform to set preferred memory cache line size.
 
uint32_t LoadImage (lldb_private::Process *process, const lldb_private::FileSpec &local_file, const lldb_private::FileSpec &remote_file, lldb_private::Status &error)
 Load a shared library into this process.
 
uint32_t LoadImageUsingPaths (lldb_private::Process *process, const lldb_private::FileSpec &library_name, const std::vector< std::string > &paths, lldb_private::Status &error, lldb_private::FileSpec *loaded_path)
 Load a shared library specified by base name into this process, looking by hand along a set of paths.
 
virtual uint32_t DoLoadImage (lldb_private::Process *process, const lldb_private::FileSpec &remote_file, const std::vector< std::string > *paths, lldb_private::Status &error, lldb_private::FileSpec *loaded_path=nullptr)
 
virtual Status UnloadImage (lldb_private::Process *process, uint32_t image_token)
 
virtual size_t ConnectToWaitingProcesses (lldb_private::Debugger &debugger, lldb_private::Status &error)
 Connect to all processes waiting for a debugger to attach.
 
virtual llvm::Expected< StructuredData::DictionarySPFetchExtendedCrashInformation (lldb_private::Process &process)
 Gather all of crash informations into a structured data dictionary.
 
virtual bool LoadPlatformBinaryAndSetup (Process *process, lldb::addr_t addr, bool notify)
 Detect a binary in memory that will determine which Platform and DynamicLoader should be used in this target/process, and update the Platform/DynamicLoader.
 
virtual CompilerType GetSiginfoType (const llvm::Triple &triple)
 
virtual Args GetExtraStartupCommands ()
 
void SetLocateModuleCallback (LocateModuleCallback callback)
 Set locate module callback.
 
LocateModuleCallback GetLocateModuleCallback () const
 
- Public Member Functions inherited from lldb_private::PluginInterface
 PluginInterface ()=default
 
virtual ~PluginInterface ()=default
 
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.
 
static const char * GetHostPlatformName ()
 
static void SetHostPlatform (const lldb::PlatformSP &platform_sp)
 
static lldb::PlatformSP Create (llvm::StringRef name)
 
static ArchSpec GetAugmentedArchSpec (Platform *platform, llvm::StringRef triple)
 Augments the triple either with information from platform or the host system (if platform is null).
 

Protected 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.
 
virtual void CalculateTrapHandlerSymbolNames ()=0
 Ask the Platform subclass to fill in the list of trap handler names.
 
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.
 

Protected Attributes

bool m_is_host
 
bool m_os_version_set_while_connected
 
bool m_system_arch_set_while_connected
 
std::string m_sdk_sysroot
 
std::string m_sdk_build
 
FileSpec m_working_dir
 
std::string m_remote_url
 
std::string m_hostname
 
llvm::VersionTuple m_os_version
 
ArchSpec m_system_arch
 
std::mutex m_mutex
 
size_t m_max_uid_name_len
 
size_t m_max_gid_name_len
 
bool m_supports_rsync
 
std::string m_rsync_opts
 
std::string m_rsync_prefix
 
bool m_supports_ssh
 
std::string m_ssh_opts
 
bool m_ignores_remote_hostname
 
std::string m_local_cache_directory
 
std::vector< ConstStringm_trap_handlers
 
bool m_calculated_trap_handlers
 
const std::unique_ptr< ModuleCachem_module_cache
 
LocateModuleCallback m_locate_module_callback
 

Private 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 74 of file Platform.h.

Member Typedef Documentation

◆ IDToNameMap

typedef std::map<uint32_t, ConstString> lldb_private::Platform::IDToNameMap
protected

Definition at line 963 of file Platform.h.

◆ LocateModuleCallback

typedef std::function<Status(const ModuleSpec &module_spec, FileSpec &module_file_spec, FileSpec &symbol_file_spec)> lldb_private::Platform::LocateModuleCallback

Definition at line 922 of file Platform.h.

◆ ModuleResolver

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

Definition at line 1013 of file Platform.h.

Constructor & Destructor Documentation

◆ Platform()

Platform::Platform ( bool  is_host_platform)

Default Constructor.

Definition at line 268 of file Platform.cpp.

References lldb_private::GetLog(), LLDB_LOGF, and lldb_private::Object.

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

◆ 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 PlatformPOSIX, lldb_private::PlatformWindows, lldb_private::platform_gdb_server::PlatformRemoteGDBServer, and lldb_private::PlatformQemuUser.

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 537 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_freebsd::PlatformFreeBSD, lldb_private::platform_gdb_server::PlatformRemoteGDBServer, lldb_private::platform_linux::PlatformLinux, lldb_private::PlatformDarwin, lldb_private::platform_netbsd::PlatformNetBSD, lldb_private::platform_openbsd::PlatformOpenBSD, PlatformPOSIX, lldb_private::PlatformQemuUser, and lldb_private::PlatformWindows.

Referenced by GetTrapHandlerSymbolNames().

◆ CallLocateModuleCallbackIfSet()

void Platform::CallLocateModuleCallbackIfSet ( const ModuleSpec module_spec,
lldb::ModuleSP module_sp,
FileSpec symbol_file_spec,
bool *  did_create_ptr 
)

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

Definition at line 373 of file Platform.h.

◆ CloseFile()

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

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

Definition at line 1983 of file Platform.cpp.

References error().

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

◆ Create()

PlatformSP Platform::Create ( llvm::StringRef  name)
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, and lldb_private::PlatformWindows.

Definition at line 1880 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 1818 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 lldb_private::PlatformDarwin.

Definition at line 883 of file Platform.h.

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

Definition at line 982 of file Platform.cpp.

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

Referenced by lldb_private::RemoteAwarePlatform::FindProcesses(), and GetAllProcesses().

◆ GetAllProcesses()

ProcessInstanceInfoList Platform::GetAllProcesses ( )

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

References lldb_private::ArchSpec::CompatibleMatch, 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

◆ 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 1830 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 620 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 767 of file Platform.h.

◆ GetDescription()

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

◆ GetEnvironment()

Environment Platform::GetEnvironment ( )
virtual

◆ GetExtraStartupCommands()

Args Platform::GetExtraStartupCommands ( )
virtual

Reimplemented in lldb_private::PlatformDarwin.

Definition at line 2130 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()

user_id_t Platform::GetFileSize ( const FileSpec file_spec)
virtual

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

Definition at line 151 of file Platform.cpp.

◆ GetFullNameForDylib()

ConstString Platform::GetFullNameForDylib ( ConstString  basename)
virtual

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

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

References GetHostPlatformSP().

Referenced by Create(), lldb_private::Debugger::Debugger(), CommandObjectPlatformList::DoExecute(), CommandObjectPlatformShell::DoExecute(), lldb::SBDebugger::GetAvailablePlatformInfoAtIndex(), lldb::SBPlatform::GetHostPlatform(), lldb_private::PlatformQemuUser::GetMmapArgumentList(), and lldb_private::PlatformList::GetOrCreate().

◆ GetHostPlatformName()

const char * Platform::GetHostPlatformName ( )
static

◆ GetIgnoresRemoteHostname()

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

◆ GetLocalCacheDirectory()

const char * Platform::GetLocalCacheDirectory ( )
virtual

◆ GetLocateModuleCallback()

Platform::LocateModuleCallback Platform::GetLocateModuleCallback ( ) const

Definition at line 2138 of file Platform.cpp.

References m_locate_module_callback.

◆ GetMaxGroupIDNameLength()

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

Definition at line 484 of file Platform.h.

References m_max_gid_name_len.

◆ GetMaxUserIDNameLength()

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

Definition at line 481 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()

llvm::StringRef lldb_private::Platform::GetName ( )
inline

Definition at line 214 of file Platform.h.

References lldb_private::PluginInterface::GetPluginName().

◆ GetOSBuildString()

std::optional< std::string > Platform::GetOSBuildString ( )

◆ GetOSKernelDescription()

std::optional< std::string > Platform::GetOSKernelDescription ( )

Definition at line 379 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 lldb_private::PlatformDarwin.

Definition at line 331 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 lldb_private::PlatformDarwin::GetOSVersion(), and GetStatus().

◆ GetPlatformSpecificConnectionInformation()

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

Reimplemented in PlatformPOSIX.

Definition at line 650 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 706 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 683 of file Platform.h.

◆ GetRemoteOSBuildString()

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

◆ GetRemoteOSKernelDescription()

virtual std::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 454 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()

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

◆ GetSDKDirectory()

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

Reimplemented in lldb_private::PlatformMacOSX.

Definition at line 450 of file Platform.h.

◆ GetSDKRootDirectory()

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

Definition at line 486 of file Platform.h.

References m_sdk_sysroot.

Referenced by lldb_private::PlatformQemuUser::DebugProcess(), and GetStatus().

◆ 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
Parameters
[in]module_specThe ModuleSpec of a binary to find.
[in]processA Process.
[out]module_spA Module that matches the ModuleSpec, if one is found.
[in]module_search_paths_ptrLocations to possibly look for a binary that matches the ModuleSpec.
[out]old_modulesExisting Modules in the Process' Target image list which match the FileSpec.
[out]did_create_ptrOptional boolean, nullptr may be passed for this argument. If this method is returning a new ModuleSP, this will be set to true. If this method is returning a ModuleSP that is already in the Target's image list, it will be false.
Returns
The Status object for any errors found while searching for the binary.

Reimplemented in lldb_private::PlatformAppleSimulator, lldb_private::PlatformDarwin, lldb_private::PlatformMacOSX, and lldb_private::PlatformRemoteDarwinDevice.

Definition at line 198 of file Platform.cpp.

References lldb::eErrorTypeGeneric, error(), lldb_private::ModuleSpec::GetFileSpec(), GetRemoteSharedModule(), lldb_private::ModuleList::GetSharedModule(), IsHost(), m_sdk_sysroot, and lldb_private::FileSpec::PrependPathComponent().

Referenced by lldb_private::PlatformDarwin::FindBundleBinaryInExecSearchPaths(), and lldb_private::PlatformDarwin::GetSharedModule().

◆ GetSiginfoType()

CompilerType Platform::GetSiginfoType ( const llvm::Triple &  triple)
virtual

◆ GetSoftwareBreakpointTrapOpcode()

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

◆ GetSSHOpts()

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

Definition at line 609 of file Platform.h.

References m_ssh_opts.

Referenced by PlatformPOSIX::GetPlatformSpecificConnectionInformation().

◆ GetStatus()

void Platform::GetStatus ( Stream strm)
virtual

Report the current status for this platform.

The returned string usually involves returning the OS version (if available), and any SDK directory that might be being used for local file caching, and if connected a quick blurb about what this platform is connected to.

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

Definition at line 282 of file Platform.cpp.

References lldb_private::Stream::AsRawOstream(), lldb_private::ArchSpec::DumpTriple(), lldb_private::Stream::EOL(), lldb_private::Stream::Format(), GetHostname(), GetOSBuildString(), GetOSKernelDescription(), GetOSVersion(), GetPlatformSpecificConnectionInformation(), lldb_private::PluginInterface::GetPluginName(), GetSDKRootDirectory(), GetSystemArchitecture(), lldb_private::ArchSpec::GetTriple(), GetWorkingDirectory(), IsConnected(), IsHost(), lldb_private::ArchSpec::IsValid(), and lldb_private::Stream::Printf().

Referenced by lldb_private::PlatformWindows::GetStatus(), lldb_private::platform_freebsd::PlatformFreeBSD::GetStatus(), lldb_private::platform_linux::PlatformLinux::GetStatus(), lldb_private::PlatformAppleSimulator::GetStatus(), lldb_private::PlatformRemoteDarwinDevice::GetStatus(), lldb_private::platform_netbsd::PlatformNetBSD::GetStatus(), and lldb_private::platform_openbsd::PlatformOpenBSD::GetStatus().

◆ GetSupportedArchitectures()

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

◆ GetSupportsRSync()

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

◆ GetSupportsSSH()

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

Definition at line 605 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 1478 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 745 of file Platform.h.

◆ GetUnixSignals()

UnixSignalsSP Platform::GetUnixSignals ( )

◆ GetUserIDResolver()

UserIDResolver & Platform::GetUserIDResolver ( )
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 506 of file Platform.cpp.

References lldb_private::FileSpec::AppendPathComponent(), CreateSymlink(), lldb_private::FileSystem::EnumerateDirectory(), error(), RecurseCopyBaton::error, lldb_private::ConstString::GetCString(), lldb_private::FileSpec::GetDirectory(), lldb_private::FileSpec::GetFilename(), lldb_private::GetLog(), lldb_private::FileSpec::GetPath(), lldb_private::FileSpec::GetPathAsConstString(), lldb_private::FileSystem::GetPermissions(), GetSupportsRSync(), GetWorkingDirectory(), lldb_private::FileSystem::Instance(), LLDB_LOGF, MakeDirectory(), lldb_private::Platform, PutFile(), lldb_private::FileSystem::Readlink(), RecurseCopy_Callback(), lldb_private::FileSpec::SetDirectory(), and lldb_private::FileSpec::SetFilename().

Referenced by LoadImage().

◆ IsCompatibleArchitecture()

bool Platform::IsCompatibleArchitecture ( const ArchSpec arch,
const ArchSpec process_host_arch,
ArchSpec::MatchType  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 1163 of file Platform.cpp.

References lldb_private::ArchSpec::Clear(), GetSupportedArchitectures(), lldb_private::ArchSpec::IsMatch(), 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 456 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::PlatformDarwin::CheckLocalSharedCache(), CloseFile(), ConnectRemote(), lldb_private::platform_android::PlatformAndroid::ConnectRemote(), PlatformPOSIX::ConnectRemote(), lldb_private::PlatformWindows::ConnectRemote(), CreateSymlink(), PlatformPOSIX::DebugProcess(), lldb_private::PlatformDarwin::DebugProcess(), DisconnectRemote(), PlatformPOSIX::DisconnectRemote(), lldb_private::PlatformWindows::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(), GetEnvironment(), lldb_private::platform_android::PlatformAndroid::GetFile(), PlatformPOSIX::GetFile(), GetFileExists(), GetFilePermissions(), GetFileSize(), GetHostname(), GetOSBuildString(), GetOSKernelDescription(), GetOSVersion(), lldb_private::platform_android::PlatformAndroid::GetPluginName(), 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(), GetProcessInfo(), GetSharedModule(), lldb_private::PlatformDarwinDevice::GetSharedModuleWithLocalCache(), GetStatus(), lldb_private::platform_freebsd::PlatformFreeBSD::GetStatus(), lldb_private::platform_linux::PlatformLinux::GetStatus(), lldb_private::platform_netbsd::PlatformNetBSD::GetStatus(), lldb_private::platform_openbsd::PlatformOpenBSD::GetStatus(), GetSystemArchitecture(), GetUnixSignals(), GetUserIDResolver(), GetWorkingDirectory(), IsConnected(), KillProcess(), LaunchProcess(), MakeDirectory(), OpenFile(), lldb_private::platform_android::PlatformAndroid::PutFile(), PlatformPOSIX::PutFile(), ReadFile(), lldb_private::RemoteAwarePlatform::ResolveExecutable(), RunShellCommand(), SetFilePermissions(), SetOSVersion(), SetSystemArchitecture(), SetWorkingDirectory(), ShellExpandArguments(), Unlink(), and 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 1843 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 1889 of file Platform.cpp.

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

◆ LoadPlatformBinaryAndSetup()

virtual bool lldb_private::Platform::LoadPlatformBinaryAndSetup ( Process process,
lldb::addr_t  addr,
bool  notify 
)
inlinevirtual

Detect a binary in memory that will determine which Platform and DynamicLoader should be used in this target/process, and update the Platform/DynamicLoader.

The binary will be loaded into the Target, or will be registered with the DynamicLoader so that it will be loaded at a later stage. Returns true to indicate that this is a platform binary and has been loaded/registered, no further action should be taken by the caller.

Parameters
[in]processProcess read memory from, a Process must be provided.
[in]addrAddress of a binary in memory.
[in]notifyWhether ModulesDidLoad should be called, if a binary is loaded. Caller may prefer to call ModulesDidLoad for multiple binaries that were loaded at the same time.
Returns
Returns true if the binary was loaded in the target (or will be via a DynamicLoader). Returns false if the binary was not loaded/registered, and the caller must load it into the target.

Definition at line 910 of file Platform.h.

◆ 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 lldb_private::PlatformDarwin.

Definition at line 762 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 lldb_private::PlatformDarwin.

Definition at line 159 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 lldb_private::PlatformDarwin.

Definition at line 516 of file Platform.h.

◆ OpenFile()

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

◆ PutFile()

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

◆ ReadFile()

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

◆ 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, lldb_private::PlatformAppleSimulator, and lldb_private::PlatformRemoteDarwinDevice.

Definition at line 766 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 876 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 lldb_private::PlatformDarwin.

Definition at line 866 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

◆ 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

◆ SetIgnoresRemoteHostname()

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

Definition at line 615 of file Platform.h.

References m_ignores_remote_hostname.

Referenced by PlatformPOSIX::ConnectRemote().

◆ SetLocalCacheDirectory()

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

Definition at line 1327 of file Platform.cpp.

References m_local_cache_directory.

Referenced by PlatformPOSIX::ConnectRemote().

◆ SetLocateModuleCallback()

void Platform::SetLocateModuleCallback ( LocateModuleCallback  callback)

Set locate module callback.

This allows users to implement their own module cache system. For example, to leverage artifacts of build system, to bypass pulling files from remote platform, or to search symbol files from symbol servers.

Definition at line 2134 of file Platform.cpp.

References m_locate_module_callback.

◆ SetOSVersion()

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

Definition at line 743 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 597 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 601 of file Platform.h.

References m_rsync_prefix.

Referenced by PlatformPOSIX::ConnectRemote().

◆ SetSDKBuild()

void lldb_private::Platform::SetSDKBuild ( std::string  sdk_build)
inline

Definition at line 492 of file Platform.h.

References m_sdk_build.

◆ SetSDKRootDirectory()

void lldb_private::Platform::SetSDKRootDirectory ( std::string  dir)
inline

Definition at line 488 of file Platform.h.

References m_sdk_sysroot.

◆ SetSSHOpts()

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

Definition at line 611 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 593 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 607 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 lldb_private::PlatformDarwin.

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

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

Referenced by LaunchProcess().

◆ SupportsModules()

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

Reimplemented in lldb_private::PlatformDarwin.

Definition at line 499 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, and lldb_private::PlatformWindows.

Definition at line 1906 of file Platform.cpp.

◆ WriteFile()

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

Member Data Documentation

◆ m_calculated_trap_handlers

bool lldb_private::Platform::m_calculated_trap_handlers
protected

Definition at line 977 of file Platform.h.

Referenced by GetTrapHandlerSymbolNames().

◆ m_hostname

std::string lldb_private::Platform::m_hostname
protected

◆ m_ignores_remote_hostname

bool lldb_private::Platform::m_ignores_remote_hostname
protected

Definition at line 974 of file Platform.h.

Referenced by GetIgnoresRemoteHostname(), and SetIgnoresRemoteHostname().

◆ m_is_host

bool lldb_private::Platform::m_is_host
protected

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

Referenced by GetLocalCacheDirectory(), and SetLocalCacheDirectory().

◆ m_locate_module_callback

LocateModuleCallback lldb_private::Platform::m_locate_module_callback
protected

◆ m_max_gid_name_len

size_t lldb_private::Platform::m_max_gid_name_len
protected

Definition at line 968 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 967 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 978 of file Platform.h.

Referenced by GetCachedSharedModule().

◆ m_mutex

std::mutex lldb_private::Platform::m_mutex
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 951 of file Platform.h.

Referenced by GetOSVersion(), and SetSystemArchitecture().

◆ m_remote_url

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

Definition at line 958 of file Platform.h.

Referenced by GetRemoteURL().

◆ m_rsync_opts

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

Definition at line 970 of file Platform.h.

Referenced by GetRSyncOpts(), and SetRSyncOpts().

◆ m_rsync_prefix

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

Definition at line 971 of file Platform.h.

Referenced by GetRSyncPrefix(), and SetRSyncPrefix().

◆ m_sdk_build

std::string lldb_private::Platform::m_sdk_build
protected

Definition at line 955 of file Platform.h.

Referenced by GetSDKBuild(), and SetSDKBuild().

◆ m_sdk_sysroot

std::string lldb_private::Platform::m_sdk_sysroot
protected

◆ m_ssh_opts

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

Definition at line 973 of file Platform.h.

Referenced by GetSSHOpts(), and SetSSHOpts().

◆ m_supports_rsync

bool lldb_private::Platform::m_supports_rsync
protected

Definition at line 969 of file Platform.h.

Referenced by GetSupportsRSync(), and SetSupportsRSync().

◆ m_supports_ssh

bool lldb_private::Platform::m_supports_ssh
protected

Definition at line 972 of file Platform.h.

Referenced by GetSupportsSSH(), and SetSupportsSSH().

◆ m_system_arch

ArchSpec lldb_private::Platform::m_system_arch
protected

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