50 lines · c
1//===-- MachVMMemory.h ------------------------------------------*- C++ -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8//9// Created by Greg Clayton on 6/26/07.10//11//===----------------------------------------------------------------------===//12 13#ifndef LLDB_TOOLS_DEBUGSERVER_SOURCE_MACOSX_MACHVMMEMORY_H14#define LLDB_TOOLS_DEBUGSERVER_SOURCE_MACOSX_MACHVMMEMORY_H15 16#include "DNBDefs.h"17#include "DNBError.h"18#include <mach/mach.h>19 20class MachVMMemory {21public:22 MachVMMemory();23 ~MachVMMemory();24 nub_size_t Read(task_t task, nub_addr_t address, void *data,25 nub_size_t data_count);26 nub_size_t Write(task_t task, nub_addr_t address, const void *data,27 nub_size_t data_count);28 nub_size_t PageSize(task_t task);29 nub_bool_t GetMemoryRegionInfo(task_t task, nub_addr_t address,30 DNBRegionInfo *region_info);31 nub_bool_t GetMemoryTags(task_t task, nub_addr_t address, nub_size_t size,32 std::vector<uint8_t> &tags);33 nub_bool_t GetMemoryProfile(DNBProfileDataScanType scanType, task_t task,34 struct task_basic_info ti, cpu_type_t cputype,35 nub_process_t pid, vm_statistics64_data_t &vminfo,36 uint64_t &physical_memory, uint64_t &anonymous,37 uint64_t &phys_footprint, uint64_t &memory_cap);38 39protected:40 nub_size_t MaxBytesLeftInPage(task_t task, nub_addr_t addr, nub_size_t count);41 42 nub_size_t WriteRegion(task_t task, const nub_addr_t address,43 const void *data, const nub_size_t data_count);44 45 vm_size_t m_page_size;46 DNBError m_err;47};48 49#endif // LLDB_TOOLS_DEBUGSERVER_SOURCE_MACOSX_MACHVMMEMORY_H50