peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame qemu-fix-systemtap.patch

5439f9
commit 256a721d46a112d8807a488ec0176985c09bbbf1
5439f9
Author: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
5439f9
Date:   Mon Apr 16 12:47:58 2012 +0100
5439f9
5439f9
    tracetool: handle DTrace keywords 'in', 'next', 'self'
5439f9
    
5439f9
    Language keywords cannot be used as argument names.  The DTrace backend
5439f9
    appends an underscore to the argument name in order to make the argument
5439f9
    name legal.
5439f9
    
5439f9
    This patch adds 'in', 'next', and 'self' keywords to dtrace.py.
5439f9
    
5439f9
    Also drop the unnecessary argument name lstrip() call.  The
5439f9
    Arguments.build() method already ensures there is no space around
5439f9
    argument names.  Furthermore it is misleading to do the lstrip() *after*
5439f9
    checking against keywords because the keyword check would not match if
5439f9
    spaces were in the name.
5439f9
    
5439f9
    Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
5439f9
    Reviewed-by: Alon Levy <alevy@redhat.com>
5439f9
    Reviewed-by: LluĂ­s Vilanova <vilanova@ac.upc.edu>
5439f9
5439f9
diff --git a/scripts/tracetool/backend/dtrace.py b/scripts/tracetool/backend/dtrace.py
5439f9
index cebbd57..9cab75c 100644
5439f9
--- a/scripts/tracetool/backend/dtrace.py
5439f9
+++ b/scripts/tracetool/backend/dtrace.py
5439f9
@@ -86,10 +86,10 @@ def stap(events):
5439f9
         i = 1
5439f9
         if len(e.args) > 0:
5439f9
             for name in e.args.names():
5439f9
-                # 'limit' is a reserved keyword
5439f9
-                if name == 'limit':
5439f9
-                    name = '_limit'
5439f9
-                out('  %s = $arg%d;' % (name.lstrip(), i))
5439f9
+                # Append underscore to reserved keywords
5439f9
+                if name in ('limit', 'in', 'next', 'self'):
5439f9
+                    name += '_'
5439f9
+                out('  %s = $arg%d;' % (name, i))
5439f9
                 i += 1
5439f9
 
5439f9
         out('}')