From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22042 invoked by alias); 19 Mar 2013 21:23:15 -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 21106 invoked by uid 89); 19 Mar 2013 21:23:07 -0000 X-Spam-Sware-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.1 Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 19 Mar 2013 21:23:04 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 3E71B2E24D; Tue, 19 Mar 2013 17:05:36 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id GG5SxS0gxDxQ; Tue, 19 Mar 2013 17:05:36 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 0A0861C798E; Tue, 19 Mar 2013 17:05:36 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 5C105C25A3; Tue, 19 Mar 2013 14:05:34 -0700 (PDT) Date: Tue, 19 Mar 2013 21:26:00 -0000 From: Joel Brobecker To: Yao Qi Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 2/3] Write CTF in host byte order Message-ID: <20130319210534.GC4506@adacore.com> References: <83ip4s4ixc.fsf@gnu.org> <1363407692-18959-1-git-send-email-yao@codesourcery.com> <1363407692-18959-3-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1363407692-18959-3-git-send-email-yao@codesourcery.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2013-03/txt/msg00723.txt.bz2 > Because data has been converted to the host byte order when they are > received from the target. We use them in host side, store them > to trace file in host side, and read the data back in host side as > well. > > gdb: > > 2013-03-16 Yao Qi > > * ctf.c (ctf_save_metadata_header): Define macro HOST_ENDIANNESS > and write it to CTF metadata. This patch looks independent of the rest, and I think would fix one of the build issues that have been reported. > +#if WORDS_BIGENDIAN > +#define HOST_ENDIANNESS "be" > +#else > +#define HOST_ENDIANNESS "le" > +#endif A comment would have been nice, although I am thinking it would have been just as simple if you did not define HOST_ENDIANNESS and used WORDS_BIGENDIAN directly in the code below: > ctf_save_write_metadata (handler, metadata_fmt, > CTF_SAVE_MAJOR, CTF_SAVE_MINOR, > - BYTE_ORDER == LITTLE_ENDIAN ? "le" : "be"); > + HOST_ENDIANNESS); + WORDS_BIGENDIAN ? "be" : "le"); Either way really works for me, especially if you think you might be using HOST_ENDIANNESS elsewhere again sometime. You can commit with a comment or the change I suggested. If someone objects, it's easy to revert or adjust. -- Joel