From owner-svn-src-head@freebsd.org Thu Nov 26 00:54:21 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 5B02CA37F5E; Thu, 26 Nov 2015 00:54:21 +0000 (UTC) (envelope-from gnn@freebsd.org) Received: from smtp.hungerhost.com (smtp.hungerhost.com [216.38.51.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 317B91025; Thu, 26 Nov 2015 00:54:20 +0000 (UTC) (envelope-from gnn@freebsd.org) Received: from pool-108-54-164-204.nycmny.fios.verizon.net ([108.54.164.204]:50429 helo=[192.168.1.6]) by vps.hungerhost.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.86) (envelope-from ) id 1a1kpH-0007zN-7i; Wed, 25 Nov 2015 19:54:19 -0500 From: "George Neville-Neil" To: "Mark Johnston" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r291341 - head/share/dtrace Date: Wed, 25 Nov 2015 19:54:18 -0500 Message-ID: <9DC14292-288A-4BD0-910B-7363AE63BA15@freebsd.org> In-Reply-To: <20151125231842.GA67865@wkstn-mjohnston.west.isilon.com> References: <201511252259.tAPMxfIq060477@repo.freebsd.org> <20151125231842.GA67865@wkstn-mjohnston.west.isilon.com> MIME-Version: 1.0 Content-Type: text/plain; format=flowed Content-Transfer-Encoding: quoted-printable X-Mailer: MailMate (1.9.3r5184) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vps.hungerhost.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - freebsd.org X-Get-Message-Sender-Via: vps.hungerhost.com: authenticated_id: gnn@neville-neil.com X-Authenticated-Sender: vps.hungerhost.com: gnn@neville-neil.com X-Source: X-Source-Args: X-Source-Dir: 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: Thu, 26 Nov 2015 00:54:21 -0000 On 25 Nov 2015, at 18:20, Mark Johnston wrote: > 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 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- /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); > } Done. Although if we ever want to expand this script it'll have to move = back to shell. DTrace has very poor options handling overall. Best, George