From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 62275 invoked by alias); 2 Nov 2015 17:57:25 -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 62261 invoked by uid 89); 2 Nov 2015 17:57:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 02 Nov 2015 17:57:23 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 4E594CDE; Mon, 2 Nov 2015 17:57:22 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tA2HvK8P030491; Mon, 2 Nov 2015 12:57:21 -0500 Message-ID: <5637A400.4020500@redhat.com> Date: Mon, 02 Nov 2015 17:57:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Simon Marchi , gdb-patches@sourceware.org CC: qiyaoltc@gmail.com Subject: Re: [PATCH] Fix length calculation in aarch64_linux_set_debug_regs References: <1446475684-31936-1-git-send-email-simon.marchi@ericsson.com> <56378884.70001@redhat.com> <563798BC.3000407@ericsson.com> In-Reply-To: <563798BC.3000407@ericsson.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-11/txt/msg00015.txt.bz2 On 11/02/2015 05:09 PM, Simon Marchi wrote: > I looked a bit more into the issue and did some testing, and it appears the > current code is correct (as Yao mentioned). It's probably not as clear as it > could be though. I think it would be nicer if expressed as > > (size of fixed part) + (size of variable part) Looking a bit more at the code in question, I agree. > On 15-11-02 11:00 AM, Pedro Alves wrote: >> IIUYC, you're pointing out two issues: >> #1 - the offsetof that doesn't work in C++. > > This actually appears to be a bug in g++. > > See this, especially towards the end: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14932 > > The expression is accepted by gcc and clang++, but not g++ (test with 4.8 and 5.2). OK. Still not sure whether it's a bug or not. It may still be invalid C++ that happens to be accepted by clang++. >> I think it's a little nicer to hide away the offsetof+sizeof. > > You mean hide in in a function? This expression is only used at one place and I think it's > reasonably straightforward if expressed correctly, but if you think it will make the code > clearer I don't mind. You convinced me. This is not really the same as the x86 case, where we wanted the offset of a register field. Thanks, Pedro Alves