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 /038new_text.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 '038new_text.cc')
-rw-r--r-- | 038new_text.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/038new_text.cc b/038new_text.cc index 7e3c02f6..10b819a3 100644 --- a/038new_text.cc +++ b/038new_text.cc @@ -31,7 +31,7 @@ if (inst.name == "new" && !inst.ingredients.empty() && is_literal_text(inst.ingr products.resize(1); products.at(0).push_back(/*alloc id*/0); products.at(0).push_back(new_mu_text(current_instruction().ingredients.at(0).name)); - trace("mem") << "new string alloc: " << products.at(0).at(0) << end(); + trace(Callstack_depth+1, "mem") << "new string alloc: " << products.at(0).at(0) << end(); break; } @@ -44,7 +44,7 @@ int new_mu_text(const string& contents) { int result = allocate(/*array length*/1 + string_length); int curr_address = result; ++curr_address; // skip alloc id - trace("mem") << "storing string length " << string_length << " in location " << curr_address << end(); + trace(Callstack_depth+1, "mem") << "storing string length " << string_length << " in location " << curr_address << end(); put(Memory, curr_address, string_length); ++curr_address; // skip length int curr = 0; @@ -53,7 +53,7 @@ int new_mu_text(const string& contents) { uint32_t curr_character; assert(curr < SIZE(contents)); tb_utf8_char_to_unicode(&curr_character, &raw_contents[curr]); - trace("mem") << "storing string character " << curr_character << " in location " << curr_address << end(); + trace(Callstack_depth+1, "mem") << "storing string character " << curr_character << " in location " << curr_address << end(); put(Memory, curr_address, curr_character); curr += tb_utf8_char_length(raw_contents[curr]); ++curr_address; |