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