diff options
author | Sam Clegg <sbc@chromium.org> | 2018-03-06 19:15:03 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-06 19:15:03 -0800 |
commit | 39193c96e4ba05393e045548727fca616a9c47ad (patch) | |
tree | 9dc0492934210af4f186a6658d7fb6423c43d94d /src/binary-reader-objdump.cc | |
parent | 527b1d973d7a82a391a694757a5aa5b911fa30a7 (diff) | |
download | wabt-39193c96e4ba05393e045548727fca616a9c47ad.tar.gz wabt-39193c96e4ba05393e045548727fca616a9c47ad.tar.bz2 wabt-39193c96e4ba05393e045548727fca616a9c47ad.zip |
objdump: Use the export name for a function if one exists (#796)
Diffstat (limited to 'src/binary-reader-objdump.cc')
-rw-r--r-- | src/binary-reader-objdump.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/binary-reader-objdump.cc b/src/binary-reader-objdump.cc index dd01b7af..724c4a9f 100644 --- a/src/binary-reader-objdump.cc +++ b/src/binary-reader-objdump.cc @@ -191,6 +191,15 @@ class BinaryReaderObjdumpPrepass : public BinaryReaderObjdumpBase { return Result::Ok; } + Result OnExport(Index index, + ExternalKind kind, + Index item_index, + string_view name) override { + if (kind == ExternalKind::Func) + SetFunctionName(item_index, name); + return Result::Ok; + } + Result OnReloc(RelocType type, Offset offset, Index index, @@ -202,7 +211,8 @@ class BinaryReaderObjdumpPrepass : public BinaryReaderObjdumpBase { void BinaryReaderObjdumpPrepass::SetFunctionName(Index index, string_view name) { - objdump_state_->function_names.resize(index + 1); + if (objdump_state_->function_names.size() <= index) + objdump_state_->function_names.resize(index + 1); objdump_state_->function_names[index] = name.to_string(); } |