summaryrefslogtreecommitdiff
path: root/src/binary-reader-objdump.cc
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2018-08-27 16:16:06 -0700
committerBen Smith <binjimin@gmail.com>2018-08-27 16:16:06 -0700
commit8af3902b8a4c65c5a9abf1a0194a71846c640586 (patch)
tree21ebe80be7990c271dc567e04624ab5ace25dca9 /src/binary-reader-objdump.cc
parent3f574198cf65bca02f4eb657ed9652d006b6e690 (diff)
downloadwabt-8af3902b8a4c65c5a9abf1a0194a71846c640586.tar.gz
wabt-8af3902b8a4c65c5a9abf1a0194a71846c640586.tar.bz2
wabt-8af3902b8a4c65c5a9abf1a0194a71846c640586.zip
[objdump] Display element count in section details (#899)
Diffstat (limited to 'src/binary-reader-objdump.cc')
-rw-r--r--src/binary-reader-objdump.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/binary-reader-objdump.cc b/src/binary-reader-objdump.cc
index 0377ec50..cec37772 100644
--- a/src/binary-reader-objdump.cc
+++ b/src/binary-reader-objdump.cc
@@ -831,9 +831,13 @@ Result BinaryReaderObjdump::BeginSection(BinarySection section_code,
name, state->offset, state->offset + size, size);
break;
case ObjdumpMode::Details:
- if (section_match) {
- if (section_code != BinarySection::Code) {
- printf("%s:\n", name);
+ if (section_match && section_code != BinarySection::Code) {
+ printf("%s", name);
+ // All known section types except the start section have a count
+ // in which case this line gets completed in OnCount().
+ if (section_code == BinarySection::Start ||
+ section_code == BinarySection::Custom) {
+ printf(":\n");
}
print_details_ = true;
} else {
@@ -875,6 +879,8 @@ void WABT_PRINTF_FORMAT(2, 3) BinaryReaderObjdump::PrintDetails(const char* fmt,
Result BinaryReaderObjdump::OnCount(Index count) {
if (options_->mode == ObjdumpMode::Headers) {
printf("count: %" PRIindex "\n", count);
+ } else if (options_->mode == ObjdumpMode::Details && print_details_) {
+ printf("[%" PRIindex "]:\n", count);
}
return Result::Ok;
}