| 4111 | } |
| 4112 | |
| 4113 | void print_trace(std::ostream& os, const ResolvedTrace& trace, Colorize& colorize) |
| 4114 | { |
| 4115 | os << "#" << std::left << std::setw(2) << trace.idx << std::right; |
| 4116 | bool already_indented = true; |
| 4117 | |
| 4118 | if (!trace.source.filename.size() || object) { |
| 4119 | os << " Object \"" << trace.object_filename << "\", at " << trace.addr << ", in " << trace.object_function |
| 4120 | << "\n"; |
| 4121 | already_indented = false; |
| 4122 | } |
| 4123 | |
| 4124 | for (size_t inliner_idx = trace.inliners.size(); inliner_idx > 0; --inliner_idx) { |
| 4125 | if (!already_indented) { |
| 4126 | os << " "; |
| 4127 | } |
| 4128 | const ResolvedTrace::SourceLoc& inliner_loc = trace.inliners[inliner_idx - 1]; |
| 4129 | print_source_loc(os, " | ", inliner_loc); |
| 4130 | if (snippet) { |
| 4131 | print_snippet(os, " | ", inliner_loc, colorize, Color::purple, inliner_context_size); |
| 4132 | } |
| 4133 | already_indented = false; |
| 4134 | } |
| 4135 | |
| 4136 | if (trace.source.filename.size()) { |
| 4137 | if (!already_indented) { |
| 4138 | os << " "; |
| 4139 | } |
| 4140 | print_source_loc(os, " ", trace.source, trace.addr); |
| 4141 | if (snippet) { |
| 4142 | print_snippet(os, " ", trace.source, colorize, Color::yellow, trace_context_size); |
| 4143 | } |
| 4144 | } |
| 4145 | } |
| 4146 | |
| 4147 | void print_snippet( |
| 4148 | std::ostream& os, |