From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28128 invoked by alias); 16 Mar 2013 04:22:54 -0000 Received: (qmail 28099 invoked by uid 22791); 16 Mar 2013 04:22:52 -0000 X-SWARE-Spam-Status: No, hits=-4.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 16 Mar 2013 04:22:46 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1UGidq-0004L9-Bc from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Fri, 15 Mar 2013 21:22:46 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Fri, 15 Mar 2013 21:22:45 -0700 Received: from qiyao.dyndns.org.dyndns.org (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.1.289.1; Fri, 15 Mar 2013 21:22:44 -0700 From: Yao Qi To: Subject: [PATCH 2/3] Write CTF in host byte order Date: Sat, 16 Mar 2013 04:23:00 -0000 Message-ID: <1363407692-18959-3-git-send-email-yao@codesourcery.com> In-Reply-To: <1363407692-18959-1-git-send-email-yao@codesourcery.com> References: <83ip4s4ixc.fsf@gnu.org> <1363407692-18959-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes 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 X-SW-Source: 2013-03/txt/msg00699.txt.bz2 On 03/15/2013 11:44 PM, Pedro Alves wrote:>> Hmmm, I'd like to write CTF in the host-endianness, > Why's that? > 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. --- gdb/ctf.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/gdb/ctf.c b/gdb/ctf.c index 44c4e9e..a93dfaf 100644 --- a/gdb/ctf.c +++ b/gdb/ctf.c @@ -242,9 +242,15 @@ ctf_save_metadata_header (struct trace_write_handler *handler) " } := chars;\n"); ctf_save_write_metadata (handler, "\n"); +#if WORDS_BIGENDIAN +#define HOST_ENDIANNESS "be" +#else +#define HOST_ENDIANNESS "le" +#endif + ctf_save_write_metadata (handler, metadata_fmt, CTF_SAVE_MAJOR, CTF_SAVE_MINOR, - BYTE_ORDER == LITTLE_ENDIAN ? "le" : "be"); + HOST_ENDIANNESS); ctf_save_write_metadata (handler, "\n"); } -- 1.7.7.6