about summary refs log tree commit diff stats
path: root/027trace.cc
diff options
context:
space:
mode:
Diffstat (limited to '027trace.cc')
-rw-r--r--027trace.cc39
1 files changed, 39 insertions, 0 deletions
diff --git a/027trace.cc b/027trace.cc
index 8056b81b..89d6f2e2 100644
--- a/027trace.cc
+++ b/027trace.cc
@@ -39,3 +39,42 @@ case SHOW_WARNINGS: {
   Hide_warnings = false;
   break;
 }
+
+//: helpers for debugging
+
+:(before "End Primitive Recipe Declarations")
+_START_TRACING,
+:(before "End Primitive Recipe Numbers")
+Recipe_ordinal["$start-tracing"] = _START_TRACING;
+:(before "End Primitive Recipe Implementations")
+case _START_TRACING: {
+  if (current_instruction().ingredients.empty())
+    Trace_stream->dump_layer = "all";
+  else
+    Trace_stream->dump_layer = current_instruction().ingredients.at(0).name;
+//?   cout << Trace_stream << ": " << Trace_stream->dump_layer << '\n'; //? 1
+  break;
+}
+
+:(before "End Primitive Recipe Declarations")
+_STOP_TRACING,
+:(before "End Primitive Recipe Numbers")
+Recipe_ordinal["$stop-tracing"] = _STOP_TRACING;
+:(before "End Primitive Recipe Implementations")
+case _STOP_TRACING: {
+  Trace_stream->dump_layer = "";
+  break;
+}
+
+:(before "End Primitive Recipe Declarations")
+_CLOSE_TRACE,
+:(before "End Primitive Recipe Numbers")
+Recipe_ordinal["$close-trace"] = _CLOSE_TRACE;
+:(before "End Primitive Recipe Implementations")
+case _CLOSE_TRACE: {
+  if (Trace_stream) {
+    delete Trace_stream;
+    Trace_stream = NULL;
+  }
+  break;
+}