From patchwork Wed Apr 5 13:24:52 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: 96848 Delivered-To: patch@linaro.org Received: by 10.182.246.10 with SMTP id xs10csp258336obc; Wed, 5 Apr 2017 06:25:32 -0700 (PDT) X-Received: by 10.237.63.39 with SMTP id p36mr27590898qtf.187.1491398732143; Wed, 05 Apr 2017 06:25:32 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id v2si17766655qte.298.2017.04.05.06.25.32 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 05 Apr 2017 06:25:32 -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]:40553 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvkwF-0004dv-Mx for patch@linaro.org; Wed, 05 Apr 2017 09:25:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvkvq-0004VR-PQ for qemu-devel@nongnu.org; Wed, 05 Apr 2017 09:25:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cvkvo-0000Cv-OZ for qemu-devel@nongnu.org; Wed, 05 Apr 2017 09:25:06 -0400 Received: from mail-wr0-x235.google.com ([2a00:1450:400c:c0c::235]:36361) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cvkvo-0000Cf-IQ for qemu-devel@nongnu.org; Wed, 05 Apr 2017 09:25:04 -0400 Received: by mail-wr0-x235.google.com with SMTP id w11so13731202wrc.3 for ; Wed, 05 Apr 2017 06:25:04 -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=XvjMPT9k/uYDRTkTG6o8j8NjuOJ+6lQxHkvIG1fUgw6H08FXvWAVLm5Tm3A+ZL+0MO LpEacab3Xpf26J+I591OeOVAt19lJZUT7ZfsDwWOMDRUNmlUK75u4ifdY2feMpXYopom 3b5MDwiJD1rsvlimbH3Xnfe7VRl1JSoOgXXto= 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=JG92XtEXaAoQ27x5aqCly1a8XXNIYpOG5vpzrNSm4YQO//HdA0ew6S+9JU3JOIBD6h eDTtr3BQFFNhhpN6y4eV1yWl/yAdAvc4zMfVsaK9LdvALoFsJhavt7CrnczLN94DaM/D 73bZ9T+zowzOm+MmxAA2rfFqltqJ3wpCXW2keAM5hzImEgQ54H4LfmfgEHmut9rwrH3t w7lZTmPa1YMHv8a4cOlzD795itGWqhJP+tB2MHK5xHY/OYBTi/ncRnewnGC5HcBjMMLK cqYjA2rpOibqEX6tPKtJ8OSUTg69sJG0pWipfg+54dEZobKxiIbS6os5eMjD9bP9YOdc dePQ== X-Gm-Message-State: AFeK/H0uq6kDymZAsFjshTSlOmdOoVkr0s+lFF+GaI1cJk56VyWB1XvKDEJdZM8A0FRHtW2l X-Received: by 10.28.64.135 with SMTP id n129mr13808757wma.45.1491398702916; Wed, 05 Apr 2017 06:25:02 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id u9sm12512275wme.8.2017.04.05.06.25.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Apr 2017 06:25:01 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 2EDCF3E029D; Wed, 5 Apr 2017 14:25:03 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: dovgaluk@ispras.ru, rth@twiddle.net, pbonzini@redhat.com Date: Wed, 5 Apr 2017 14:24:52 +0100 Message-Id: <20170405132503.32125-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170405132503.32125-1-alex.bennee@linaro.org> References: <20170405132503.32125-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::235 Subject: [Qemu-devel] [PATCH v2 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)