[committed] sim/avr: clear memory before loading a program

Tristan Gingold gingold@adacore.com
Thu Nov 12 15:17:00 GMT 2009


Hi,

because the memory for the sram and the flash is static in interp.c,  
we should clear it before loading
a program to erase effect of a previous run when the simulator is part  
of gdb.

Approved privately by Joel.

Tristan.

sim/
2009-11-12  Tristan Gingold  <gingold@adacore.com>

	* avr/interp.c (sim_load): Clear memory before loading.


diff -c -r1.3 interp.c
*** sim/avr/interp.c	9 Nov 2009 13:50:30 -0000	1.3
--- sim/avr/interp.c	12 Nov 2009 15:03:18 -0000
***************
*** 1793,1798 ****
--- 1793,1802 ----
   {
     bfd *prog_bfd;

+   /* Clear all the memory.  */
+   memset (sram, 0, sizeof (sram));
+   memset (flash, 0, sizeof (flash));
+
     prog_bfd = sim_load_file (sd, myname, callback, prog, abfd,
                               sim_kind == SIM_OPEN_DEBUG,
                               0, sim_write);



More information about the Gdb-patches mailing list