[PATCH] Fix memory-region overlapping checking
Wei-cheng Wang
cole945@gmail.com
Thu Aug 2 06:11:00 GMT 2012
Hi,
After adding a memory-region with <hi addr> as max CORE_ADDR+1,
no more memory-region can be added. It always complains about "overlapping"
For example,
(gdb) mem 0x50 0x80 ro
(gdb) mem 0xffffff00 0x100000000 ro
(gdb) info mem
Using user-defined memory regions.
Num Enb Low Addr High Addr Attrs
1 y 0x00000050 0x00000080 ro nocache
2 y 0xffffff00 0x100000000 ro nocache
(gdb) mem 0x100 0x200 ro
overlapping memory region
When checking whether the new memory-region includes a previous one,
it should take care special case, where hi == 0 means max CORE_ADDR+1.
Wei-cheng
2012-08-02 Wei-cheng Wang <cole945@gmail.com>
* memattr.c (create_mem_region): Fix memory-region overlapping checking
in special case.
diff --git a/gdb/memattr.c b/gdb/memattr.c
--- a/gdb/memattr.c
+++ b/gdb/memattr.c
@@ -207,7 +207,7 @@ create_mem_region (CORE_ADDR lo, CORE_ADDR 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)))
+ || (lo <= n->lo && ((hi >= n->hi && n->hi != 0) || hi == 0)))
{
printf_unfiltered (_("overlapping memory region\n"));
return;
More information about the Gdb-patches
mailing list