2e32ee0
2010-04-27  Jakub Jelinek  <jakub@redhat.com>
2e32ee0
2e32ee0
	* unwind-dw2.c (_Unwind_DebugHook): Add used attribute.
2e32ee0
1418c18
2009-05-27  Tom Tromey  <tromey@redhat.com>
1418c18
1418c18
	* unwind-dw2.c (_Unwind_DebugHook): New function.
1418c18
	(uw_install_context): Call _Unwind_DebugHook.
1418c18
1418c18
--- gcc/unwind-dw2.c	(revision 147933)
1418c18
+++ gcc/unwind-dw2.c	(revision 147934)
2e32ee0
@@ -1473,18 +1473,32 @@ uw_init_context_1 (struct _Unwind_Contex
1418c18
   context->ra = __builtin_extract_return_addr (outer_ra);
1418c18
 }
1418c18
 
2e32ee0
+static void _Unwind_DebugHook (void *, void *)
2e32ee0
+  __attribute__ ((__noinline__, __used__));
1418c18
+
1418c18
+/* This function is called during unwinding.  It is intended as a hook
1418c18
+   for a debugger to intercept exceptions.  CFA is the CFA of the
1418c18
+   target frame.  HANDLER is the PC to which control will be
1418c18
+   transferred.  */
1418c18
+static void
1418c18
+_Unwind_DebugHook (void *cfa __attribute__ ((__unused__)),
1418c18
+		   void *handler __attribute__ ((__unused__)))
1418c18
+{
1418c18
+  asm ("");
1418c18
+}
1418c18
 
1418c18
 /* Install TARGET into CURRENT so that we can return to it.  This is a
1418c18
    macro because __builtin_eh_return must be invoked in the context of
1418c18
    our caller.  */
1418c18
 
1418c18
-#define uw_install_context(CURRENT, TARGET)				 \
1418c18
-  do									 \
1418c18
-    {									 \
1418c18
-      long offset = uw_install_context_1 ((CURRENT), (TARGET));		 \
1418c18
-      void *handler = __builtin_frob_return_addr ((TARGET)->ra);	 \
1418c18
-      __builtin_eh_return (offset, handler);				 \
1418c18
-    }									 \
1418c18
+#define uw_install_context(CURRENT, TARGET)				\
1418c18
+  do									\
1418c18
+    {									\
1418c18
+      long offset = uw_install_context_1 ((CURRENT), (TARGET));		\
1418c18
+      void *handler = __builtin_frob_return_addr ((TARGET)->ra);	\
1418c18
+      _Unwind_DebugHook ((TARGET)->cfa, handler);			\
1418c18
+      __builtin_eh_return (offset, handler);				\
1418c18
+    }									\
1418c18
   while (0)
1418c18
 
1418c18
 static long