|
|
9ae3a8 |
From 7c6cf82e285a657b38a2b2c85e26d975b7e91ae0 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
Date: Tue, 7 Oct 2014 14:06:54 +0200
|
|
|
9ae3a8 |
Subject: [PATCH 36/43] trace: extract stap_escape() function for reuse
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Message-id: <1412690820-31016-6-git-send-email-stefanha@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 61610
|
|
|
9ae3a8 |
O-Subject: [RHEL7.1 qemu-kvm PATCH 05/11] trace: extract stap_escape() function for reuse
|
|
|
9ae3a8 |
Bugzilla: 1088112
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
SystemTap reserved words sometimes conflict with QEMU variable names.
|
|
|
9ae3a8 |
We escape them to prevent conflicts.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Move escaping into its own function so the next patch can reuse it.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit a76ccf3c1cb06576af091c5ac8bc264515b1bb7f)
|
|
|
9ae3a8 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Conflicts:
|
|
|
9ae3a8 |
scripts/tracetool/format/stap.py
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
The tracetool downstream code is missing the TCG instrumentation and
|
|
|
9ae3a8 |
multi-backend tracing, which involved a reorganization of the code.
|
|
|
9ae3a8 |
The upstream patch modified scripts/tracetool/format/stap.py but
|
|
|
9ae3a8 |
downstream the right file is scripts/tracetool/backend/dtrace.py.
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
scripts/tracetool/backend/dtrace.py | 11 ++++++++---
|
|
|
9ae3a8 |
1 file changed, 8 insertions(+), 3 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/scripts/tracetool/backend/dtrace.py b/scripts/tracetool/backend/dtrace.py
|
|
|
9ae3a8 |
index e31bc79..614316f 100644
|
|
|
9ae3a8 |
--- a/scripts/tracetool/backend/dtrace.py
|
|
|
9ae3a8 |
+++ b/scripts/tracetool/backend/dtrace.py
|
|
|
9ae3a8 |
@@ -35,6 +35,13 @@ def _binary():
|
|
|
9ae3a8 |
return BINARY
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+def stap_escape(identifier):
|
|
|
9ae3a8 |
+ # Append underscore to reserved keywords
|
|
|
9ae3a8 |
+ if identifier in RESERVED_WORDS:
|
|
|
9ae3a8 |
+ return identifier + '_'
|
|
|
9ae3a8 |
+ return identifier
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
def c(events):
|
|
|
9ae3a8 |
pass
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
@@ -98,9 +105,7 @@ def stap(events):
|
|
|
9ae3a8 |
i = 1
|
|
|
9ae3a8 |
if len(e.args) > 0:
|
|
|
9ae3a8 |
for name in e.args.names():
|
|
|
9ae3a8 |
- # Append underscore to reserved keywords
|
|
|
9ae3a8 |
- if name in RESERVED_WORDS:
|
|
|
9ae3a8 |
- name += '_'
|
|
|
9ae3a8 |
+ name = stap_escape(name)
|
|
|
9ae3a8 |
out(' %s = $arg%d;' % (name, i))
|
|
|
9ae3a8 |
i += 1
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|