From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 7B2473858CDA for ; Fri, 22 Dec 2023 04:40:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7B2473858CDA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7B2473858CDA Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703220028; cv=none; b=amv7YFMH/pIEa9VGxuK4QLTUlXegbtIgG39Sv/F0rfJ4yx7St/32svzhlxnl76CSFh+L8oTpx68LihJDso6FVTXKYM9MGtanGI8YGdTrW/4+a52Ik4hVVqVia+tgxGdiROgsZdqkfYhsVay4kESFJNJXLEzSx32TCFgZtBPOs+Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703220028; c=relaxed/simple; bh=/iNLEu7yQoxME2mMONy7O9rTd2UQf+hiL/3qDOzU6cU=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=BGzMCOP7pyN7v/iJcdYdtv86UJaglBQDWogxTdQTnTcI9vZhE6gJd+Ktfk+7fLfPB54vYwfyN61AfMrenWtLgGfCB2gTzrwnNc86iMjHg3q+1Vef8UyARbtz7+JzJ9uCovYQmJksPDftTziKOc9Y4fbsrHOya/2NmGbW0RgCEtg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1703220026; bh=/iNLEu7yQoxME2mMONy7O9rTd2UQf+hiL/3qDOzU6cU=; h=Date:Subject:To:References:From:In-Reply-To:From; b=sAdRGUAXBTYTeBD1iUIP6XIymgp7opgkQaTLpXGD/MaKA0PGGG6X9iDwL+y9jOjTL nUs7mGtjyDvu/g8xQ7HR01FumHFY1yiU+RJ/Cc13/+I06hRBHDq60OQlbncux+nfV5 dWoOOQnc1Y/Gb4yXlWVCCxiCKSqczALEyvWI0Nqk= Received: from [10.0.0.11] (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id C48AD1E091; Thu, 21 Dec 2023 23:40:26 -0500 (EST) Message-ID: <976f8faa-dedd-4fd6-9ce0-ff488baf030c@simark.ca> Date: Thu, 21 Dec 2023 23:40:26 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 23/26] gdbserver: set register statuses in registers_from_string Content-Language: en-US To: Tankut Baris Aktemur , gdb-patches@sourceware.org References: <23857f86bb74dc803b8deedc1c38e51363554500.1677582745.git.tankut.baris.aktemur@intel.com> From: Simon Marchi In-Reply-To: <23857f86bb74dc803b8deedc1c38e51363554500.1677582745.git.tankut.baris.aktemur@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2023-02-28 06:28, Tankut Baris Aktemur via Gdb-patches wrote: > The registers_from_string function uses hex2bin to set the values of > all registers. Set the register statuses to REG_VALID to reflect this > change. > --- > gdbserver/regcache.cc | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/gdbserver/regcache.cc b/gdbserver/regcache.cc > index 644f436c681..32f0e1109e6 100644 > --- a/gdbserver/regcache.cc > +++ b/gdbserver/regcache.cc > @@ -259,6 +259,8 @@ regcache::registers_from_string (const char *buf) > len = tdesc->registers_size * 2; > } > hex2bin (buf, registers, len / 2); > + /* All register data have been re-written. Update the statuses. */ > + memset (register_status, REG_VALID, tdesc->reg_defs.size ()); > } > > /* See regcache.h */ Well... technically, registers_from_string is written in a way that if the input buffer is too short, the registers at the end will not be written (don't know why it's written like that, instead of erroring out, but that's how it is right now). So you should only set to REG_VALID the registers that are actually completely written, setting the rest to REG_UNKNOWN. Simon