diff options
author | Tom Tromey <tromey@redhat.com> | 2013-03-15 08:55:07 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2013-03-15 09:55:07 +0100 |
commit | 83c214a83559727f5215fcc9b293e14f427730b8 (patch) | |
tree | dd1140722871f720e036bdc5b3cf325a5ccd3b10 | |
parent | d0a7de7055d1ded39c4e0cfe0ed0411bcd69a1f9 (diff) | |
download | gcc-83c214a83559727f5215fcc9b293e14f427730b8.zip gcc-83c214a83559727f5215fcc9b293e14f427730b8.tar.gz gcc-83c214a83559727f5215fcc9b293e14f427730b8.tar.bz2 |
unwind-cxx.h: Include sys/sdt.h if detected.
* libsupc++/unwind-cxx.h: Include sys/sdt.h if detected.
(PROBE2): New macro.
* libsupc++/eh_throw.cc (__cxa_throw, __cxa_rethrow): Add probe.
* libsupc++/eh_catch.cc (__cxa_begin_catch): Add probe.
* configure.ac: Check for sys/sdt.h.
* configure, config.h.in: Rebuild.
From-SVN: r196674
-rw-r--r-- | libstdc++-v3/ChangeLog | 9 | ||||
-rw-r--r-- | libstdc++-v3/config.h.in | 3 | ||||
-rwxr-xr-x | libstdc++-v3/configure | 2 | ||||
-rw-r--r-- | libstdc++-v3/configure.ac | 2 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/eh_catch.cc | 3 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/eh_throw.cc | 9 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/unwind-cxx.h | 13 |
7 files changed, 38 insertions, 3 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 65ed5fc..c5a5dde 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2013-03-15 Tom Tromey <tromey@redhat.com> + + * libsupc++/unwind-cxx.h: Include sys/sdt.h if detected. + (PROBE2): New macro. + * libsupc++/eh_throw.cc (__cxa_throw, __cxa_rethrow): Add probe. + * libsupc++/eh_catch.cc (__cxa_begin_catch): Add probe. + * configure.ac: Check for sys/sdt.h. + * configure, config.h.in: Rebuild. + 2013-03-14 Jonathan Wakely <jwakely.gcc@gmail.com> PR libstdc++/56613 diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in index 07a1e50..9937a1e 100644 --- a/libstdc++-v3/config.h.in +++ b/libstdc++-v3/config.h.in @@ -400,6 +400,9 @@ /* Define to 1 if you have the <sys/resource.h> header file. */ #undef HAVE_SYS_RESOURCE_H +/* Define to 1 if you have the <sys/sdt.h> header file. */ +#undef HAVE_SYS_SDT_H + /* Define to 1 if you have the <sys/sem.h> header file. */ #undef HAVE_SYS_SEM_H diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index fa44bac..f40ddcf 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -20417,7 +20417,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu for ac_header in endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \ locale.h machine/endian.h machine/param.h nan.h stdint.h stdlib.h string.h \ strings.h sys/ipc.h sys/isa_defs.h sys/machine.h sys/param.h \ -sys/resource.h sys/sem.h sys/stat.h sys/time.h sys/types.h unistd.h \ +sys/resource.h sys/sdt.h sys/sem.h sys/stat.h sys/time.h sys/types.h unistd.h \ wchar.h wctype.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index a64fee2..de66406 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -216,7 +216,7 @@ GLIBCXX_CHECK_SYSCTL_HW_NCPU AC_CHECK_HEADERS([endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \ locale.h machine/endian.h machine/param.h nan.h stdint.h stdlib.h string.h \ strings.h sys/ipc.h sys/isa_defs.h sys/machine.h sys/param.h \ -sys/resource.h sys/sem.h sys/stat.h sys/time.h sys/types.h unistd.h \ +sys/resource.h sys/sdt.h sys/sem.h sys/stat.h sys/time.h sys/types.h unistd.h \ wchar.h wctype.h]) # Only do link tests if native. Else, hardcode. diff --git a/libstdc++-v3/libsupc++/eh_catch.cc b/libstdc++-v3/libsupc++/eh_catch.cc index 779f5a3..43e875a 100644 --- a/libstdc++-v3/libsupc++/eh_catch.cc +++ b/libstdc++-v3/libsupc++/eh_catch.cc @@ -80,6 +80,9 @@ __cxxabiv1::__cxa_begin_catch (void *exc_obj_in) _GLIBCXX_NOTHROW } objectp = __gxx_caught_object(exceptionObject); + + PROBE2 (catch, objectp, header->exceptionType); + #ifdef __ARM_EABI_UNWINDER__ _Unwind_Complete(exceptionObject); #endif diff --git a/libstdc++-v3/libsupc++/eh_throw.cc b/libstdc++-v3/libsupc++/eh_throw.cc index 297aa04..a79a025 100644 --- a/libstdc++-v3/libsupc++/eh_throw.cc +++ b/libstdc++-v3/libsupc++/eh_throw.cc @@ -60,6 +60,8 @@ extern "C" void __cxxabiv1::__cxa_throw (void *obj, std::type_info *tinfo, void (_GLIBCXX_CDTOR_CALLABI *dest) (void *)) { + PROBE2 (throw, obj, tinfo); + // Definitely a primary. __cxa_refcounted_exception *header = __get_refcounted_exception_header_from_obj (obj); @@ -97,7 +99,12 @@ __cxxabiv1::__cxa_rethrow () if (!__is_gxx_exception_class(header->unwindHeader.exception_class)) globals->caughtExceptions = 0; else - header->handlerCount = -header->handlerCount; + { + header->handlerCount = -header->handlerCount; + // Only notify probe for C++ exceptions. + PROBE2 (rethrow, __get_object_from_ambiguous_exception(header), + header->exceptionType); + } #ifdef _GLIBCXX_SJLJ_EXCEPTIONS _Unwind_SjLj_Resume_or_Rethrow (&header->unwindHeader); diff --git a/libstdc++-v3/libsupc++/unwind-cxx.h b/libstdc++-v3/libsupc++/unwind-cxx.h index e2b945d..ed4eea5 100644 --- a/libstdc++-v3/libsupc++/unwind-cxx.h +++ b/libstdc++-v3/libsupc++/unwind-cxx.h @@ -37,6 +37,19 @@ #include <bits/atomic_word.h> #include <cxxabi.h> +#ifdef _GLIBCXX_HAVE_SYS_SDT_H +#include <sys/sdt.h> +/* We only want to use stap probes starting with v3. Earlier versions + added too much startup cost. */ +#if defined (STAP_PROBE2) && _SDT_NOTE_TYPE >= 3 +#define PROBE2(name, arg1, arg2) STAP_PROBE2 (libstdcxx, name, arg1, arg2) +#endif +#endif + +#ifndef PROBE2 +#define PROBE2(name, arg1, arg2) +#endif + #pragma GCC visibility push(default) namespace __cxxabiv1 |