emscripten-core / emscripten-core/emscripten

Looking for a way to report unhandled c++ exceptions to 3rd party crash reporting system

Open
#22,613 10 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

_This is a question, not a bug._

We're trying to find a generic way to report stack traces for all exceptions _unhandled in c++_ (meaning: also for c++ exceptions that _are handled in JS_). We're using `-fwasm-exceptions` and `-sEXCEPTION_STACK_TRACES`.

We found out that Emscripten's `___throw_exception_with_stack_trace` JS function is called whenever c++ exception is thrown. What we'd like to do is plug into this function, so we can get a stack trace and send it to 3rd party crash reporting system.

We've been trying different approaches, but had little to no success. We're looking for any guidance, or the reason for why it is bad/wrong idea in the first place.

**Version of emscripten/emsdk:**
```
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.61 (67fa4c16496b157a7fc3377afd69ee0445e8a6e3)
clang version 19.0.0git (https:/github.com/llvm/llvm-project 7cfffe74eeb68fbb3fb9706ac7071f8caeeb6520)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /Users/kurak/Developer/emsdk/upstream/bin
```

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.