summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorDaniel Jacobowitz <dan@debian.org>2004-01-30 15:08:57 +0000
committerDaniel Jacobowitz <dan@debian.org>2004-01-30 15:08:57 +0000
commit00c7083826a27f78df00521861d40a08789fb925 (patch)
tree4fe9fda88746db896932b2f9c9035a8d334df8e6 /gdb
parent9d394027bd5455ef028f8b45e7eea45dcef4cfd2 (diff)
downloadgdb-00c7083826a27f78df00521861d40a08789fb925.tar.gz
* regcache.c (new_register_cache): Clear the allocated register
buffer. Suggested by Atsushi Nemoto <anemo@mba.ocn.ne.jp>.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/gdbserver/ChangeLog5
-rw-r--r--gdb/gdbserver/regcache.c7
2 files changed, 10 insertions, 2 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 603c33f2527..ea3fca9ea25 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-30 Daniel Jacobowitz <drow@mvista.com>
+
+ * regcache.c (new_register_cache): Clear the allocated register
+ buffer. Suggested by Atsushi Nemoto <anemo@mba.ocn.ne.jp>.
+
2003-10-13 Daniel Jacobowitz <drow@mvista.com>
* linux-low.c (linux_resume): Take a struct thread_resume *
diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c
index be3b3a7f33e..bc64ebcbb97 100644
--- a/gdb/gdbserver/regcache.c
+++ b/gdb/gdbserver/regcache.c
@@ -1,5 +1,5 @@
/* Register support routines for the remote server for GDB.
- Copyright 2001, 2002
+ Copyright 2001, 2002, 2004
Free Software Foundation, Inc.
This file is part of GDB.
@@ -101,7 +101,10 @@ new_register_cache (void)
regcache = malloc (sizeof (*regcache));
- regcache->registers = malloc (register_bytes);
+ /* Make sure to zero-initialize the register cache when it is created,
+ in case there are registers the target never fetches. This way they'll
+ read as zero instead of garbage. */
+ regcache->registers = calloc (1, register_bytes);
if (regcache->registers == NULL)
fatal ("Could not allocate register cache.");