From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27953 invoked by alias); 1 Oct 2010 01:51:20 -0000 Received: (qmail 27670 invoked by uid 22791); 1 Oct 2010 01:51:15 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,TW_CP,TW_EG X-Spam-Check-By: sourceware.org Received: from mail-gy0-f169.google.com (HELO mail-gy0-f169.google.com) (209.85.160.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 Oct 2010 01:51:09 +0000 Received: by gyf3 with SMTP id 3so485394gyf.0 for ; Thu, 30 Sep 2010 18:51:08 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.57.15 with SMTP id a15mr1198724vch.142.1285897867497; Thu, 30 Sep 2010 18:51:07 -0700 (PDT) Received: by 10.220.202.9 with HTTP; Thu, 30 Sep 2010 18:51:07 -0700 (PDT) In-Reply-To: <201009282123.29913.pedro@codesourcery.com> References: <20100203174414.GA29948@lucon.org> <201009282123.29913.pedro@codesourcery.com> Date: Fri, 01 Oct 2010 01:51:00 -0000 Message-ID: Subject: Re: PATCH: gdbserver: Clear regcache if buf is NULL From: "H.J. Lu" To: Pedro Alves Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-10/txt/msg00000.txt.bz2 On Tue, Sep 28, 2010 at 1:23 PM, Pedro Alves wrote: > On Wednesday 03 February 2010 17:44:14, H.J. Lu wrote: >> If xstate_bv bits are zero, XSAVE extended state is in init state and >> gdbserver should treat XMM/YMM registers as 0. This patch clears regcache >> if buf is NULL. OK to install? >> >> Thanks. >> >> >> H.J. >> --- >> 2010-02-03 =A0H.J. Lu =A0 >> >> =A0 =A0 =A0 * regcache.c (supply_register): Clear regcache if buf is NUL= L. >> >> diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c >> index 2082604..d6cdc46 100644 >> --- a/gdb/gdbserver/regcache.c >> +++ b/gdb/gdbserver/regcache.c >> @@ -215,7 +215,10 @@ register_data (struct regcache *regcache, int n, in= t fetch) >> =A0void >> =A0supply_register (struct regcache *regcache, int n, const void *buf) >> =A0{ >> - =A0memcpy (register_data (regcache, n, 0), buf, register_size (n)); >> + =A0if (buf) >> + =A0 =A0memcpy (register_data (regcache, n, 0), buf, register_size (n)); >> + =A0else >> + =A0 =A0memset (register_data (regcache, n, 0), 0, register_size (n)); >> =A0} > > Hi H.J.. =A0I'm looking at where in the current sources this > ended up being used, and not finding it. =A0Am I right in thinking > that the need for this was obsoleted when you later tought > gdbserver x86-linux about xml descriptions? > i387-fp.c has if ((x86_xcr0 & I386_XSTATE_SSE)) { int xmm0_regnum =3D find_regno ("xmm0"); if ((clear_bv & I386_XSTATE_SSE)) p =3D NULL; else p =3D (char *) buf; for (i =3D 0; i < num_xmm_registers; i++) { if (p) p =3D ((char *) &fp->xmm_space[0]) + i * 16; supply_register (regcache, i + xmm0_regnum, p); } } --=20 H.J.