#include "util/linux/ptrace_broker.h"
#include <fcntl.h>
#include <limits.h>
#include <string.h>
#include <sys/mman.h>
#include <syscall.h>
#include <unistd.h>
#include <algorithm>
#include "base/check_op.h"
#include "base/memory/page_size.h"
#include "base/posix/eintr_wrapper.h"
#include "third_party/lss/lss.h"
#include "util/linux/scoped_ptrace_attach.h"
#include "util/misc/memory_sanitizer.h"
#include "util/posix/scoped_mmap.h"
namespace crashpad {
namespace {
size_t FormatPID(char* buffer, pid_t pid) { … }
}
class PtraceBroker::AttachmentsArray { … };
PtraceBroker::PtraceBroker(int sock, pid_t pid, bool is_64_bit)
: … { … }
PtraceBroker::~PtraceBroker() = default;
void PtraceBroker::SetFileRoot(const char* new_root) { … }
int PtraceBroker::Run() { … }
int PtraceBroker::RunImpl(AttachmentsArray* attachments) { … }
int PtraceBroker::SendError(ExceptionHandlerProtocol::Errno err) { … }
int PtraceBroker::SendReadError(ReadError error) { … }
int PtraceBroker::SendOpenResult(OpenResult result) { … }
int PtraceBroker::SendFileContents(FileHandle handle) { … }
void PtraceBroker::TryOpeningMemFile() { … }
int PtraceBroker::SendMemory(pid_t pid, VMAddress address, VMSize size) { … }
#if defined(MEMORY_SANITIZER)
__attribute__((no_sanitize("memory")))
#endif
int PtraceBroker::SendDirectory(FileHandle handle) { … }
int PtraceBroker::ReceiveAndOpenFilePath(VMSize path_length,
bool is_directory,
ScopedFileHandle* handle) { … }
}