From owner-freebsd-dtrace@freebsd.org Fri Jul 21 05:09:13 2017 Return-Path: Delivered-To: freebsd-dtrace@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 15AE6D7FACA for ; Fri, 21 Jul 2017 05:09:13 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-pg0-x22a.google.com (mail-pg0-x22a.google.com [IPv6:2607:f8b0:400e:c05::22a]) (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 D77F0639AC for ; Fri, 21 Jul 2017 05:09:12 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-pg0-x22a.google.com with SMTP id s4so23751225pgr.5 for ; Thu, 20 Jul 2017 22:09:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=SobDs5BRYLP1qwieD+vVn0JMFbucW9TyKLMNXxcr1Qo=; b=PGrPVXnjNxxK4BKzLJubS7vaCaZlsrOxEE5IyiiXFPGFi6858xXJHvpbqWVvxLxK07 8m+ttRS7DHXgiSx/TtGj5o6Q3MguuTNWm445r3YMz74Fh2WAlMFXT6wwHexkLYy4bTd3 pglZsJR1R2wKiA1dw7AszydhQX0L7xC7W1D+BFihItqBEd+9Bmfw00KSoDfX/XE3J4ww xikGaFY94uJiOl3DxysZgyIkMB/riNprjos3ibkvbLNhx5P30sleJHRr+zI9AjXkinIB b1Hco4JQ4IVLEeVo7gHy0ZtzYvftBseWS9zNaTT3AogQyRkljJ2wH6rNnr3l5SBa51Gi 6UVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=SobDs5BRYLP1qwieD+vVn0JMFbucW9TyKLMNXxcr1Qo=; b=GKyah9j8FWDfOEY7gjM8y2xiRNOhskVS1j5pMFqMRflYHxVJmo+FmE3KDp7j6bE1jl YK1fs9ChrjJ1Bj5siNAL6QRAAU1rfvxRODZtMO0WqrwDSobxq00uRXX0GITYYtsDo3mL ys/PguUEWKHJ6feN6+CNDkhRPxL3vjlb41LjqACKU1lMFh9CuFeYdo9RGi8ZlnHiFFGK eLpNh+xUc5PaQDbhuz9bXJEjGfbXE44ATrXxSybQ+Ii3JOLWpr1SXkaLb/cMwfgIT+cD MAEsBT8ra6ewnAbtV4ASph7X5hqXSWEgGzQUTxM0KP/xggrsmHgM8LMy+kW8TtqCuKyR SQ/w== X-Gm-Message-State: AIVw111akJMqYWcumphppBzXoAmcWJBho0cgq+vftFy6KvK/3DeZNBdj hxTlg5wR0HAW2s3l X-Received: by 10.98.89.22 with SMTP id n22mr6273799pfb.326.1500613752049; Thu, 20 Jul 2017 22:09:12 -0700 (PDT) Received: from raichu ([2604:4080:1102:0:ca60:ff:fe9d:3963]) by smtp.gmail.com with ESMTPSA id d15sm7488984pgt.44.2017.07.20.22.09.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jul 2017 22:09:11 -0700 (PDT) Sender: Mark Johnston Date: Thu, 20 Jul 2017 22:09:07 -0700 From: Mark Johnston To: Nan Xiao Cc: Matthew Ahrens , freebsd-dtrace@freebsd.org Subject: Re: Does DTrace script only support "#pragma D option ..", not "-x option"? Message-ID: <20170721050907.GA2736@raichu> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Jul 2017 05:09:13 -0000 On Fri, Jul 21, 2017 at 12:56:28PM +0800, Nan Xiao wrote: > Hi Matt & Mark, > > Firstly, thanks very much for your responses! > > I change my script as this: > > #!/usr/sbin/dtrace -x dynvarsize=64m -s > > dtrace:::BEGIN > { > printf("Hello FreeBSD!\n"); > } > > It still generates errors: > > dtrace: failed to set -x dynvarsize: Invalid option name > > > But dynvarsize should be a valid option name. It turns out that this won't work on FreeBSD: on a shebang line, the tokens following the interpreter path are passed to the interpreter as a single argument, so dtrace(1)'s option parser won't handle your example. I think it follows that you have no choice but to specify the option with a pragma. See the two block comments here: https://svnweb.freebsd.org/base/head/sys/kern/imgact_shell.c?view=markup#l61