From patchwork Sun Mar 15 13:28:08 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: 184560 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp1698674ile; Sun, 15 Mar 2020 06:37:41 -0700 (PDT) X-Google-Smtp-Source: ADFU+vurTAwUmvRsDuWuUEXeuU1URzBrlM8IDsBUj1u8ITqKkYsjbV7/YUPncZOXCJ/ptgG67xU1 X-Received: by 2002:a37:9c07:: with SMTP id f7mr22483781qke.349.1584279461229; Sun, 15 Mar 2020 06:37:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584279461; cv=none; d=google.com; s=arc-20160816; b=UCtKSL7WZnK5GInMU0YB7zbtdwvjSzD3w7+/IE+VIHAgSaG9cz9XslKbexCGXs9eEh uSWynwDTBLdED2olnQrf3qjE/vyAUBWsubf57110JcfE4Lb1FRHnTpxnDLom8qRi0O9l OoHBMX0crXLo84jucn4038ALRAudbVcB3aKUrQTgPpO3q3SmM/ezTFgV9jsYu7eHQxFv Dl2FgG7SsUuLKmsAoD0oVEKw1sO9fo/YE7bJFiNeZCJsH6iF8ijdZG+ldgXmT4/WHRML iZVQDmHJplVX3ocKtfNadaLekRsKb1WduR5hYAoJKCLcwbMb9yV/S6J8p1VyD/FRVZPj kLbg== 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=rtyy8CX6lQ0m3U8wFWf3AzT/p7YOaZwtAFg++0OM+ps=; b=aKmYt51SPmIN+dBcQqHlsfakjQZ2gDIkUfXFuq0ugoXVsFOCOTZuWLenPozpxu9fr/ w9J0NWaEvP0jGyB77/mynjB7/HjaxIfsCs7oEVU+MZNvT/9FO2iqfOJ+6AKFh/2PUMuI RFqNys+XetpWRjMSYsZAoCFogp6HqVSRejC+1WY/KQZC+UtQgdDbOsRKivNs+sL/+8W+ qX28uXg+KhKcqeLbYK3unnUaZtalh+7rqXM1Dqf83TGJFWJiN7KUlKMxdsYeVLBRlcqk UkFF/+GxGAUcI7GRRsUHMIu4dBNrVQmK4a2MTaDbNauYcjDE4lhfPmtrjdoz6hvEf88b 6ejw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=JlLN8yVK; 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 u89si8735267qtd.76.2020.03.15.06.37.41 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 15 Mar 2020 06:37:41 -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=JlLN8yVK; 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]:54048 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDTSW-00075y-Nu for patch@linaro.org; Sun, 15 Mar 2020 09:37:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50922) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDTJl-00089o-Sx for qemu-devel@nongnu.org; Sun, 15 Mar 2020 09:28:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDTJk-0003Wf-NA for qemu-devel@nongnu.org; Sun, 15 Mar 2020 09:28:37 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:35894) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jDTJk-0003Qd-FC for qemu-devel@nongnu.org; Sun, 15 Mar 2020 09:28:36 -0400 Received: by mail-wm1-x341.google.com with SMTP id g62so15117060wme.1 for ; Sun, 15 Mar 2020 06:28:34 -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=rtyy8CX6lQ0m3U8wFWf3AzT/p7YOaZwtAFg++0OM+ps=; b=JlLN8yVKsJtkMAokOUasuGG7z7aQ20ngIy//oSRTN2kvpOKeyS/eD0FVATR8ky75mt Ui8tyIIm1pBInZysWZnwjJHI6KmZVRZg6EWzhRs9a7IgOV1fooohlNMyHi8YB4L2Pgbm zJ9KB8Cvi2gkzZfTzEDFtX4SjI4dqPOh2t5o8zpCDTLe7TySU7JTWTTgjZK5FOe428+5 YFeU6Fq3MrxBKtVwMMWvLGSS7xubObEULYTbMNyuNO3yUX5xX4gCEzVTlldKc44DX/49 uc9zQ5aOD8+5T/epO6wO+P4MXbNKKhZEEnS2WevT6U1H0+TpY7ABpkRbxvxelKoSxdSh se8w== 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=rtyy8CX6lQ0m3U8wFWf3AzT/p7YOaZwtAFg++0OM+ps=; b=auL2QYGKD8sv7Bte4cSHnOlhExSsumzrqGI+QG+ruhTCECtzbkejsC123ejlnaLTA4 bRE29qgqjZ+bw5aukm/8XNTpRy0wgIhCDv3XtSGEJq6BJx7pAQvHMuH0SIQSA0pscPJC T4K/QYZsjulSJErSSVkgi7PDcfV4cAGpjii8BZhIBuguCvWZDkFa5YHt36UD1nMyOWsR HaiwdQW/fHgwwqxX0RSrXpLSfng689ru2V0UZakx1vqI/Ay7FjEdJG4cKMtaOGJSYdBo wn8ZP+DodS0G4UtUoI3hqjAjkMVxKX2g2gdE5FQ6K/P6a8wD5TbRLh94ufpAEI/Ncj3E g9/w== X-Gm-Message-State: ANhLgQ1lp+0xlkmM/jT3vMsb/Q+wQtRbZglTcYt0CpyVhAEvnFDvovB8 pDOjM/EmIPz9WerpSkq8EGDzyfWQ X-Received: by 2002:a05:600c:215:: with SMTP id 21mr22132041wmi.119.1584278913643; Sun, 15 Mar 2020 06:28:33 -0700 (PDT) Received: from localhost.localdomain (191.red-83-42-66.dynamicip.rima-tde.net. [83.42.66.191]) by smtp.gmail.com with ESMTPSA id d15sm87590503wrp.37.2020.03.15.06.28.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Mar 2020 06:28:33 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 12/13] target/rx: Dump bytes for each insn during disassembly Date: Sun, 15 Mar 2020 14:28:08 +0100 Message-Id: <20200315132810.7022-13-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200315132810.7022-1-f4bug@amsat.org> References: <20200315132810.7022-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::341 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: Yoshinori Sato , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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> Signed-off-by: Yoshinori Sato 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