From 4efc0ff3168f9ff6e80b2fa4b3302baac4035abb Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 21 Jul 2015 23:38:21 -0700 Subject: 1826 - edit: start carefully showing all errors Eventually we might be able to get rid of die entirely. This is just a preliminary stab at a random error. In the process I ran into two issues that have impeded debugging before: a) Naming conflicts within scenarios are a real no-no. I need to warn on them, but the rules are getting complicated: Always print warnings on redefine But not in interactive mode Or in scenarios checking warning behavior Unless the scenario recipe itself is overridden b) Now that we've added collect_layers and a long time can go between traces, debugging is a minefield because trace lines don't print to screen immediately after they're created. Need to do something about that. Maybe explicitly trigger collection by tracing '\n' or something. These are the next two items on my todo list. --- 081run_interactive.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to '081run_interactive.cc') diff --git a/081run_interactive.cc b/081run_interactive.cc index 5258b2c0..f7d049ff 100644 --- a/081run_interactive.cc +++ b/081run_interactive.cc @@ -188,6 +188,7 @@ if (must_clean_up_interactive) clean_up_interactive(); if (must_clean_up_interactive) clean_up_interactive(); :(code) void clean_up_interactive() { + Trace_stream->newline(); // flush trace Hide_warnings = false; Running_interactive = false; // hack: assume collect_layer isn't set anywhere else @@ -267,13 +268,23 @@ Recipe_ordinal["reload"] = RELOAD; :(before "End Primitive Recipe Implementations") case RELOAD: { assert(scalar(ingredients.at(0))); + if (!Trace_stream) { + Trace_file = ""; // if there wasn't already a stream we don't want to save it + Trace_stream = new trace_stream; + Trace_stream->collect_layer = "warn"; + } Loading_interactive = true; Hide_warnings = true; load(read_mu_string(ingredients.at(0).at(0))); transform_all(); + Trace_stream->newline(); // flush trace Hide_warnings = false; Loading_interactive = false; products.resize(1); products.at(0).push_back(warnings_from_trace()); + if (Trace_stream->collect_layer == "warn") { + delete Trace_stream; + Trace_stream = NULL; + } break; } -- cgit 1.4.1-2-gfad0