From patchwork Tue Jun 11 11:37:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 166431 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2264284ilk; Tue, 11 Jun 2019 05:01:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxo688O4MuhtpHcEYNaRWjVsLnxIh+8LSyrx7BcZhCQYCSZv9//SAeNeqD1+eP3nq9euHxg X-Received: by 2002:ac8:1829:: with SMTP id q38mr46256737qtj.252.1560254519890; Tue, 11 Jun 2019 05:01:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560254519; cv=none; d=google.com; s=arc-20160816; b=si3Kfjha6RsSKoJ+wYvLdbyJyk6l9ZbCmMLfTZ8M7royqYa/IJTeksn1RAosKd4HUU LgtVaY8fZb05nGaHOXvNmolz2mBasLLv8O3/8Rx1dkexv7qflUbz230PQnazwwWTET5N 8meuYSD6Vs7v3CvrtQkUfzQmeRCANHg7+SOMJjFdotfLo3Rs5kaSRT1CIvL3QZQk4+GT 0zyUP3QmzCXUQIBic2ZgyuPWAhu1dcJOZmIbJk+t0+YLn+b5VBjOBEVwaoPthTLTmdou p/Pkp3YHHknOoBA0K/lp65NIY5HHiLIqu4yEW3tKGaGgwe/rj26+RQoP0GlvwvZNa8IM wF6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from; bh=fjiHS9xytTkZ9fd06fQEBg4Kt9fDBI24+AHRH/hfj1M=; b=zuqfH9VlivP5ezfYb7jzlwe0JxaLQ2UDmDvW0AUkTmT6owk+TeD6zGNirjghm7Vj06 U5v/BOO7FJ0mEJl0wIUS1MuQaJFlQ3Ed/ZhQA23KQpTOyL9nRMCkibtbF8kRIA3/ci/U 3FiYgW5zQ6rKAfcRqc+MUyXsrGh4ShN57n+6XUlheTeUHcNySdq4x+zcZEmKMVkeRFq2 NHejhqt5iSKtR+sl/OPIgsx0BLFeFbxEw07z476/zPUI3H4l1a7hlJkyNbesheIS26AZ xNVynQbfoLfhLKD29ezIJWVaaxb3FF2IFLebiwQRM/MpcurLFM30l8vR4JZGxbj6emjY NL2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v30si80288qtb.153.2019.06.11.05.01.59 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2019 05:01:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:56786 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hafTT-0002SF-FO for patch@linaro.org; Tue, 11 Jun 2019 08:01:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52343) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hafAD-0006ts-ED for qemu-devel@nongnu.org; Tue, 11 Jun 2019 07:42:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haf6R-0000Kh-OJ for qemu-devel@nongnu.org; Tue, 11 Jun 2019 07:38:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43776) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1haf6R-0000JE-IK for qemu-devel@nongnu.org; Tue, 11 Jun 2019 07:38:11 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DAC6D307D90D; Tue, 11 Jun 2019 11:38:10 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.167]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0698A60BF1; Tue, 11 Jun 2019 11:38:08 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Igor Mammedov Date: Tue, 11 Jun 2019 13:37:20 +0200 Message-Id: <20190611113731.16940-11-philmd@redhat.com> In-Reply-To: <20190611113731.16940-1-philmd@redhat.com> References: <20190611113731.16940-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 11 Jun 2019 11:38:10 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v19 10/21] target/rx: Dump bytes for each insn during disassembly X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , Yoshinori Sato , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson There are so many different forms of each RX instruction that it will be very useful to be able to look at the bytes to see on which path a bug may lie. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Yoshinori Sato Signed-off-by: Yoshinori Sato Message-Id: <20190607091116.49044-24-ysato@users.sourceforge.jp> Tested-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/rx/disas.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/target/rx/disas.c b/target/rx/disas.c index 5a32a87534..d73b53db44 100644 --- a/target/rx/disas.c +++ b/target/rx/disas.c @@ -102,7 +102,21 @@ static int bdsp_s(DisasContext *ctx, int d) /* Include the auto-generated decoder. */ #include "decode.inc.c" -#define prt(...) (ctx->dis->fprintf_func)((ctx->dis->stream), __VA_ARGS__) +static void dump_bytes(DisasContext *ctx) +{ + int i, len = ctx->len; + + for (i = 0; i < len; ++i) { + ctx->dis->fprintf_func(ctx->dis->stream, "%02x ", ctx->bytes[i]); + } + ctx->dis->fprintf_func(ctx->dis->stream, "%*c", (8 - i) * 3, '\t'); +} + +#define prt(...) \ + do { \ + dump_bytes(ctx); \ + ctx->dis->fprintf_func(ctx->dis->stream, __VA_ARGS__); \ + } while (0) #define RX_MEMORY_BYTE 0 #define RX_MEMORY_WORD 1