[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 01/18] trace: extract stap_escape() function for reus
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 01/18] trace: extract stap_escape() function for reuse |
Date: |
Tue, 12 Aug 2014 14:37:38 +0100 |
SystemTap reserved words sometimes conflict with QEMU variable names.
We escape them to prevent conflicts.
Move escaping into its own function so the next patch can reuse it.
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
scripts/tracetool/format/stap.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/scripts/tracetool/format/stap.py b/scripts/tracetool/format/stap.py
index e24abf7..9e780f1 100644
--- a/scripts/tracetool/format/stap.py
+++ b/scripts/tracetool/format/stap.py
@@ -27,6 +27,13 @@ RESERVED_WORDS = (
)
+def stap_escape(identifier):
+ # Append underscore to reserved keywords
+ if identifier in RESERVED_WORDS:
+ return identifier + '_'
+ return identifier
+
+
def generate(events, backend):
events = [e for e in events
if "disable" not in e.properties]
@@ -45,9 +52,7 @@ def generate(events, backend):
i = 1
if len(e.args) > 0:
for name in e.args.names():
- # Append underscore to reserved keywords
- if name in RESERVED_WORDS:
- name += '_'
+ name = stap_escape(name)
out(' %s = $arg%d;' % (name, i))
i += 1
--
1.9.3
- [Qemu-devel] [PULL 00/18] Tracing patches, Stefan Hajnoczi, 2014/08/12
- [Qemu-devel] [PULL 02/18] trace: add tracetool simpletrace_stap format, Stefan Hajnoczi, 2014/08/12
- [Qemu-devel] [PULL 01/18] trace: extract stap_escape() function for reuse,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 04/18] trace: install simpletrace SystemTap tapset, Stefan Hajnoczi, 2014/08/12
- [Qemu-devel] [PULL 03/18] simpletrace: add simpletrace.py --no-header option, Stefan Hajnoczi, 2014/08/12
- [Qemu-devel] [PULL 06/18] trace: [tcg] Argument type transformation rules, Stefan Hajnoczi, 2014/08/12
- [Qemu-devel] [PULL 05/18] trace: [tcg] Add documentation, Stefan Hajnoczi, 2014/08/12
- [Qemu-devel] [PULL 07/18] trace: [tcg] Argument type transformation machinery, Stefan Hajnoczi, 2014/08/12
- [Qemu-devel] [PULL 08/18] trace: [tcg] Add 'tcg' event property, Stefan Hajnoczi, 2014/08/12
- [Qemu-devel] [PULL 10/18] trace: [tcg] Define TCG tracing helper routines, Stefan Hajnoczi, 2014/08/12
- [Qemu-devel] [PULL 09/18] trace: [tcg] Declare TCG tracing helper routines, Stefan Hajnoczi, 2014/08/12
- [Qemu-devel] [PULL 11/18] trace: [tcg] Define TCG tracing helper routine wrappers, Stefan Hajnoczi, 2014/08/12
- [Qemu-devel] [PULL 12/18] trace: [tcg] Include TCG-tracing helpers, Stefan Hajnoczi, 2014/08/12