svn commit: r323997 - head/contrib/gcc/config/arm

Ian Lepore ian at FreeBSD.org
Mon Sep 25 23:24:43 UTC 2017


Author: ian
Date: Mon Sep 25 23:24:41 2017
New Revision: 323997
URL: https://svnweb.freebsd.org/changeset/base/323997

Log:
  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.

Modified:
  head/contrib/gcc/config/arm/unwind-arm.c

Modified: head/contrib/gcc/config/arm/unwind-arm.c
==============================================================================
--- head/contrib/gcc/config/arm/unwind-arm.c	Mon Sep 25 21:23:49 2017	(r323996)
+++ head/contrib/gcc/config/arm/unwind-arm.c	Mon Sep 25 23:24:41 2017	(r323997)
@@ -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))


More information about the svn-src-all mailing list