From 99be02a28d9d810d101d85f6ed552fc2754e1fd8 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Fri, 2 Jul 2010 08:15:27 -0700 Subject: [PATCH] Indent/outdent when logging dwarf at runtime. --- src/rt/rust_crate_reader.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/rt/rust_crate_reader.cpp b/src/rt/rust_crate_reader.cpp index 3c36729ff26..ece0281c5d9 100644 --- a/src/rt/rust_crate_reader.cpp +++ b/src/rt/rust_crate_reader.cpp @@ -255,6 +255,7 @@ rust_crate_reader::die::die(die_reader *rdr, uintptr_t off) if (!ab_idx) { ab = NULL; dom->log(rust_log::DWARF, "DIE <0x%" PRIxPTR "> (null)", off); + dom->get_log().outdent(); } else { ab = rdr->abbrevs.get_abbrev(ab_idx); dom->log(rust_log::DWARF, "DIE <0x%" PRIxPTR "> abbrev 0x%" @@ -451,19 +452,21 @@ rust_crate_reader::die::next() const { rdr_sess use(rdr); if (start_attrs()) { - attr a; - while (step_attr(a)) { - I(dom, !(a.is_numeric() && a.is_string())); - if (a.is_numeric()) - dom->log(rust_log::DWARF, " attr num: 0x%" - PRIxPTR, a.get_num(dom)); - else if (a.is_string()) - dom->log(rust_log::DWARF, " attr str: %s", - a.get_str(dom)); - else - dom->log(rust_log::DWARF, " attr ??:"); - } + attr a; + while (step_attr(a)) { + I(dom, !(a.is_numeric() && a.is_string())); + if (a.is_numeric()) + dom->log(rust_log::DWARF, " attr num: 0x%" + PRIxPTR, a.get_num(dom)); + else if (a.is_string()) + dom->log(rust_log::DWARF, " attr str: %s", + a.get_str(dom)); + else + dom->log(rust_log::DWARF, " attr ??:"); + } } + if (has_children()) + dom->get_log().indent(); } return die(rdr, rdr->tell_off()); }