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. --- subx/034compute_segment_address.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'subx/034compute_segment_address.cc') diff --git a/subx/034compute_segment_address.cc b/subx/034compute_segment_address.cc index 2798e040..79c6e45d 100644 --- a/subx/034compute_segment_address.cc +++ b/subx/034compute_segment_address.cc @@ -31,7 +31,7 @@ Currently_parsing_segment_index = -1; if (!starts_with(segment_title, "0x")) { Currently_parsing_named_segment = true; if (!contains_key(Segment_index, segment_title)) { - trace(99, "parse") << "new segment '" << segment_title << "'" << end(); + trace(3, "parse") << "new segment '" << segment_title << "'" << end(); if (out.segments.empty() && segment_title != "code") { raise << "first segment must be 'code' but is '" << segment_title << "'\n" << end(); return; @@ -44,7 +44,7 @@ if (!starts_with(segment_title, "0x")) { out.segments.push_back(segment()); } else { - trace(99, "parse") << "appending to segment '" << segment_title << "'" << end(); + trace(3, "parse") << "appending to segment '" << segment_title << "'" << end(); } Currently_parsing_segment_index = get(Segment_index, segment_title); } @@ -52,7 +52,7 @@ if (!starts_with(segment_title, "0x")) { :(before "End flush(p, lines) Special-cases") if (Currently_parsing_named_segment) { assert(!p.segments.empty()); - trace(99, "parse") << "flushing segment" << end(); + trace(3, "parse") << "flushing segment" << end(); vector& curr_segment_data = p.segments.at(Currently_parsing_segment_index).lines; curr_segment_data.insert(curr_segment_data.end(), lines.begin(), lines.end()); lines.clear(); @@ -107,7 +107,7 @@ Transform.push_back(compute_segment_starts); :(code) void compute_segment_starts(program& p) { - trace(99, "transform") << "-- compute segment addresses" << end(); + trace(3, "transform") << "-- compute segment addresses" << end(); uint32_t p_offset = /*size of ehdr*/0x34 + SIZE(p.segments)*0x20/*size of each phdr*/; for (size_t i = 0; i < p.segments.size(); ++i) { segment& curr = p.segments.at(i); -- cgit 1.4.1-2-gfad0