Skip to content

Reaction to _Unwind_RaiseException not finding a handler in C++ #204

@work-robot

Description

@work-robot

The exception handling ABI states:

_URC_END_OF_STACK: The unwinder encountered the end of the stack during phase 1, without finding a handler. The unwind runtime will not have modified the stack. The C++ runtime will normally call uncaught_exception() in this case.

But uncaught_exception() is a pure function, it just returns whether stack unwinding is still in progress or not.

__cxa_throw from libstdc++:

#ifdef __USING_SJLJ_EXCEPTIONS__
  _Unwind_SjLj_RaiseException (&header->exc.unwindHeader);
#else
  _Unwind_RaiseException (&header->exc.unwindHeader);
#endif

  // Some sort of unwinding error.  Note that terminate is a handler.
  __cxa_begin_catch (&header->exc.unwindHeader);
  std::terminate ();

It unconditionally calls terminate after marking the exception as caught.

libcxxabi also calls __cxa_begin_catch followed by terminate.

Maybe this should just state terminate instead of uncaught_exception()? Is the call to __cxa_begin_catch mandated?

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