Re: Compilation failure for mingw64 target (was New ARI warning Fri Mar 15 02:02:12 UTC 2013 in -D 2013-03-15-gmt)

Yao Qi
2013-03-15T14:43:48Z

On 03/15/2013 07:05 PM, Yao Qi wrote:
> This problem is addressed by using "native" endianness in CTF metadata,
> so BYTE_ORDER and LITTLE_ENDIAN can be avoided.

Here is the updated one, in which 'WORDS_BIGENDIAN' is checked to get
the host-endianness. This macro is used somewhere else in GDB, so looks
it is a right way.

Rebuild native GDB on x86-linux and cross build GDB for mingw32 target
respectively.

--
Yao (é½å°§)

gdb:

2013-03-15 Yao Qi <yao@codesourcery.com>

* ctf.c (ctf_save_metadata_header): Define macro
HOST_ENDIANNESS. Write HOST_ENDIANNESS to metadata.
(ctf_start) [USE_WIN32API]: Call mkdir with DIRNAME only.
[!USE_WIN32API]: Call mkdir with DIRNAME and mode parameter.
---
gdb/ctf.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/gdb/ctf.c b/gdb/ctf.c
index 44c4e9e..09f9fae 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");
}

@@ -298,10 +304,16 @@ ctf_start (struct trace_file_writer *self, const char *dirname)
struct ctf_trace_file_writer *writer
= (struct ctf_trace_file_writer *) self;
int i;
+ int ret = 0;

/* Create DIRNAME. */
- if (mkdir (dirname, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
- && errno != EEXIST)
+#ifdef USE_WIN32API
+ ret = mkdir (dirname);
+#else
+ ret = mkdir (dirname, S_IRUSR | S_IWUSR | S_IXUSR);
+#endif
+
+ if (ret && errno != EEXIST)
error (_("Unable to open directory '%s' for saving trace data (%s)"),
dirname, safe_strerror (errno));

--
1.7.7.6