Date: Thu, 19 Oct 2017 17:26:27 +0000 (UTC) From: Ian Lepore <ian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r324760 - stable/11/contrib/gcc/config/arm Message-ID: <201710191726.v9JHQRHx059318@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ian Date: Thu Oct 19 17:26:26 2017 New Revision: 324760 URL: https://svnweb.freebsd.org/changeset/base/324760 Log: MFC r323997-r323998 r323997: Fix handling of uncaught exceptions in a std::terminate() handler on arm. When raising an exception, the unwinder searches for a catch handler and if none is found it should invoke std::terminate() with the uncaught exception as the "current" exception. Before this change, the terminate handler was invoked with no exception as current (abi::__cxa_current_exception_type() returned NULL), because the return value from the unwinder indicated an internal failure in unwinding. It turns out that was because all errors from get_eit_entry() were translated to _URC_FAILURE. Now the error is returned untranslated, which allows _URC_END_OF_STACK to percolate upwards to throw_exception() in libcxxrt. When it sees that return status it properly calls std::terminate() with the uncaught exception installed as the current exception, allowing custom terminate handlers to work with it. r323998: Fix the return value from _Unwind_Backtrace() on arm. If unwinding stops due to hitting the end of the call chain, the return value is supposed to be _URC_END_OF_STACK; other values indicate internal errors. The return value from get_eit_entry() is now returned without translating it to _URC_FAILURE, so that callers can see _URC_END_OF_STACK when it happens. Modified: stable/11/contrib/gcc/config/arm/unwind-arm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/gcc/config/arm/unwind-arm.c ============================================================================== --- stable/11/contrib/gcc/config/arm/unwind-arm.c Thu Oct 19 16:42:03 2017 (r324759) +++ stable/11/contrib/gcc/config/arm/unwind-arm.c Thu Oct 19 17:26:26 2017 (r324760) @@ -625,8 +625,8 @@ __gnu_Unwind_RaiseException (_Unwind_Control_Block * u do { /* Find the entry for this routine. */ - if (get_eit_entry (ucbp, saved_vrs.core.r[R_PC]) != _URC_OK) - return _URC_FAILURE; + if ((pr_result = get_eit_entry (ucbp, saved_vrs.core.r[R_PC])) != _URC_OK) + return pr_result; /* Call the pr to decide what to do. */ pr_result = ((personality_routine) UCB_PR_ADDR (ucbp)) @@ -773,11 +773,8 @@ __gnu_Unwind_Backtrace(_Unwind_Trace_Fn trace, void * do { /* Find the entry for this routine. */ - if (get_eit_entry (ucbp, saved_vrs.core.r[R_PC]) != _URC_OK) - { - code = _URC_FAILURE; + if ((code = get_eit_entry (ucbp, saved_vrs.core.r[R_PC])) != _URC_OK) break; - } /* The dwarf unwinder assumes the context structure holds things like the function and LSDA pointers. The ARM implementation
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710191726.v9JHQRHx059318>