From patchwork Wed Apr 18 14:07:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 153518 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 B6489B6F6E for ; Thu, 19 Apr 2012 00:08:45 +1000 (EST) Received: from localhost ([::1]:56342 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKVYp-0003Qc-H7 for incoming@patchwork.ozlabs.org; Wed, 18 Apr 2012 10:08:43 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56017) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKVYV-0003BE-U5 for qemu-devel@nongnu.org; Wed, 18 Apr 2012 10:08:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SKVYM-000062-D7 for qemu-devel@nongnu.org; Wed, 18 Apr 2012 10:08:23 -0400 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:48689) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKVYM-000055-4x for qemu-devel@nongnu.org; Wed, 18 Apr 2012 10:08:14 -0400 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 18 Apr 2012 15:08:10 +0100 Received: from d06nrmr1507.portsmouth.uk.ibm.com (9.149.38.233) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 18 Apr 2012 15:08:07 +0100 Received: from d06av12.portsmouth.uk.ibm.com (d06av12.portsmouth.uk.ibm.com [9.149.37.247]) by d06nrmr1507.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q3IE87bQ1658912 for ; Wed, 18 Apr 2012 15:08:07 +0100 Received: from d06av12.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q3IE85Fg002609 for ; Wed, 18 Apr 2012 08:08:06 -0600 Received: from localhost (sig-9-146-161-195.uk.ibm.com [9.146.161.195]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q3IE85Ct002588; Wed, 18 Apr 2012 08:08:05 -0600 From: Stefan Hajnoczi To: Anthony Liguori Date: Wed, 18 Apr 2012 15:07:24 +0100 Message-Id: <1334758044-14443-10-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1334758044-14443-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1334758044-14443-1-git-send-email-stefanha@linux.vnet.ibm.com> MIME-Version: 1.0 x-cbid: 12041814-4966-0000-0000-0000021055EC X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 195.75.94.106 Cc: Harsh Prateek Bora , qemu-devel@nongnu.org, Stefan Hajnoczi , =?UTF-8?q?Llu=C3=ADs=20Vilanova?= Subject: [Qemu-devel] [PATCH 9/9] 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('}')