From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10615 invoked by alias); 25 Feb 2006 21:38:46 -0000 Received: (qmail 10608 invoked by uid 22791); 25 Feb 2006 21:38:45 -0000 X-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 25 Feb 2006 21:38:44 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id k1PLcgta006967 for ; Sat, 25 Feb 2006 16:38:42 -0500 Received: from pobox.toronto.redhat.com (pobox.toronto.redhat.com [172.16.14.4]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id k1PLcb130349; Sat, 25 Feb 2006 16:38:37 -0500 Received: from touchme.toronto.redhat.com (IDENT:postfix@touchme.toronto.redhat.com [172.16.14.9]) by pobox.toronto.redhat.com (8.12.8/8.12.8) with ESMTP id k1PLcbg2014824; Sat, 25 Feb 2006 16:38:37 -0500 Received: from ton.toronto.redhat.com (ton.toronto.redhat.com [172.16.14.15]) by touchme.toronto.redhat.com (Postfix) with ESMTP id E29D98000E9; Sat, 25 Feb 2006 16:38:36 -0500 (EST) Received: from ton.toronto.redhat.com (localhost.localdomain [127.0.0.1]) by ton.toronto.redhat.com (8.13.1/8.13.1) with ESMTP id k1PLcagm000384; Sat, 25 Feb 2006 16:38:36 -0500 Received: (from fche@localhost) by ton.toronto.redhat.com (8.13.1/8.13.1/Submit) id k1PLcaZx000383; Sat, 25 Feb 2006 16:38:36 -0500 Date: Sat, 25 Feb 2006 21:38:00 -0000 From: "Frank Ch. Eigler" To: Martin Hunt Cc: systemtap@sources.redhat.com Subject: Re: command line arguments Message-ID: <20060225213836.GK20902@redhat.com> References: <20060223224218.GE20902@redhat.com> <1140760330.5306.3.camel@dragon> <20060224122448.GG20902@redhat.com> <1140806672.3378.24.camel@dragon> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1140806672.3378.24.camel@dragon> User-Agent: Mutt/1.4.1i Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2006-q1/txt/msg00630.txt.bz2 Hi - hunt wrote: > Ah, I see. I was confused because this doesn't work: > > stap -e 'probe begin {printf("%d (%s)\n", $1,@1);exit()}' hello > [...] > > stap -e 'probe begin {printf("%d (%s)\n", $1,@1,$2,@2);exit()}' 42 Yes, both these intentionally emit errors. > [...] Still, I don't see how you can do anything like getopt to > process args. One can't, with what there is now. It would not take much to add another way of accessing the entire argument array, for some adventurous person to implement getopt on top of. Then again, I wonder how great a loss not bothering would be. Few shell scripts use getopt. Large ones, sure, but little ones almost never. I imagine systemtap scripts to be more like the small ones, using plain positional arguments. > I see in a later message you are thinking of having some special > syntax to allow variables to be set on the command line? [...] Code is now there in stpd and in the probe modules to initialize number and string globals, by simply giving them as additional named module options ("insmod foo.ko foo=1 bar=beef"). There is no stap interface to that yet. I figured I'd hold off on that part until the cross-instrumentation (=.ko-precompilation) problem is solved. > I'd like to see this kind of parsing be possible. How would it work? > > topsys.stp -- -d 5 -n 20 > > topsys.stp -- -n 20 -pid 5160,5161 > > topsys.stp -- -d 5 -name "metacity" For something that elaborate, in the absence of other facilities, you can use a shell/perl/tcl wrapper. - FChE