This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/3] Write CTF in host byte order


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  <yao@codesourcery.com>

	* 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]