4139
This commit is contained in:
parent
26b4bdc8b3
commit
d51abbf123
12
003trace.cc
12
003trace.cc
|
@ -117,6 +117,12 @@ struct trace_stream {
|
|||
return *curr_stream;
|
||||
}
|
||||
|
||||
void dump() {
|
||||
ofstream fout("last_run");
|
||||
fout << readable_contents("");
|
||||
fout.close();
|
||||
}
|
||||
|
||||
// be sure to call this before messing with curr_stream or curr_label
|
||||
void newline();
|
||||
// useful for debugging
|
||||
|
@ -214,11 +220,7 @@ struct lease_tracer {
|
|||
lease_tracer::lease_tracer() { Trace_stream = new trace_stream; }
|
||||
lease_tracer::~lease_tracer() {
|
||||
if (!Trace_stream) return; // in case tests close Trace_stream
|
||||
if (Save_trace) {
|
||||
ofstream fout("last_run");
|
||||
fout << Trace_stream->readable_contents("");
|
||||
fout.close();
|
||||
}
|
||||
if (Save_trace) Trace_stream->dump();
|
||||
delete Trace_stream, Trace_stream = NULL;
|
||||
}
|
||||
:(before "End Includes")
|
||||
|
|
12
020run.cc
12
020run.cc
|
@ -233,13 +233,11 @@ else if (is_equal(*arg, "--trace")) {
|
|||
|
||||
:(code)
|
||||
void cleanup_main() {
|
||||
if (Save_trace && Trace_stream) {
|
||||
cerr << "writing trace to 'last_run'\n";
|
||||
ofstream fout("last_run");
|
||||
fout << Trace_stream->readable_contents("");
|
||||
fout.close();
|
||||
}
|
||||
if (Trace_stream) delete Trace_stream, Trace_stream = NULL;
|
||||
if (!Trace_stream) return;
|
||||
if (Save_trace);
|
||||
Trace_stream->dump();
|
||||
delete Trace_stream;
|
||||
Trace_stream = NULL;
|
||||
}
|
||||
:(before "End One-time Setup")
|
||||
atexit(cleanup_main);
|
||||
|
|
|
@ -179,11 +179,7 @@ case _SAVE_TRACE: {
|
|||
}
|
||||
:(before "End Primitive Recipe Implementations")
|
||||
case _SAVE_TRACE: {
|
||||
if (Save_trace) {
|
||||
ofstream fout("last_run");
|
||||
fout << Trace_stream->readable_contents("");
|
||||
fout.close();
|
||||
}
|
||||
if (Save_trace) Trace_stream->dump();
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,12 +75,7 @@ void decrement_refcount(int old_address, const type_tree* payload_type, int payl
|
|||
put(Memory, old_address, old_refcount);
|
||||
if (old_refcount < 0) {
|
||||
cerr << "Negative refcount!!! " << old_address << ' ' << old_refcount << '\n';
|
||||
if (Trace_stream) {
|
||||
cerr << "Saving trace to last_run.\n";
|
||||
ofstream fout("last_run");
|
||||
fout << Trace_stream->readable_contents("");
|
||||
fout.close();
|
||||
}
|
||||
if (Trace_stream) Trace_stream->dump();
|
||||
exit(1);
|
||||
}
|
||||
// End Decrement Refcount(old_address, payload_type, payload_size)
|
||||
|
|
|
@ -229,11 +229,7 @@ void run_mu_scenario(const scenario& s) {
|
|||
if (!Hide_errors && trace_contains_errors() && !Scenario_testing_scenario)
|
||||
Passed = false;
|
||||
if (not_already_inside_test && Trace_stream) {
|
||||
if (Save_trace) {
|
||||
ofstream fout("last_run");
|
||||
fout << Trace_stream->readable_contents("");
|
||||
fout.close();
|
||||
}
|
||||
if (Save_trace) Trace_stream->dump();
|
||||
delete Trace_stream;
|
||||
Trace_stream = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue