From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: "Alex Bennée" <alex.bennee@linaro.org>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
riku.voipio@iki.fi, richard.henderson@linaro.org,
laurent@vivier.eu, Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH v1 5/7] disas: include an optional note for the start of disassembly
Date: Fri, 1 May 2020 17:08:43 +0200 [thread overview]
Message-ID: <bd5c3bde-81b4-6d77-7c66-f2839904ccac@redhat.com> (raw)
In-Reply-To: <20200501145713.19822-6-alex.bennee@linaro.org>
On 5/1/20 4:57 PM, Alex Bennée wrote:
> This will become useful shortly for providing more information about
> output assembly inline. While there fix up the indenting and code
> formatting in disas().
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> include/disas/disas.h | 2 +-
> include/exec/log.h | 4 ++--
> accel/tcg/translate-all.c | 4 ++--
> disas.c | 15 +++++++++++----
> tcg/tcg.c | 4 ++--
> 5 files changed, 18 insertions(+), 11 deletions(-)
>
> diff --git a/include/disas/disas.h b/include/disas/disas.h
> index 36c33f6f19..1b6e035e32 100644
> --- a/include/disas/disas.h
> +++ b/include/disas/disas.h
> @@ -7,7 +7,7 @@
> #include "cpu.h"
>
> /* Disassemble this for me please... (debugging). */
> -void disas(FILE *out, void *code, unsigned long size);
> +void disas(FILE *out, void *code, unsigned long size, const char *note);
> void target_disas(FILE *out, CPUState *cpu, target_ulong code,
> target_ulong size);
>
> diff --git a/include/exec/log.h b/include/exec/log.h
> index fcc7b9e00b..3ed797c1c8 100644
> --- a/include/exec/log.h
> +++ b/include/exec/log.h
> @@ -56,13 +56,13 @@ static inline void log_target_disas(CPUState *cpu, target_ulong start,
> rcu_read_unlock();
> }
>
> -static inline void log_disas(void *code, unsigned long size)
> +static inline void log_disas(void *code, unsigned long size, const char *note)
> {
> QemuLogFile *logfile;
> rcu_read_lock();
> logfile = atomic_rcu_read(&qemu_logfile);
> if (logfile) {
> - disas(logfile->fd, code, size);
> + disas(logfile->fd, code, size, note);
> }
> rcu_read_unlock();
> }
> diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
> index e4f703a7e6..cdf58bb420 100644
> --- a/accel/tcg/translate-all.c
> +++ b/accel/tcg/translate-all.c
> @@ -1800,7 +1800,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
> size_t data_size = gen_code_size - code_size;
> size_t i;
>
> - log_disas(tb->tc.ptr, code_size);
> + log_disas(tb->tc.ptr, code_size, NULL);
>
> for (i = 0; i < data_size; i += sizeof(tcg_target_ulong)) {
> if (sizeof(tcg_target_ulong) == 8) {
> @@ -1814,7 +1814,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
> }
> }
> } else {
> - log_disas(tb->tc.ptr, gen_code_size);
> + log_disas(tb->tc.ptr, gen_code_size, NULL);
> }
> qemu_log("\n");
> qemu_log_flush();
> diff --git a/disas.c b/disas.c
> index 3937da6157..bb74650633 100644
> --- a/disas.c
> +++ b/disas.c
> @@ -586,7 +586,7 @@ char *plugin_disas(CPUState *cpu, uint64_t addr, size_t size)
> }
>
> /* Disassemble this for me please... (debugging). */
> -void disas(FILE *out, void *code, unsigned long size)
> +void disas(FILE *out, void *code, unsigned long size, const char *note)
> {
> uintptr_t pc;
> int count;
> @@ -674,10 +674,17 @@ void disas(FILE *out, void *code, unsigned long size)
> for (pc = (uintptr_t)code; size > 0; pc += count, size -= count) {
> fprintf(out, "0x%08" PRIxPTR ": ", pc);
> count = print_insn(pc, &s.info);
> - fprintf(out, "\n");
> - if (count < 0)
> - break;
> + if (note) {
> + fprintf(out, "\t\t%s\n", note);
> + note = NULL;
> + } else {
> + fprintf(out, "\n");
> + }
> + if (count < 0) {
> + break;
> + }
> }
> +
> }
>
> /* Look up symbol for debugging purpose. Returns "" if unknown. */
> diff --git a/tcg/tcg.c b/tcg/tcg.c
> index dd4b3d7684..a2268d9db0 100644
> --- a/tcg/tcg.c
> +++ b/tcg/tcg.c
> @@ -1092,7 +1092,7 @@ void tcg_prologue_init(TCGContext *s)
> size_t data_size = prologue_size - code_size;
> size_t i;
>
> - log_disas(buf0, code_size);
> + log_disas(buf0, code_size, NULL);
>
> for (i = 0; i < data_size; i += sizeof(tcg_target_ulong)) {
> if (sizeof(tcg_target_ulong) == 8) {
> @@ -1106,7 +1106,7 @@ void tcg_prologue_init(TCGContext *s)
> }
> }
> } else {
> - log_disas(buf0, prologue_size);
> + log_disas(buf0, prologue_size, NULL);
> }
> qemu_log("\n");
> qemu_log_flush();
>
next prev parent reply other threads:[~2020-05-01 15:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-01 14:57 [PATCH v1 0/7] various tcg and linux-user updates Alex Bennée
2020-05-01 14:57 ` [PATCH v1 1/7] linux-user: completely re-write init_guest_space Alex Bennée
2020-05-01 14:57 ` [PATCH v1 2/7] exec/cpu-all: Use bool for have_guest_base Alex Bennée
2020-05-01 14:57 ` [PATCH v1 3/7] accel/tcg: Relax va restrictions on 64-bit guests Alex Bennée
2020-05-01 14:57 ` [PATCH v1 4/7] accel/tcg: don't disable exec_tb trace events Alex Bennée
2020-05-11 12:16 ` Philippe Mathieu-Daudé
2020-05-01 14:57 ` [PATCH v1 5/7] disas: include an optional note for the start of disassembly Alex Bennée
2020-05-01 15:08 ` Philippe Mathieu-Daudé [this message]
2020-05-01 14:57 ` [PATCH v1 6/7] disas: add optional note support to cap_disas Alex Bennée
2020-05-11 12:18 ` Philippe Mathieu-Daudé
2020-05-01 14:57 ` [PATCH v1 7/7] translate-all: include guest address in out_asm output Alex Bennée
2020-05-07 9:47 ` Alex Bennée
2020-05-11 11:12 ` [PATCH v1 0/7] various tcg and linux-user updates Alex Bennée
2020-05-11 18:05 ` Laurent Vivier
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=bd5c3bde-81b4-6d77-7c66-f2839904ccac@redhat.com \
--to=philmd@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=laurent@vivier.eu \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=riku.voipio@iki.fi \
--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).