]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* regcache.c (new_register_cache): Clear the allocated register
authorDaniel Jacobowitz <drow@false.org>
Fri, 30 Jan 2004 15:08:57 +0000 (15:08 +0000)
committerDaniel Jacobowitz <drow@false.org>
Fri, 30 Jan 2004 15:08:57 +0000 (15:08 +0000)
buffer.  Suggested by Atsushi Nemoto <anemo@mba.ocn.ne.jp>.

gdb/gdbserver/ChangeLog
gdb/gdbserver/regcache.c

index 603c33f2527bf0787c8f0d6034435c7d6cec197f..ea3fca9ea2521d790a245108e79415f3eab4c737 100644 (file)
@@ -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 *
index be3b3a7f33e549f89b8f19d451256a560b23911e..bc64ebcbb979b2b608db56c777ea956e7890de57 100644 (file)
@@ -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.");