diff libgcc/unwind.inc @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
line wrap: on
line diff
--- a/libgcc/unwind.inc	Fri Oct 27 22:46:09 2017 +0900
+++ b/libgcc/unwind.inc	Thu Oct 25 07:37:49 2018 +0900
@@ -1,5 +1,5 @@
 /* Exception handling and frame unwind runtime interface routines. -*- C -*-
-   Copyright (C) 2001-2017 Free Software Foundation, Inc.
+   Copyright (C) 2001-2018 Free Software Foundation, Inc.
 
    This file is part of GCC.
 
@@ -36,9 +36,11 @@
 
 static _Unwind_Reason_Code
 _Unwind_RaiseException_Phase2(struct _Unwind_Exception *exc,
-			      struct _Unwind_Context *context)
+			      struct _Unwind_Context *context,
+			      unsigned long *frames_p)
 {
   _Unwind_Reason_Code code;
+  unsigned long frames = 1;
 
   while (1)
     {
@@ -71,8 +73,10 @@
       gcc_assert (!match_handler);
 
       uw_update_context (context, &fs);
+      _Unwind_Frames_Increment (context, frames);
     }
 
+  *frames_p = frames;
   return code;
 }
 
@@ -83,6 +87,7 @@
 {
   struct _Unwind_Context this_context, cur_context;
   _Unwind_Reason_Code code;
+  unsigned long frames;
 
   /* Set up this_context to describe the current stack frame.  */
   uw_init_context (&this_context);
@@ -128,11 +133,11 @@
   exc->private_2 = uw_identify_context (&cur_context);
 
   cur_context = this_context;
-  code = _Unwind_RaiseException_Phase2 (exc, &cur_context);
+  code = _Unwind_RaiseException_Phase2 (exc, &cur_context, &frames);
   if (code != _URC_INSTALL_CONTEXT)
     return code;
 
-  uw_install_context (&this_context, &cur_context);
+  uw_install_context (&this_context, &cur_context, frames);
 }
 
 
@@ -140,11 +145,13 @@
 
 static _Unwind_Reason_Code
 _Unwind_ForcedUnwind_Phase2 (struct _Unwind_Exception *exc,
-			     struct _Unwind_Context *context)
+			     struct _Unwind_Context *context,
+			     unsigned long *frames_p)
 {
   _Unwind_Stop_Fn stop = (_Unwind_Stop_Fn) (_Unwind_Ptr) exc->private_1;
   void *stop_argument = (void *) (_Unwind_Ptr) exc->private_2;
   _Unwind_Reason_Code code, stop_code;
+  unsigned long frames = 1;
 
   while (1)
     {
@@ -183,8 +190,10 @@
       /* Update cur_context to describe the same frame as fs, and discard
 	 the previous context if necessary.  */
       uw_advance_context (context, &fs);
+      _Unwind_Frames_Increment (context, frames);
     }
 
+  *frames_p = frames;
   return code;
 }
 
@@ -197,6 +206,7 @@
 {
   struct _Unwind_Context this_context, cur_context;
   _Unwind_Reason_Code code;
+  unsigned long frames;
 
   uw_init_context (&this_context);
   cur_context = this_context;
@@ -204,11 +214,11 @@
   exc->private_1 = (_Unwind_Ptr) stop;
   exc->private_2 = (_Unwind_Ptr) stop_argument;
 
-  code = _Unwind_ForcedUnwind_Phase2 (exc, &cur_context);
+  code = _Unwind_ForcedUnwind_Phase2 (exc, &cur_context, &frames);
   if (code != _URC_INSTALL_CONTEXT)
     return code;
 
-  uw_install_context (&this_context, &cur_context);
+  uw_install_context (&this_context, &cur_context, frames);
 }
 
 
@@ -220,6 +230,7 @@
 {
   struct _Unwind_Context this_context, cur_context;
   _Unwind_Reason_Code code;
+  unsigned long frames;
 
   uw_init_context (&this_context);
   cur_context = this_context;
@@ -227,13 +238,13 @@
   /* Choose between continuing to process _Unwind_RaiseException
      or _Unwind_ForcedUnwind.  */
   if (exc->private_1 == 0)
-    code = _Unwind_RaiseException_Phase2 (exc, &cur_context);
+    code = _Unwind_RaiseException_Phase2 (exc, &cur_context, &frames);
   else
-    code = _Unwind_ForcedUnwind_Phase2 (exc, &cur_context);
+    code = _Unwind_ForcedUnwind_Phase2 (exc, &cur_context, &frames);
 
   gcc_assert (code == _URC_INSTALL_CONTEXT);
 
-  uw_install_context (&this_context, &cur_context);
+  uw_install_context (&this_context, &cur_context, frames);
 }
 
 
@@ -245,6 +256,7 @@
 {
   struct _Unwind_Context this_context, cur_context;
   _Unwind_Reason_Code code;
+  unsigned long frames;
 
   /* Choose between continuing to process _Unwind_RaiseException
      or _Unwind_ForcedUnwind.  */
@@ -254,11 +266,11 @@
   uw_init_context (&this_context);
   cur_context = this_context;
 
-  code = _Unwind_ForcedUnwind_Phase2 (exc, &cur_context);
+  code = _Unwind_ForcedUnwind_Phase2 (exc, &cur_context, &frames);
 
   gcc_assert (code == _URC_INSTALL_CONTEXT);
 
-  uw_install_context (&this_context, &cur_context);
+  uw_install_context (&this_context, &cur_context, frames);
 }