about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--020run.cc1
-rw-r--r--029tools.cc20
2 files changed, 18 insertions, 3 deletions
diff --git a/020run.cc b/020run.cc
index 8f471b56..5ca093e7 100644
--- a/020run.cc
+++ b/020run.cc
@@ -162,7 +162,6 @@ if (!Run_tests) {
   setup();
 //?   Trace_file = "interactive";
 //?   START_TRACING_UNTIL_END_OF_SCOPE;
-//?   Trace_stream->collect_layers.insert("app");
   run_main(argc, argv);
   teardown();
 }
diff --git a/029tools.cc b/029tools.cc
index 8c22ad44..fa1ae463 100644
--- a/029tools.cc
+++ b/029tools.cc
@@ -166,6 +166,24 @@ case _CLEAR_TRACE: {
   break;
 }
 
+:(before "End Primitive Recipe Declarations")
+_SAVE_TRACE,
+:(before "End Primitive Recipe Numbers")
+Recipe_ordinal["$save-trace"] = _SAVE_TRACE;
+:(before "End Primitive Recipe Checks")
+case _SAVE_TRACE: {
+  break;
+}
+:(before "End Primitive Recipe Implementations")
+case _SAVE_TRACE: {
+  if (!Trace_file.empty()) {
+    ofstream fout((Trace_dir+Trace_file).c_str());
+    fout << Trace_stream->readable_contents("");
+    fout.close();
+  }
+  break;
+}
+
 //: assert: perform sanity checks at runtime
 
 :(scenario assert)
@@ -268,8 +286,6 @@ case _SYSTEM: {
   break;
 }
 
-//:: helpers for debugging
-
 :(before "End Primitive Recipe Declarations")
 _DUMP_MEMORY,
 :(before "End Primitive Recipe Numbers")