bytecodealliance / bytecodealliance/wasmtime

Attach debug info from source language

Open
#8,658 9 comments 0 reactions 0 assignees View on GitHub
wasmtime:debugging
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 18h
Merged PRs (30d)
126

Description

#### Feature

Currently, `wasmtime`'s error in wat text files are based on the compilation offset.

When an error occurs, it is very confusing where the error occurred.

I would like to attach some source language location information to point out the error location.

Similar to:

```wat
;; @url: file://path/position.wasm:line:column
(type $test-type (externref))
;; @url: file://path/position.wasm:offset
(func $test-function
;; @file: main.rs:12:24
(block $test-block

)
)
```

`binaryen` supports similar features
at: https://github.com/WebAssembly/binaryen/blob/921644ca65afbafb84fb82d58dacc4a028e2d720/test/lit/debug/full.wat#L49-L64

#### Benefit

Clearer error location

#### Implementation

Unknown, perhaps we can parse custom instructions and mixin them into the final binary wasm with debugger info.

#### Alternatives

Wait for [source language debugging](https://github.com/elliottt/rfcs/blob/trevor/wasmtime-debugging/accepted/wasmtime-debugging.md#source-language-debugging).

But I'm not quite sure how this works, or how to integrate it with my pipeline.

Many times I write wat files manually, without any toolchain.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.