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: 9664035 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1F75360353 for ; Wed, 5 Apr 2017 13:26:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0458D28518 for ; Wed, 5 Apr 2017 13:26:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED27828517; Wed, 5 Apr 2017 13:26:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9199028518 for ; Wed, 5 Apr 2017 13:26:15 +0000 (UTC) Received: from localhost ([::1]:40553 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvkww-0004dv-L1 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 05 Apr 2017 09:26:14 -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=20Benn=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=20Benn=C3=A9e?= , fred.konrad@greensocs.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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)