yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-simpletrace-Convert-name-from-mapping-record-to-str.patch

ae23c9
From 94150e55c2a2f43e95e5c14c753aee5900df47f1 Mon Sep 17 00:00:00 2001
ae23c9
From: Stefan Hajnoczi <stefanha@redhat.com>
ae23c9
Date: Wed, 11 Jul 2018 12:31:04 +0100
ae23c9
Subject: [PATCH 3/4] simpletrace: Convert name from mapping record to str
ae23c9
ae23c9
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
ae23c9
Message-id: <20180711123104.31091-2-stefanha@redhat.com>
ae23c9
Patchwork-id: 81299
ae23c9
O-Subject: [qemu-kvm RHEL8/virt212 PATCH 1/1] simpletrace: Convert name from mapping record to str
ae23c9
Bugzilla: 1594969
ae23c9
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
ae23c9
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
ae23c9
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
ae23c9
ae23c9
From: Eduardo Habkost <ehabkost@redhat.com>
ae23c9
ae23c9
The rest of the code assumes that idtoname is a (int -> str)
ae23c9
dictionary, so convert the data accordingly.
ae23c9
ae23c9
This is necessary to make the script work with Python 3 (where
ae23c9
reads from a binary file return 'bytes' objects, not 'str').
ae23c9
ae23c9
Fixes the following error:
ae23c9
ae23c9
  $ python3 ./scripts/simpletrace.py trace-events-all trace-27445
ae23c9
  b'object_class_dynamic_cast_assert' event is logged but is not \
ae23c9
  declared in the trace events file, try using trace-events-all instead.
ae23c9
ae23c9
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
ae23c9
Message-id: 20180619194549.15584-1-ehabkost@redhat.com
ae23c9
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
ae23c9
(cherry picked from commit 749c1d8e3e12c44247927d8f72f68ec0c0266f8b)
ae23c9
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 scripts/simpletrace.py | 2 +-
ae23c9
 1 file changed, 1 insertion(+), 1 deletion(-)
ae23c9
ae23c9
diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py
ae23c9
index d4a50a1..4ad34f9 100755
ae23c9
--- a/scripts/simpletrace.py
ae23c9
+++ b/scripts/simpletrace.py
ae23c9
@@ -70,7 +70,7 @@ def get_record(edict, idtoname, rechdr, fobj):
ae23c9
 def get_mapping(fobj):
ae23c9
     (event_id, ) = struct.unpack('=Q', fobj.read(8))
ae23c9
     (len, ) = struct.unpack('=L', fobj.read(4))
ae23c9
-    name = fobj.read(len)
ae23c9
+    name = fobj.read(len).decode()
ae23c9
 
ae23c9
     return (event_id, name)
ae23c9
 
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9