OSDN Git Service

Index: ChangeLog
[pf3gnuchains/gcc-fork.git] / gcc / unwind-sjlj.c
index ff39ca4..8d9766f 100644 (file)
@@ -1,5 +1,6 @@
 /* DWARF2 exception handling and frame unwind runtime interface routines.
-   Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+   Free Software Foundation, Inc.
 
    This file is part of GCC.
 
 
 #include "tconfig.h"
 #include "tsystem.h"
+#include "coretypes.h"
+#include "tm.h"
 #include "unwind.h"
 #include "gthr.h"
 
-#if USING_SJLJ_EXCEPTIONS
+#ifdef __USING_SJLJ_EXCEPTIONS__
 
 #ifdef DONT_USE_BUILTIN_SETJMP
 #ifndef inhibit_libc
@@ -62,7 +65,7 @@ struct SjLj_Function_Context
 #ifdef DONT_USE_BUILTIN_SETJMP
   /* We don't know what sort of alignment requirements the system
      jmp_buf has.  We over estimated in except.c, and now we have
-     to match that here just in case the system *didn't* have more 
+     to match that here just in case the system *didn't* have more
      restrictive requirements.  */
   jmp_buf jbuf __attribute__((aligned));
 #else
@@ -75,7 +78,7 @@ struct _Unwind_Context
   struct SjLj_Function_Context *fc;
 };
 
-typedef struct 
+typedef struct
 {
   _Unwind_Personality_Fn personality;
 } _Unwind_FrameState;
@@ -91,15 +94,9 @@ static __gthread_key_t fc_key;
 static int use_fc_key = -1;
 
 static void
-fc_key_dtor (void *ptr)
-{
-  __gthread_key_dtor (fc_key, ptr);
-}
-
-static void
 fc_key_init (void)
 {
-  use_fc_key = __gthread_key_create (&fc_key, fc_key_dtor) == 0;
+  use_fc_key = __gthread_key_create (&fc_key, 0) == 0;
 }
 
 static void
@@ -173,6 +170,15 @@ _Unwind_GetGR (struct _Unwind_Context *context, int index)
   return context->fc->data[index];
 }
 
+/* Get the value of the CFA as saved in CONTEXT.  */
+
+_Unwind_Word
+_Unwind_GetCFA (struct _Unwind_Context *context)
+{
+  /* ??? Ideally __builtin_setjmp places the CFA in the jmpbuf.  */
+  return NULL;
+}
+
 void
 _Unwind_SetGR (struct _Unwind_Context *context, int index, _Unwind_Word val)
 {
@@ -207,6 +213,12 @@ _Unwind_GetRegionStart (struct _Unwind_Context *context __attribute__((unused))
   return 0;
 }
 
+void *
+_Unwind_FindEnclosingFunction (void *pc)
+{
+  return NULL;
+}
+
 #ifndef __ia64__
 _Unwind_Ptr
 _Unwind_GetDataRelBase (struct _Unwind_Context *context __attribute__((unused)) )
@@ -243,19 +255,21 @@ uw_update_context (struct _Unwind_Context *context,
   context->fc = context->fc->prev;
 }
 
-static inline void 
+static inline void
 uw_init_context (struct _Unwind_Context *context)
 {
   context->fc = _Unwind_SjLj_GetContext ();
 }
 
 /* ??? There appear to be bugs in integrate.c wrt __builtin_longjmp and
-   virtual-stack-vars.  An inline version of this segfaults on Sparc.  */
-#define uw_install_context(CURRENT, TARGET)    \
-  do {                                         \
-    _Unwind_SjLj_SetContext ((TARGET)->fc);    \
-    longjmp ((TARGET)->fc->jbuf, 1);           \
-  } while (0)
+   virtual-stack-vars.  An inline version of this segfaults on SPARC.  */
+#define uw_install_context(CURRENT, TARGET)            \
+  do                                                   \
+    {                                                  \
+      _Unwind_SjLj_SetContext ((TARGET)->fc);          \
+      longjmp ((TARGET)->fc->jbuf, 1);                 \
+    }                                                  \
+  while (0)
 
 
 static inline _Unwind_Ptr
@@ -271,6 +285,7 @@ uw_identify_context (struct _Unwind_Context *context)
 #define _Unwind_RaiseException         _Unwind_SjLj_RaiseException
 #define _Unwind_ForcedUnwind           _Unwind_SjLj_ForcedUnwind
 #define _Unwind_Resume                 _Unwind_SjLj_Resume
+#define _Unwind_Resume_or_Rethrow      _Unwind_SjLj_Resume_or_Rethrow
 
 #include "unwind.inc"