aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2019-05-23 08:18:31 -0700
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>2020-03-19 17:58:05 +0100
commite43917cce55e18cc62db47026c4c3880523ed27a (patch)
tree3f46c373dbd213b5e15f3ee315a1d7b010d31263
parent05a8599fcc7773d3c4b0c8fd7a19c1d65d636406 (diff)
target/rx: Dump bytes for each insn during disassembly
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é <philmd@redhat.com> Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20190531134315.4109-24-richard.henderson@linaro.org> Acked-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
-rw-r--r--target/rx/disas.c16
1 files changed, 15 insertions, 1 deletions
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