From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8410 invoked by alias); 20 Oct 2010 14:04:25 -0000 Received: (qmail 8400 invoked by uid 22791); 20 Oct 2010 14:04:24 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-fx0-f41.google.com (HELO mail-fx0-f41.google.com) (209.85.161.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 20 Oct 2010 14:04:15 +0000 Received: by fxm2 with SMTP id 2so2894642fxm.0 for ; Wed, 20 Oct 2010 07:04:13 -0700 (PDT) Received: by 10.216.158.140 with SMTP id q12mr8333709wek.14.1287583453220; Wed, 20 Oct 2010 07:04:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.179.14 with HTTP; Wed, 20 Oct 2010 07:03:53 -0700 (PDT) In-Reply-To: <201010201128.17479.pedro@codesourcery.com> References: <201010191020.04495.pedro@codesourcery.com> <201010201128.17479.pedro@codesourcery.com> From: Hui Zhu Date: Wed, 20 Oct 2010 14:04:00 -0000 Message-ID: Subject: Re: [PATCH] tracepoint: fix tfile byte order issue To: Pedro Alves Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 2010-10/txt/msg00319.txt.bz2 On Wed, Oct 20, 2010 at 18:28, Pedro Alves wrote: > On Wednesday 20 October 2010 09:49:58, Hui Zhu wrote: >> I make a new patch change to use target_gdbarch and use >> extract_signed_integer in signed value. >> >> And I found that tfile_trace_find define the size of a frame to a int: >> int data_size; >> >> But I found that gdbserver/tracepoint.c:struct traceframe: >> unsigned int data_size : 32; >> >> So I change this int to unsigned int. > > Thanks. =A0It appears the format description in gdb.texinfo doesn't > make that explicit, but indeed all sizes should be unsigned. > >> @@ -3665,6 +3665,9 @@ tfile_get_traceframe_address (off_t tfra >> =A0 =A0 =A0perror_with_name (trace_filename); >> =A0 =A0else if (gotten < 2) >> =A0 =A0 =A0error (_("Premature end of file while reading trace file")); >> + =A0tpnum =3D (short) extract_signed_integer ((gdb_byte *)&tpnum, 2, >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 gdbarch_byte_order >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 (target_gdbarch)); > > I don't think you need all the casts to short, int, etc.. anymore. =A0Ple= ase > add the missing space in the second cast: "(gdb_byte *) &tpnum" everywher= e too. > > Otherwise okay. =A0Thanks. > > -- > Pedro Alves > Thanks Pedro. Fixed and checked in. Hui