From patchwork Mon Apr 10 12:55:14 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: 97127 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp1350490qgd; Mon, 10 Apr 2017 06:01:35 -0700 (PDT) X-Received: by 10.55.77.79 with SMTP id a76mr620957qkb.296.1491829183815; Mon, 10 Apr 2017 05:59:43 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id a9si13368082qkg.12.2017.04.10.05.59.43 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 10 Apr 2017 05:59:43 -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]:34334 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cxYuz-0005jY-9W for patch@linaro.org; Mon, 10 Apr 2017 08:59:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53421) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cxYqr-0002UE-Ry for qemu-devel@nongnu.org; Mon, 10 Apr 2017 08:55:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cxYqn-00036s-Mb for qemu-devel@nongnu.org; Mon, 10 Apr 2017 08:55:25 -0400 Received: from mail-wr0-x234.google.com ([2a00:1450:400c:c0c::234]:33355) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cxYqn-00035g-GK for qemu-devel@nongnu.org; Mon, 10 Apr 2017 08:55:21 -0400 Received: by mail-wr0-x234.google.com with SMTP id l28so18756218wre.0 for ; Mon, 10 Apr 2017 05:55:19 -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=TkYgST0aC7EfCsvhWzUDsbmC+uJRo/NfprdBJQDP9ck=; b=kdrOjdcBdgCutEMx4cn15OET3jTL0yU+79ue5Gy6ddgnocKdITYLYCwkb48UyOuyzq 6aL8UQRbFVwxylk88d1Q9Mmz/zBTU+56LoA4ENcnX8fq6GdLXV0soCNVvXA+W6oA8oh5 HbZk1RBOTBBV8sBJPQL1QqCxacKg964TFE4E0= 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=TkYgST0aC7EfCsvhWzUDsbmC+uJRo/NfprdBJQDP9ck=; b=bjdnVEn7j3E6FtGz5l4stxWlYAk+l98gBI5efAw4RvYmQe3eSlU1tN1Zfpjir2KtpK Vh0UAkeKGQWm0B4UdS7pPaAtfQyrn3nRuyuZNPknzsNV8DvRWrTf8Fv5+kIx1z99fSVL OtaPlXI96OcyxnLZe5tloVUYGfiYZzcKxQI01/bhKSchGArQ8MqomJjBJedAwtSIl0q4 pyd1gb/A5hhVVn4CxFWP6B/XksbkgAJx/HgI9GCLV6FHqullHwqQgUuhzUIsNupMxFpj 1S/4DazoY1dbDJ2/1/OMvg1QvnuNHZPiDvtVVgE5Ps/JUXOKf19UAri1hWoHxSBUDjsB 9EJA== X-Gm-Message-State: AFeK/H0KqLdEGYlQlqWQwu74HiBSE3oWbChPatAkY6xH921bQ/2s68kTIa4x8KddpbppyZJ7 X-Received: by 10.223.164.195 with SMTP id h3mr38501689wrb.171.1491828918062; Mon, 10 Apr 2017 05:55:18 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id m201sm10226411wmd.15.2017.04.10.05.55.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Apr 2017 05:55:16 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id EDCA13E0FB5; Mon, 10 Apr 2017 13:55:24 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Mon, 10 Apr 2017 13:55:14 +0100 Message-Id: <20170410125524.21008-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170410125524.21008-1-alex.bennee@linaro.org> References: <20170410125524.21008-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::234 Subject: [Qemu-devel] [PULL 01/11] 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: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org 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 -- 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)