From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
richard.henderson@linaro.org,
"Richard Henderson" <rth@twiddle.net>
Subject: [RFC PATCH] translate-all: include guest address in out_asm output
Date: Fri, 24 Apr 2020 18:39:14 +0100 [thread overview]
Message-ID: <20200424173914.2957-1-alex.bennee@linaro.org> (raw)
This is a slightly hackish Friday afternoon attempt to include the
guest address in our out_asm output in an effort to make it a little
easier to see what is generating what final assembly.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
accel/tcg/translate-all.c | 38 ++++++++++++++++++++++++++++++++------
1 file changed, 32 insertions(+), 6 deletions(-)
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index 9924e66d1f..31711de938 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -1789,14 +1789,42 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
if (qemu_loglevel_mask(CPU_LOG_TB_OUT_ASM) &&
qemu_log_in_addr_range(tb->pc)) {
FILE *logfile = qemu_log_lock();
+ size_t code_size, data_size = 0;
+ size_t insn_start;
+ int insn = 0;
qemu_log("OUT: [size=%d]\n", gen_code_size);
if (tcg_ctx->data_gen_ptr) {
- size_t code_size = tcg_ctx->data_gen_ptr - tb->tc.ptr;
- size_t data_size = gen_code_size - code_size;
- size_t i;
+ code_size = tcg_ctx->data_gen_ptr - tb->tc.ptr;
+ data_size = gen_code_size - code_size;
+ } else {
+ code_size = gen_code_size;
+ }
+
+ /* first dump prologue */
+ insn_start = tcg_ctx->gen_insn_end_off[0];
+ if (insn_start > 0) {
+ qemu_log(" prologue: [size=%ld]\n", insn_start);
+ log_disas(tb->tc.ptr, insn_start);
+ }
+
+ do {
+ size_t insn_end;
+ if (insn < (tb->icount - 1)) {
+ insn_end = tcg_ctx->gen_insn_end_off[insn + 1];
+ } else {
+ insn_end = code_size;
+ }
+ qemu_log(" for guest addr: " TARGET_FMT_lx ":\n",
+ tcg_ctx->gen_insn_data[insn][0]);
+
+ log_disas(tb->tc.ptr + insn_start, insn_end - insn_start);
- log_disas(tb->tc.ptr, code_size);
+ insn_start = insn_end;
+ } while (++insn < tb->icount && insn_start < code_size);
+ if (data_size) {
+ int i;
+ qemu_log(" data: [size=%ld]\n", data_size);
for (i = 0; i < data_size; i += sizeof(tcg_target_ulong)) {
if (sizeof(tcg_target_ulong) == 8) {
qemu_log("0x%08" PRIxPTR ": .quad 0x%016" PRIx64 "\n",
@@ -1808,8 +1836,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
*(uint32_t *)(tcg_ctx->data_gen_ptr + i));
}
}
- } else {
- log_disas(tb->tc.ptr, gen_code_size);
}
qemu_log("\n");
qemu_log_flush();
--
2.20.1
next reply other threads:[~2020-04-24 17:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-24 17:39 Alex Bennée [this message]
2020-04-24 19:38 ` [RFC PATCH] translate-all: include guest address in out_asm output Richard Henderson
2020-04-24 20:10 ` no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200424173914.2957-1-alex.bennee@linaro.org \
--to=alex.bennee@linaro.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).