Skip to content

Backtrace with SourceSpan #19

@oovm

Description

@oovm

Is it possible to append source span information to generate a backtrace that jumps to the source language?

Assume the following syntax:

(func $source-function
    (result i32)
    (i32.const 0)
    (@name "package::module::function-name")
    (@file "language-source.file") ;; or shared source id, the path will appear multiple times
    (@line 12) (@column 4)         ;; if source is utf8 text file, use line and utf8 width
    (@offset 114)                  ;; if not a text file or non-utf8 encoding
)

Then the following log will be generated during trap, and the IDE can recognize and generate a local link:

0: 0x00000100 - unreachable or other trap name
1: 0x00000104 - in package::module::function-name(input1, input2)
                at language-source.file:114
2: 0x00000108 - in package::module::function-caller(input1, input2, input3)
                at language-source.file:514

It seems that the browser can use source-map or DWARF, but this is not part of the wasm standard, and it does not fit the features of wasm very well.

Should the wasm standard define a standardized set of debugger metainfo?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions