summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2017-09-14 19:05:05 -0700
committerBen Smith <binjimin@gmail.com>2017-09-14 19:05:05 -0700
commit18f7772c47f0720fbaa38a01e6892826705ec26f (patch)
treed3d854b48a1dd28e3f9660e2d124e25aa6da2bfb /src
parent7a0bf623e2b69621fa45f2d194c9dd6233086203 (diff)
downloadwabt-18f7772c47f0720fbaa38a01e6892826705ec26f.tar.gz
wabt-18f7772c47f0720fbaa38a01e6892826705ec26f.tar.bz2
wabt-18f7772c47f0720fbaa38a01e6892826705ec26f.zip
Enable all reader features in objdump (#628)
Objdump should really make a best effort to display anything its given. There are other tools that are better suited for validation.
Diffstat (limited to 'src')
-rw-r--r--src/binary-reader-objdump.cc7
-rw-r--r--src/binary-reader-objdump.h1
-rw-r--r--src/feature.h6
-rw-r--r--src/tools/wasm-objdump.cc4
4 files changed, 9 insertions, 9 deletions
diff --git a/src/binary-reader-objdump.cc b/src/binary-reader-objdump.cc
index 80196ce6..67b27cdc 100644
--- a/src/binary-reader-objdump.cc
+++ b/src/binary-reader-objdump.cc
@@ -1127,10 +1127,9 @@ Result ReadBinaryObjdump(const uint8_t* data,
size_t size,
ObjdumpOptions* options,
ObjdumpState* state) {
- ReadBinaryOptions read_options;
- read_options.read_debug_names = true;
- read_options.log_stream = options->log_stream;
- read_options.features = options->features;
+ Features features;
+ features.EnableAll();
+ ReadBinaryOptions read_options(features, options->log_stream, true);
switch (options->mode) {
case ObjdumpMode::Prepass: {
diff --git a/src/binary-reader-objdump.h b/src/binary-reader-objdump.h
index 7bd09fb7..d07696d2 100644
--- a/src/binary-reader-objdump.h
+++ b/src/binary-reader-objdump.h
@@ -45,7 +45,6 @@ struct ObjdumpOptions {
bool disassemble;
bool debug;
bool relocs;
- Features features;
ObjdumpMode mode;
const char* filename;
const char* section_name;
diff --git a/src/feature.h b/src/feature.h
index 6577b71e..c563a45e 100644
--- a/src/feature.h
+++ b/src/feature.h
@@ -27,6 +27,12 @@ class Features {
public:
void AddOptions(OptionParser*);
+ void EnableAll() {
+#define WABT_FEATURE(variable, flag, help) enable_##variable();
+#include "src/feature.def"
+#undef WABT_FEATURE
+ }
+
#define WABT_FEATURE(variable, flag, help) \
bool variable##_enabled() const { return variable##_enabled_; } \
void enable_##variable() { variable##_enabled_ = true; }
diff --git a/src/tools/wasm-objdump.cc b/src/tools/wasm-objdump.cc
index 64ecef6d..5b907fc0 100644
--- a/src/tools/wasm-objdump.cc
+++ b/src/tools/wasm-objdump.cc
@@ -19,7 +19,6 @@
#include <cstring>
#include "src/common.h"
-#include "src/feature.h"
#include "src/option-parser.h"
#include "src/stream.h"
#include "src/binary-reader.h"
@@ -35,7 +34,6 @@ examples:
)";
static ObjdumpOptions s_objdump_options;
-static Features s_features;
static std::vector<const char*> s_infiles;
@@ -58,7 +56,6 @@ static void ParseOptions(int argc, char** argv) {
s_log_stream = FileStream::CreateStdout();
s_objdump_options.log_stream = s_log_stream.get();
});
- s_features.AddOptions(&parser);
parser.AddOption('x', "details", "Show section details",
[]() { s_objdump_options.details = true; });
parser.AddOption('r', "reloc", "Show relocations inline with disassembly",
@@ -81,7 +78,6 @@ Result dump_file(const char* filename) {
// Perform serveral passed over the binary in order to print out different
// types of information.
s_objdump_options.filename = filename;
- s_objdump_options.features = s_features;
printf("\n");
ObjdumpState state;