From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6891 invoked by alias); 30 Jan 2004 15:09:38 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 6849 invoked from network); 30 Jan 2004 15:09:35 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 30 Jan 2004 15:09:35 -0000 Received: from drow by nevyn.them.org with local (Exim 4.30 #1 (Debian)) id 1AmaH0-00087y-CJ; Fri, 30 Jan 2004 10:09:34 -0500 Date: Fri, 30 Jan 2004 15:09:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Cc: Atsushi Nemoto Subject: Re: mips gdbserver reports R0 != 0 Message-ID: <20040130150934.GA23806@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com, Atsushi Nemoto References: <20040128.000717.126570739.anemo@mba.ocn.ne.jp> <20040127171204.GA6369@nevyn.them.org> <20040128.103415.59462128.nemoto@toshiba-tops.co.jp> <20040129.105230.78702389.nemoto@toshiba-tops.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040129.105230.78702389.nemoto@toshiba-tops.co.jp> User-Agent: Mutt/1.5.1i X-SW-Source: 2004-01/txt/msg00759.txt.bz2 On Thu, Jan 29, 2004 at 10:52:30AM +0900, Atsushi Nemoto wrote: > >>>>> On Wed, 28 Jan 2004 10:34:15 +0900 (JST), Atsushi Nemoto said: > drow> Explicitly zeroing the register cache should fix this, so I'd be > drow> happier with that solution. > > drow> [Do you have a copyright assignment on file for GDB, btw? If > drow> not, I'll make the patch myself for you to test, to spare us the > drow> legal dance.] > > anemo> No, I don't. Please make the patch for me. Then I will try > anemo> it. Thank you. > > I just inserted a line: > > memset (regcache->registers, 0, register_bytes); > > to new_register_cache() (regcache.c:108) and it fixed my problem. I > don't think anybody can do the legal dance on this line :-) Indeed. Thanks! I've committed this. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer 2004-01-30 Daniel Jacobowitz * regcache.c (new_register_cache): Clear the allocated register buffer. Suggested by Atsushi Nemoto . Index: regcache.c =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/regcache.c,v retrieving revision 1.6 diff -u -p -r1.6 regcache.c --- regcache.c 13 Jun 2002 19:29:46 -0000 1.6 +++ regcache.c 30 Jan 2004 15:08:48 -0000 @@ -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.");