GithubHelp home page GithubHelp logo

Comments (6)

pepyakin avatar pepyakin commented on May 14, 2024

In general, there is no way to get location of the trap yet (although this should be very useful, and I think this is somwthing we want sooner rather than later)

However, it is possible to print information provided in panic payload, at least if you have a custom panic fmt. But im not sure how panics are reported in wasm32-unknown-unknown with std.

from wasmi.

tailhook avatar tailhook commented on May 14, 2024

However, it is possible to print information provided in panic payload, at least if you have a custom panic fmt. But im not sure how panics are reported in wasm32-unknown-unknown with std.

It looks like payload is ignored by rust compiler: https://github.com/rust-lang/rust/blob/master/src/libpanic_unwind/wasm32.rs#L28

Also, what do you mean by "print"? I don't think there is some builtin way to print something in wasm.

from wasmi.

pepyakin avatar pepyakin commented on May 14, 2024

AFAIK, actual printing happens in the panic hook, ie here which happens before libpanic_* takes control (just take a look at other impls or at libpanic_abort).

Also, what do you mean by "print"? I don't think there is some builtin way to print something in wasm.

Yeah, you're right! However, in some envs such as web JS or wasmi we can define what it means to print something.

And, In fact, wasm std lib supports basic i/o however under special flag DEBUG

Hope this helps!

from wasmi.

tailhook avatar tailhook commented on May 14, 2024

Wow, that worked like a charm! Thanks. Here is the code that catches panics and logs payload and location for anyone trying to figure it out.

However, I think this issue (i.e. tracking traps and not only panics out of the box) depends on debugging symbols and should not be closed yet. Right?

from wasmi.

pepyakin avatar pepyakin commented on May 14, 2024

Im very happy thats worked!

And yea, you right, we still need to have means to debug different kinds of traps and print stacktraces. And yeah it depends on debugging symbols (although plain name section should do the trick for the start)

from wasmi.

Robbepop avatar Robbepop commented on May 14, 2024

Closed in favor of #538.

from wasmi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.