diff options
author | Rod Vagg <rod@vagg.org> | 2024-01-04 17:11:25 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-03 22:11:25 -0800 |
commit | 118fb9b274dd11f7a896412046f9e599e1a58681 (patch) | |
tree | 03dc63f0e79d27cc8bd444e07a744aa385ada1ef /src | |
parent | b85ecbec261ff7e84351505da3b2c45d9ea8d3c7 (diff) | |
download | wabt-118fb9b274dd11f7a896412046f9e599e1a58681.tar.gz wabt-118fb9b274dd11f7a896412046f9e599e1a58681.tar.bz2 wabt-118fb9b274dd11f7a896412046f9e599e1a58681.zip |
Handle zero local count in disassembly (#2359)
Previously: local[0..4294967295]
Current: local[]
Diffstat (limited to 'src')
-rw-r--r-- | src/binary-reader-objdump.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/binary-reader-objdump.cc b/src/binary-reader-objdump.cc index b1335f68..488ff1d2 100644 --- a/src/binary-reader-objdump.cc +++ b/src/binary-reader-objdump.cc @@ -635,13 +635,15 @@ Result BinaryReaderObjdumpDisassemble::OnLocalDecl(Index decl_index, for (size_t i = data_size; i < IMMEDIATE_OCTET_COUNT; i++) { printf(" "); } - printf(" | local[%" PRIindex, local_index_); + printf(" | local["); + if (count > 0) { + printf("%" PRIindex, local_index_); - if (count != 1) { - printf("..%" PRIindex "", local_index_ + count - 1); + if (count != 1) { + printf("..%" PRIindex "", local_index_ + count - 1); + } + local_index_ += count; } - local_index_ += count; - printf("] type=%s\n", type.GetName().c_str()); last_opcode_end = current_opcode_offset + data_size; |