public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* lto wrapper verboseness
@ 2015-07-30  0:14 Nathan Sidwell
  2015-07-30  8:27 ` Richard Biener
  0 siblings, 1 reply; 11+ messages in thread
From: Nathan Sidwell @ 2015-07-30  0:14 UTC (permalink / raw)
  To: Jakub Jelinek, GCC Patches

[-- Attachment #1: Type: text/plain, Size: 182 bytes --]

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

[-- Attachment #2: ltowrapper.patch --]
[-- Type: text/x-patch, Size: 1526 bytes --]

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);

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-10-05 14:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-30  0:14 lto wrapper verboseness Nathan Sidwell
2015-07-30  8:27 ` Richard Biener
2015-07-30  8:28   ` Jakub Jelinek
2015-07-30  9:24     ` Richard Biener
2015-07-30 11:37       ` Nathan Sidwell
2015-09-28  9:44   ` Thomas Schwinge
2015-09-28 11:54     ` Bernd Schmidt
2015-09-30 18:45       ` Thomas Schwinge
2015-10-05 10:04         ` [PR other/65021] mkoffloads -save-temps handling, and cleanup cleanup (was: lto wrapper verboseness) Thomas Schwinge
2015-10-05 12:41           ` [PR other/65021] mkoffloads -save-temps handling, and cleanup cleanup Bernd Schmidt
2015-10-05 14:16             ` Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).