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. --- 089scenario_filesystem.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to '089scenario_filesystem.cc') diff --git a/089scenario_filesystem.cc b/089scenario_filesystem.cc index bacb61be..b0429ea7 100644 --- a/089scenario_filesystem.cc +++ b/089scenario_filesystem.cc @@ -208,24 +208,24 @@ void construct_resources_object(const map& contents) { for (map::const_iterator p = contents.begin(); p != contents.end(); ++p) { ++curr; // skip alloc id of resource.name put(Memory, curr, new_mu_text(p->first)); - trace("mem") << "storing file name " << get(Memory, curr) << " in location " << curr << end(); + trace(Callstack_depth+1, "mem") << "storing file name " << get(Memory, curr) << " in location " << curr << end(); ++curr; ++curr; // skip alloc id of resource.contents put(Memory, curr, new_mu_text(p->second)); - trace("mem") << "storing file contents " << get(Memory, curr) << " in location " << curr << end(); + trace(Callstack_depth+1, "mem") << "storing file contents " << get(Memory, curr) << " in location " << curr << end(); ++curr; } curr = resources_data_address + /*skip alloc id of resources.data*/1; put(Memory, curr, SIZE(contents)); // array length - trace("mem") << "storing resources size " << get(Memory, curr) << " in location " << curr << end(); + trace(Callstack_depth+1, "mem") << "storing resources size " << get(Memory, curr) << " in location " << curr << end(); // wrap the resources data in a 'resources' object int resources_address = allocate(size_of_resources()); curr = resources_address+/*alloc id*/1+/*offset of 'data' element*/1+/*skip alloc id of 'data' element*/1; put(Memory, curr, resources_data_address); - trace("mem") << "storing resources data address " << resources_data_address << " in location " << curr << end(); + trace(Callstack_depth+1, "mem") << "storing resources data address " << resources_data_address << " in location " << curr << end(); // save in product put(Memory, RESOURCES+/*skip alloc id*/1, resources_address); - trace("mem") << "storing resources address " << resources_address << " in location " << RESOURCES << end(); + trace(Callstack_depth+1, "mem") << "storing resources address " << resources_address << " in location " << RESOURCES << end(); } int size_of_resources() { -- cgit 1.4.1-2-gfad0