From owner-svn-src-head@freebsd.org Wed Nov 25 23:19:07 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25E11A369A1; Wed, 25 Nov 2015 23:19:07 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk0-x236.google.com (mail-qk0-x236.google.com [IPv6:2607:f8b0:400d:c09::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CACB414F4; Wed, 25 Nov 2015 23:19:06 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by qkda6 with SMTP id a6so21720315qkd.3; Wed, 25 Nov 2015 15:19:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=Z+/q4y6wWpZIUJi67yDzmVId31p834d56O9BQ6TqDL8=; b=hgip4m8pSoMvfpRS3JxLtolL7VIsQfjzaGSljWmLP2Hwsefwik3lOBpJOCeVSpRjDc m6KjM4gS2xQc80tfOFNihZybg2xa5S82kWws/WOAsJvMUbwVl5v72h/RgLZMofU3DuEw pcdLevUb+AxTRs8aNsuSzmRy4Yw68UNa6X33XSS7en3bog/wpWNENEXmfeuiBDmJNIT/ LJk+nq4vAumbEum5v9bk9LYGye9tW9onRqqFS4UgE9QUm1oR1RtJpzqygnb7PgEaGESV ZPDTUaTKk8NYWM9oFgf4qCGh7OLOd31t2HNbgkoT5S/an1QDknjdiQsn3ztQYYAnvtM+ MjUQ== X-Received: by 10.55.81.3 with SMTP id f3mr31459816qkb.35.1448493545857; Wed, 25 Nov 2015 15:19:05 -0800 (PST) Received: from wkstn-mjohnston.west.isilon.com (c-67-182-131-225.hsd1.wa.comcast.net. [67.182.131.225]) by smtp.gmail.com with ESMTPSA id j64sm3797093qhc.36.2015.11.25.15.19.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Nov 2015 15:19:05 -0800 (PST) Sender: Mark Johnston Date: Wed, 25 Nov 2015 15:20:41 -0800 From: Mark Johnston To: "George V. Neville-Neil" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r291341 - head/share/dtrace Message-ID: <20151125231842.GA67865@wkstn-mjohnston.west.isilon.com> References: <201511252259.tAPMxfIq060477@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201511252259.tAPMxfIq060477@repo.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Nov 2015 23:19:07 -0000 On Wed, Nov 25, 2015 at 10:59:41PM +0000, George V. Neville-Neil wrote: > Author: gnn > Date: Wed Nov 25 22:59:41 2015 > New Revision: 291341 > URL: https://svnweb.freebsd.org/changeset/base/291341 > > Log: > Summary: A simple script to print the return value of any function, > with or without wild cards. > > Added: > head/share/dtrace/retval.sh (contents, props changed) > > Added: head/share/dtrace/retval.sh > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/share/dtrace/retval.sh Wed Nov 25 22:59:41 2015 (r291341) > @@ -0,0 +1,43 @@ > +#!/bin/sh > +# > +# Copyright (c) 2015 George V. Neville-Neil > +# All rights reserved. > +# > +# Redistribution and use in source and binary forms, with or without > +# modification, are permitted provided that the following conditions > +# are met: > +# 1. Redistributions of source code must retain the above copyright > +# notice, this list of conditions and the following disclaimer. > +# 2. Redistributions in binary form must reproduce the above copyright > +# notice, this list of conditions and the following disclaimer in the > +# documentation and/or other materials provided with the distribution. > +# > +# THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND > +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE > +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > +# SUCH DAMAGE. > +# > +# $FreeBSD$ > +# > +# retval.sh - show the return value of any probe named by the user > +# > +# USAGE: retval.sh name > +# > +# The name can be a full function name or a wild card name. The > +# caller is responsible for handling the escaping of wild cards. > +# > +/usr/sbin/dtrace -n ' > + > +#pragma D option quiet > + > +:::'$1':return { > + printf("%s %d\n", probefunc, arg1); > +} > +' This can be done without a shell since D has support for command-line arguments. The following should be equivalent: #!/usr/sbin/dtrace -s #pragma D option quiet fbt::$1:return { printf("%s %d\n", probefunc, arg1); }