aboutsummaryrefslogtreecommitdiff
path: root/gdb/memattr.c
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
commitb6d1a1d52671a8aa58a29900f521edcd1a534ecd (patch)
treea7af7c092d1435b4fd19954742886c969e555676 /gdb/memattr.c
parent6c6ea35e3430aed6ef6af1225a0924e95be97d30 (diff)
downloadgdb-b6d1a1d52671a8aa58a29900f521edcd1a534ecd.zip
gdb-b6d1a1d52671a8aa58a29900f521edcd1a534ecd.tar.gz
gdb-b6d1a1d52671a8aa58a29900f521edcd1a534ecd.tar.bz2
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.
Diffstat (limited to 'gdb/memattr.c')
-rw-r--r--gdb/memattr.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gdb/memattr.c b/gdb/memattr.c
index e8eb56a..8d7b0d8 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;