RFC: add some static probes to libstdc++

Tom Tromey tromey@redhat.com
Tue Apr 9 17:47:00 GMT 2013

>>>>> "Jonathan" == Jonathan Wakely <jwakely.gcc@gmail.com> writes:

Marc> I thought you were going to suggest enhancing the configure test
Marc> so it fails on old systemtap (detects it as absent).

Jonathan> Ah yes, that's a much better idea!

Here's a patch to do that.

I tested it on x86-64 Fedora 18.  I tested the "failing" path by using
an old sdt.h.  This required a number of iterations to ensure that the
test failed for the right reasons.

Ok?  I think it should go on the 4.8 branch as well.


2013-04-09  Tom Tromey  <tromey@redhat.com>

	* configure, config.h.in: Rebuild.
	* configure.ac: Use GLIBCXX_CHECK_SDT_H.  Don't check for
	* acinclude.m4 (GLIBCXX_CHECK_SDT_H): New defun.

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 4d06b20..619fff0 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -3660,6 +3660,36 @@ AC_DEFUN([GLIBCXX_ENABLE_WERROR], [
+dnl Check to see if sys/sdt.h exists and that it is suitable for use.
+dnl Some versions of sdt.h were not compatible with C++11.
+  AC_MSG_RESULT([for suitable sys/sdt.h])
+  # Note that this test has to be run with the C language.
+  # Otherwise, sdt.h will try to include some headers from
+  # libstdc++ itself.
+  AC_CACHE_VAL(glibcxx_cv_sys_sdt_h, [
+    # Because we have to run the test in C, we use grep rather
+    # than the compiler to check for the bug.  The bug is that
+    # were strings without trailing whitespace, causing g++
+    # to look for operator"".  The pattern searches for the fixed
+    # output.
+    AC_EGREP_CPP([ \",\" ], [
+      #include <sys/sdt.h>
+      int f() { STAP_PROBE(hi, bob); }
+    ], [glibcxx_cv_sys_sdt_h=yes], [glibcxx_cv_sys_sdt_h=no])
+  ])
+  if test $glibcxx_cv_sys_sdt_h = yes; then
+              [Define to 1 if you have a suitable <sys/sdt.h> header file])
+  fi
+  AC_MSG_RESULT($glibcxx_cv_sys_sdt_h)
 # Macros from the top-level gcc directory.
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index de66406..73d430a 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
 # Check for available headers.
 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/sdt.h sys/sem.h sys/stat.h sys/time.h sys/types.h unistd.h \
+sys/resource.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.

More information about the Libstdc++ mailing list