summaryrefslogtreecommitdiffstats
path: root/scripts/tracetool
diff options
context:
space:
mode:
authorStefan Hajnoczi2012-04-16 13:47:58 +0200
committerStefan Hajnoczi2012-04-18 15:03:00 +0200
commit256a721d46a112d8807a488ec0176985c09bbbf1 (patch)
tree45c6fd636d58700858467f6fe5871f5b913dec7a /scripts/tracetool
parenttracetool: Add MAINTAINERS info (diff)
downloadqemu-256a721d46a112d8807a488ec0176985c09bbbf1.tar.gz
qemu-256a721d46a112d8807a488ec0176985c09bbbf1.tar.xz
qemu-256a721d46a112d8807a488ec0176985c09bbbf1.zip
tracetool: handle DTrace keywords 'in', 'next', 'self'
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>
Diffstat (limited to 'scripts/tracetool')
-rw-r--r--scripts/tracetool/backend/dtrace.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/tracetool/backend/dtrace.py b/scripts/tracetool/backend/dtrace.py
index cebbd57dd8..9cab75cde8 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('}')