aboutsummaryrefslogtreecommitdiff
path: root/gdb/target-memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/target-memory.c')
-rw-r--r--gdb/target-memory.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gdb/target-memory.c b/gdb/target-memory.c
index 1c8faa8..7f048de 100644
--- a/gdb/target-memory.c
+++ b/gdb/target-memory.c
@@ -138,14 +138,18 @@ block_boundaries (CORE_ADDR address, CORE_ADDR *begin, CORE_ADDR *end)
{
struct mem_region *region;
unsigned blocksize;
+ CORE_ADDR offset_in_region;
region = lookup_mem_region (address);
gdb_assert (region->attrib.mode == MEM_FLASH);
blocksize = region->attrib.blocksize;
+
+ offset_in_region = address - region->lo;
+
if (begin)
- *begin = address / blocksize * blocksize;
+ *begin = region->lo + offset_in_region / blocksize * blocksize;
if (end)
- *end = (address + blocksize - 1) / blocksize * blocksize;
+ *end = region->lo + (offset_in_region + blocksize - 1) / blocksize * blocksize;
}
/* Given the list of memory requests to be WRITTEN, this function