cryptospore / rpms / qemu-kvm

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