This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: add debug hook to unwinder


>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:

Tom> This patch adds a debugging hook to the dwarf unwinder.

Here is a new revision of this patch.  Ian suggested using an
unconditional call to a static function rather than a conditional
call.

Bootstrapped & regtested on x86-64 (compile farm).  I also updated my
gdb patch and tested it, and the functionality works as desired.

Ok?

Tom

2009-05-20  Tom Tromey  <tromey@redhat.com>

	* unwind-dw2.c (_Unwind_DebugHook): New function.
	(uw_install_context): Call _Unwind_DebugHook.

Index: gcc/unwind-dw2.c
===================================================================
--- gcc/unwind-dw2.c	(revision 147709)
+++ gcc/unwind-dw2.c	(working copy)
@@ -1473,18 +1473,31 @@
   context->ra = __builtin_extract_return_addr (outer_ra);
 }
 
+static void _Unwind_DebugHook (void *, void *) __attribute__ ((__noinline__));
 
+/* This function is called during unwinding.  It is intended as a hook
+   for a debugger to intercept exceptions.  CFA is the CFA of the
+   target frame.  HANDLER is the PC to which control will be
+   transferred.  */
+static void
+_Unwind_DebugHook (void *cfa __attribute__ ((__unused__)),
+		   void *handler __attribute__ ((__unused__)))
+{
+  asm ("");
+}
+
 /* Install TARGET into CURRENT so that we can return to it.  This is a
    macro because __builtin_eh_return must be invoked in the context of
    our caller.  */
 
-#define uw_install_context(CURRENT, TARGET)				 \
-  do									 \
-    {									 \
-      long offset = uw_install_context_1 ((CURRENT), (TARGET));		 \
-      void *handler = __builtin_frob_return_addr ((TARGET)->ra);	 \
-      __builtin_eh_return (offset, handler);				 \
-    }									 \
+#define uw_install_context(CURRENT, TARGET)				\
+  do									\
+    {									\
+      long offset = uw_install_context_1 ((CURRENT), (TARGET));		\
+      void *handler = __builtin_frob_return_addr ((TARGET)->ra);	\
+      _Unwind_DebugHook ((TARGET)->cfa, handler);			\
+      __builtin_eh_return (offset, handler);				\
+    }									\
   while (0)
 
 static long


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]