aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcc.c
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@bitrange.com>2002-11-20 19:49:53 +0000
committerHans-Peter Nilsson <hp@gcc.gnu.org>2002-11-20 19:49:53 +0000
commit414d23ae18deaae675fe45cd997e71ede2f6af94 (patch)
tree9eafda11516ee784c63faf8b744d44153d2c5e6c /gcc/gcc.c
parent3ba2436a67f611be43fc02a1f400a69a95088695 (diff)
downloadgcc-414d23ae18deaae675fe45cd997e71ede2f6af94.zip
gcc-414d23ae18deaae675fe45cd997e71ede2f6af94.tar.gz
gcc-414d23ae18deaae675fe45cd997e71ede2f6af94.tar.bz2
Makefile.in (RUN_GEN, [...]): New variables.
* Makefile.in (RUN_GEN, VALGRIND_DRIVER_DEFINES): New variables. (DRIVER_DEFINES): Add $(VALGRIND_DRIVER_DEFINES). (executing gencheck, genconfigs, genconditions, genflags, gencodes, genconstants, genemit, genrecog, genopinit, genextract, genpeep, genattr, genattrtab, genoutput, gengenrtl, genpreds, gengtype, genprotos): Prepend $(RUN_GEN). * configure.in: Move host compiler tests before --enable-checking tests. (--enable-checking=valgrind): New. * config.in, configure: Regenerate. * cppfiles.c [!ENABLE_VALGRIND_CHECKING] (VALGRIND_DISCARD): Define as empty. (read_include_file): When doing the mmap+1 trick, valgrind-annotate the byte after the mmap:ed area as readable. (purge_cache): Remove above annotation. * gcc.c (execute) [ENABLE_VALGRIND_CHECKING]: Arrange to prepend VALGRIND_PATH -q to each command. From-SVN: r59309
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r--gcc/gcc.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 56cb08f..c30851d 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -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++)