From patchwork Mon Apr 16 11:53:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 152818 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 21F0EB6FE0 for ; Mon, 16 Apr 2012 21:54:38 +1000 (EST) Received: from localhost ([::1]:58594 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SJkVu-0007XA-7z for incoming@patchwork.ozlabs.org; Mon, 16 Apr 2012 07:54:34 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SJkVk-0007Wn-CI for qemu-devel@nongnu.org; Mon, 16 Apr 2012 07:54:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SJkVi-00009O-G8 for qemu-devel@nongnu.org; Mon, 16 Apr 2012 07:54:23 -0400 Received: from e06smtp17.uk.ibm.com ([195.75.94.113]:52715) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SJkVi-00008g-7T for qemu-devel@nongnu.org; Mon, 16 Apr 2012 07:54:22 -0400 Received: from /spool/local by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 16 Apr 2012 12:54:12 +0100 Received: from d06nrmr1507.portsmouth.uk.ibm.com (9.149.38.233) by e06smtp17.uk.ibm.com (192.168.101.147) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 16 Apr 2012 12:54:11 +0100 Received: from d06av07.portsmouth.uk.ibm.com (d06av07.portsmouth.uk.ibm.com [9.149.37.248]) by d06nrmr1507.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q3GBsC1I2392238 for ; Mon, 16 Apr 2012 12:54:12 +0100 Received: from d06av07.portsmouth.uk.ibm.com (d06av07.portsmouth.uk.ibm.com [127.0.0.1]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q3GBrXwW015131 for ; Mon, 16 Apr 2012 07:53:34 -0400 Received: from localhost (dyn-9-174-219-44.manchester-maybrook.uk.ibm.com [9.174.219.44]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q3GBrXFP015104; Mon, 16 Apr 2012 07:53:33 -0400 From: Stefan Hajnoczi To: Date: Mon, 16 Apr 2012 12:53:58 +0100 Message-Id: <1334577238-22242-1-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.9.5 x-cbid: 12041611-0542-0000-0000-0000018DBFF0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 195.75.94.113 Cc: =?UTF-8?q?Llu=C3=ADs=20Vilanova?= , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH] tracetool: handle DTrace keywords 'in', 'next', 'self' X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Language keywords cannot be used as argument names. The DTrace backend appends an underscore to the argument name in order to make the argument name legal. This patch adds 'in', 'next', and 'self' keywords to dtrace.py. Also drop the unnecessary argument name lstrip() call. The Arguments.build() method already ensures there is no space around argument names. Furthermore it is misleading to do the lstrip() *after* checking against keywords because the keyword check would not match if spaces were in the name. Signed-off-by: Stefan Hajnoczi Reviewed-by: Alon Levy Reviewed-by: LluĂ­s Vilanova --- scripts/tracetool/backend/dtrace.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/tracetool/backend/dtrace.py b/scripts/tracetool/backend/dtrace.py index cebbd57..9cab75c 100644 --- a/scripts/tracetool/backend/dtrace.py +++ b/scripts/tracetool/backend/dtrace.py @@ -86,10 +86,10 @@ def stap(events): i = 1 if len(e.args) > 0: for name in e.args.names(): - # 'limit' is a reserved keyword - if name == 'limit': - name = '_limit' - out(' %s = $arg%d;' % (name.lstrip(), i)) + # Append underscore to reserved keywords + if name in ('limit', 'in', 'next', 'self'): + name += '_' + out(' %s = $arg%d;' % (name, i)) i += 1 out('}')