From c442a5ad806b6cccbb3ec4c5744b14b0c1f31a01 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 25 Feb 2019 00:17:46 -0800 Subject: 4987 - support `browse_trace` tool in SubX I've extracted it into a separate binary, independent of my Mu prototype. I also cleaned up my tracing layer to be a little nicer. Major improvements: - Realized that incremental tracing really ought to be the default. And to minimize printing traces to screen. - Finally figured out how to combine layers and call stack frames in a single dimension of depth. The answer: optimize for the experience of `browse_trace`. Instructions occupy a range of depths based on their call stack frame, and minor details of an instruction lie one level deeper in each case. Other than that, I spent some time adjusting levels everywhere to make `browse_trace` useful. --- 072recipe.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to '072recipe.cc') diff --git a/072recipe.cc b/072recipe.cc index 439b2000..43b1d013 100644 --- a/072recipe.cc +++ b/072recipe.cc @@ -79,11 +79,9 @@ case CALL: { :(before "End Primitive Recipe Implementations") case CALL: { // Begin Call - if (Trace_stream) { - ++Trace_stream->callstack_depth; - trace("trace") << "indirect 'call': incrementing callstack depth to " << Trace_stream->callstack_depth << end(); - assert(Trace_stream->callstack_depth < 9000); // 9998-101 plus cushion - } + trace(Callstack_depth+1, "trace") << "indirect 'call': incrementing callstack depth to " << Callstack_depth << end(); + ++Callstack_depth; + assert(Callstack_depth < Max_depth); if (!ingredients.at(0).at(0)) { raise << maybe(current_recipe_name()) << "tried to call empty recipe in '" << to_string(current_instruction()) << "'" << end(); break; @@ -224,7 +222,7 @@ void resolve_indirect_ambiguous_call(const recipe_ordinal r, int index, instruct Transform.push_back(check_indirect_calls_against_header); // idempotent :(code) void check_indirect_calls_against_header(const recipe_ordinal r) { - trace(9991, "transform") << "--- type-check 'call' instructions inside recipe " << get(Recipe, r).name << end(); + trace(101, "transform") << "--- type-check 'call' instructions inside recipe " << get(Recipe, r).name << end(); const recipe& caller = get(Recipe, r); for (int i = 0; i < SIZE(caller.steps); ++i) { const instruction& inst = caller.steps.at(i); -- cgit 1.4.1-2-gfad0