From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123494 invoked by alias); 27 Jan 2017 12:11:20 -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 123403 invoked by uid 89); 27 Jan 2017 12:11:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=architectural X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 27 Jan 2017 12:11:12 +0000 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 549E4FAF47; Fri, 27 Jan 2017 12:11:12 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7FFAC1CCC8F; Fri, 27 Jan 2017 12:11:11 +0000 (UTC) Subject: Re: [PATCH] Removal of uses of MAX_REGISTER_SIZE To: Alan Hayward , "gdb-patches@sourceware.org" References: <7CF07197-4FED-4970-BB4B-2FE828E29A63@arm.com> Cc: nd From: Pedro Alves Message-ID: <45e3a5e1-a9aa-1bc0-5d08-526b89fc458e@redhat.com> Date: Fri, 27 Jan 2017 12:11:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <7CF07197-4FED-4970-BB4B-2FE828E29A63@arm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-01/txt/msg00615.txt.bz2 On 01/24/2017 10:31 AM, Alan Hayward wrote: > aarch64_pseudo_write (struct gdbarch *gdbarch, struct regcache *regcache, > int regnum, const gdb_byte *buf) > { > - gdb_byte reg_buf[MAX_REGISTER_SIZE]; > + gdb_byte *reg_buf = (gdb_byte *) alloca (register_size (gdbarch, regnum)); > > /* Ensure the register buffer is zero, we want gdb writes of the > various 'scalar' pseudo registers to behavior like architectural > writes, register width bytes are written the remainder are set to > zero. */ > - memset (reg_buf, 0, sizeof (reg_buf)); > + memset (reg_buf, 0, sizeof (register_size (gdbarch, regnum))); OK, I scrolled a bit further down to the third hunk. This sizeof is clearly broken. There may be more instances of this. Makes me wonder whether this is the right approach. :-/ (No, I don't have a formed opinion for what that would be.) Thanks, Pedro Alves