diff options
Diffstat (limited to 'src/binary-reader-objdump.cc')
-rw-r--r-- | src/binary-reader-objdump.cc | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/binary-reader-objdump.cc b/src/binary-reader-objdump.cc index 52e6d27a..80850541 100644 --- a/src/binary-reader-objdump.cc +++ b/src/binary-reader-objdump.cc @@ -548,6 +548,8 @@ class BinaryReaderObjdumpDisassemble : public BinaryReaderObjdumpBase { Result OnOpcodeBlockSig(Type sig_type) override; Result OnOpcodeType(Type type) override; + Result OnTryTableExpr(Type sig_type, + const CatchClauseVector& catches) override; Result OnBrTableExpr(Index num_targets, Index* target_depths, Index default_target_depth) override; @@ -903,6 +905,50 @@ Result BinaryReaderObjdumpDisassemble::OnOpcodeType(Type type) { return Result::Ok; } +Result BinaryReaderObjdumpDisassemble::OnTryTableExpr( + Type sig_type, + const CatchClauseVector& catches) { + if (!in_function_body) { + return Result::Ok; + } + + std::string buffer = std::string(); + + if (sig_type != Type::Void) { + buffer.append(BlockSigToString(sig_type).c_str()).append(" "); + } + + for (auto& catch_ : catches) { + switch (catch_.kind) { + case CatchKind::Catch: + buffer.append("catch "); + break; + case CatchKind::CatchRef: + buffer.append("catch_ref "); + break; + case CatchKind::CatchAll: + buffer.append("catch_all "); + break; + case CatchKind::CatchAllRef: + buffer.append("catch_all_ref "); + break; + } + if (catch_.kind == CatchKind::Catch || catch_.kind == CatchKind::CatchRef) { + buffer.append(std::to_string(catch_.tag)); + } + buffer.append(" ").append(std::to_string(catch_.depth)).append(" "); + } + + if (!buffer.empty()) { + // remove trailing space + buffer.pop_back(); + } + + LogOpcode("%s", buffer.c_str()); + indent_level++; + return Result::Ok; +} + Result BinaryReaderObjdumpDisassemble::OnBrTableExpr( Index num_targets, Index* target_depths, |