Skip to content

How to abort #9715

Closed
Closed
@dschuff

Description

@dschuff

Currently emscripten's implementation of abort() calls to JS (where it calls some user hooks and collects a stack trace) and throws an exception, allowing it to propagate through all the wasm frames out to the caller.

Once we have wasm exceptions, that probably won't be what we want, because foreign exceptions unwinding through wasm frames will cause destructors to run, which isn't what we want for abort (and it may eventually be the case that in some configurations C++ catch(...) clauses may catch foreign exceptions). We need some other way to abort.

One straighforward option could be to export a wasm function that executes unreachable. IIUC with MVP wasm that would be functionally the same, but I don't know if anywhere in emscripten's runtime actually tries to catch or check an abort. Also the issue of traps vs exceptions isn't 100% settled yet but it will certainly be the case that the wasm code will ensure that traps do not cause destructor execution.

It's a little unfortunate to have to export an extra function, but it would be nice to have the same API for EH and non-EH builds.

Any ideas I'm missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions