Skip to content

Commit

Permalink
Merge branch 'master' into ventuzelo/validate-wasm-fuzzer
Browse files Browse the repository at this point in the history
  • Loading branch information
pventuzelo authored Sep 3, 2019
2 parents afa6d6f + 777833e commit 7680c0e
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 35 deletions.
58 changes: 29 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions docs/debugging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Debugging Wasmer

## When is this document useful?

If you're developing wasmer or running into issues, this document will explain to useful techniques and common errors.

## Tracing syscalls

To trace syscalls, compile with the `debug` feature (`cargo build --features "debug"`). For even more verbose messages, use the `trace` flag.

## Tracing calls

TODO: did we disable tracing calls? if not talk about how to enable it
TODO: someone with more context on the backends mention which backends this works for

If you'd like to see all calls and you're using emscripten, you can use a symbol map to get better error output with the `em-symbol-map` flag.

## Common things that can go wrong

### Missing imports

If, when attempting to run a wasm module, you get an error about missing imports there are a number of things that could be going wrong.

The most likely is that we haven't implemented those imports for your ABI. If you're targeting emscripten, this is probably the issue.

However if that's not the case, then there's a chance that you're using an unsupported ABI (let us know!) or that the wasm is invalid for the detected ABI. (TODO: link to wasm contracts or something)

### Hitting `undefined`

If this happens it's because wasmer does not have full support for whatever feature you tried to use. Running with tracing on can help clarify the issue if it's not clear from the message.

To fix this, file an issue letting us know that wasmer is missing a feature that's important to you. If you'd like, you can try to implement it yourself and send us a PR.

### No output

If you're seeing no output from running the wasm module then it may be that:
- this is the intended behavior of the wasm module
- or it's very slow to compile (try compiling with a faster backend like cranelift (the default) or singlepass (requires nightly))

### Segfault

If you're seeing a segfault while developing wasmer, chances are that it's a cache issue. We reset the cache on every version bump, but if you're running it from source then the cache may become invalid, which can lead to segfaults.

To fix this delete the cache with `wasmer cache clean` or run the command with the `disable-cache` flag (`wasmer run some.wasm --disable-cache`)

If you're seeing a segfault with a released version of wasmer, please file an issue so we can ship an updated version as soon as possible.

### Something else

If none of this has helped with your issue, let us know and we'll do our best to help.
2 changes: 1 addition & 1 deletion lib/clif-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ version = "0.11.2"
version = "0.0.7"

[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.7", features = ["errhandlingapi", "minwindef", "minwinbase", "winnt"] }
winapi = { version = "0.3.8", features = ["errhandlingapi", "minwindef", "minwinbase", "winnt"] }
wasmer-win-exception-handler = { path = "../win-exception-handler", version = "0.6.0" }

[features]
Expand Down
2 changes: 1 addition & 1 deletion lib/llvm-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ features = ["llvm8-0", "target-x86"]
nix = "0.15.0"

[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.7", features = ["memoryapi"] }
winapi = { version = "0.3.8", features = ["memoryapi"] }

[build-dependencies]
cc = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion lib/runtime-c-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ llvm-backend = ["wasmer-runtime/llvm", "wasmer-runtime/default-backend-llvm"]
singlepass-backend = ["wasmer-runtime/singlepass", "wasmer-runtime/default-backend-singlepass"]

[build-dependencies]
cbindgen = "0.9.0"
cbindgen = "0.9.1"
2 changes: 1 addition & 1 deletion lib/runtime-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ version = "0.5.6"
version = "0.8.1"

[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.7", features = ["memoryapi"] }
winapi = { version = "0.3.8", features = ["memoryapi"] }

[dev-dependencies]
field-offset = "0.1.1"
Expand Down
2 changes: 1 addition & 1 deletion lib/wasi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ byteorder = "1.3.2"
time = "0.1.42"

[target.'cfg(windows)'.dependencies]
winapi = "0.3.7"
winapi = "0.3.8"
2 changes: 1 addition & 1 deletion lib/win-exception-handler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition = "2018"

[target.'cfg(windows)'.dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.6.0" }
winapi = { version = "0.3.7", features = ["winbase", "errhandlingapi", "minwindef", "minwinbase", "winnt"] }
winapi = { version = "0.3.8", features = ["winbase", "errhandlingapi", "minwindef", "minwinbase", "winnt"] }
libc = "0.2.60"

[build-dependencies]
Expand Down

0 comments on commit 7680c0e

Please sign in to comment.