projects
/
sdk
/
emulator
/
qemu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2d591ce
)
trace: extract stap_escape() function for reuse
author
Stefan Hajnoczi
<stefanha@redhat.com>
Sun, 22 Jun 2014 13:46:04 +0000
(21:46 +0800)
committer
Stefan Hajnoczi
<stefanha@redhat.com>
Tue, 12 Aug 2014 13:26:11 +0000
(14:26 +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 <stefanha@redhat.com>
scripts/tracetool/format/stap.py
patch
|
blob
|
history
diff --git
a/scripts/tracetool/format/stap.py
b/scripts/tracetool/format/stap.py
index
e24abf7
..
9e780f1
100644
(file)
--- 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