diff options
Diffstat (limited to 'gdb/memattr.c')
-rw-r--r-- | gdb/memattr.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/gdb/memattr.c b/gdb/memattr.c index 8c46d7eb168..05ad413cc0a 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) @@ -244,12 +245,22 @@ mem_info_command (char *args, int from_tty) tmp = local_hex_string_custom ((unsigned long) m->lo, "016l"); printf_filtered ("%s ", tmp); - + if (TARGET_ADDR_BIT <= 32) - tmp = local_hex_string_custom ((unsigned long) m->hi, "08l"); + { + if (m->hi == 0) + tmp = "0x100000000"; + else + tmp = local_hex_string_custom ((unsigned long) m->hi, "08l"); + } else - tmp = local_hex_string_custom ((unsigned long) m->hi, "016l"); - + { + if (m->hi == 0) + tmp = "0x10000000000000000"; + else + tmp = local_hex_string_custom ((unsigned long) m->hi, "016l"); + } + printf_filtered ("%s ", tmp); /* Print a token for each attribute. @@ -504,7 +515,7 @@ mem_delete_command (char *args, int from_tty) } void -_initialize_mem () +_initialize_mem (void) { add_com ("mem", class_vars, mem_command, "Define attributes for memory region.\n\ |