Add [-q] [-t TYPEREGEXP] [NAMEREGEXP] args to info [args|functions|locals|variables]
[deliverable/binutils-gdb.git] / gdb / ctf.c
index a156b1faf27d9016690826af1e0feda9a8b18e8d..ca5266fbd7c588c07fec662ec6c199931a3d8c6d 100644 (file)
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -31,6 +31,7 @@
 #include "tracefile.h"
 #include <ctype.h>
 #include <algorithm>
+#include "common/filestuff.h"
 
 /* The CTF target.  */
 
@@ -354,7 +355,8 @@ ctf_start (struct trace_file_writer *self, const char *dirname)
 
   std::string file_name = string_printf ("%s/%s", dirname, CTF_METADATA_NAME);
 
-  writer->tcs.metadata_fd = fopen (file_name.c_str (), "w");
+  writer->tcs.metadata_fd
+    = gdb_fopen_cloexec (file_name.c_str (), "w").release ();
   if (writer->tcs.metadata_fd == NULL)
     error (_("Unable to open file '%s' for saving trace data (%s)"),
           file_name.c_str (), safe_strerror (errno));
@@ -362,7 +364,8 @@ ctf_start (struct trace_file_writer *self, const char *dirname)
   ctf_save_metadata_header (&writer->tcs);
 
   file_name = string_printf ("%s/%s", dirname, CTF_DATASTREAM_NAME);
-  writer->tcs.datastream_fd = fopen (file_name.c_str (), "w");
+  writer->tcs.datastream_fd
+    = gdb_fopen_cloexec (file_name.c_str (), "w").release ();
   if (writer->tcs.datastream_fd == NULL)
     error (_("Unable to open file '%s' for saving trace data (%s)"),
           file_name.c_str (), safe_strerror (errno));
@@ -1008,14 +1011,14 @@ ctf_read_tsv (struct uploaded_tsv **uploaded_tsvs)
 #define SET_ARRAY_FIELD(EVENT, SCOPE, VAR, NUM, ARRAY) \
   do                                                   \
     {                                                  \
-      uint32_t u32, i;                                         \
+      uint32_t lu32, i;                                                \
       const struct bt_definition *def;                         \
                                                                \
-      u32 = (uint32_t) bt_ctf_get_uint64 (bt_ctf_get_field ((EVENT),   \
-                                                           (SCOPE),    \
-                                                           #NUM));     \
+      lu32 = (uint32_t) bt_ctf_get_uint64 (bt_ctf_get_field ((EVENT),  \
+                                                            (SCOPE),   \
+                                                            #NUM));    \
       def = bt_ctf_get_field ((EVENT), (SCOPE), #ARRAY);               \
-      for (i = 0; i < u32; i++)                                        \
+      for (i = 0; i < lu32; i++)                                       \
        {                                                               \
          const struct bt_definition *element                           \
            = bt_ctf_get_index ((EVENT), def, i);                       \
This page took 0.027142 seconds and 4 git commands to generate.