Message ID | 55B95C2F.8020606@acm.org |
---|---|
State | New |
Headers | show |
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
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
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
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
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);