From patchwork Tue Mar 17 16:36:15 2020 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: 184635 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4374038ile; Tue, 17 Mar 2020 09:57:01 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsA5NzC3CHdSsYbIzYmqVfb/k40nf53YcZt6AR38P4nmXd0IDbVJO2EDHU/jrRa3uJUZOd5 X-Received: by 2002:a37:80c7:: with SMTP id b190mr5815883qkd.255.1584464221574; Tue, 17 Mar 2020 09:57:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584464221; cv=none; d=google.com; s=arc-20160816; b=mbA3maMPQ9aLtJrYAXVsHnko5TVfc0eD5voqxZJiIYZC4DFwyJflk1bAPyND40NCRM wiWh8xCUwOpKnbjTAm0+zVKA6WNJu4zu6WfagkBcvbCbBEe2MAvTH1Q77rKW1EhjsDuO Aivu1Y+7XumqM1aX4s3rnB+Pm0vND4aMbZTdcK5OHv2pdqObONP2qGtwQ8EwfklG+ca7 BHEl59SBz1t0e7qB2X9ksGlSexrRAHt/SFoUF/R07niyb6NWAyhSGe1VPMH2Q6wxGT3o JoAOSIT21JcMSJHPNLVT6bfedOU32v1acTLI9lQQ0vK5yt/Ca3aUuLM6ic5UXYQo1QAL y2AQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=mfXBsBn9LUhSN6WgjaxZSay9usosB3zq5/7Zod3QK24=; b=sNaKd9ukce0o4bFtYEvuQRNlkwsbECQQUYye0dlZvRmmIcpMEksNxJC4uQHNFio1oo BimY84VAv80kUaAsNFZXhQ1vDxnQP1ueuHNmfX6+A8rGp+vY2uOXyoVyziJCGnyBH9o2 TG9k8guG9QPU67yYhSvXa3htNBxAkznHdnbNcTZGTUwQM4lGm1XsgCswiFwItWh0uGcI gpEP8GCLoEx74A7Nk4sQYYo/veXYJUqYH6+jyHMdBk0GuWS9MGSx14MG1jDxc6oup55G FdLddVwfulNLtYM0u0ClwsU8cxHdic5wkCGQtj4MaXOFh1WUwgs2U/w8AoF+CK57tNZZ OvJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=QUEYm0Gv; 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=amsat.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x15si2351832qkn.232.2020.03.17.09.57.01 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Mar 2020 09:57:01 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=QUEYm0Gv; 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=amsat.org Received: from localhost ([::1]:36986 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEFWX-0001uY-0k for patch@linaro.org; Tue, 17 Mar 2020 12:57:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36015) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEFCn-0003z4-Hg for qemu-devel@nongnu.org; Tue, 17 Mar 2020 12:36:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jEFCm-00045K-5y for qemu-devel@nongnu.org; Tue, 17 Mar 2020 12:36:37 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:38015) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jEFCl-0003zS-UZ for qemu-devel@nongnu.org; Tue, 17 Mar 2020 12:36:36 -0400 Received: by mail-wr1-x429.google.com with SMTP id s1so4826255wrv.5 for ; Tue, 17 Mar 2020 09:36:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mfXBsBn9LUhSN6WgjaxZSay9usosB3zq5/7Zod3QK24=; b=QUEYm0GvgtCTNgoqFK+49ALq0djvwNFe8r0Xv+LW/Ri4C19e9ps7Z2wAGtxu5r//9f ROkmA6VWTsMns3NN2D+6Qs/V5K63h/AxbvmhP5yfgwePIPfFScyJu3flpVE3r5s0ivsF zyHvRq6AKPieVIR50GBCat0tnwWvr3obgCG5jVMtIQWCWtGQnZG5a636A3GX2+vut1i9 mggir+p+4M1U7/gldFuJAfprah/nWk6zRgQ74PRlCekRYFOOPHI3esHYstiM4GpGutfl bvHBsBC1IACsMAnnIAtwxTvkBF8UH1FtIRRhd+RxTshfyK9VdWZr8+QXaYVIK3vHAbaS A9pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=mfXBsBn9LUhSN6WgjaxZSay9usosB3zq5/7Zod3QK24=; b=EZwKcQbcKhOEJOlyFY4PokuAf3w4zpgJG6PWlN3suTRWbUVG/QCqi2SL8uuUJHMLgH cj0LgRfbSt0PrJLSoBuY7f80B3B3ri5MhNuCuMeCTa7uUcS7R3vPx01wdg+tYsxM4QID yv2AvqDPaAgPgA4OjMuNLlO2g2O5H2viXB3Png0bikIk78ft2iG/Bg98Dq/of00H8Wqm a32z93itv/PyXaQNcMNb4+41qxv0VYemlfUgNizMzVutUvsupGq7lCukjnxZVFP4ZMLr IRktO4+PwUq/8WfDL8y+S1exwB57Fcej2tq6GybZiVpNSQnCsid7fNn0LJOehVE1rWwf PqbQ== X-Gm-Message-State: ANhLgQ1tXiPzUr+qZMmWb6aBwCIYP2kgFR9z2Iz6ucJIaeRK+CsgOG9a LafO/3fXUEmu1/FWoHUrylalSYku X-Received: by 2002:a5d:5342:: with SMTP id t2mr7085696wrv.104.1584462994353; Tue, 17 Mar 2020 09:36:34 -0700 (PDT) Received: from x1w.redhat.com (96.red-83-59-163.dynamicip.rima-tde.net. [83.59.163.96]) by smtp.gmail.com with ESMTPSA id b202sm4618697wmd.15.2020.03.17.09.36.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2020 09:36:33 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 12/13] target/rx: Dump bytes for each insn during disassembly Date: Tue, 17 Mar 2020 17:36:15 +0100 Message-Id: <20200317163616.30027-13-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200317163616.30027-1-f4bug@amsat.org> References: <20200317163616.30027-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::429 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: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= , Yoshinori Sato , Richard Henderson 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 Tested-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-Id: <20190531134315.4109-24-richard.henderson@linaro.org> Acked-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- target/rx/disas.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) -- 2.21.1 diff --git a/target/rx/disas.c b/target/rx/disas.c index dcfb7baf99..6dee7a0342 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