diff mbox

lto wrapper verboseness

Message ID 55B95C2F.8020606@acm.org
State New
Headers show

Commit Message

Nathan Sidwell July 29, 2015, 11:05 p.m. UTC
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

Comments

Richard Biener July 30, 2015, 8:09 a.m. UTC | #1
On Thu, Jul 30, 2015 at 1:05 AM, Nathan Sidwell <nathan@acm.org> wrote:
> 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?

Err - fork_execute through collect_execute already does this if
verbose || debug.

So better figure out why this doesn't work.

Richard.

> nathan
Jakub Jelinek July 30, 2015, 8:15 a.m. UTC | #2
On Thu, Jul 30, 2015 at 10:09:05AM +0200, Richard Biener wrote:
> On Thu, Jul 30, 2015 at 1:05 AM, Nathan Sidwell <nathan@acm.org> wrote:
> > 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?
> 
> Err - fork_execute through collect_execute already does this if
> verbose || debug.
> 
> So better figure out why this doesn't work.

All I can add is that it really doesn't work, so far to get at the arguments
passed to the offloading cc1/cc1plus/f951, I had to strace -s 1024 -v and
capture what has been passed to the compiler and the content of the
temporary file with options.

	Jakub
Richard Biener July 30, 2015, 8:28 a.m. UTC | #3
On Thu, Jul 30, 2015 at 10:15 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Jul 30, 2015 at 10:09:05AM +0200, Richard Biener wrote:
>> On Thu, Jul 30, 2015 at 1:05 AM, Nathan Sidwell <nathan@acm.org> wrote:
>> > 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?
>>
>> Err - fork_execute through collect_execute already does this if
>> verbose || debug.
>>
>> So better figure out why this doesn't work.
>
> All I can add is that it really doesn't work, so far to get at the arguments
> passed to the offloading cc1/cc1plus/f951, I had to strace -s 1024 -v and
> capture what has been passed to the compiler and the content of the
> temporary file with options.

Is this because collect_execute prints the variant with the response file?
Then better fix that.  Of course we only print the driver invocation - but
that's the same with the proposed patch.

Richard.

>         Jakub
Nathan Sidwell July 30, 2015, 11:12 a.m. UTC | #4
On 07/30/15 04:28, Richard Biener wrote:
> On Thu, Jul 30, 2015 at 10:15 AM, Jakub Jelinek <jakub@redhat.com> wrote:
>> On Thu, Jul 30, 2015 at 10:09:05AM +0200, Richard Biener wrote:
>>> On Thu, Jul 30, 2015 at 1:05 AM, Nathan Sidwell <nathan@acm.org> wrote:
>>>> 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?
>>>
>>> Err - fork_execute through collect_execute already does this if
>>> verbose || debug.
>>>
>>> So better figure out why this doesn't work.
>>
>> All I can add is that it really doesn't work, so far to get at the arguments
>> passed to the offloading cc1/cc1plus/f951, I had to strace -s 1024 -v and
>> capture what has been passed to the compiler and the content of the
>> temporary file with options.
>
> Is this because collect_execute prints the variant with the response file?
> Then better fix that.  Of course we only print the driver invocation - but
> that's the same with the proposed patch.

It did surprise me that the usual machinery wasn't printing this stuff, but I 
didn't investigate why.


nathan
diff mbox

Patch

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