OSDN Git Service

From 2002-01-18 Greg McGary <greg@mcgary.org>:
authorcagney <cagney>
Wed, 13 Feb 2002 19:00:46 +0000 (19:00 +0000)
committercagney <cagney>
Wed, 13 Feb 2002 19:00:46 +0000 (19:00 +0000)
* (create_mem_region): Disallow useless empty region.  Regions are
half-open intervals, so allow [A..B) [B..C) as non-overlapping.

gdb/ChangeLog
gdb/memattr.c

index 6d826db..6eaad95 100644 (file)
@@ -1,3 +1,9 @@
+2002-02-13  Andrew Cagney  <ac131313@redhat.com>
+
+       From 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.
+
 2002-02-13  Michael Chastain <mec@shout.net>
 
        * defs.h: Kill CONST_PTR.
index e8eb56a..8d7b0d8 100644 (file)
@@ -45,9 +45,10 @@ create_mem_region (CORE_ADDR lo, CORE_ADDR hi,
 {
   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_ADDR hi,
   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;