From patchwork Thu Feb 28 15:32:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 224111 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id CD3A42C02AB for ; Fri, 1 Mar 2013 02:32:23 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1362670345; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID: User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=2cWK5sQSCDmjqCOHwxxMH3Cp3hc=; b=wVCW2edcGl/uojU DBJBV/B8ybZaozkkqjRVn3LFgDwBcTmMBNqVycsv19Nb+Q4l0lzo9+UB8VLOBWOp Fj3RvuFarUT7urj0TIRIbBbBdf6wPzeI1X9G+cBkOqdJiyVIGGywE0OiNNyeeyGE SnRL5gObR9rKWTghls2U4QvMGihE= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=Vz+jtpKZEp2n/l9T+I8qQePKxozw4qo1ikKJAfJCR1JUsfZlMj2nsEhFYQD/Iv LXLIb/99O0BB6kXzjiaEQudFN27+jrg9mAXogh5P5+FuuP67C9IdTxgMsVnUaToa RfasciZImjpJloMUtR/YxEXIbAHvoAvKqQv+devAcsctc=; Received: (qmail 24682 invoked by alias); 28 Feb 2013 15:32:17 -0000 Received: (qmail 24665 invoked by uid 22791); 28 Feb 2013 15:32:14 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_SPAMHAUS_DROP, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS, TW_CX X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 28 Feb 2013 15:32:05 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r1SFW4et022161 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 28 Feb 2013 10:32:04 -0500 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r1SFW29D017313 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 28 Feb 2013 10:32:03 -0500 From: Tom Tromey To: Dave Korn Cc: libstdc , gcc-patches@gcc.gnu.org Subject: Re: RFC: add some static probes to libstdc++ References: <87sj4hzap2.fsf@fleche.redhat.com> <512F4E5C.8050400@gmail.com> Date: Thu, 28 Feb 2013 08:32:02 -0700 In-Reply-To: <512F4E5C.8050400@gmail.com> (Dave Korn's message of "Thu, 28 Feb 2013 12:32:28 +0000") Message-ID: <87a9qozc7h.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.92 (gnu/linux) MIME-Version: 1.0 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Dave> How did it build in the without sys/sdt.h case? Sorry about that again. I must have made some change after testing it. Here is an updated version. One thing I found out while fixing this up is that changes to unwind-cxx.h do not cause anything to rebuild if I just run "make". I have to "make clean" each time. On the plus side, while digging around after being confused by this, I found that I didn't actually need "../config.h" -- the code now checks _GLIBCXX_HAVE_SYS_SDT_H instead. Tom 2013-02-27 Tom Tromey * 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. 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 #include +#ifdef _GLIBCXX_HAVE_SYS_SDT_H +#include +/* 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