LLDB mainline
|
A class that provides host computer information. More...
#include "lldb/Host/Host.h"
Public Types | |
typedef std::function< void(lldb::pid_t pid, int signal, int status)> | MonitorChildProcessCallback |
typedef std::map< lldb::pid_t, bool > | TidMap |
typedef std::pair< lldb::pid_t, bool > | TidPair |
Static Public Member Functions | |
static llvm::Expected< HostThread > | StartMonitoringChildProcess (const MonitorChildProcessCallback &callback, lldb::pid_t pid) |
Start monitoring a child process. | |
static void | SystemLog (lldb::Severity severity, llvm::StringRef message) |
Emit the given message to the operating system log. | |
static lldb::pid_t | GetCurrentProcessID () |
Get the process ID for the calling process. | |
static void | Kill (lldb::pid_t pid, int signo) |
static lldb::thread_t | GetCurrentThread () |
Get the thread token (the one returned by ThreadCreate when the thread was created) for the calling thread in the current process. | |
static const char * | GetSignalAsCString (int signo) |
static FileSpec | GetModuleFileSpecForHostAddress (const void *host_addr) |
Given an address in the current process (the process that is running the LLDB code), return the name of the module that it comes from. | |
static bool | GetBundleDirectory (const FileSpec &file, FileSpec &bundle_directory) |
If you have an executable that is in a bundle and want to get back to the bundle directory from the path itself, this function will change a path to a file within a bundle to the bundle directory itself. | |
static bool | ResolveExecutableInBundle (FileSpec &file) |
When executable files may live within a directory, where the directory represents an executable bundle (like the MacOSX app bundles), then locate the executable within the containing bundle. | |
static uint32_t | FindProcesses (const ProcessInstanceInfoMatch &match_info, ProcessInstanceInfoList &proc_infos) |
static bool | FindProcessThreads (const lldb::pid_t pid, TidMap &tids_to_attach) |
static bool | GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &proc_info) |
static Status | LaunchProcess (ProcessLaunchInfo &launch_info) |
Launch the process specified in launch_info. | |
static 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. | |
static Status | RunShellCommand (llvm::StringRef command, const FileSpec &working_dir, int *status_ptr, int *signo_ptr, std::string *command_output, const Timeout< std::micro > &timeout, bool run_in_shell=true, bool hide_stderr=false) |
Run a shell command. | |
static 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, bool run_in_shell=true, bool hide_stderr=false) |
Run a shell command. | |
static Status | RunShellCommand (const Args &args, const FileSpec &working_dir, int *status_ptr, int *signo_ptr, std::string *command_output, const Timeout< std::micro > &timeout, bool run_in_shell=true, bool hide_stderr=false) |
Run a shell command. | |
static Status | RunShellCommand (llvm::StringRef shell, const Args &args, const FileSpec &working_dir, int *status_ptr, int *signo_ptr, std::string *command_output, const Timeout< std::micro > &timeout, bool run_in_shell=true, bool hide_stderr=false) |
Run a shell command. | |
static llvm::Error | OpenFileInExternalEditor (llvm::StringRef editor, const FileSpec &file_spec, uint32_t line_no) |
static bool | IsInteractiveGraphicSession () |
Check if we're running in an interactive graphical session. | |
static Environment | GetEnvironment () |
static std::unique_ptr< Connection > | CreateDefaultConnection (llvm::StringRef url) |
Static Protected Member Functions | |
static uint32_t | FindProcessesImpl (const ProcessInstanceInfoMatch &match_info, ProcessInstanceInfoList &proc_infos) |
A class that provides host computer information.
Host is a class that answers information about the host operating system.
typedef std::function<void(lldb::pid_t pid, int signal, int status)> lldb_private::Host::MonitorChildProcessCallback |
typedef std::map<lldb::pid_t, bool> lldb_private::Host::TidMap |
typedef std::pair<lldb::pid_t, bool> lldb_private::Host::TidPair |
|
static |
Definition at line 581 of file common/Host.cpp.
Referenced by lldb::SBCommunication::Connect().
|
static |
Definition at line 637 of file common/Host.cpp.
References FindProcessesImpl().
Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::AttachWaitProcess(), lldb_private::Platform::FindProcesses(), lldb_private::PlatformAppleSimulator::FindProcesses(), and lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qfProcessInfo().
|
staticprotected |
Definition at line 149 of file freebsd/Host.cpp.
References GetFreeBSDProcessArgs(), GetFreeBSDProcessCPUType(), lldb_private::ProcessInstanceInfoMatch::GetMatchAllUsers(), lldb_private::Ignore, lldb_private::ProcessInstanceInfoMatch::Matches(), lldb_private::ProcessInstanceInfo::SetEffectiveGroupID(), lldb_private::ProcessInstanceInfo::SetEffectiveUserID(), lldb_private::ProcessInfo::SetGroupID(), lldb_private::ProcessInstanceInfoMatch::SetNameMatchType(), lldb_private::ProcessInstanceInfo::SetParentProcessID(), lldb_private::ProcessInfo::SetProcessID(), and lldb_private::ProcessInfo::SetUserID().
Referenced by FindProcesses().
|
static |
Definition at line 370 of file common/Host.cpp.
Referenced by lldb_private::process_linux::NativeProcessLinux::Attach().
If you have an executable that is in a bundle and want to get back to the bundle directory from the path itself, this function will change a path to a file within a bundle to the bundle directory itself.
[in] | file | A file spec that might point to a file in a bundle. |
[out] | bundle_directory | An object will be filled in with the bundle directory for the bundle when true is returned. Otherwise file is left untouched and false is returned. |
Definition at line 343 of file common/Host.cpp.
References lldb_private::FileSpec::Clear().
Referenced by lldb_private::PlatformDarwin::GetSharedModule().
|
static |
Get the process ID for the calling process.
Definition at line 245 of file common/Host.cpp.
Referenced by lldb_private::HostInfoBase::ComputeProcessTempFileDirectory().
|
static |
Get the thread token (the one returned by ThreadCreate when the thread was created) for the calling thread in the current process.
Definition at line 249 of file common/Host.cpp.
Referenced by lldb_private::Process::CurrentThreadIsPrivateStateThread(), lldb_private::Process::GetRunLock(), lldb_private::Debugger::IsIOHandlerThreadCurrentThread(), lldb_private::CommandInterpreter::RunCommandInterpreter(), and lldb_private::Process::RunThreadPlan().
|
static |
Definition at line 119 of file common/Host.cpp.
References environ.
Referenced by lldb_private::PlatformQemuUser::DebugProcess(), lldb_private::process_gdb_remote::GDBRemoteCommunication::GetDebugserverPath(), lldb_private::Platform::GetEnvironment(), lldb_private::PlatformQemuUser::GetEnvironment(), RunShellCommand(), and lldb_private::process_gdb_remote::GDBRemoteCommunication::StartDebugserverProcess().
|
static |
Given an address in the current process (the process that is running the LLDB code), return the name of the module that it comes from.
This can be useful when you need to know the path to the shared library that your code is running in for loading resources that are relative to your binary.
[in] | host_addr | The pointer to some code in the current process. |
Definition at line 353 of file common/Host.cpp.
References lldb_private::FileSystem::Instance(), lldb_private::FileSystem::Resolve(), and lldb_private::FileSpec::SetFile().
Referenced by lldb_private::HostInfoBase::ComputeSharedLibraryDirectory().
|
static |
Definition at line 226 of file freebsd/Host.cpp.
References lldb_private::ProcessInstanceInfo::Clear(), GetFreeBSDProcessArgs(), GetFreeBSDProcessCPUType(), GetFreeBSDProcessUserAndGroup(), and lldb_private::ProcessInfo::SetProcessID().
Referenced by lldb_private::process_freebsd::NativeProcessFreeBSD::Manager::Attach(), lldb_private::process_netbsd::NativeProcessNetBSD::Manager::Attach(), lldb_private::NativeThreadWindows::GetName(), lldb_private::PlatformDarwin::GetOSVersion(), lldb_private::Platform::GetProcessInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qProcessInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::Handle_qProcessInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qProcessInfoPID(), lldb_private::process_freebsd::NativeProcessFreeBSD::Manager::Launch(), lldb_private::process_netbsd::NativeProcessNetBSD::Manager::Launch(), lldb_private::NativeProcessWindows::NativeProcessWindows(), and lldb_private::NativeProcessWindows::OnDebuggerConnected().
|
static |
Definition at line 253 of file common/Host.cpp.
References SIGKILL, SIGSTOP, and SIGTRAP.
Referenced by CommandObjectPlatformShell::DoExecute(), lldb_private::process_linux::NativeProcessLinux::MonitorSignal(), and lldb_private::process_linux::NativeProcessLinux::Signal().
|
static |
Check if we're running in an interactive graphical session.
Definition at line 578 of file common/Host.cpp.
Referenced by lldb_private::CommandInterpreter::SaveTranscript().
|
static |
Definition at line 566 of file common/Host.cpp.
Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::Handle_qLaunchGDBServer(), lldb_private::process_gdb_remote::ProcessGDBRemote::KillDebugserverProcess(), lldb_private::Platform::KillProcess(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::KillSpawnedProcess(), and RunShellCommand().
|
static |
Launch the process specified in launch_info.
The monitoring callback in launch_info must be set, and it will be called when the process terminates.
Definition at line 545 of file common/Host.cpp.
References error(), lldb_private::HostProcess::GetProcessId(), lldb_private::MonitoringProcessLauncher::LaunchProcess(), and lldb_private::ProcessInfo::SetProcessID().
Referenced by lldb_private::PlatformQemuUser::DebugProcess(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::LaunchProcess(), lldb_private::Platform::LaunchProcess(), RunShellCommand(), and lldb_private::process_gdb_remote::GDBRemoteCommunication::StartDebugserverProcess().
|
static |
Definition at line 571 of file common/Host.cpp.
Referenced by lldb_private::Thread::GetStatus(), lldb_private::CommandInterpreter::SaveTranscript(), and lldb_private::Thread::SetSelectedFrameByIndexNoisily().
|
static |
When executable files may live within a directory, where the directory represents an executable bundle (like the MacOSX app bundles), then locate the executable within the containing bundle.
[in,out] | file | A file spec that currently points to the bundle that will be filled in with the executable path within the bundle if true is returned. Otherwise file is left untouched. |
Definition at line 348 of file common/Host.cpp.
Referenced by lldb_private::TargetList::CreateTargetInternal(), lldb::SBModuleSpecList::GetModuleSpecifications(), lldb_private::PlatformDarwin::GetSharedModule(), and lldb_private::Platform::ResolveExecutable().
|
static |
Run a shell command.
Definition at line 418 of file common/Host.cpp.
References RunShellCommand().
|
static |
Run a shell command.
Definition at line 397 of file common/Host.cpp.
References RunShellCommand().
Referenced by lldb_private::SymbolLocatorDebugSymbols::DownloadObjectAndSymbolFile(), PlatformPOSIX::GetFile(), GetXcodeSelectPath(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qPlatform_shell(), PlatformPOSIX::PutFile(), RunShellCommand(), lldb_private::Platform::RunShellCommand(), and xcrun().
|
static |
Run a shell command.
Definition at line 428 of file common/Host.cpp.
References lldb_private::Args::AppendArguments(), lldb_private::ProcessLaunchInfo::AppendDuplicateFileAction(), lldb_private::ProcessLaunchInfo::AppendOpenFileAction(), lldb_private::ProcessLaunchInfo::AppendSuppressFileAction(), lldb_private::ProcessLaunchInfo::ConvertArgumentsForLaunchingInShell(), lldb_private::FileSystem::CreateWritableDataBuffer(), error(), lldb_private::Status::FromErrorString(), lldb_private::Status::FromErrorStringWithFormat(), lldb_private::ProcessInfo::GetArguments(), lldb_private::FileSystem::GetByteSize(), GetEnvironment(), lldb_private::ProcessInfo::GetEnvironment(), lldb_private::FileSpec::GetPath(), lldb_private::ProcessInfo::GetProcessID(), lldb_private::FileSystem::Instance(), Kill(), LaunchProcess(), LLDB_INVALID_PROCESS_ID, MonitorShellCommand(), lldb_private::ProcessInfo::SetArchitecture(), lldb_private::ProcessInfo::SetArguments(), lldb_private::ProcessLaunchInfo::SetMonitorProcessCallback(), lldb_private::FileSpec::SetPath(), lldb_private::ProcessLaunchInfo::SetShell(), lldb_private::ProcessLaunchInfo::SetWorkingDirectory(), and SIGKILL.
|
static |
Run a shell command.
Definition at line 407 of file common/Host.cpp.
References RunShellCommand().
|
static |
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 240 of file freebsd/Host.cpp.
References lldb_private::Status::FromErrorString().
Referenced by lldb_private::Platform::ShellExpandArguments().
|
static |
Start monitoring a child process.
Allows easy monitoring of child processes. callback will be called when the child process exits or if it dies from a signal.
[in] | callback | A function callback to call when a child receives a signal or exits. |
[in] | pid | The process ID of a child process to monitor. |
Definition at line 125 of file common/Host.cpp.
References lldb_private::ThreadLauncher::LaunchThread(), MonitorChildProcessThreadFunction(), and UINT32_MAX.
Referenced by lldb_private::ProcessLaunchInfo::MonitorProcess(), and lldb_private::HostProcessPosix::StartMonitoring().
|
static |
Emit the given message to the operating system log.
Definition at line 97 of file common/Host.cpp.
Referenced by lldb_private::SystemLogHandler::Emit(), and lldb_private::Debugger::ReportDiagnosticImpl().