diff options
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r-- | gcc/gcc.c | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -2877,6 +2877,33 @@ execute () #endif /* DEBUG */ } +#ifdef ENABLE_VALGRIND_CHECKING + /* Run the each command through valgrind. To simplifiy prepending the + path to valgrind and the option "-q" (for quiet operation unless + something triggers), we allocate a separate argv array. */ + + for (i = 0; i < n_commands; i++) + { + const char **argv; + int argc; + int j; + + for (argc = 0; commands[i].argv[argc] != NULL; argc++) + ; + + argv = alloca ((argc + 3) * sizeof (char *)); + + argv[0] = VALGRIND_PATH; + argv[1] = "-q"; + for (j = 2; j < argc + 2; j++) + argv[j] = commands[i].argv[j - 2]; + argv[j] = NULL; + + commands[i].argv = argv; + commands[i].prog = argv[0]; + } +#endif + /* Run each piped subprocess. */ for (i = 0; i < n_commands; i++) |