|
|
ddf19c |
From e7cdcd1e39c4c030a32c9e8ef79316eae8555bc8 Mon Sep 17 00:00:00 2001
|
|
|
ddf19c |
From: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
ddf19c |
Date: Thu, 16 Jan 2020 17:52:48 +0000
|
|
|
ddf19c |
Subject: [PATCH 04/15] trace: update qemu-trace-stap to Python 3
|
|
|
ddf19c |
MIME-Version: 1.0
|
|
|
ddf19c |
Content-Type: text/plain; charset=UTF-8
|
|
|
ddf19c |
Content-Transfer-Encoding: 8bit
|
|
|
ddf19c |
|
|
|
ddf19c |
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
ddf19c |
Message-id: <20200116175248.286556-2-stefanha@redhat.com>
|
|
|
ddf19c |
Patchwork-id: 93365
|
|
|
ddf19c |
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 1/1] trace: update qemu-trace-stap to Python 3
|
|
|
ddf19c |
Bugzilla: 1787395
|
|
|
ddf19c |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
ddf19c |
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
|
|
ddf19c |
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
ddf19c |
|
|
|
ddf19c |
qemu-trace-stap does not support Python 3 yet:
|
|
|
ddf19c |
|
|
|
ddf19c |
$ scripts/qemu-trace-stap list path/to/qemu-system-x86_64
|
|
|
ddf19c |
Traceback (most recent call last):
|
|
|
ddf19c |
File "scripts/qemu-trace-stap", line 175, in <module>
|
|
|
ddf19c |
main()
|
|
|
ddf19c |
File "scripts/qemu-trace-stap", line 171, in main
|
|
|
ddf19c |
args.func(args)
|
|
|
ddf19c |
File "scripts/qemu-trace-stap", line 118, in cmd_list
|
|
|
ddf19c |
print_probes(args.verbose, "*")
|
|
|
ddf19c |
File "scripts/qemu-trace-stap", line 114, in print_probes
|
|
|
ddf19c |
if line.startswith(prefix):
|
|
|
ddf19c |
TypeError: startswith first arg must be bytes or a tuple of bytes, not str
|
|
|
ddf19c |
|
|
|
ddf19c |
Now that QEMU requires Python 3.5 or later we can switch to pure Python
|
|
|
ddf19c |
3. Use Popen()'s universal_newlines=True argument to treat stdout as
|
|
|
ddf19c |
text instead of binary.
|
|
|
ddf19c |
|
|
|
ddf19c |
Fixes: 62dd1048c0bd ("trace: add ability to do simple printf logging via systemtap")
|
|
|
ddf19c |
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1787395
|
|
|
ddf19c |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
ddf19c |
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
|
ddf19c |
Message-id: 20200107112438.383958-1-stefanha@redhat.com
|
|
|
ddf19c |
Message-Id: <20200107112438.383958-1-stefanha@redhat.com>
|
|
|
ddf19c |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
ddf19c |
(cherry picked from commit 3f0097169bb60268cc5dda0c5ea47c31ab57b22f)
|
|
|
ddf19c |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
ddf19c |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
ddf19c |
---
|
|
|
ddf19c |
scripts/qemu-trace-stap | 8 ++++----
|
|
|
ddf19c |
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
ddf19c |
|
|
|
ddf19c |
diff --git a/scripts/qemu-trace-stap b/scripts/qemu-trace-stap
|
|
|
ddf19c |
index 91d1051..90527eb 100755
|
|
|
ddf19c |
--- a/scripts/qemu-trace-stap
|
|
|
ddf19c |
+++ b/scripts/qemu-trace-stap
|
|
|
ddf19c |
@@ -1,4 +1,4 @@
|
|
|
ddf19c |
-#!/usr/bin/python
|
|
|
ddf19c |
+#!/usr/bin/env python3
|
|
|
ddf19c |
# -*- python -*-
|
|
|
ddf19c |
#
|
|
|
ddf19c |
# Copyright (C) 2019 Red Hat, Inc
|
|
|
ddf19c |
@@ -18,8 +18,6 @@
|
|
|
ddf19c |
# You should have received a copy of the GNU General Public License
|
|
|
ddf19c |
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
|
ddf19c |
|
|
|
ddf19c |
-from __future__ import print_function
|
|
|
ddf19c |
-
|
|
|
ddf19c |
import argparse
|
|
|
ddf19c |
import copy
|
|
|
ddf19c |
import os.path
|
|
|
ddf19c |
@@ -104,7 +102,9 @@ def cmd_list(args):
|
|
|
ddf19c |
if verbose:
|
|
|
ddf19c |
print("Listing probes with name '%s'" % script)
|
|
|
ddf19c |
proc = subprocess.Popen(["stap", "-l", script],
|
|
|
ddf19c |
- stdout=subprocess.PIPE, env=tapset_env(tapsets))
|
|
|
ddf19c |
+ stdout=subprocess.PIPE,
|
|
|
ddf19c |
+ universal_newlines=True,
|
|
|
ddf19c |
+ env=tapset_env(tapsets))
|
|
|
ddf19c |
out, err = proc.communicate()
|
|
|
ddf19c |
if proc.returncode != 0:
|
|
|
ddf19c |
print("No probes found, are the tapsets installed in %s" % tapset_dir(args.binary))
|
|
|
ddf19c |
--
|
|
|
ddf19c |
1.8.3.1
|
|
|
ddf19c |
|