This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]