From 381baeef7aa4f2c8758a9910ebb97af46c0dd7eb Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Mon, 13 May 2013 01:30:24 -0400 Subject: Add new --trace[=MODE] flags, with --trace=dir This mode replaces the previous heuristic setting enabled with -O, where we would log directory enter/leave for each synchronized output. Now we only do that if --trace=dir is given. --- job.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'job.c') diff --git a/job.c b/job.c index 106c518..56055e4 100644 --- a/job.c +++ b/job.c @@ -768,14 +768,20 @@ sync_output (struct child *c) unsynchronized; still better than silently discarding it. */ void *sem = acquire_semaphore (); - /* We've entered the "critical section" during which a lock is held. - We want to keep it as short as possible. */ - log_working_directory (1, 1); + /* We've entered the "critical section" during which a lock is held. We + want to keep it as short as possible. */ + + /* Log the working directory. Force it if we're doing dir tracing. */ + log_working_directory (1, (trace_flag & TRACE_DIRECTORY)); + if (outfd_not_empty) - pump_from_tmp (c->outfd, stdout); + pump_from_tmp (c->outfd, stdout); if (errfd_not_empty && c->errfd != c->outfd) pump_from_tmp (c->errfd, stderr); - log_working_directory (0, 1); + + /* If we're doing dir tracing, force the leave message. */ + if (trace_flag & TRACE_DIRECTORY) + log_working_directory (0, 1); /* Exit the critical section. */ if (sem) @@ -1506,7 +1512,7 @@ start_job_command (struct child *child) return; } - print_cmd = (just_print_flag || trace_flag + print_cmd = (just_print_flag || (trace_flag & TRACE_RULE) || (!(flags & COMMANDS_SILENT) && !silent_flag)); #ifdef OUTPUT_SYNC @@ -2237,7 +2243,7 @@ new_job (struct file *file) /* Trace the build. Use message here so that changes to working directories are logged. */ - if (trace_flag) + if (trace_flag & TRACE_RULE) { char *newer = allocated_variable_expand_for_file ("$?", c->file); const char *nm; -- cgit v1.2.3