From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24564 invoked by alias); 5 Apr 2006 00:41:51 -0000 Received: (qmail 24556 invoked by uid 22791); 5 Apr 2006 00:41:51 -0000 X-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from ausmtp04.au.ibm.com (HELO ausmtp04.au.ibm.com) (202.81.18.152) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 05 Apr 2006 00:41:49 +0000 Received: from sd0208e0.au.ibm.com (d23rh904.au.ibm.com [202.81.18.202]) by ausmtp04.au.ibm.com (8.13.6/8.13.5) with ESMTP id k350ob6n113084 for ; Wed, 5 Apr 2006 10:50:37 +1000 Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.250.237]) by sd0208e0.au.ibm.com (8.12.10/NCO/VER6.8) with ESMTP id k350irIn229008 for ; Wed, 5 Apr 2006 10:44:58 +1000 Received: from d23av04.au.ibm.com (loopback [127.0.0.1]) by d23av04.au.ibm.com (8.12.11/8.13.3) with ESMTP id k350fXqB018594 for ; Wed, 5 Apr 2006 10:41:34 +1000 Received: from d23m0017.cn.ibm.com (cnnco04.cn.ibm.com [9.181.122.142]) by d23av04.au.ibm.com (8.12.11/8.12.11) with ESMTP id k350fX5m018572; Wed, 5 Apr 2006 10:41:33 +1000 To: fche@redhat.com, systemtap@sources.redhat.com Subject: Re: adding statements in alias definition as epilogue MIME-Version: 1.0 X-Mailer: Lotus Notes Release 7.0 HF144 February 01, 2006 Message-ID: From: Guang Lei Li Date: Wed, 05 Apr 2006 00:41:00 -0000 X-MIMETrack: Serialize by Router on d23m0017/23/M/IBM(Release 6.53HF654 | July 22, 2005) at 04/05/2006 08:42:47, Serialize complete at 04/05/2006 08:42:47 Content-Type: text/plain; charset="US-ASCII" X-IsSubscribed: yes 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-q2/txt/msg00034.txt.bz2 >> [...] What I want is to let user specify whether to log backtrace in his >> scripts, like the following: >> stap -e "probe addevent.tskdispatch.cpuidle { backtrace=1 } [...] >> But unfortunately, it won't work because "backtrace=1" is added after >> "log_cpuidle_tracedata(HOOKID_TASK_CPUIDLE, backtrace)". [...] > You can have two alias definitions: > probe addevent.tskdispatch.cpuidle.backtrace = addevent.tskdispatch.cpuidle { > backtrace = 1 > } > probe addevent.tskdispatch.cpuidle = .... { > if (backtrace) log_more (); > } But this won't work either. Because addevent.tskdispatch.cpuidle.backtrace will be expanded into: probe ... { if (backtrace) log_more (); backtrace = 1 } I tried the following patch: root:/home/lgl/systemtap/src> diff -uprN elaborate.cxx.ori elaborate.cxx --- elaborate.cxx.ori 2006-04-04 15:34:27.000000000 +0800 +++ elaborate.cxx 2006-04-04 15:34:53.000000000 +0800 @@ -334,15 +334,15 @@ alias_expansion_builder // there's concatenated code here and we only want one vardecl per // resulting variable. - for (unsigned i = 0; i < alias->body->statements.size(); ++i) + for (unsigned i = 0; i < use->body->statements.size(); ++i) { - statement *s = deep_copy_visitor::deep_copy(alias->body->statements[i]); + statement *s = deep_copy_visitor::deep_copy(use->body->statements[i]); n->body->statements.push_back(s); } - for (unsigned i = 0; i < use->body->statements.size(); ++i) + for (unsigned i = 0; i < alias->body->statements.size(); ++i) { - statement *s = deep_copy_visitor::deep_copy(use->body->statements[i]); + statement *s = deep_copy_visitor::deep_copy(alias->body->statements[i]); n->body->statements.push_back(s); } And it can cause the statements in alias definitions to be put as epilogue. So do we need the option to specify whether to put the statements in an alias definition as prologue or epilogue? that is to say: probe derived_probes := probe_alias { statements_in_derived_probes } probe probe_alias_definitions { statements_in_alias_definitions } and systemtap will generate: probe derived_probes { statements_in_derived_probes statements_in_alias_definitions } And if you change "probe derived_probes := probe_alias" to "probe derived_probes = probe_alias", systemtap will generate: probe derived_probes { statements_in_alias_definitions statements_in_derived_probes } I am not sure if other people than me have this requirement too. But it seems to me that being able to put statements in an alias definitions as epilogue enables you to change the default behaviors define in original probe alias, which should be useful. Li Guanglei - Linux Performance, China Systems & Technology Lab China Development Lab, Beijing Tel: 86-10-82782244 Ext.3516 Email: liguangl@cn.ibm.com, IMAP: guanglei@cn.ibm.com