#include <sys/ptrace.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <limits>
#include <string>
#include <vector>
#include "base/debug/proc_maps_linux.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/format_macros.h"
#include "base/logging.h"
#include "base/posix/eintr_wrapper.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
namespace {
MappedMemoryRegion;
constexpr size_t kPageSize = …;
struct PageMapEntry { … };
static_assert …;
class ScopedPtracer { … };
bool ParseProcMaps(pid_t pid, std::vector<MappedMemoryRegion>* regions) { … }
bool ShouldDump(const MappedMemoryRegion& region) { … }
base::File OpenProcPidFile(const char* filename, pid_t pid) { … }
bool DumpRegion(const MappedMemoryRegion& region,
pid_t pid,
base::File* proc_mem,
base::File* proc_pagemap) { … }
bool DumpMappings(pid_t pid) { … }
}
int main(int argc, char** argv) { … }