about summary refs log tree commit diff stats
path: root/089scenario_filesystem.cc
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-02-25 00:17:46 -0800
committerKartik Agaram <vc@akkartik.com>2019-02-25 01:50:53 -0800
commitc442a5ad806b6cccbb3ec4c5744b14b0c1f31a01 (patch)
tree318fb1d56e7ee3c750635d3326ad0739dfdacefe /089scenario_filesystem.cc
parente5998f74ac29bb4bf2aedfdd6fbea801ffdb08f6 (diff)
downloadmu-c442a5ad806b6cccbb3ec4c5744b14b0c1f31a01.tar.gz
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.
Diffstat (limited to '089scenario_filesystem.cc')
-rw-r--r--089scenario_filesystem.cc10
1 files changed, 5 insertions, 5 deletions
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<string, string>& contents) {
   for (map<string, string>::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() {