This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/3] Write CTF in host byte order
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 19 Mar 2013 14:05:34 -0700
- Subject: Re: [PATCH 2/3] Write CTF in host byte order
- References: <83ip4s4ixc dot fsf at gnu dot org> <1363407692-18959-1-git-send-email-yao at codesourcery dot com> <1363407692-18959-3-git-send-email-yao at codesourcery dot com>
> 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 <yao@codesourcery.com>
>
> * 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