This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
lto wrapper verboseness
- From: Nathan Sidwell <nathan at acm dot org>
- To: Jakub Jelinek <jakub at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 29 Jul 2015 19:05:19 -0400
- Subject: lto wrapper verboseness
- Authentication-results: sourceware.org; auth=none
Jakub,
this patch augments the lto wrapper to print out the arguments to spawned
commands when verbose. I found this useful in debugging recent development.
ok for trunk?
nathan
2015-07-29 Nathan Sidwell <nathan@codesourcery.com>
* lto-wrapper.c (verbose_exec): New.
(compile_offload_image, run_gcc): Call it.
Index: gcc/lto-wrapper.c
===================================================================
--- gcc/lto-wrapper.c (revision 226372)
+++ gcc/lto-wrapper.c (working copy)
@@ -115,6 +115,15 @@ maybe_unlink (const char *file)
fprintf (stderr, "[Leaving LTRANS %s]\n", file);
}
+/* Print command being executed. */
+static void
+verbose_exec (const char *const *argv)
+{
+ while (*argv)
+ fprintf (stderr, " %s", *argv++);
+ fprintf (stderr, "\n");
+}
+
/* Template of LTRANS dumpbase suffix. */
#define DUMPBASE_SUFFIX ".ltrans18446744073709551615"
@@ -693,6 +702,8 @@ compile_offload_image (const char *targe
obstack_ptr_grow (&argv_obstack, NULL);
argv = XOBFINISH (&argv_obstack, char **);
+ if (verbose)
+ verbose_exec (argv);
fork_execute (argv[0], argv, true);
obstack_free (&argv_obstack, NULL);
}
@@ -1156,6 +1167,8 @@ run_gcc (unsigned argc, char *argv[])
new_argv = XOBFINISH (&argv_obstack, const char **);
argv_ptr = &new_argv[new_head_argc];
+ if (verbose)
+ verbose_exec (new_argv);
fork_execute (new_argv[0], CONST_CAST (char **, new_argv), true);
if (lto_mode == LTO_MODE_LTO)
@@ -1264,6 +1277,8 @@ cont:
}
else
{
+ if (verbose)
+ verbose_exec (new_argv);
fork_execute (new_argv[0], CONST_CAST (char **, new_argv),
true);
maybe_unlink (input_name);