gcc/gcc46-unwind-debughook-sdt....

89 lines
2.7 KiB
Diff

2011-01-14 Tom Tromey <tromey@redhat.com>
* unwind-dw2.c: Include sys/sdt.h if it exists.
(_Unwind_DebugHook): Use STAP_PROBE2.
* config.in, configure: Rebuild.
* configure.ac: Check for sys/sdt.h.
--- gcc/configure.ac
+++ gcc/configure.ac
@@ -4313,6 +4313,16 @@ if test x$gcc_cv_libc_provides_ssp = xyes; then
[Define if your target C library provides stack protector support])
fi
+# Test for <sys/sdt.h> on the target.
+GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H])
+AC_MSG_CHECKING(sys/sdt.h in the target C library)
+have_sys_sdt_h=no
+if test -f $target_header_dir/sys/sdt.h; then
+ AC_DEFINE(HAVE_SYS_SDT_H, 1,
+ [Define if your target C library provides sys/sdt.h])
+fi
+AC_MSG_RESULT($have_sys_sdt_h)
+
# Check if TFmode long double should be used by default or not.
# Some glibc targets used DFmode long double, but with glibc 2.4
# and later they can use TFmode.
--- gcc/unwind-dw2.c
+++ gcc/unwind-dw2.c
@@ -37,6 +37,10 @@
#include "gthr.h"
#include "unwind-dw2.h"
+#ifdef HAVE_SYS_SDT_H
+#include <sys/sdt.h>
+#endif
+
#ifndef __USING_SJLJ_EXCEPTIONS__
#ifndef STACK_GROWS_DOWNWARD
@@ -1493,7 +1497,13 @@ static void
_Unwind_DebugHook (void *cfa __attribute__ ((__unused__)),
void *handler __attribute__ ((__unused__)))
{
+ /* We only want to use stap probes starting with v3. Earlier
+ versions added too much startup cost. */
+#if defined (HAVE_SYS_SDT_H) && defined (STAP_PROBE2) && _SDT_NOTE_TYPE >= 3
+ STAP_PROBE2 (libgcc, unwind, cfa, handler);
+#else
asm ("");
+#endif
}
/* Install TARGET into CURRENT so that we can return to it. This is a
--- gcc/config.in.jj 2011-01-22 10:21:47.000000000 +0100
+++ gcc/config.in 2011-01-22 11:10:39.000000000 +0100
@@ -1405,6 +1407,9 @@
#endif
+/* Define if your target C library provides sys/sdt.h */
+#undef HAVE_SYS_SDT_H
+
/* Define to 1 if you have the <sys/stat.h> header file. */
#ifndef USED_FOR_TARGET
#undef HAVE_SYS_STAT_H
--- gcc/configure.jj 2011-01-22 10:20:55.000000000 +0100
+++ gcc/configure 2011-01-22 11:10:34.990648298 +0100
@@ -25757,6 +25757,19 @@ $as_echo "#define TARGET_LIBC_PROVIDES_S
fi
+# Test for <sys/sdt.h> on the target.
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking sys/sdt.h in the target C library" >&5
+$as_echo_n "checking sys/sdt.h in the target C library... " >&6; }
+have_sys_sdt_h=no
+if test -f $target_header_dir/sys/sdt.h; then
+
+$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sys_sdt_h" >&5
+$as_echo "$have_sys_sdt_h" >&6; }
+
# Check if TFmode long double should be used by default or not.
# Some glibc targets used DFmode long double, but with glibc 2.4
# and later they can use TFmode.