summaryrefslogtreecommitdiff
path: root/job.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2013-05-13 01:30:24 -0400
committerPaul Smith <psmith@gnu.org>2013-05-13 01:30:24 -0400
commit381baeef7aa4f2c8758a9910ebb97af46c0dd7eb (patch)
treea62e74040e2ea16c3480566b0d2cb246c6fec453 /job.c
parent5367d393ddb36fc8b3f358418d5c9f2b9f01d2fe (diff)
downloadgunmake-381baeef7aa4f2c8758a9910ebb97af46c0dd7eb.tar.gz
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.
Diffstat (limited to 'job.c')
-rw-r--r--job.c20
1 files changed, 13 insertions, 7 deletions
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;