aboutsummaryrefslogtreecommitdiff
path: root/gdb/memattr.c
diff options
context:
space:
mode:
authorDon Howard <dhoward@redhat.com>2002-06-24 22:08:30 +0000
committerDon Howard <dhoward@redhat.com>2002-06-24 22:08:30 +0000
commit2b236d8208fe58b1c1278f60e936f35a61a9dd49 (patch)
tree803b5d4eb553050f3d66e9faa3409d0ee25c7840 /gdb/memattr.c
parent942dc0e9ec7bfb2e1d990d89ba0f69c6cc695d78 (diff)
downloadgdb-2b236d8208fe58b1c1278f60e936f35a61a9dd49.zip
gdb-2b236d8208fe58b1c1278f60e936f35a61a9dd49.tar.gz
gdb-2b236d8208fe58b1c1278f60e936f35a61a9dd49.tar.bz2
2002-06-24 Don Howard <dhoward@redhat.com>
* memattr.c (create_mem_region): Treat hi == 0 as a special case that means max CORE_ADDR+1. (lookup_mem_region): Ditto. (mem_info_command): Ditto.
Diffstat (limited to 'gdb/memattr.c')
-rw-r--r--gdb/memattr.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/gdb/memattr.c b/gdb/memattr.c
index 8c46d7e..37a97eb 100644
--- a/gdb/memattr.c
+++ b/gdb/memattr.c
@@ -47,7 +47,7 @@ create_mem_region (CORE_ADDR lo, CORE_ADDR hi,
struct mem_region *n, *new;
/* lo == hi is a useless empty region */
- if (lo >= hi)
+ if (lo >= hi && hi != 0)
{
printf_unfiltered ("invalid memory region: low >= high\n");
return NULL;
@@ -57,8 +57,9 @@ 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 || n->hi == 0))
+ || (hi > n->lo && (hi <= n->hi || n->hi == 0))
+ || (lo <= n->lo && (hi >= n->hi || hi == 0)))
{
printf_unfiltered ("overlapping memory region\n");
return NULL;
@@ -111,7 +112,7 @@ lookup_mem_region (CORE_ADDR addr)
{
if (m->enabled_p == 1)
{
- if (addr >= m->lo && addr < m->hi)
+ if (addr >= m->lo && (addr < m->hi || m->hi == 0))
return m;
if (addr >= m->hi && lo < m->hi)
@@ -234,6 +235,7 @@ mem_info_command (char *args, int from_tty)
for (m = mem_region_chain; m; m = m->next)
{
+ CORE_ADDR hi;
char *tmp;
printf_filtered ("%-3d %-3c\t",
m->number,
@@ -244,11 +246,12 @@ mem_info_command (char *args, int from_tty)
tmp = local_hex_string_custom ((unsigned long) m->lo, "016l");
printf_filtered ("%s ", tmp);
-
+ hi = (m->hi == 0 ? ~0 : m->hi);
+
if (TARGET_ADDR_BIT <= 32)
- tmp = local_hex_string_custom ((unsigned long) m->hi, "08l");
+ tmp = local_hex_string_custom ((unsigned long) hi, "08l");
else
- tmp = local_hex_string_custom ((unsigned long) m->hi, "016l");
+ tmp = local_hex_string_custom ((unsigned long) hi, "016l");
printf_filtered ("%s ", tmp);