gdb/
authorYao Qi <yao@codesourcery.com>
Wed, 20 Mar 2013 02:54:22 +0000 (02:54 +0000)
committerYao Qi <yao@codesourcery.com>
Wed, 20 Mar 2013 02:54:22 +0000 (02:54 +0000)
* ctf.c (ctf_save_metadata_header): Define macro HOST_ENDIANNESS
and write it to CTF metadata.

gdb/ChangeLog
gdb/ctf.c

index eca3b52f063042045f873f72e712607e6050bc28..ae37a863da2979068290ba62df00e81beb608f0c 100644 (file)
@@ -1,3 +1,8 @@
+2013-03-20  Yao Qi  <yao@codesourcery.com>
+
+       * ctf.c (ctf_save_metadata_header): Define macro HOST_ENDIANNESS
+       and write it to CTF metadata.
+
 2013-03-19  Corinna Vinschen  <vinschen@redhat.com>
 
        * windows-nat.c (handle_output_debug_string): Change type of n to
index d2ff862dd3731c188ea7bb039c8c4d4a5d124010..117f72a7701488c415d30f0d828b62d2103d102d 100644 (file)
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -218,9 +218,17 @@ ctf_save_metadata_header (struct trace_write_handler *handler)
                           " := uint64_t;\n");
   ctf_save_write_metadata (handler, "\n");
 
+  /* Get the byte order of the host and write CTF data in this byte
+     order.  */
+#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");
 }