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]

[PATCH] Put _Unwind_DebugHook into .dynsym


Hi!

If libgcc_s.so.1 is stripped and no separate debug info for it
is installed, GDB can't find _Unwind_DebugHook to put a breakpoint on it.
The following patch forces it into .dynsym, assuming GDB would handle
it even if debug info is missing.  Of course when debuginfo is available
GDB should use _Unwind_DebugHook details provided in there.

The patch shouldn't slow down unwinding, as the call still doesn't go
through PLT, just has an exported alias.

2010-04-27  Jakub Jelinek  <jakub@redhat.com>

	* libgcc-std.ver (_Unwind_DebugHook): Export @GCC_4.6.0.
	* unwind-dw2.c (_Unwind_DH1, _Unwind_DH2, _Unwind_DH3): Define.
	(_Unwind_DebugHook): If HAVE_GAS_HIDDEN, don't make it static.
	(_Unwind_DebugHookAlias): For HAVE_GAS_HIDDEN a hidden alias
	to _Unwind_DebugHook, otherwise function-like macro expanding
	to _Unwind_DebugHook.
	(uw_install_context): Call _Unwind_DebugHookAlias instead of
	_Unwind_DebugHook.

--- gcc/libgcc-std.ver.jj	2010-03-31 13:12:00.000000000 +0200
+++ gcc/libgcc-std.ver	2010-04-27 09:37:56.000000000 +0200
@@ -1910,3 +1910,8 @@ GCC_4.5.0 {
   __unordxf2
   __unordtf2
 }
+
+%inherit GCC_4.6.0 GCC_4.5.0
+GCC_4.6.0 {
+  _Unwind_DebugHook
+}
--- gcc/unwind-dw2.c.jj	2010-04-27 09:10:34.000000000 +0200
+++ gcc/unwind-dw2.c	2010-04-27 09:36:26.000000000 +0200
@@ -1482,14 +1482,28 @@ uw_init_context_1 (struct _Unwind_Contex
   context->ra = __builtin_extract_return_addr (outer_ra);
 }
 
+#ifdef HAVE_GAS_HIDDEN
+# define _Unwind_DH1(x) #x
+# define _Unwind_DH2(cname) _Unwind_DH3 (__USER_LABEL_PREFIX__, cname)
+# define _Unwind_DH3(prefix, cname) _Unwind_DH1 (prefix) cname
+
+void _Unwind_DebugHook (void *, void *)
+  __attribute__ ((__noinline__, __used__, __noclone__));
+__typeof (_Unwind_DebugHook) _Unwind_DebugHookAlias
+  __attribute__ ((__noinline__, __used__, __noclone__,
+		  __visibility__ ("hidden"),
+		  __alias__ (_Unwind_DH2 ("_Unwind_DebugHook"))));
+#else
 static void _Unwind_DebugHook (void *, void *)
   __attribute__ ((__noinline__, __used__, __noclone__));
+# define _Unwind_DebugHookAlias(cfa, handler) _Unwind_DebugHook (cfa, handler)
+#endif
 
 /* 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
+void
 _Unwind_DebugHook (void *cfa __attribute__ ((__unused__)),
 		   void *handler __attribute__ ((__unused__)))
 {
@@ -1505,7 +1519,7 @@ _Unwind_DebugHook (void *cfa __attribute
     {									\
       long offset = uw_install_context_1 ((CURRENT), (TARGET));		\
       void *handler = __builtin_frob_return_addr ((TARGET)->ra);	\
-      _Unwind_DebugHook ((TARGET)->cfa, handler);			\
+      _Unwind_DebugHookAlias ((TARGET)->cfa, handler);			\
       __builtin_eh_return (offset, handler);				\
     }									\
   while (0)

	Jakub


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