From patchwork Mon Jan 17 17:23:43 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 79198 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 A6E73B712B for ; Tue, 18 Jan 2011 04:23:54 +1100 (EST) Received: (qmail 30581 invoked by alias); 17 Jan 2011 17:23:52 -0000 Received: (qmail 30567 invoked by uid 22791); 17 Jan 2011 17:23:51 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD 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; Mon, 17 Jan 2011 17:23:46 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0HHNjAt003936 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 17 Jan 2011 12:23:45 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0HHNiXK011514; Mon, 17 Jan 2011 12:23:44 -0500 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p0HHNh4x032036; Mon, 17 Jan 2011 12:23:44 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id 73726378326; Mon, 17 Jan 2011 10:23:43 -0700 (MST) From: Tom Tromey To: Roland McGrath Cc: gcc-patches@gcc.gnu.org, systemtap@sources.redhat.com Subject: Re: Patch: add systemtap-style marker to _Unwind_DebugHook References: <20110116200848.F0EF11807D2@magilla.sf.frob.com> <20110117170650.0404F18099A@magilla.sf.frob.com> Date: Mon, 17 Jan 2011 10:23:43 -0700 In-Reply-To: <20110117170650.0404F18099A@magilla.sf.frob.com> (Roland McGrath's message of "Mon, 17 Jan 2011 09:06:49 -0800 (PST)") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (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 >>>>> "Roland" == Roland McGrath writes: Roland> That test would work. (That macro is not defined at all in Roland> earlier versions.) Here is an updated version. Tom 2011-01-14 Tom Tromey * 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. diff --git a/gcc/configure.ac b/gcc/configure.ac index 776c71f..44a963d 100644 --- a/gcc/configure.ac +++ b/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 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. diff --git a/gcc/unwind-dw2.c b/gcc/unwind-dw2.c index 2ea9adb..25990b4 100644 --- a/gcc/unwind-dw2.c +++ b/gcc/unwind-dw2.c @@ -1,6 +1,6 @@ /* DWARF2 exception handling and frame unwind runtime interface routines. Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2008, 2009, 2010 Free Software Foundation, Inc. + 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -37,6 +37,10 @@ #include "gthr.h" #include "unwind-dw2.h" +#ifdef HAVE_SYS_SDT_H +#include +#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