This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: fix spurious overlapping-region complaint for contiguous regions


I spotted this when I got a spurios "overlapping memory region" for this:

mem 0 0x400 32 cache
mem 0x400 0x500 32 nocache

The manual and other code say that the low address is inclusive while
the high address is exclusive.

2002-01-18  Greg McGary  <greg@mcgary.org>

	* (create_mem_region): Disallow useless empty region.  Regions are
	half-open intervals, so allow [A..B) [B..C) as non-overlapping.

Index: memattr.c
===================================================================
RCS file: /cvs/src/src/gdb/memattr.c,v
retrieving revision 1.7
diff -u -p -r1.7 memattr.c
--- memattr.c	2001/08/02 11:58:29	1.7
+++ memattr.c	2002/01/19 02:10:30
@@ -45,9 +45,10 @@ create_mem_region (CORE_ADDR lo, CORE_AD
 {
   struct mem_region *n, *new;
 
-  if (lo > hi)
+  /* lo == hi is a useless empty region */
+  if (lo >= hi)
     {
-      printf_unfiltered ("invalid memory region\n");
+      printf_unfiltered ("invalid memory region: low >= high\n");
       return NULL;
     }
 
@@ -55,8 +56,8 @@ create_mem_region (CORE_ADDR lo, CORE_AD
   while (n)
     {
       /* overlapping node */
-      if ((lo >= n->lo && lo <= n->hi) ||
-	  (hi >= n->lo && hi <= n->hi))
+      if ((lo >= n->lo && lo < n->hi) ||
+	  (hi > n->lo && hi <= n->hi))
 	{
 	  printf_unfiltered ("overlapping memory region\n");
 	  return NULL;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]