summaryrefslogtreecommitdiff
path: root/src/binary-reader-objdump.cc
Commit message (Collapse)AuthorAgeFilesLines
...
* Consistent comments when ending anonymous namespace (#521)Sam Clegg2017-06-231-1/+1
| | | | This matches the wording preferred by llvm.
* Add parsing and objdump support for updated "linking" section (#483)Sam Clegg2017-06-221-0/+21
|
* Rewrite wabt::Opcode as C++ class (#500)Ben Smith2017-06-191-9/+8
| | | | | | | | | | | | | The class stores just one enum, so should be optimized to be passed as a register. Since it is an object, the get_opcode_* accessors can now be members: get_opcode_name(opcode) => opcode.GetName() One side-effect of this change is that the opcode enumeration does not match its binary encoding. This is a potential source of errors, but will allows us to use a contiguous set of values for the enumeration, so Opcode::GetInfo is an O(1) lookup. It will also be beneficial when adding operators with prefixed encodings.
* Remove option default macros (#508)Ben Smith2017-06-191-1/+1
|
* [objdump] Be more explict about type and element indexes (#481)Sam Clegg2017-06-071-5/+9
|
* [objdump] Split out state from ObjdumpOptions (#479)Sam Clegg2017-06-061-43/+35
| | | | | Also, use C++ constructor inheritance to avoid some boilerplate constructors.
* Use override keyword where appropriate (#467)Sam Clegg2017-06-021-115/+116
|
* Add debug names to wasm-link tests (#452)Sam Clegg2017-05-231-1/+4
| | | | | | | Also, have wasmdump list debug names for function table elements. These changes make it easier to interpret the wasm-link test outputs.
* Fix disassembly of 64-bit values in wasmdump (#446)Ben Smith2017-05-221-2/+2
| | | | | | Also change formatting of uint32_t operands (`i32.const`, `grow_memory`, `current_memory`) to `%u`. Fixes #445.
* [wasmdump] Include debug names for functions (#443)Sam Clegg2017-05-221-4/+9
|
* [wasmdump] Display function names at call sites in disassembly (#441)Sam Clegg2017-05-191-0/+11
| | | | Also print Index types as decimal rather than hex since this seems to be the convention elsewhere.
* Use Index/Address/Offset instead of uint32_t (#433)Ben Smith2017-05-151-170/+167
| | | | | | | | | | | | An `Index` is an index into one of the WebAssembly index spaces. It also is used for counts for these spaces, as well as parameter counts and result counts. An `Address` is an index into linear memory, or the size of a data region in linear memory. An `Offset` is an offset into the host's file or memory buffer. This fixes issue #322.
* Use C++ style C headers (e.g. <cstdlib>) (#431)Ben Smith2017-05-111-5/+4
|
* [wasmdump] Make export section more readable (#430)Sam Clegg2017-05-111-12/+18
|
* Update reloction names to match "spec" (#427)Sam Clegg2017-05-101-3/+3
|
* [wasmdump] Show function names along with relocations (#425)Sam Clegg2017-05-101-24/+34
|
* Add wasmdump support for start section (#420)Sam Clegg2017-05-081-0/+11
|
* wasmdump: support multiple input files (#411)Sam Clegg2017-05-031-3/+3
| | | | This mimick how objdump behaves. Also makes the code more readable.
* Improve wasmdump output for relocations and data segments (#406)Sam Clegg2017-04-251-7/+18
| | | | | | | | For data segments, print the file offsets so they match the file offsets shown when dumping relocations. For relocations, only show the addend when one is present and correctly display negative addends in the same way that objdump does (e.g. symbol_foo-0x10 and symbol_foo+0x10)
* Refactor Stream/Writer; write as C++ (#399)Ben Smith2017-04-161-6/+6
|
* Refactor wasmdump so that the disassembly pass has its own reader class (#395)Sam Clegg2017-04-051-302/+312
|
* Use 8 hex digits for wasm version rather than 6. (#391)pipcet2017-04-051-1/+1
|
* Run tests on AppVeyor (#385)Ben Smith2017-04-041-4/+12
| | | | | | | | | | | | | | | | | | Fixes issue #326. * Install target installs all executables; this is required because we don't actually know where MSVC builds its targets to * Use absolute paths when running all executables * Set `PYTHONPATH` to test directory; for some reason the Windows `sys.path` doesn't include the current script's directory * In `wasmdump`, strip the directory up to the last slash or backslash * In `wasm-interp`, Use round-to-nearest-ties-to-even when converting from uint64 to float or double * Check for backslash or slash in `get_dirname` in `wasm-interp`, when looking for modules alongside the JSON file * print floats in `wasm-interp` using `%f` not `%g`, since MSVC prints using 3 digits for exponent instead of 2 * In `run-wasm-link.py`, remove file before renaming on top of it
* Use classes + virtual functions for BinaryReader (#376)Ben Smith2017-03-301-437/+499
| | | | | | | | | | | | | | | This adds a few new classes: * BinaryReader: the abstract base class * BinaryReaderNop: implements all of BinaryReader, but does nothing * BinaryReaderLogging: logs calls through BinaryReader, and forwards to another BinaryReader Typically this means we can remove the Context structs from these implementations, since that data can just move into the BinaryReader subclasses. I also took the opportunity to rename the new member functions to MixedCase instead of snake_case, since that's more common in C++.
* wasmdump: Fix output of local names (#372)Sam Clegg2017-03-291-10/+7
| | | | | Previously we could nest the local names inside the function names, but in the new names sections the locals all come later on.
* Replace wabt::*vector with std::vector (#366)Ben Smith2017-03-221-21/+14
| | | | | | | | | | | | This propagates through a lot of code since std::vector will call constructors and destructors. In particular, this CL adds many default constructors and destructors to previously POD types. Many of them are only there to construct `Var` and `StringSlice` types, so they likely can be removed when those have their own constructors. Since unions members cannot contain constructors or destructors (without additional implementation), this CL changes those members to pointers instead. (Perhaps in a future CL these will be std::variant instead of union, so the members can be value types again.)
* wasmdump: Improve printing on relocation information (#364)Sam Clegg2017-03-221-3/+13
| | | | Print the addend and make it more clear what the different offsets mean.
* Add callback for end opcode and end of function (#358)Sam Clegg2017-03-161-0/+7
| | | | | Without this objdump doesn't show the final byte/opcode of each function.
* Fix potential one-definition-rule breaking structs (#356)Ben Smith2017-03-151-0/+4
| | | | | | | | Context is the most common potential problem here, but I noticed that wasm-link.h had some others too (DataSegment and Export). These probably aren't an issue yet, since they all have trivial constructors. As soon as we add non-trivial types to these they break though.
* Fix crash using binary reader logging with error (#351)Ben Smith2017-03-131-9/+0
| | | | | | | | | | | | | | | | When the binary logging is turned on, it can't use the `reader->on_error` directly since that function expects that the user_data is the BinaryReaderInterpreter context (for example), but it is actually the LoggingContext. To make it easier for users to use the default error handler, now they return a bool saying whether the error was handled. Some additional changes: * Add a test that uses logging and succeeds * Add a test that uses logging and has an error * Change the `run-*-interp.py` scripts to use `-t` for tracing and `-v` for logging
* Update relocation encoding to latest "spec" (#352)Sam Clegg2017-03-131-3/+9
| | | | | | | | | | | This brings wabt into line with what llvm is now producing and what is soon that land in the tool-conventions "spec" for static linking. Adds 'index' and (options) 'addend' to relocations. Define Reloc in common.h rather than once for each tool.
* binary reader API: pass module/field names to on_import_* (#348)pipcet2017-03-101-22/+16
| | | | | | | | | * pass module/field names to on_import_* simplify some code that no longer needs to store the field name in a context. * remove nop method
* Move loop variable into for loop header (#347)Ben Smith2017-03-091-7/+5
|
* Add --debug flag to wasmdump and wasm-link (#338)Sam Clegg2017-03-071-0/+1
| | | | | Enable logging in the binary reader when the --debug flag is passed to wasmdump and wasm-link
* Extensible name section support (#337)pipcet2017-03-061-3/+11
| | | | | | | | | | | | | | | | | | * support the new extensible "name" section as specified in https://github.com/WebAssembly/design/commit/cd2af4d8149b23be87cc9eabbc4a97c7029178ad * robustness, use enum class for name section subsections * fix tests to expect actual output * fix linker to parse and emit extensible name section * remove duplicated code * don't skip functions without locals when writing the local subsection * use wabt_snprintf; remove duplicated code
* Replace the Wabt/wabt prefix with a C++ namespace (#331)Ben Smith2017-03-021-243/+240
|
* Make most enumerations into enum classes (#329)Ben Smith2017-03-011-77/+80
|
* Require C++-style casts, disallow C-style casts (#320)Ben Smith2017-02-271-41/+42
|
* Remove struct and enum typedefs (#317)Ben Smith2017-02-241-2/+2
|
* Change NULL -> nullptr (#315)Ben Smith2017-02-241-6/+7
| | | Also switch to using C++11.
* Switch C files to CC files (#309)Ben Smith2017-02-231-0/+769
Mostly this involves adding additional casts. Though there are a few more substantial changes: * The default method for relocating parser stacks no longer works because Bison assumes that C++ values can't be memcpy'd. Ours can, but there's no easy way to make the generated code do the right thing, so we do it manually * Removed all uses of WabtBool and replaced with bool * Renamed all uses of export and mutable -> export_ and mutable_ * Casting an invalid value to an enum triggers ubsan, so we have to be a little more careful about when we do it (see binary-reader.c:read_sections()) * It's illegal to forward-declare enums, so we just #include instead. * Designated initializers are not allowed in g++, so we have to switch them to lazily initialized structures instead. Pretty horrible, so it will be nice to have a better solution for C++.