This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] Fix off-by-one error in flash programming
- From: Daniel Jacobowitz <drow at false dot org>
- To: gdb-patches at sourceware dot org
- Date: Thu, 7 Jun 2007 10:25:25 -0400
- Subject: [commit] Fix off-by-one error in flash programming
Kazu Hirata discovered that GDB would crash if you tried to completely
fill a flash memory region. Here's the fix - we want the end of the
sector containing the last programmed byte, not the end of the
following sector. Tested on m68k-elf and checked in.
--
Daniel Jacobowitz
CodeSourcery
2007-06-07 Daniel Jacobowitz <dan@codesourcery.com>
* target-memory.c (blocks_to_erase): Correct off-by-one error.
Index: target-memory.c
===================================================================
--- target-memory.c (revision 173224)
+++ target-memory.c (working copy)
@@ -166,7 +166,7 @@ blocks_to_erase (VEC(memory_write_reques
CORE_ADDR begin, end;
block_boundaries (ptr->begin, &begin, 0);
- block_boundaries (ptr->end, 0, &end);
+ block_boundaries (ptr->end - 1, 0, &end);
if (!VEC_empty (memory_write_request_s, result)
&& VEC_last (memory_write_request_s, result)->end >= begin)