Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EH] Make Wasm EH rethrow print stack traces #20372

Merged
merged 4 commits into from
Oct 3, 2023

Commits on Oct 2, 2023

  1. [EH] Make Wasm EH rethrow print stack traces

    In Wasm EH, even if we set `-sASSERTION` or `-sEXCEPTION_STACK_TRACES`,
    if we rethrow an exception in the code, we lose the effect of that
    option because previously we called `__throw_exception_with_stack_trace`
    only in `__cxa_throw`:
    https://github.com/emscripten-core/emscripten/blob/9ce7020632aa6f7578c6e40e197b800a4dd7073f/system/lib/libcxxabi/src/cxa_exception.cpp#L294-L296
    
    This adds the same mechanism to `__cxa_rethrow` (which is used for
    C++ `throw;`) and `__cxa_rethrow_primary_exception` (which is used for
    `std::rethrow_exception`).
    
    This does not solve the problem of losing stack traces _before_ the
    rethrowing. libc++abi's `__cxa_rethrow` and
    `__cxa_rethrow_primary_exception` are implemented as throwing a pointer
    in the same way we first throw it and they are not aware of any
    metadata. This happens even in the native platform with GDB; GDB's
    backtrace only shows stack traces after rethrowing. We may try to fix
    this later by passing `exnref`
    (WebAssembly/exception-handling#281) to the
    library, but this is likely to take some time.
    
    Partially fixes emscripten-core#20301.
    aheejin committed Oct 2, 2023
    Configuration menu
    Copy the full SHA
    a208c42 View commit details
    Browse the repository at this point in the history
  2. Address comments

    aheejin committed Oct 2, 2023
    Configuration menu
    Copy the full SHA
    a7c5fe5 View commit details
    Browse the repository at this point in the history
  3. Simplify if

    aheejin committed Oct 2, 2023
    Configuration menu
    Copy the full SHA
    d3f7e5b View commit details
    Browse the repository at this point in the history

Commits on Oct 3, 2023

  1. Use self.emcc_args

    aheejin committed Oct 3, 2023
    Configuration menu
    Copy the full SHA
    ca2da5c View commit details
    Browse the repository at this point in the history