aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/target-memory.c8
2 files changed, 11 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4f9fac2..459f0ff 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2017-10-11 Mark Rages <markrages@gmail.com>
+
+ * target-memory.c (block_boundaries): Fix for block address not
+ aligned on block size.
+
2017-10-10 Pedro Alves <palves@redhat.com>
Tom Tromey <tom@tromey.com>
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