From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 97250 invoked by alias); 22 Jun 2018 14:25:51 -0000 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 Received: (qmail 97142 invoked by uid 89); 22 Jun 2018 14:25:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: sessmg23.ericsson.net Received: from sessmg23.ericsson.net (HELO sessmg23.ericsson.net) (193.180.251.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 22 Jun 2018 14:25:40 +0000 Received: from ESESSMB501.ericsson.se (Unknown_Domain [153.88.183.119]) by sessmg23.ericsson.net (Symantec Mail Security) with SMTP id 82.CC.22015.1E60D2B5; Fri, 22 Jun 2018 16:25:37 +0200 (CEST) Received: from ESESBMB501.ericsson.se (153.88.183.168) by ESESSMB501.ericsson.se (153.88.183.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 22 Jun 2018 16:25:36 +0200 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (153.88.183.157) by ESESBMB501.ericsson.se (153.88.183.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3 via Frontend Transport; Fri, 22 Jun 2018 16:25:35 +0200 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; Received: from [142.133.60.192] (192.75.88.130) by BN7PR15MB2388.namprd15.prod.outlook.com (2603:10b6:406:8c::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.884.21; Fri, 22 Jun 2018 14:25:33 +0000 Subject: Re: [PATCH v3] Support large registers in regcache transfer_regset To: Alan Hayward , CC: References: <20180622130819.1940-1-alan.hayward@arm.com> From: Simon Marchi Message-ID: <5034396d-84f5-c6d0-ea7e-488073ba7215@ericsson.com> Date: Fri, 22 Jun 2018 14:25:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180622130819.1940-1-alan.hayward@arm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SN6PR02CA0032.namprd02.prod.outlook.com (2603:10b6:805:a2::45) To BN7PR15MB2388.namprd15.prod.outlook.com (2603:10b6:406:8c::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aad4a734-4bd9-436e-ea89-08d5d84c03c6 X-MS-TrafficTypeDiagnostic: BN7PR15MB2388: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Forefront-PRVS: 071156160B Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2018 14:25:33.0743 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aad4a734-4bd9-436e-ea89-08d5d84c03c6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR15MB2388 X-OriginatorOrg: ericsson.com X-IsSubscribed: yes X-SW-Source: 2018-06/txt/msg00543.txt.bz2 Hi Alan, The patch LGTM. I noted two small comments you might want to address before pushing. Sorry again for the extra work I made you do! On 2018-06-22 09:08 AM, Alan Hayward wrote: > @@ -868,6 +900,39 @@ regcache::write_part (int regnum, int offset, int len, > > /* See regcache.h. */ > > +void > +reg_buffer::raw_supply_part (int regnum, int offset, int len, > + const gdb_byte *in) > +{ > + int reg_size = register_size (arch (), regnum); > + > + gdb_assert (in != nullptr); > + gdb_assert (offset >= 0 && offset <= reg_size); > + gdb_assert (len >= 0 && offset + len <= reg_size); > + > + if (offset == 0 && len == 0) > + { > + /* Nothing to do. */ > + return; > + } > + > + if (offset == 0 && len == reg_size) > + { > + /* Supply the full register. */ > + return raw_supply (regnum, in); > + } > + > + gdb_byte *reg = (gdb_byte *) alloca (reg_size); > + > + /* Read when needed. */ > + if (offset > 0 || offset + len < reg_size) I think this if is unneeded now, with the earlier check? If we reach this point, it will always be for a partial register. > diff --git a/gdb/regcache.h b/gdb/regcache.h > index 983137f6ad..e706d87b54 100644 > --- a/gdb/regcache.h > +++ b/gdb/regcache.h > @@ -166,6 +166,10 @@ public: > void raw_collect_integer (int regnum, gdb_byte *addr, int addr_len, > bool is_signed) const; > > + /* Collect register REGNUM from REGCACHE, starting at offset in REGCACHE, > + reading only LEN. */ I think "starting at offset in REGCACHE" is wrong, you probably meant "starting at offset in the register" or something like that? > + void raw_collect_part (int regnum, int offset, int len, gdb_byte *out) const; > + > /* See common/common-regcache.h. */ > void raw_supply (int regnum, const void *buf) override; > > @@ -187,6 +191,10 @@ public: > unavailable). */ > void raw_supply_zeroed (int regnum); > > + /* Supply register REGNUM to REGCACHE, starting at offset in REGCACHE, writing > + only LEN, without editing the rest of the register. */ Here too. Thanks, Simon