map_info.h revision 501edd29b823ce1301d2effdd3a9e4b6e2b20b76
1/* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17/* Process memory map. */ 18 19#ifndef _CORKSCREW_MAP_INFO_H 20#define _CORKSCREW_MAP_INFO_H 21 22#include <sys/types.h> 23#include <stdbool.h> 24 25#ifdef __cplusplus 26extern "C" { 27#endif 28 29typedef struct map_info { 30 struct map_info* next; 31 uintptr_t start; 32 uintptr_t end; 33 bool is_executable; 34 void* data; // arbitrary data associated with the map by the user, initially NULL 35 char name[]; 36} map_info_t; 37 38/* Loads memory map from /proc/<tid>/maps. */ 39map_info_t* load_map_info_list(pid_t tid); 40 41/* Frees memory map. */ 42void free_map_info_list(map_info_t* milist); 43 44/* Finds the memory map that contains the specified address. */ 45const map_info_t* find_map_info(const map_info_t* milist, uintptr_t addr); 46 47/* Gets the memory map for this process. (result is cached) */ 48const map_info_t* my_map_info_list(); 49 50#ifdef __cplusplus 51} 52#endif 53 54#endif // _CORKSCREW_MAP_INFO_H 55