diff options
author | Kartik Agaram <vc@akkartik.com> | 2019-02-25 00:17:46 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2019-02-25 01:50:53 -0800 |
commit | c442a5ad806b6cccbb3ec4c5744b14b0c1f31a01 (patch) | |
tree | 318fb1d56e7ee3c750635d3326ad0739dfdacefe /085scenario_console.cc | |
parent | e5998f74ac29bb4bf2aedfdd6fbea801ffdb08f6 (diff) | |
download | mu-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 '085scenario_console.cc')
-rw-r--r-- | 085scenario_console.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/085scenario_console.cc b/085scenario_console.cc index 31aa4fe7..af6e44c2 100644 --- a/085scenario_console.cc +++ b/085scenario_console.cc @@ -66,7 +66,7 @@ case ASSUME_CONSOLE: { for (int i = 0; i < SIZE(r.steps); ++i) { const instruction& inst = r.steps.at(i); if (inst.name == "left-click") { - trace("mem") << "storing 'left-click' event starting at " << Current_routine->alloc << end(); + trace(Callstack_depth+1, "mem") << "storing 'left-click' event starting at " << Current_routine->alloc << end(); put(Memory, curr_address, /*tag for 'touch-event' variant of 'event' exclusive-container*/2); put(Memory, curr_address+/*skip tag*/1+/*offset of 'type' in 'mouse-event'*/0, TB_KEY_MOUSE_LEFT); put(Memory, curr_address+/*skip tag*/1+/*offset of 'row' in 'mouse-event'*/1, to_integer(inst.ingredients.at(0).name)); @@ -74,7 +74,7 @@ case ASSUME_CONSOLE: { curr_address += size_of_event(); } else if (inst.name == "press") { - trace("mem") << "storing 'press' event starting at " << curr_address << end(); + trace(Callstack_depth+1, "mem") << "storing 'press' event starting at " << curr_address << end(); string key = inst.ingredients.at(0).name; if (is_integer(key)) put(Memory, curr_address+1, to_integer(key)); @@ -95,18 +95,18 @@ case ASSUME_CONSOLE: { else { // keyboard input assert(inst.name == "type"); - trace("mem") << "storing 'type' event starting at " << curr_address << end(); + trace(Callstack_depth+1, "mem") << "storing 'type' event starting at " << curr_address << end(); const string& contents = inst.ingredients.at(0).name; const char* raw_contents = contents.c_str(); int num_keyboard_events = unicode_length(contents); int curr = 0; for (int i = 0; i < num_keyboard_events; ++i) { - trace("mem") << "storing 'text' tag at " << curr_address << end(); + trace(Callstack_depth+1, "mem") << "storing 'text' tag at " << curr_address << end(); put(Memory, curr_address, /*tag for 'text' variant of 'event' exclusive-container*/0); uint32_t curr_character; assert(curr < SIZE(contents)); tb_utf8_char_to_unicode(&curr_character, &raw_contents[curr]); - trace("mem") << "storing character " << curr_character << " at " << curr_address+/*skip exclusive container tag*/1 << end(); + trace(Callstack_depth+1, "mem") << "storing character " << curr_character << " at " << curr_address+/*skip exclusive container tag*/1 << end(); put(Memory, curr_address+/*skip exclusive container tag*/1, curr_character); curr += tb_utf8_char_length(raw_contents[curr]); curr_address += size_of_event(); @@ -116,9 +116,9 @@ case ASSUME_CONSOLE: { assert(curr_address == event_data_address+/*skip alloc id*/1+size); // wrap the array of events in a console object int console_address = allocate(size_of_console()); - trace("mem") << "storing console in " << console_address << end(); + trace(Callstack_depth+1, "mem") << "storing console in " << console_address << end(); put(Memory, CONSOLE+/*skip alloc id*/1, console_address); - trace("mem") << "storing console data in " << console_address+/*offset of 'data' in container 'events'*/1 << end(); + trace(Callstack_depth+1, "mem") << "storing console data in " << console_address+/*offset of 'data' in container 'events'*/1 << end(); put(Memory, console_address+/*skip alloc id*/1+/*offset of 'data' in container 'events'*/1+/*skip alloc id of 'data'*/1, event_data_address); break; } |