From nobody Sun Apr 28 06:36:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 152943767997052.60315883053465; Tue, 19 Jun 2018 12:47:59 -0700 (PDT) Received: from localhost ([::1]:44681 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVMbW-0000Ig-SD for importer@patchew.org; Tue, 19 Jun 2018 15:47:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56888) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVMZh-0007vl-QL for qemu-devel@nongnu.org; Tue, 19 Jun 2018 15:45:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVMZe-0000Kq-Lf for qemu-devel@nongnu.org; Tue, 19 Jun 2018 15:45:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36778) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fVMZe-0000Jk-FZ for qemu-devel@nongnu.org; Tue, 19 Jun 2018 15:45:54 -0400 Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F035E87621 for ; Tue, 19 Jun 2018 19:45:52 +0000 (UTC) Received: from localhost (ovpn-116-16.gru2.redhat.com [10.97.116.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id D8BDFAD93C; Tue, 19 Jun 2018 19:45:50 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Tue, 19 Jun 2018 16:45:49 -0300 Message-Id: <20180619194549.15584-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 19 Jun 2018 19:45:53 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] simpletrace: Convert name from mapping record to str X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Stefan Hajnoczi , Cleber Rosa Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The rest of the code assumes that idtoname is a (int -> str) dictionary, so convert the data accordingly. This is necessary to make the script work with Python 3 (where reads from a binary file return 'bytes' objects, not 'str'). Fixes the following error: $ python3 ./scripts/simpletrace.py trace-events-all trace-27445 b'object_class_dynamic_cast_assert' event is logged but is not \ declared in the trace events file, try using trace-events-all instead. Signed-off-by: Eduardo Habkost --- scripts/simpletrace.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py index d4a50a1e2b..4ad34f90cd 100755 --- a/scripts/simpletrace.py +++ b/scripts/simpletrace.py @@ -70,7 +70,7 @@ def get_record(edict, idtoname, rechdr, fobj): def get_mapping(fobj): (event_id, ) =3D struct.unpack('=3DQ', fobj.read(8)) (len, ) =3D struct.unpack('=3DL', fobj.read(4)) - name =3D fobj.read(len) + name =3D fobj.read(len).decode() =20 return (event_id, name) =20 --=20 2.18.0.rc1.1.g3f1ff2140