summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2002-02-13 19:00:47 +0000
committerAndrew Cagney <cagney@redhat.com>2002-02-13 19:00:47 +0000
commit93a8f0782b4fa1e41b5837029eb737ea59656c22 (patch)
treef794fc3728ac4d056636efa3be7b72614cff3277
parent1f8fc00aba75d564920db400130b10c168d92fe6 (diff)
downloadgdb-93a8f0782b4fa1e41b5837029eb737ea59656c22.tar.gz
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.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/memattr.c9
2 files changed, 11 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6d826dbd2f3..6eaad95b2ae 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/memattr.c b/gdb/memattr.c
index e8eb56a458b..8d7b0d8c558 100644
--- a/gdb/memattr.c
+++ b/gdb/memattr.c
@@ -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;