diff options
Diffstat (limited to 'src/binary-reader-objdump.cc')
-rw-r--r-- | src/binary-reader-objdump.cc | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/src/binary-reader-objdump.cc b/src/binary-reader-objdump.cc index 949e1dde..2ffed911 100644 --- a/src/binary-reader-objdump.cc +++ b/src/binary-reader-objdump.cc @@ -70,6 +70,7 @@ BinaryReaderObjdumpBase::BinaryReaderObjdumpBase(const uint8_t* data, data(data), size(size) { ZeroMemory(section_starts); + BinaryReaderNop::allow_future_exceptions = options->allow_future_exceptions; } Result BinaryReaderObjdumpBase::BeginSection(BinarySection section_code, @@ -260,8 +261,14 @@ void BinaryReaderObjdumpDisassemble::LogOpcode(const uint8_t* data, // Print disassemble int indent_level = this->indent_level; - if (current_opcode == Opcode::Else) - indent_level--; + switch (current_opcode) { + case Opcode::Else: + case Opcode::Catch: + case Opcode::CatchAll: + indent_level--; + default: + break; + } for (int j = 0; j < indent_level; j++) { printf(" "); } @@ -464,6 +471,12 @@ class BinaryReaderObjdump : public BinaryReaderObjdumpBase { Index global_index, Type type, bool mutable_) override; + Result OnImportException(Index import_index, + StringSlice module_name, + StringSlice field_name, + Index except_index, + TypeVector& sig) override; + Result OnFunctionCount(Index count) override; Result OnFunction(Index index, Index sig_index) override; @@ -532,6 +545,9 @@ class BinaryReaderObjdump : public BinaryReaderObjdumpBase { Result OnSymbolInfoCount(Index count) override; Result OnSymbolInfo(StringSlice name, uint32_t flags) override; + Result OnExceptionCount(Index count) override; + Result OnExceptionType(Index index, TypeVector& sig) override; + private: bool ShouldPrintDetails(); void PrintDetails(const char* fmt, ...); @@ -752,6 +768,24 @@ Result BinaryReaderObjdump::OnImportGlobal(Index import_index, return Result::Ok; } +Result BinaryReaderObjdump::OnImportException(Index import_index, + StringSlice module_name, + StringSlice field_name, + Index except_index, + TypeVector& sig) { + PrintDetails(" - except[%" PRIindex "] (", except_index); + for (Index i = 0; i < sig.size(); ++i) { + if (i != 0) { + PrintDetails(", "); + } + PrintDetails("%s", type_name(sig[i])); + } + PrintDetails(") <- " PRIstringslice "." PRIstringslice "\n", + WABT_PRINTF_STRING_SLICE_ARG(module_name), + WABT_PRINTF_STRING_SLICE_ARG(field_name)); + return Result::Ok; +} + Result BinaryReaderObjdump::OnMemoryCount(Index count) { return OnCount(count); } @@ -1042,6 +1076,25 @@ Result BinaryReaderObjdump::OnSymbolInfo(StringSlice name, return Result::Ok; } +Result BinaryReaderObjdump::OnExceptionCount(Index count) { + return OnCount(count); +} + +Result BinaryReaderObjdump::OnExceptionType( + Index index, TypeVector& sig) { + if (!ShouldPrintDetails()) + return Result::Ok; + printf(" - except[%" PRIindex "] (", index); + for (Index i = 0; i < sig.size(); ++i) { + if (i != 0) { + printf(", "); + } + printf("%s", type_name(sig[i])); + } + printf(")\n"); + return Result::Ok; +} + } // end anonymous namespace Result read_binary_objdump(const uint8_t* data, @@ -1051,6 +1104,7 @@ Result read_binary_objdump(const uint8_t* data, ReadBinaryOptions read_options; read_options.read_debug_names = true; read_options.log_stream = options->log_stream; + read_options.allow_future_exceptions = options->allow_future_exceptions; switch (options->mode) { case ObjdumpMode::Prepass: { |