From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16078 invoked by alias); 22 Feb 2018 17:20:10 -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 16058 invoked by uid 89); 22 Feb 2018 17:20:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=blah X-HELO: gateway30.websitewelcome.com Received: from gateway30.websitewelcome.com (HELO gateway30.websitewelcome.com) (50.116.125.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Feb 2018 17:20:07 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 43294B6A3 for ; Thu, 22 Feb 2018 11:20:06 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id ouXOeS5wHcGlpouXOeOLfx; Thu, 22 Feb 2018 11:20:06 -0600 Received: from 174-29-60-18.hlrn.qwest.net ([174.29.60.18]:35506 helo=pokyo) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1eouXN-003lmW-VW; Thu, 22 Feb 2018 11:20:06 -0600 From: Tom Tromey To: Peeter Joot Cc: gdb-patches@sourceware.org, peeter.joot@lzlabs.com, simark@simark.ca Subject: Re: [PATCH] review request: implementing DW_AT_endianity References: <20171010233010.58471-1-peeter.joot@lzlabs.com> Date: Thu, 22 Feb 2018 17:20:00 -0000 In-Reply-To: <20171010233010.58471-1-peeter.joot@lzlabs.com> (Peeter Joot's message of "Tue, 10 Oct 2017 19:30:10 -0400") Message-ID: <87371tq6uz.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-BWhitelist: no X-Source-L: No X-Exim-ID: 1eouXN-003lmW-VW X-Source-Sender: 174-29-60-18.hlrn.qwest.net (pokyo) [174.29.60.18]:35506 X-Source-Auth: tom+tromey.com X-Email-Count: 4 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-SW-Source: 2018-02/txt/msg00321.txt.bz2 >>>>> "Peeter" == Peeter Joot writes: I happened to run across this patch today. What's the status of it? Peeter> +enum bfd_endian Peeter> +type_byte_order (struct gdbarch * gdbarch, struct type *type) Peeter> +{ Peeter> + if (TYPE_ENDIANITY_BIG (type)) Peeter> + return BFD_ENDIAN_BIG; Peeter> + else if (TYPE_ENDIANITY_LITTLE (type)) Peeter> + return BFD_ENDIAN_LITTLE; Peeter> + if (!gdbarch) Peeter> + gdbarch = get_type_arch (type); Peeter> + return gdbarch_byte_order (gdbarch); Does it ever make sense to call type_byte_order with a gdbarch other than the type's gdbarch? I would assume not but I'm not really sure. What would this mean? Anyway, if it doesn't make sense, then I'd suggest just removing the gdbarch parameter. Peeter> + unsigned int flag_endianity_big : 1; Peeter> + unsigned int flag_endianity_little : 1; It also seems to me that perhaps only a single bit is needed -- something like: unsigned int flag_endian_differs_from_arch : 1; Then type_byte_order could do: enum bfd_endian endian = gdbarch_byte_order (...); if (blah blah flag_endian_differs_from_arch) endian = (endian == BFD_ENDIAN_LITTLE) ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE; Of course this only makes sense if the arch endianness can't change somehow, and if only the type's arch can be used to get the endianness. Tom