This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[committed] sim/avr: clear memory before loading a program
- From: Tristan Gingold <gingold at adacore dot com>
- To: gdb-patches ml <gdb-patches at sourceware dot org>
- Date: Thu, 12 Nov 2009 16:17:16 +0100
- Subject: [committed] sim/avr: clear memory before loading a program
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);