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-exception 6// 7//===----------------------------------------------------------------------===// 8// 9// Created by Greg Clayton on 6/26/07. 10// 11//===----------------------------------------------------------------------===// 12 13#ifndef LLDB_TOOLS_DEBUGSERVER_SOURCE_MACOSX_MACHVMMEMORY_H 14#define LLDB_TOOLS_DEBUGSERVER_SOURCE_MACOSX_MACHVMMEMORY_H 15 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 GetMemoryProfile(DNBProfileDataScanType scanType, task_t task, 32 struct task_basic_info ti, cpu_type_t cputype, 33 nub_process_t pid, vm_statistics64_data_t &vminfo, 34 uint64_t &physical_memory, uint64_t &anonymous, 35 uint64_t &phys_footprint, uint64_t &memory_cap); 36 37protected: 38 nub_size_t MaxBytesLeftInPage(task_t task, nub_addr_t addr, nub_size_t count); 39 40 nub_size_t WriteRegion(task_t task, const nub_addr_t address, 41 const void *data, const nub_size_t data_count); 42 43 vm_size_t m_page_size; 44 DNBError m_err; 45}; 46 47#endif // LLDB_TOOLS_DEBUGSERVER_SOURCE_MACOSX_MACHVMMEMORY_H 48