1c50c785cSJohn Marino /* The memory range data structure, and associated utilities. 2c50c785cSJohn Marino 3*ef5ccd6cSJohn Marino Copyright (C) 2010-2013 Free Software Foundation, Inc. 4c50c785cSJohn Marino 5c50c785cSJohn Marino This file is part of GDB. 6c50c785cSJohn Marino 7c50c785cSJohn Marino This program is free software; you can redistribute it and/or modify 8c50c785cSJohn Marino it under the terms of the GNU General Public License as published by 9c50c785cSJohn Marino the Free Software Foundation; either version 3 of the License, or 10c50c785cSJohn Marino (at your option) any later version. 11c50c785cSJohn Marino 12c50c785cSJohn Marino This program is distributed in the hope that it will be useful, 13c50c785cSJohn Marino but WITHOUT ANY WARRANTY; without even the implied warranty of 14c50c785cSJohn Marino MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15c50c785cSJohn Marino GNU General Public License for more details. 16c50c785cSJohn Marino 17c50c785cSJohn Marino You should have received a copy of the GNU General Public License 18c50c785cSJohn Marino along with this program. If not, see <http://www.gnu.org/licenses/>. */ 19c50c785cSJohn Marino 20c50c785cSJohn Marino #ifndef MEMRANGE_H 21c50c785cSJohn Marino #define MEMRANGE_H 22c50c785cSJohn Marino 23c50c785cSJohn Marino #include "vec.h" 24c50c785cSJohn Marino 25c50c785cSJohn Marino /* Defines a [START, START + LENGTH) memory range. */ 26c50c785cSJohn Marino 27c50c785cSJohn Marino struct mem_range 28c50c785cSJohn Marino { 29c50c785cSJohn Marino /* Lowest address in the range. */ 30c50c785cSJohn Marino CORE_ADDR start; 31c50c785cSJohn Marino 32c50c785cSJohn Marino /* Length of the range. */ 33c50c785cSJohn Marino int length; 34c50c785cSJohn Marino }; 35c50c785cSJohn Marino 36c50c785cSJohn Marino typedef struct mem_range mem_range_s; 37c50c785cSJohn Marino 38c50c785cSJohn Marino DEF_VEC_O(mem_range_s); 39c50c785cSJohn Marino 40c50c785cSJohn Marino /* Returns true if the ranges defined by [start1, start1+len1) and 41c50c785cSJohn Marino [start2, start2+len2) overlap. */ 42c50c785cSJohn Marino 43c50c785cSJohn Marino extern int mem_ranges_overlap (CORE_ADDR start1, int len1, 44c50c785cSJohn Marino CORE_ADDR start2, int len2); 45c50c785cSJohn Marino 46c50c785cSJohn Marino /* Sort ranges by start address, then coalesce contiguous or 47c50c785cSJohn Marino overlapping ranges. */ 48c50c785cSJohn Marino 49c50c785cSJohn Marino extern void normalize_mem_ranges (VEC(mem_range_s) *memory); 50c50c785cSJohn Marino 51c50c785cSJohn Marino #endif 52