summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2018-11-29 14:30:06 -0800
committerGitHub <noreply@github.com>2018-11-29 14:30:06 -0800
commit6b93a50cf1e3750f0b7a0e4290c73dc202e0ce6a (patch)
treee2bbfa65adbbf7485fc148d248a187daf7ee11f7 /src
parent451edf63ed251b7438173dd88a224890c47a0872 (diff)
downloadwabt-6b93a50cf1e3750f0b7a0e4290c73dc202e0ce6a.tar.gz
wabt-6b93a50cf1e3750f0b7a0e4290c73dc202e0ce6a.tar.bz2
wabt-6b93a50cf1e3750f0b7a0e4290c73dc202e0ce6a.zip
wasm-objdump: Cleanup hanlding of global names from #960 (#963)
This is way I should have implement it the first time around
Diffstat (limited to 'src')
-rw-r--r--src/binary-reader-objdump.cc16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/binary-reader-objdump.cc b/src/binary-reader-objdump.cc
index ddd2d7b9..7653d105 100644
--- a/src/binary-reader-objdump.cc
+++ b/src/binary-reader-objdump.cc
@@ -483,21 +483,9 @@ void BinaryReaderObjdumpDisassemble::LogOpcode(size_t data_size,
if (fmt) {
printf(" ");
va_list args;
- va_list args_copy;
va_start(args, fmt);
- va_copy(args_copy, args);
vprintf(fmt, args);
va_end(args);
-
- if (current_opcode == Opcode::GetGlobal ||
- current_opcode == Opcode::SetGlobal) {
- int global_index = va_arg(args_copy, int);
- if (const char* name = GetGlobalName(global_index)) {
- printf(" <%s>", name);
- }
- }
-
- va_end(args_copy);
}
}
@@ -529,6 +517,10 @@ Result BinaryReaderObjdumpDisassemble::OnOpcodeIndex(Index value) {
const char* name;
if (current_opcode == Opcode::Call && (name = GetFunctionName(value))) {
LogOpcode(immediate_len, "%d <%s>", value, name);
+ } else if ((current_opcode == Opcode::GetGlobal ||
+ current_opcode == Opcode::SetGlobal) &&
+ (name = GetGlobalName(value))) {
+ LogOpcode(immediate_len, "%d <%s>", value, name);
} else {
LogOpcode(immediate_len, "%d", value);
}