LLDB mainline
|
#include "lldb/Host/Host.h"
#include "PosixSpawnResponsible.h"
#include <AvailabilityMacros.h>
#include <TargetConditionals.h>
#include "llvm/TargetParser/Host.h"
#include <asl.h>
#include <crt_externs.h>
#include <cstdio>
#include <cstdlib>
#include <dlfcn.h>
#include <grp.h>
#include <libproc.h>
#include <pwd.h>
#include <spawn.h>
#include <sys/proc.h>
#include <sys/stat.h>
#include <sys/sysctl.h>
#include <sys/types.h>
#include <unistd.h>
#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/ProcessLaunchInfo.h"
#include "lldb/Host/ThreadLauncher.h"
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/Endian.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/NameMatches.h"
#include "lldb/Utility/ProcessInfo.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/StructuredData.h"
#include "lldb/lldb-defines.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/Support/Errno.h"
#include "llvm/Support/FileSystem.h"
#include "../cfcpp/CFCBundle.h"
#include "../cfcpp/CFCMutableArray.h"
#include "../cfcpp/CFCMutableDictionary.h"
#include "../cfcpp/CFCReleaser.h"
#include "../cfcpp/CFCString.h"
#include <objc/objc-auto.h>
#include <os/log.h>
#include <CoreFoundation/CoreFoundation.h>
#include <Foundation/Foundation.h>
Go to the source code of this file.
Macros | |
#define | _POSIX_SPAWN_DISABLE_ASLR 0x0100 |
Functions | |
int | __pthread_chdir (const char *path) |
int | __pthread_fchdir (int fildes) |
static bool | GetMacOSXProcessCPUType (ProcessInstanceInfo &process_info) |
static bool | GetMacOSXProcessArgs (const ProcessInstanceInfoMatch *match_info_ptr, ProcessInstanceInfo &process_info) |
static bool | GetMacOSXProcessUserAndGroup (ProcessInstanceInfo &process_info) |
static short | GetPosixspawnFlags (const ProcessLaunchInfo &launch_info) |
static Status | LaunchProcessXPC (const char *exe_path, ProcessLaunchInfo &launch_info, lldb::pid_t &pid) |
static bool | AddPosixSpawnFileAction (void *_file_actions, const FileAction *info, Log *log, Status &error) |
static Status | LaunchProcessPosixSpawn (const char *exe_path, const ProcessLaunchInfo &launch_info, lldb::pid_t &pid) |
static bool | ShouldLaunchUsingXPC (ProcessLaunchInfo &launch_info) |
Variables | |
static os_log_t | g_os_log |
static std::once_flag | g_os_log_once |
int __pthread_chdir | ( | const char * | path | ) |
Referenced by LaunchProcessPosixSpawn().
int __pthread_fchdir | ( | int | fildes | ) |
Referenced by LaunchProcessPosixSpawn().
|
static |
Definition at line 1028 of file Host.mm.
References lldb::eErrorTypePOSIX, lldb_private::FileAction::eFileActionClose, lldb_private::FileAction::eFileActionDuplicate, lldb_private::FileAction::eFileActionNone, lldb_private::FileAction::eFileActionOpen, error(), lldb_private::FileAction::GetAction(), lldb_private::FileAction::GetActionArgument(), lldb_private::FileAction::GetFD(), lldb_private::FileAction::GetPath(), and LLDB_LOG.
Referenced by LaunchProcessPosixSpawn().
|
static |
Definition at line 538 of file Host.mm.
References lldb_private::Args::AppendArgument(), lldb_private::ProcessInfo::GetArchitecture(), lldb_private::ProcessInfo::GetArguments(), lldb_private::WritableDataBuffer::GetBytes(), lldb_private::DataBufferHeap::GetByteSize(), lldb_private::DataExtractor::GetCStr(), lldb_private::ConstString::GetCString(), lldb_private::ProcessInfo::GetEnvironment(), lldb_private::ProcessInfo::GetExecutableFile(), lldb_private::FileSpec::GetFilename(), lldb_private::ProcessInfo::GetName(), lldb_private::ProcessInstanceInfoMatch::GetNameMatchType(), lldb_private::ProcessInfo::GetProcessID(), lldb_private::ProcessInstanceInfoMatch::GetProcessInfo(), lldb_private::ArchSpec::GetTriple(), lldb_private::DataExtractor::GetU32(), lldb_private::endian::InlHostByteOrder(), lldb_private::Environment::insert(), lldb_private::NameMatches(), lldb_private::DataExtractor::PeekData(), lldb_private::ProcessInfo::ProcessIDIsValid(), and lldb_private::FileSpec::SetFile().
|
static |
Definition at line 465 of file Host.mm.
References lldb_private::ArchSpec::Clear(), CPU_TYPE_ARM64, CPU_TYPE_ARM64_32, lldb_private::eArchTypeMachO, lldb_private::ProcessInfo::GetArchitecture(), lldb_private::ProcessInfo::GetProcessID(), lldb_private::ProcessInfo::ProcessIDIsValid(), and lldb_private::ArchSpec::SetArchitecture().
|
static |
Definition at line 614 of file Host.mm.
References lldb_private::ProcessInfo::GetProcessID(), LLDB_INVALID_PROCESS_ID, lldb_private::ProcessInfo::ProcessIDIsValid(), lldb_private::ProcessInstanceInfo::SetEffectiveGroupID(), lldb_private::ProcessInstanceInfo::SetEffectiveUserID(), lldb_private::ProcessInfo::SetGroupID(), lldb_private::ProcessInstanceInfo::SetParentProcessID(), lldb_private::ProcessInfo::SetUserID(), and UINT32_MAX.
|
static |
Definition at line 854 of file Host.mm.
References _POSIX_SPAWN_DISABLE_ASLR, lldb_private::eLazyBoolCalculate, lldb_private::eLazyBoolNo, lldb_private::eLazyBoolYes, lldb_private::ProcessLaunchInfo::GetFlags(), lldb_private::ProcessLaunchInfo::GetLaunchInSeparateProcessGroup(), and lldb_private::Flags::Test().
Referenced by LaunchProcessPosixSpawn(), and LaunchProcessXPC().
|
static |
Definition at line 1105 of file Host.mm.
References __pthread_chdir(), __pthread_fchdir(), AddPosixSpawnFileAction(), CPU_SUBTYPE_X86_64_H, lldb::eErrorTypePOSIX, error(), lldb_private::Environment::Envp::get(), lldb_private::ProcessInfo::GetArchitecture(), lldb_private::ProcessInfo::GetArguments(), lldb_private::Args::GetConstArgumentVector(), lldb_private::ProcessInfo::GetEnvironment(), lldb_private::Environment::getEnvp(), lldb_private::ProcessLaunchInfo::GetFileActionAtIndex(), lldb_private::ProcessLaunchInfo::GetFlags(), lldb_private::GetLog(), lldb_private::ArchSpec::GetMachOCPUSubType(), lldb_private::ArchSpec::GetMachOCPUType(), lldb_private::ProcessLaunchInfo::GetNumFileActions(), lldb_private::FileSpec::GetPath(), GetPosixspawnFlags(), lldb_private::ProcessLaunchInfo::GetShell(), lldb_private::ProcessLaunchInfo::GetWorkingDirectory(), lldb_private::Host, LLDB_INVALID_CPUTYPE, LLDB_INVALID_PROCESS_ID, LLDB_LOG, lldb_private::Process, setup_posix_spawn_responsible_flag(), lldb_private::Flags::Test(), and UINT32_MAX.
|
static |
Definition at line 892 of file Host.mm.
References lldb::eErrorTypeGeneric, error(), lldb_private::ProcessInfo::GetArchitecture(), lldb_private::ProcessInfo::GetArguments(), lldb_private::ProcessInfo::GetEnvironment(), lldb_private::ProcessLaunchInfo::GetFileActionForFD(), lldb_private::GetLog(), lldb_private::ArchSpec::GetMachOCPUType(), lldb_private::FileAction::GetPath(), GetPosixspawnFlags(), lldb_private::ProcessInfo::GetUserID(), lldb_private::Host, LLDB_LOG, and lldb_private::Process.
|
static |
Definition at line 1317 of file Host.mm.
References lldb_private::ProcessInfo::GetUserID().