[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/5] target/i386: convert to use format_state instead of dump
From: |
Eric Blake |
Subject: |
Re: [PATCH 3/5] target/i386: convert to use format_state instead of dump_state |
Date: |
Wed, 8 Sep 2021 13:05:13 -0500 |
User-agent: |
NeoMutt/20210205-739-420e15 |
On Wed, Sep 08, 2021 at 11:37:09AM +0100, Daniel P. Berrangé wrote:
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> target/i386/cpu-dump.c | 325 ++++++++++++++++++++++-------------------
> target/i386/cpu.c | 2 +-
> target/i386/cpu.h | 2 +-
> 3 files changed, 174 insertions(+), 155 deletions(-)
>
> diff --git a/target/i386/cpu-dump.c b/target/i386/cpu-dump.c
> index 02b635a52c..8e19485a20 100644
> --- a/target/i386/cpu-dump.c
> +++ b/target/i386/cpu-dump.c
> @@ -94,41 +94,45 @@ static const char *cc_op_str[CC_OP_NB] = {
> };
>
> static void
> -cpu_x86_dump_seg_cache(CPUX86State *env, FILE *f,
> +cpu_x86_dump_seg_cache(CPUX86State *env, GString *buf,
> const char *name, struct SegmentCache *sc)
> {
> #ifdef TARGET_X86_64
> if (env->hflags & HF_CS64_MASK) {
> - qemu_fprintf(f, "%-3s=%04x %016" PRIx64 " %08x %08x", name,
> - sc->selector, sc->base, sc->limit,
> - sc->flags & 0x00ffff00);
> + g_string_append_printf(buf, "%-3s=%04x %016" PRIx64 " %08x %08x",
> name,
> + sc->selector, sc->base, sc->limit,
> + sc->flags & 0x00ffff00);
Did you consider using open_memstream() to get a FILE* that can then
be passed into these callbacks unchanged, rather than rewriting all
the callbacks to a new signature?
Then again, I like the GString signature better than FILE*, even if it
makes for longer lines.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[PATCH 2/5] hw/core: introduce 'format_state' callback to replace 'dump_state', Daniel P . Berrangé, 2021/09/08
[PATCH 3/5] target/i386: convert to use format_state instead of dump_state, Daniel P . Berrangé, 2021/09/08
[PATCH 4/5] qapi: introduce x-query-registers QMP command, Daniel P . Berrangé, 2021/09/08
[PATCH 5/5] monitor: rewrite 'info registers' in terms of 'x-query-registers', Daniel P . Berrangé, 2021/09/08
Re: [PATCH 0/5] Stop adding HMP-only commands, allow QMP for all, Ján Tomko, 2021/09/08