From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2610:1c1:1:606c::19:2]) by sourceware.org (Postfix) with ESMTPS id CA3953857835 for ; Tue, 22 Nov 2022 22:32:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CA3953857835 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 4NGzXn588Hz3Zt8; Tue, 22 Nov 2022 22:32:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NGzXn4PXwz4MTq; Tue, 22 Nov 2022 22:32:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669156361; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OVg20Yqvggsr0qbcWXLBc0tyD5TX7jUtbaOA6UdNbXA=; b=rh+vrFFhpdjEJRIfnNZO+222TqksXFJIzhHp4N4A9rrfdHQY+BRGE2TOYiHyS6ePDLstlA OTuMJyHHGTOD2Oygf9P59lzTAikJqcnGmps3GL6DVmiEqLjx6FjhiIv4QUrJMV24IQUtRD HuNUrMmqCprD0atjjxSw5CAu/ksPkpBhTTgr1RB+gO9b3Re6RGmNS1IXL/rnc8N3qPfy95 teUHlYSY0zczS4hqjlcHX8BiJxUgGk7YnuUbNkK/jfIywcmkNHL4VBQoAQCTwlWdh+LsWI 5DvZASgLR9u6ZE8fDB+0V0SiRECSi5hyd+xWfolpetw0el2UWnqkJ7oweUZqzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669156361; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OVg20Yqvggsr0qbcWXLBc0tyD5TX7jUtbaOA6UdNbXA=; b=fLaX5p24G1e6Mx7ozO/yT/vOery/rg7KL18spdd+kJd66Ul01eQFJi1B85mPfex0Q79//X uJXfgJpAGLT91bgDggBAU7MNpaRniC4QgTIjwmCE2kkv+HYmpkJK11CbDgiMMLlG6sS1lt 8EblDJagyq2Gds5bEze3qD7fngKQuqy/ScNvaOW2Bm1yDASFV2GjWwJ9PjvuEA8fqGf6A1 v6JpTI+dPoRy5pRaosGEmEATKsXblr2VrqOPwebBwGzbAt9vkleu5c75XnU5j0oRsT0gZ0 U+r1pvBSChj1Xo6anujeGR/UcBdOdvwJp0n5VzCaHRy9+ohYk5v/FGqOua9gfg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669156361; a=rsa-sha256; cv=none; b=F9o3I1BYwOcWFEC7ZqncjeuAz/xvEP6AB7oJ+UO2afMdt8uRzw89tx9Bxs2KLZ2G0a9iJQ MYWT+xeyQHCCTSndjyntOL85HxmkcF3ExnBVk1JrMONb+s30OvRzFNepUp78XuvtzA5wfv 4iRnz632wCxOk+1IFydRuLcvMn87vCf2Et2A7J1sKOGN+lAFONyRh7QaicOgVzUiqBMHNe IzmV99Dq2zox+/8lB29p5T2IrNZ70Z8KstjMhWiv026H69CvILFlnTXU50fk19nlcuL8wO 4YC9kUkCuPjaTrNcLCALOaljDQgv7HWlPHc6QVCv5HbiE+B/9+GkawzUq5+m+w== Received: from [10.0.1.4] (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4NGzXn1Sk0zbJ6; Tue, 22 Nov 2022 22:32:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: Date: Tue, 22 Nov 2022 14:32:40 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH 1/5] regcache: Add collect/supply_regset variants that accept a register base. Content-Language: en-US To: Simon Marchi , gdb-patches@sourceware.org References: <20220708005816.9408-1-jhb@FreeBSD.org> <20220708005816.9408-2-jhb@FreeBSD.org> From: John Baldwin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP 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 11/22/22 11:56 AM, Simon Marchi wrote: > On 7/7/22 20:58, John Baldwin wrote: >> --- >> gdb/regcache.c | 28 +++++++++++++++++++++++++--- >> gdb/regcache.h | 24 ++++++++++++++++++++++-- >> 2 files changed, 47 insertions(+), 5 deletions(-) >> >> diff --git a/gdb/regcache.c b/gdb/regcache.c >> index 037659ef8fa..1db3d972ef8 100644 >> --- a/gdb/regcache.c >> +++ b/gdb/regcache.c >> @@ -1242,7 +1245,18 @@ void >> regcache::supply_regset (const struct regset *regset, >> int regnum, const void *buf, size_t size) >> { >> - transfer_regset (regset, this, regnum, (const gdb_byte *) buf, nullptr, size); >> + transfer_regset (regset, 0, this, regnum, (const gdb_byte *) buf, nullptr, >> + size); >> +} > > Can the old regcache::{supply,collect}_regset (without regbase) become > trivial wrappers around the new ones (with regbase)? I would put the > implementation directly in the .h if doing that. Yes, that will work and I will make that change. >> diff --git a/gdb/regcache.h b/gdb/regcache.h >> index 1dbba5ce9af..f01127b20fb 100644 >> --- a/gdb/regcache.h >> +++ b/gdb/regcache.h >> @@ -150,6 +150,14 @@ extern void regcache_collect_regset (const struct regset *regset, >> int regnum, void *buf, size_t size); >> >> >> +extern void regcache_supply_regset (const struct regset *regset, int regbase, >> + struct regcache *regcache, >> + int regnum, const void *buf, >> + size_t size); >> +extern void regcache_collect_regset (const struct regset *regset, int regbase, >> + const struct regcache *regcache, >> + int regnum, void *buf, size_t size); > > These don't have a definition, I guess they are not needed. Oops, yes. I think I was originally going to add them for completeness, but I think it's better to not add them so will axe the prototypes. > (Could we make a patch that removes regcache_supply_regset and > regcache_collect_regset, since they just forward to the regcache > methods?) > >> + belonging to the regset, otherwise just the register numbered >> + REGNUM. The REGSET's 'regmap' field must point to an array of >> + 'struct regcache_map_entry'. The valid register numbers in each >> + entry in 'struct regcache_map_entry' are offset by REGBASE. */ >> + >> + void supply_regset (const struct regset *regset, int regbase, >> + int regnum, const void *buf, size_t size); >> + >> + void collect_regset (const struct regset *regset, int regbase, int regnum, >> + void *buf, size_t size) const; >> + >> void supply_regset (const struct regset *regset, >> int regnum, const void *buf, size_t size); >> >> - >> void collect_regset (const struct regset *regset, int regnum, >> void *buf, size_t size) const; > > Can you document the last two, just by saying something like "Same as > the above, but with REGBASE == 0"? Will do. -- John Baldwin