#include "lldb/Host/posix/ProcessLauncherPosixFork.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostProcess.h"
#include "lldb/Host/Pipe.h"
#include "lldb/Host/ProcessLaunchInfo.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "llvm/Support/Errno.h"
#include <climits>
#include <sys/ptrace.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sstream>
#include <csignal>
#ifdef __ANDROID__
#include <android/api-level.h>
#define PT_TRACE_ME …
#endif
#if defined(__ANDROID_API__) && __ANDROID_API__ < 15
#include <linux/personality.h>
#elif defined(__linux__)
#include <sys/personality.h>
#endif
usingnamespacelldb;
usingnamespacelldb_private;
static void write_string(int error_fd, const char *str) { … }
[[noreturn]] static void ExitWithError(int error_fd,
const char *operation) { … }
static void DisableASLR(int error_fd) { … }
static void DupDescriptor(int error_fd, const char *file, int fd, int flags) { … }
namespace {
struct ForkFileAction { … };
struct ForkLaunchInfo { … };
}
[[noreturn]] static void ChildFunc(int error_fd, const ForkLaunchInfo &info) { … }
ForkFileAction::ForkFileAction(const FileAction &act)
: … { … }
static std::vector<ForkFileAction>
MakeForkActions(const ProcessLaunchInfo &info) { … }
static Environment::Envp FixupEnvironment(Environment env) { … }
ForkLaunchInfo::ForkLaunchInfo(const ProcessLaunchInfo &info)
: … { … }
HostProcess
ProcessLauncherPosixFork::LaunchProcess(const ProcessLaunchInfo &launch_info,
Status &error) { … }