]> git.proxmox.com Git - mirror_qemu.git/commitdiff
tracetool: handle DTrace keywords 'in', 'next', 'self'
authorStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Mon, 16 Apr 2012 11:47:58 +0000 (12:47 +0100)
committerStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Wed, 18 Apr 2012 13:03:00 +0000 (14:03 +0100)
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 <stefanha@linux.vnet.ibm.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
Reviewed-by: LluĂ­s Vilanova <vilanova@ac.upc.edu>
scripts/tracetool/backend/dtrace.py

index cebbd57dd8dcac2eee26dc19cf5ac7285ff8cd0e..9cab75cde8d8d2d6c578c1127f4d75abf8b0e2ba 100644 (file)
@@ -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('}')