From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 73764 invoked by alias); 25 Mar 2019 15:18:06 -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 73753 invoked by uid 89); 25 Mar 2019 15:18:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=differentiate X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 25 Mar 2019 15:18:04 +0000 Received: from [172.16.0.89] (192-222-157-41.qc.cable.ebox.net [192.222.157.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 185D81E471; Mon, 25 Mar 2019 11:18:02 -0400 (EDT) Subject: Re: [PATCH 1/2] Add linux_get_hwcap To: Alan Hayward , "gdb-patches@sourceware.org" Cc: nd References: <20190325120542.92123-1-alan.hayward@arm.com> From: Simon Marchi Message-ID: <0cea3f8f-e66e-574c-0c6e-aa2c2bbead4f@simark.ca> Date: Mon, 25 Mar 2019 15:18:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190325120542.92123-1-alan.hayward@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2019-03/txt/msg00540.txt.bz2 On 2019-03-25 8:05 a.m., Alan Hayward wrote: > Tidy up calls to read HWCAP (and HWCAP2) by adding common functions, > removing the PPC and AArch64 specific versions. > > The only function difference is in aarch64_linux_core_read_description - if > the hwcap read fails it now return a valid description instead of nullptr. ARM also seems to have changed behavior, both the native target and core target. It's not necessarily, a problem, as long as it's a conscious change. > diff --git a/gdb/linux-tdep.h b/gdb/linux-tdep.h > index 824ba3afaf..ee9c2bcc90 100644 > --- a/gdb/linux-tdep.h > +++ b/gdb/linux-tdep.h > @@ -61,4 +61,10 @@ extern void linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch); > > extern int linux_is_uclinux (void); > > +/* Fetch the AT_HWCAP entry from the auxv vector for the given TARGET. */ > +extern CORE_ADDR linux_get_hwcap (struct target_ops *target); > + > +/* Fetch the AT_HWCAP2 entry from the auxv vector for the given TARGET. */ > +extern CORE_ADDR linux_get_hwcap2 (struct target_ops *target); For these two functions, can you mention that 0 is returned if the search in the AUXV vector fails? I was a bit surprised you didn't keep your version returning a bool to indicate whether the search succeeded or failed, but if this version is good enough, I am fine with it. If we ever have a target that really needs to differentiate between a lookup failure and a lookup success that returns the value 0, we can change it back or add another overload. This patch LGTM with the comment above updated. Simon