From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: saito.kazuya@jp.fujitsu.com,
Stefan Hajnoczi <stefanha@redhat.com>,
vilanova@ac.upc.edu
Subject: [Qemu-devel] [PATCH v2 1/4] trace: extract stap_escape() function for reuse
Date: Sun, 22 Jun 2014 21:46:04 +0800 [thread overview]
Message-ID: <1403444767-2601-2-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1403444767-2601-1-git-send-email-stefanha@redhat.com>
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 | 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
next prev parent reply other threads:[~2014-06-22 13:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-22 13:46 [Qemu-devel] [PATCH v2 0/4] trace: add simpletrace-stap format to generate binary trace Stefan Hajnoczi
2014-06-22 13:46 ` Stefan Hajnoczi [this message]
2014-06-22 13:46 ` [Qemu-devel] [PATCH v2 2/4] trace: add tracetool simpletrace_stap format Stefan Hajnoczi
2014-06-22 13:46 ` [Qemu-devel] [PATCH v2 3/4] simpletrace: add simpletrace.py --no-header option Stefan Hajnoczi
2014-06-22 13:46 ` [Qemu-devel] [PATCH v2 4/4] trace: install simpletrace SystemTap tapset Stefan Hajnoczi
2014-07-09 7:06 ` [Qemu-devel] [PATCH v2 0/4] trace: add simpletrace-stap format to generate binary trace Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1403444767-2601-2-git-send-email-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=saito.kazuya@jp.fujitsu.com \
--cc=vilanova@ac.upc.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).