From patchwork Fri Apr 7 15:42:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 97030 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp339713qgd; Fri, 7 Apr 2017 08:42:53 -0700 (PDT) X-Received: by 10.55.132.3 with SMTP id g3mr37145250qkd.300.1491579773813; Fri, 07 Apr 2017 08:42:53 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 65si5104142qte.303.2017.04.07.08.42.53 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 07 Apr 2017 08:42:53 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51491 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwW2H-0002Po-BU for patch@linaro.org; Fri, 07 Apr 2017 11:42:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53348) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwW1p-0002OU-2u for qemu-devel@nongnu.org; Fri, 07 Apr 2017 11:42:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cwW1k-0007Q4-OM for qemu-devel@nongnu.org; Fri, 07 Apr 2017 11:42:25 -0400 Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]:37894) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cwW1k-0007Ok-Hm for qemu-devel@nongnu.org; Fri, 07 Apr 2017 11:42:20 -0400 Received: by mail-wm0-x232.google.com with SMTP id t189so10640824wmt.1 for ; Fri, 07 Apr 2017 08:42:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=y4gLmuyiJw4HesVY6D0Ojzjezl7TjKLlEXwQrdHobHg=; b=CvLaOogEdw2bHyCTInO6Sox/QMgNE90JOPZNdbs+JD25M4Q4jKDYY2/ui2jwSkFxyr 2eNOji/omB19GIFMnOInNJd7lyeFlNugTs6QGKFGDt4wm55ASVGHrDh5C7VWsDhFOAMs s2D58tlA+Jh2IjwzjecpzqAz80y0gT0hRj9sY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=y4gLmuyiJw4HesVY6D0Ojzjezl7TjKLlEXwQrdHobHg=; b=NovT8adT4yiidc68l7fllDW9MnMv0kKYuDI9YmHuIhNv9uK1NSUg3nxCwSEoTPrUWx UeUk2Pj4RLAXjXrdaLBExGWBjM+6UWa/qHGCCNahuok9SzxRKzO1sPVoZRcA1CvvWmeb K5I8aUhHyP32tsfAQBcYka3+Z18CLIU1wyW5LCED9d2e09l1KRTQxnKfi4L4c3ibL7sh sualGY85lPsirnsaC7hz5lpSkUPp6oh6jY+DM0g0UjiTdriwVxCm8UQmRuJ/ukiMkWq/ g/4PYSxYQ3RXx/RDhvzR8LPOLbq31NG8CmskRSIthZ3vwOcyZ8UqM+KGumruW5561pps yKMQ== X-Gm-Message-State: AN3rC/5+mH3yyokawatWNJb7ekKVPcxcsQK8GAhd3v6mATHjAFb0eQFb npPcMJCk7dPynYL3 X-Received: by 10.28.128.197 with SMTP id b188mr1401259wmd.115.1491579739358; Fri, 07 Apr 2017 08:42:19 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id m201sm6743476wmd.15.2017.04.07.08.42.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Apr 2017 08:42:17 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 1CC7D3E0FF9; Fri, 7 Apr 2017 16:42:22 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: dovgaluk@ispras.ru, rth@twiddle.net, pbonzini@redhat.com Date: Fri, 7 Apr 2017 16:42:10 +0100 Message-Id: <20170407154221.26918-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170407154221.26918-1-alex.bennee@linaro.org> References: <20170407154221.26918-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::232 Subject: [Qemu-devel] [PATCH v3 01/12] scripts/qemugdb/mtree.py: fix up mtree dump 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: mttcg@listserver.greensocs.com, peter.maydell@linaro.org, nikunj@linux.vnet.ibm.com, a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, cota@braap.org, bobby.prani@gmail.com, =?utf-8?q?Alex_Benn=C3=A9e?= , fred.konrad@greensocs.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Since QEMU has been able to build with native Int128 support this was broken as it attempts to fish values out of the non-existent structure. Also the alias print was trying to make a %x out of gdb.ValueType directly which didn't seem to work. Signed-off-by: Alex Bennée --- scripts/qemugdb/mtree.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) -- 2.11.0 diff --git a/scripts/qemugdb/mtree.py b/scripts/qemugdb/mtree.py index cc8131c2e7..e6791b7885 100644 --- a/scripts/qemugdb/mtree.py +++ b/scripts/qemugdb/mtree.py @@ -21,7 +21,15 @@ def isnull(ptr): return ptr == gdb.Value(0).cast(ptr.type) def int128(p): - return int(p['lo']) + (int(p['hi']) << 64) + '''Read an Int128 type to a python integer. + + QEMU can be built with native Int128 support so we need to detect + if the value is a structure or the native type. + ''' + if p.type.code == gdb.TYPE_CODE_STRUCT: + return int(p['lo']) + (int(p['hi']) << 64) + else: + return int(("%s" % p), 16) class MtreeCommand(gdb.Command): '''Display the memory tree hierarchy''' @@ -69,7 +77,7 @@ class MtreeCommand(gdb.Command): gdb.write('%s alias: %s@%016x (@ %s)\n' % (' ' * level, alias['name'].string(), - ptr['alias_offset'], + int(ptr['alias_offset']), alias, ), gdb.STDOUT)