From patchwork Mon Apr 3 12:45:16 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: 96630 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp82595qgd; Mon, 3 Apr 2017 05:47:36 -0700 (PDT) X-Received: by 10.233.232.68 with SMTP id a65mr6474747qkg.104.1491223656768; Mon, 03 Apr 2017 05:47:36 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id b134si2250504qkg.144.2017.04.03.05.47.36 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 03 Apr 2017 05:47:36 -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]:59133 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cv1OQ-0002dF-Cs for patch@linaro.org; Mon, 03 Apr 2017 08:47:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52373) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cv1MU-0001LX-1M for qemu-devel@nongnu.org; Mon, 03 Apr 2017 08:45:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cv1MP-00011u-Lw for qemu-devel@nongnu.org; Mon, 03 Apr 2017 08:45:34 -0400 Received: from mail-wr0-x229.google.com ([2a00:1450:400c:c0c::229]:35071) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cv1MP-000118-FS for qemu-devel@nongnu.org; Mon, 03 Apr 2017 08:45:29 -0400 Received: by mail-wr0-x229.google.com with SMTP id k6so162836978wre.2 for ; Mon, 03 Apr 2017 05:45:27 -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=MIQActdlSi9GvsfxXC3ocE3vBTIuaVQbbRrJ/DaBQCpiUSAh3WiP3ep3jgjDIU5Auz liCdFtR30Qm6vRkHNra+ocBa9P+BeuauW/fTqOSagsoff5h14r0Xf/Hs/bARJh0zvyYT J6dvBwn/HLzw6qV+KMFYkM+qgCnbWYOWOmxzc= 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=b4Sf/rixOYhv1C/hw4/t2KgIo/w5HkZbm7e1MPsOdTxhhS1orfCm1HtJLagdhdZUZJ d1hJVt1DLvHLqjdymnVTOFdX43yUcMjYKUDJRaDamt1ZBE3oSvKNc/TrhkW0bK3Xaiap IfLm7FBJQLYcLz2j6QuI1zJXWtCbQvkjHb38wtaPQQQjBROF2NY3YefO8TcHBFY4mI9d Lrgf3gjI5JY6gbGVIu+5GzY/BPL0XTNKe4HFBH3Pp64oygp7ukOcpdjGIp/zLNa03zHo vsa37XYWLK73+CTcho8Z95qR0GNR3GQ15jtgbw+rhlElJzwjrcaeQMTVtmR9WspaRzDs mcZQ== X-Gm-Message-State: AFeK/H3Nb2gfK1ALuqkg8qweNnYr2HUjAKAybDFg3BrXtboiLiaCte5S WyYUr8fP0TKUUNe6 X-Received: by 10.28.113.12 with SMTP id m12mr9375748wmc.18.1491223526628; Mon, 03 Apr 2017 05:45:26 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id v14sm14175247wmv.24.2017.04.03.05.45.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Apr 2017 05:45:25 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id CD9443E1050; Mon, 3 Apr 2017 13:45:24 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: dovgaluk@ispras.ru, rth@twiddle.net, pbonzini@redhat.com Date: Mon, 3 Apr 2017 13:45:16 +0100 Message-Id: <20170403124524.10824-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170403124524.10824-1-alex.bennee@linaro.org> References: <20170403124524.10824-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::229 Subject: [Qemu-devel] [RFC PATCH v1 1/9] 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)