From: Daniel Jacobowitz <drow@mvista.com>
To: gdb-patches@sources.redhat.com
Cc: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Subject: Re: mips gdbserver reports R0 != 0
Date: Fri, 30 Jan 2004 15:09:00 -0000 [thread overview]
Message-ID: <20040130150934.GA23806@nevyn.them.org> (raw)
In-Reply-To: <20040129.105230.78702389.nemoto@toshiba-tops.co.jp>
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 <anemo@mba.ocn.ne.jp> 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 <drow@mvista.com>
* regcache.c (new_register_cache): Clear the allocated register
buffer. Suggested by Atsushi Nemoto <anemo@mba.ocn.ne.jp>.
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.");
prev parent reply other threads:[~2004-01-30 15:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-27 10:35 Atsushi Nemoto
2004-01-27 14:17 ` Daniel Jacobowitz
2004-01-27 15:01 ` Atsushi Nemoto
2004-01-27 17:12 ` Daniel Jacobowitz
2004-01-28 1:33 ` Atsushi Nemoto
2004-01-29 1:51 ` Atsushi Nemoto
2004-01-30 15:09 ` Daniel Jacobowitz [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040130150934.GA23806@nevyn.them.org \
--to=drow@mvista.com \
--cc=anemo@mba.ocn.ne.jp \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox